disable tpc in madwifi by default (seems to be hurting performance in long-distance...
[openwrt.git] / package / madwifi / patches / 305-pureg_fix.patch
1 diff -urN madwifi-ng-r2377-20070526.old/ath/if_ath.c madwifi-ng-r2377-20070526.dev/ath/if_ath.c
2 --- madwifi-ng-r2377-20070526.old/ath/if_ath.c 2007-05-26 18:51:09.426654472 +0200
3 +++ madwifi-ng-r2377-20070526.dev/ath/if_ath.c 2007-05-26 18:51:09.440652344 +0200
4 @@ -3383,7 +3383,9 @@
5 rfilt |= HAL_RX_FILTER_PROM;
6 if (ic->ic_opmode == IEEE80211_M_STA ||
7 sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
8 - (sc->sc_nostabeacons) || sc->sc_scanning)
9 + (sc->sc_nostabeacons) || sc->sc_scanning ||
10 + ((ic->ic_opmode == IEEE80211_M_HOSTAP) &&
11 + (ic->ic_protmode != IEEE80211_PROT_NONE)))
12 rfilt |= HAL_RX_FILTER_BEACON;
13 if (sc->sc_nmonvaps > 0)
14 rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
15 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_input.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_input.c
16 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_input.c 2007-05-26 18:51:09.429654016 +0200
17 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_input.c 2007-05-26 18:51:09.443651888 +0200
18 @@ -321,11 +321,12 @@
19 bssid = wh->i_addr3;
20 }
21 /*
22 - * Validate the bssid.
23 + * Validate the bssid. Let beacons get through though for 11g protection mode.
24 */
25 #ifdef ATH_SUPERG_XR
26 if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
27 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
28 + !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
29 + (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
30 /*
31 * allow MGT frames to vap->iv_xrvap.
32 * this will allow roaming between XR and normal vaps
33 @@ -344,7 +345,8 @@
34 }
35 #else
36 if (!IEEE80211_ADDR_EQ(bssid, vap->iv_bss->ni_bssid) &&
37 - !IEEE80211_ADDR_EQ(bssid, dev->broadcast)) {
38 + !IEEE80211_ADDR_EQ(bssid, dev->broadcast) &&
39 + (subtype != IEEE80211_FC0_SUBTYPE_BEACON)) {
40 /* not interested in */
41 IEEE80211_DISCARD_MAC(vap, IEEE80211_MSG_INPUT,
42 bssid, NULL, "%s", "not to bss");
43 @@ -2555,7 +2557,7 @@
44 u_int8_t *frm, *efrm;
45 u_int8_t *ssid, *rates, *xrates, *wpa, *rsn, *wme, *ath;
46 u_int8_t rate;
47 - int reassoc, resp, allocbs = 0;
48 + int reassoc, resp, allocbs = 0, has_erp = 0;
49 u_int8_t qosinfo;
50
51 wh = (struct ieee80211_frame *) skb->data;
52 @@ -2577,11 +2579,15 @@
53 * o station mode when associated (to collect state
54 * updates such as 802.11g slot time), or
55 * o adhoc mode (to discover neighbors)
56 + * o ap mode in protection mode (beacons only)
57 * Frames otherwise received are discarded.
58 */
59 if (!((ic->ic_flags & IEEE80211_F_SCAN) ||
60 (vap->iv_opmode == IEEE80211_M_STA && ni->ni_associd) ||
61 - vap->iv_opmode == IEEE80211_M_IBSS)) {
62 + (vap->iv_opmode == IEEE80211_M_IBSS) ||
63 + ((subtype == IEEE80211_FC0_SUBTYPE_BEACON) &&
64 + (vap->iv_opmode == IEEE80211_M_HOSTAP) &&
65 + (ic->ic_protmode != IEEE80211_PROT_NONE)))) {
66 vap->iv_stats.is_rx_mgtdiscard++;
67 return;
68 }
69 @@ -2664,6 +2670,7 @@
70 break;
71 }
72 scan.erp = frm[2];
73 + has_erp = 1;
74 break;
75 case IEEE80211_ELEMID_RSN:
76 scan.rsn = frm;
77 @@ -2839,6 +2846,20 @@
78 ieee80211_bg_scan(vap);
79 return;
80 }
81 +
82 + /* Update AP protection mode when in 11G mode */
83 + if ((vap->iv_opmode == IEEE80211_M_HOSTAP) &&
84 + IEEE80211_IS_CHAN_ANYG(ic->ic_curchan)) {
85 +
86 + /* Assume no ERP IE == 11b AP */
87 + if ((!has_erp || (has_erp && (scan.erp & IEEE80211_ERP_NON_ERP_PRESENT))) &&
88 + !(ic->ic_flags & IEEE80211_F_USEPROT)) {
89 +
90 + ic->ic_flags |= IEEE80211_F_USEPROT;
91 + ic->ic_flags_ext |= IEEE80211_FEXT_ERPUPDATE;
92 + }
93 + }
94 +
95 /*
96 * If scanning, just pass information to the scan module.
97 */
98 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c
99 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_node.c 2007-05-26 18:51:09.430653864 +0200
100 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_node.c 2007-05-26 18:51:09.444651736 +0200
101 @@ -332,10 +332,16 @@
102 /* Update country ie information */
103 ieee80211_build_countryie(ic);
104
105 - if (IEEE80211_IS_CHAN_HALF(chan))
106 + if (IEEE80211_IS_CHAN_HALF(chan)) {
107 ni->ni_rates = ic->ic_sup_half_rates;
108 - else if (IEEE80211_IS_CHAN_QUARTER(chan))
109 + } else if (IEEE80211_IS_CHAN_QUARTER(chan)) {
110 ni->ni_rates = ic->ic_sup_quarter_rates;
111 + }
112 +
113 + if ((vap->iv_flags & IEEE80211_F_PUREG) &&
114 + IEEE80211_IS_CHAN_ANYG(chan)) {
115 + ieee80211_setpuregbasicrates(&ni->ni_rates);
116 + }
117
118 (void) ieee80211_sta_join1(PASS_NODE(ni));
119 }
120 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c
121 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_proto.c 2007-05-26 18:51:09.431653712 +0200
122 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_proto.c 2007-05-26 18:51:09.445651584 +0200
123 @@ -586,6 +586,28 @@
124 { 4, { 2, 4, 11, 22 } }, /* IEEE80211_MODE_TURBO_G (mixed b/g) */
125 };
126
127 +static const struct ieee80211_rateset basicpureg[] = {
128 + { 7, {2, 4, 11, 22, 12, 24, 48 } },
129 +};
130 +
131 +/*
132 + * Mark basic rates for the 11g rate table based on the pureg setting
133 + */
134 +void
135 +ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs)
136 +{
137 + int i, j;
138 +
139 + for (i = 0; i < rs->rs_nrates; i++) {
140 + rs->rs_rates[i] &= IEEE80211_RATE_VAL;
141 + for (j = 0; j < basicpureg[0].rs_nrates; j++)
142 + if (basicpureg[0].rs_rates[j] == rs->rs_rates[i]) {
143 + rs->rs_rates[i] |= IEEE80211_RATE_BASIC;
144 + break;
145 + }
146 + }
147 +}
148 +
149 /*
150 * Mark the basic rates for the 11g rate table based on the
151 * specified mode. For 11b compatibility we mark only 11b
152 diff -urN madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h
153 --- madwifi-ng-r2377-20070526.old/net80211/ieee80211_var.h 2007-05-26 18:51:09.321670432 +0200
154 +++ madwifi-ng-r2377-20070526.dev/net80211/ieee80211_var.h 2007-05-26 18:51:09.445651584 +0200
155 @@ -584,6 +584,8 @@
156 void ieee80211_build_countryie(struct ieee80211com *);
157 int ieee80211_media_setup(struct ieee80211com *, struct ifmedia *, u_int32_t,
158 ifm_change_cb_t, ifm_stat_cb_t);
159 +void ieee80211_setpuregbasicrates(struct ieee80211_rateset *rs);
160 +
161
162 /* Key update synchronization methods. XXX should not be visible. */
163 static __inline void
164
This page took 0.044504 seconds and 5 git commands to generate.