update madwifi to the madwifi-dfs branch - should fix a few ad-hoc mode issues, needs more testing
SVN-Revision: 9648v19.07.3_mercusys_ac12_duma
parent
93df90ed3e
commit
9c7edf0ad0
@ -1,15 +0,0 @@
|
||||
Index: madwifi-ng-r2834-20071106/ath/if_ath.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2834-20071106.orig/ath/if_ath.c 2007-11-07 14:02:00.533401273 +0100
|
||||
+++ madwifi-ng-r2834-20071106/ath/if_ath.c 2007-11-07 14:02:00.957425434 +0100
|
||||
@@ -2122,7 +2122,10 @@
|
||||
ath_draintxq(sc);
|
||||
if (!sc->sc_invalid) {
|
||||
ath_stoprecv(sc);
|
||||
+
|
||||
+ /* XXX: this helps to avoid crashes on ifconfig down/up
|
||||
ath_hal_phydisable(ah);
|
||||
+ */
|
||||
} else
|
||||
sc->sc_rxlink = NULL;
|
||||
ath_beacon_free(sc); /* XXX needed? */
|
@ -1,197 +0,0 @@
|
||||
Index: madwifi-ng-r2834-20071106/ath/if_ath.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2834-20071106.orig/ath/if_ath.c 2007-11-07 14:02:01.785472625 +0100
|
||||
+++ madwifi-ng-r2834-20071106/ath/if_ath.c 2007-11-07 14:02:02.637521177 +0100
|
||||
@@ -4559,16 +4559,31 @@
|
||||
struct ieee80211com *ic = &sc->sc_ic;
|
||||
struct ath_hal *ah = sc->sc_ah;
|
||||
struct ieee80211_node *ni;
|
||||
- u_int32_t nexttbtt, intval;
|
||||
+ u_int32_t nexttbtt = 0;
|
||||
+ u_int32_t intval;
|
||||
+ u_int64_t tsf, hw_tsf;
|
||||
+ u_int32_t tsftu, hw_tsftu;
|
||||
+ int should_reset_tsf = 0;
|
||||
|
||||
if (vap == NULL)
|
||||
vap = TAILQ_FIRST(&ic->ic_vaps); /* XXX */
|
||||
|
||||
ni = vap->iv_bss;
|
||||
|
||||
- /* extract tstamp from last beacon and convert to TU */
|
||||
- nexttbtt = TSF_TO_TU(LE_READ_4(ni->ni_tstamp.data + 4),
|
||||
- LE_READ_4(ni->ni_tstamp.data));
|
||||
+ hw_tsf = ath_hal_gettsf64(ah);
|
||||
+ tsf = le64_to_cpu(ni->ni_tstamp.tsf);
|
||||
+ hw_tsftu = hw_tsf >> 10;
|
||||
+ tsftu = tsf >> 10;
|
||||
+
|
||||
+ /* we should reset hw TSF only once, so we increment
|
||||
+ ni_tstamp.tsf to avoid resetting the hw TSF multiple
|
||||
+ times */
|
||||
+
|
||||
+ if (tsf == 0) {
|
||||
+ should_reset_tsf = 1;
|
||||
+ ni->ni_tstamp.tsf = cpu_to_le64(1);
|
||||
+ }
|
||||
+
|
||||
/* XXX conditionalize multi-bss support? */
|
||||
if (ic->ic_opmode == IEEE80211_M_HOSTAP) {
|
||||
/*
|
||||
@@ -4582,20 +4597,61 @@
|
||||
if (sc->sc_stagbeacons)
|
||||
intval /= ATH_BCBUF; /* for staggered beacons */
|
||||
if ((sc->sc_nostabeacons) &&
|
||||
- (vap->iv_opmode == IEEE80211_M_HOSTAP))
|
||||
- nexttbtt = 0;
|
||||
+ (vap->iv_opmode == IEEE80211_M_HOSTAP))
|
||||
+ should_reset_tsf = 1;
|
||||
} else
|
||||
intval = ni->ni_intval & HAL_BEACON_PERIOD;
|
||||
- if (nexttbtt == 0) /* e.g. for ap mode */
|
||||
+
|
||||
+#define FUDGE 2
|
||||
+ sc->sc_syncbeacon = 0;
|
||||
+ if (should_reset_tsf) {
|
||||
+
|
||||
+ /* We just created the interface and TSF will be reset to
|
||||
+ zero, so next beacon will be sent at the next intval
|
||||
+ time */
|
||||
+
|
||||
nexttbtt = intval;
|
||||
- else if (intval) /* NB: can be 0 for monitor mode */
|
||||
- nexttbtt = roundup(nexttbtt, intval);
|
||||
- DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt %u intval %u (%u)\n",
|
||||
- __func__, nexttbtt, intval, ni->ni_intval);
|
||||
+ } else if (intval) { /* NB: can be 0 for monitor mode */
|
||||
+ if (tsf == 1) {
|
||||
+
|
||||
+ /* We do not receive any beacons or probe response. Since
|
||||
+ a beacon should be sent every 'intval' ms, we compute
|
||||
+ the next beacon timestamp using the hardware TSF. We
|
||||
+ ensure that it is at least FUDGE ms ahead of the
|
||||
+ current TSF. Otherwise, we use the next beacon
|
||||
+ timestamp again */
|
||||
+
|
||||
+ nexttbtt = roundup(hw_tsftu +1, intval);
|
||||
+ while (nexttbtt <= hw_tsftu + FUDGE) {
|
||||
+ nexttbtt += intval;
|
||||
+ }
|
||||
+ } else {
|
||||
+ if (tsf > hw_tsf) {
|
||||
+
|
||||
+ /* We do receive a beacon from someone else in the past,
|
||||
+ but the hw TSF has not been updated (otherwise we
|
||||
+ would have tsf >= hw_tsf). Since we cannot use the
|
||||
+ hardware TSF, we will do nothing and wait for the
|
||||
+ next beacon. In order to do so, we set sc->syncbeacon
|
||||
+ again */
|
||||
+
|
||||
+ sc->sc_syncbeacon = 1;
|
||||
+ goto ath_beacon_config_debug;
|
||||
+ } else {
|
||||
+ /* We do receive a beacon in the past, normal case. We
|
||||
+ make sure that the timestamp is at least FUDGE ms
|
||||
+ ahead of the hardware TSF */
|
||||
+
|
||||
+ nexttbtt = tsftu + intval;
|
||||
+ while (nexttbtt <= hw_tsftu + FUDGE) {
|
||||
+ nexttbtt += intval;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (ic->ic_opmode == IEEE80211_M_STA && !(sc->sc_nostabeacons)) {
|
||||
HAL_BEACON_STATE bs;
|
||||
- u_int64_t tsf;
|
||||
- u_int32_t tsftu;
|
||||
int dtimperiod, dtimcount;
|
||||
int cfpperiod, cfpcount;
|
||||
|
||||
@@ -4611,13 +4667,13 @@
|
||||
dtimcount = 0; /* XXX? */
|
||||
cfpperiod = 1; /* NB: no PCF support yet */
|
||||
cfpcount = 0;
|
||||
-#define FUDGE 2
|
||||
/*
|
||||
* Pull nexttbtt forward to reflect the current
|
||||
* TSF and calculate dtim+cfp state for the result.
|
||||
*/
|
||||
- tsf = ath_hal_gettsf64(ah);
|
||||
- tsftu = TSF_TO_TU(tsf>>32, tsf) + FUDGE;
|
||||
+ nexttbtt = tsftu;
|
||||
+ if (nexttbtt == 0) /* e.g. for ap mode */
|
||||
+ nexttbtt = intval;
|
||||
do {
|
||||
nexttbtt += intval;
|
||||
if (--dtimcount < 0) {
|
||||
@@ -4625,7 +4681,7 @@
|
||||
if (--cfpcount < 0)
|
||||
cfpcount = cfpperiod - 1;
|
||||
}
|
||||
- } while (nexttbtt < tsftu);
|
||||
+ } while (nexttbtt < hw_tsftu + FUDGE);
|
||||
#undef FUDGE
|
||||
memset(&bs, 0, sizeof(bs));
|
||||
bs.bs_intval = intval;
|
||||
@@ -4677,7 +4733,7 @@
|
||||
DPRINTF(sc, ATH_DEBUG_BEACON,
|
||||
"%s: tsf %llu tsf:tu %u intval %u nexttbtt %u dtim %u nextdtim %u bmiss %u sleep %u cfp:period %u maxdur %u next %u timoffset %u\n",
|
||||
__func__,
|
||||
- (unsigned long long) tsf, tsftu,
|
||||
+ (unsigned long long) hw_tsf, hw_tsftu,
|
||||
bs.bs_intval,
|
||||
bs.bs_nexttbtt,
|
||||
bs.bs_dtimperiod,
|
||||
@@ -4699,7 +4755,7 @@
|
||||
ath_hal_intrset(ah, sc->sc_imask);
|
||||
} else {
|
||||
ath_hal_intrset(ah, 0);
|
||||
- if (nexttbtt == intval)
|
||||
+ if (should_reset_tsf)
|
||||
intval |= HAL_BEACON_RESET_TSF;
|
||||
if (ic->ic_opmode == IEEE80211_M_IBSS) {
|
||||
/*
|
||||
@@ -4736,8 +4792,40 @@
|
||||
if (ic->ic_opmode == IEEE80211_M_IBSS && sc->sc_hasveol)
|
||||
ath_beacon_start_adhoc(sc, vap);
|
||||
}
|
||||
- sc->sc_syncbeacon = 0;
|
||||
#undef TSF_TO_TU
|
||||
+
|
||||
+ ath_beacon_config_debug:
|
||||
+
|
||||
+ /* we print all debug messages here, in order to preserve the
|
||||
+ time critical aspect of this function */
|
||||
+
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON,
|
||||
+ "%s: ni=%p tsf=%llu hw_tsf=%llu tsftu=%u hw_tsftu=%u\n",
|
||||
+ __func__, ni, tsf, hw_tsf, tsftu, hw_tsftu);
|
||||
+
|
||||
+ if (should_reset_tsf) {
|
||||
+ /* we just created the interface */
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON, "%s: first beacon\n",__func__);
|
||||
+ } else {
|
||||
+ if (tsf == 1) {
|
||||
+ /* we do not receive any beacons or probe response */
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON,
|
||||
+ "%s: no beacon received...\n",__func__);
|
||||
+ } else {
|
||||
+ if (tsf > hw_tsf) {
|
||||
+ /* we do receive a beacon and the hw TSF has not been updated */
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON,
|
||||
+ "%s: beacon received, but TSF is incorrect\n",__func__);
|
||||
+ } else {
|
||||
+ /* we do receive a beacon in the past, normal case */
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON,
|
||||
+ "%s: beacon received, TSF is correct\n",__func__);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ DPRINTF(sc, ATH_DEBUG_BEACON, "%s: nexttbtt=%u intval=%u\n",
|
||||
+ __func__,nexttbtt, intval & HAL_BEACON_PERIOD);
|
||||
}
|
||||
|
||||
static int
|
@ -1,258 +0,0 @@
|
||||
Index: madwifi-ng-r2978-20071127/ath/if_ath.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2978-20071127.orig/ath/if_ath.c 2007-11-27 21:18:24.910671912 +0100
|
||||
+++ madwifi-ng-r2978-20071127/ath/if_ath.c 2007-11-27 21:21:37.137626301 +0100
|
||||
@@ -515,7 +515,6 @@
|
||||
*/
|
||||
#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
|
||||
((bssid_mask)[0] &= ~(((ATH_BCBUF-1) << 2) | 0x02))
|
||||
-#define ATH_GET_VAP_ID(bssid) ((bssid)[0] >> 2)
|
||||
#define ATH_SET_VAP_BSSID(bssid, id) \
|
||||
do { \
|
||||
if (id) \
|
||||
@@ -1203,7 +1202,11 @@
|
||||
case IEEE80211_M_IBSS:
|
||||
if ((sc->sc_nvaps != 0) && (ic->ic_opmode == IEEE80211_M_STA))
|
||||
return NULL;
|
||||
- ic_opmode = opmode;
|
||||
+ else if (sc->sc_nvaps == 0)
|
||||
+ ic_opmode = opmode;
|
||||
+ else
|
||||
+ ic_opmode = IEEE80211_M_HOSTAP;
|
||||
+ sc->sc_nibssvaps++;
|
||||
break;
|
||||
case IEEE80211_M_AHDEMO:
|
||||
case IEEE80211_M_MONITOR:
|
||||
@@ -1233,7 +1236,7 @@
|
||||
return NULL;
|
||||
}
|
||||
|
||||
- if (sc->sc_nvaps >= ATH_BCBUF) {
|
||||
+ if (sc->sc_nvaps + sc->sc_nibssvaps >= ATH_BCBUF) {
|
||||
printk(KERN_WARNING "too many virtual APs (already got %d)\n",
|
||||
sc->sc_nvaps);
|
||||
return NULL;
|
||||
@@ -1288,6 +1291,7 @@
|
||||
/* Use RadioTAP interface type for monitor mode. */
|
||||
dev->type = ARPHRD_IEEE80211_RADIOTAP;
|
||||
|
||||
+ avp->av_bslot = -1;
|
||||
if ((flags & IEEE80211_CLONE_BSSID) && sc->sc_hasbmask) {
|
||||
struct ieee80211vap *v;
|
||||
unsigned int id_mask, id;
|
||||
@@ -1301,18 +1305,22 @@
|
||||
|
||||
/* do a full search to mark all the allocated VAPs */
|
||||
id_mask = 0;
|
||||
- TAILQ_FOREACH(v, &ic->ic_vaps, iv_next)
|
||||
- id_mask |= (1 << ATH_GET_VAP_ID(v->iv_myaddr));
|
||||
+ TAILQ_FOREACH(v, &ic->ic_vaps, iv_next) {
|
||||
+ struct ath_vap *a = (struct ath_vap *) v->iv_dev->priv;
|
||||
+ if (a->av_bslot >= 0)
|
||||
+ id_mask |= (1 << a->av_bslot);
|
||||
+ }
|
||||
|
||||
- for (id = 1; id < ATH_BCBUF; id++) {
|
||||
+ /* IBSS mode has local always set, so don't hand out beacon slot 0 to an IBSS vap */
|
||||
+ for (id = (opmode == IEEE80211_M_IBSS ? 1 : 0); id < ATH_BCBUF; id++) {
|
||||
/* get the first available slot */
|
||||
if ((id_mask & (1 << id)) == 0) {
|
||||
ATH_SET_VAP_BSSID(vap->iv_myaddr, id);
|
||||
+ avp->av_bslot = id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
- avp->av_bslot = -1;
|
||||
STAILQ_INIT(&avp->av_mcastq.axq_q);
|
||||
ATH_TXQ_LOCK_INIT(&avp->av_mcastq);
|
||||
if (opmode == IEEE80211_M_HOSTAP || opmode == IEEE80211_M_IBSS) {
|
||||
@@ -1322,33 +1330,14 @@
|
||||
*/
|
||||
avp->av_bcbuf = STAILQ_FIRST(&sc->sc_bbuf);
|
||||
STAILQ_REMOVE_HEAD(&sc->sc_bbuf, bf_list);
|
||||
- if (opmode == IEEE80211_M_HOSTAP || !sc->sc_hasveol) {
|
||||
+ if ((opmode == IEEE80211_M_IBSS) || (opmode == IEEE80211_M_HOSTAP) || !sc->sc_hasveol) {
|
||||
unsigned int slot;
|
||||
- /*
|
||||
- * Assign the VAP to a beacon xmit slot. As
|
||||
- * above, this cannot fail to find one.
|
||||
- */
|
||||
- avp->av_bslot = 0;
|
||||
- for (slot = 0; slot < ATH_BCBUF; slot++)
|
||||
- if (sc->sc_bslot[slot] == NULL) {
|
||||
- /*
|
||||
- * XXX hack, space out slots to better
|
||||
- * deal with misses
|
||||
- */
|
||||
- if (slot + 1 < ATH_BCBUF &&
|
||||
- sc->sc_bslot[slot+1] == NULL) {
|
||||
- avp->av_bslot = slot + 1;
|
||||
- break;
|
||||
- }
|
||||
- avp->av_bslot = slot;
|
||||
- /* NB: keep looking for a double slot */
|
||||
- }
|
||||
KASSERT(sc->sc_bslot[avp->av_bslot] == NULL,
|
||||
("beacon slot %u not empty?", avp->av_bslot));
|
||||
sc->sc_bslot[avp->av_bslot] = vap;
|
||||
sc->sc_nbcnvaps++;
|
||||
}
|
||||
- if ((opmode == IEEE80211_M_HOSTAP) && (sc->sc_hastsfadd)) {
|
||||
+ if ((sc->sc_opmode == IEEE80211_M_HOSTAP) && (sc->sc_hastsfadd)) {
|
||||
/*
|
||||
* Multiple VAPs are to transmit beacons and we
|
||||
* have h/w support for TSF adjusting; enable use
|
||||
@@ -1460,7 +1449,9 @@
|
||||
sc->sc_stagbeacons = 0;
|
||||
}
|
||||
|
||||
- if (vap->iv_opmode == IEEE80211_M_STA) {
|
||||
+ if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
||||
+ sc->sc_nibssvaps--;
|
||||
+ } else if (vap->iv_opmode == IEEE80211_M_STA) {
|
||||
sc->sc_nstavaps--;
|
||||
sc->sc_nostabeacons = 0;
|
||||
} else if (vap->iv_opmode == IEEE80211_M_MONITOR)
|
||||
@@ -3816,7 +3807,7 @@
|
||||
sc->sc_opmode == HAL_M_IBSS || /* NB: AHDEMO too */
|
||||
(sc->sc_nostabeacons) || sc->sc_scanning)
|
||||
rfilt |= HAL_RX_FILTER_BEACON;
|
||||
- if (sc->sc_nmonvaps > 0)
|
||||
+ if ((sc->sc_nmonvaps > 0) || ((sc->sc_nvaps > 0) && (sc->sc_nibssvaps > 0)))
|
||||
rfilt |= (HAL_RX_FILTER_CONTROL | HAL_RX_FILTER_BEACON |
|
||||
HAL_RX_FILTER_PROBEREQ | HAL_RX_FILTER_PROM);
|
||||
return rfilt;
|
||||
@@ -6284,12 +6275,20 @@
|
||||
type = ieee80211_input(ni, skb, rs->rs_rssi, bf->bf_tsf);
|
||||
ieee80211_unref_node(&ni);
|
||||
} else {
|
||||
+ const struct ieee80211_frame_min *wh = (const struct ieee80211_frame_min *) skb->data;
|
||||
/*
|
||||
* No key index or no entry, do a lookup and
|
||||
* add the node to the mapping table if possible.
|
||||
*/
|
||||
- ni = ieee80211_find_rxnode(ic,
|
||||
- (const struct ieee80211_frame_min *) skb->data);
|
||||
+ if (((wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_PROBE_REQ) &&
|
||||
+ (sc->sc_nibssvaps > 0))
|
||||
+ /* if this is a probe request, send it to all vaps
|
||||
+ * when looking up nodes, hostap will be preferred over ibss,
|
||||
+ * because ibss will catch all nodes */
|
||||
+ ni = NULL;
|
||||
+ else
|
||||
+ ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
|
||||
+
|
||||
if (ni != NULL) {
|
||||
struct ath_node *an = ATH_NODE(ni);
|
||||
ieee80211_keyix_t keyix;
|
||||
Index: madwifi-ng-r2978-20071127/ath/if_athvar.h
|
||||
===================================================================
|
||||
--- madwifi-ng-r2978-20071127.orig/ath/if_athvar.h 2007-11-27 21:18:08.257722921 +0100
|
||||
+++ madwifi-ng-r2978-20071127/ath/if_athvar.h 2007-11-27 21:18:30.026963473 +0100
|
||||
@@ -209,7 +209,7 @@
|
||||
#define ATH_RXBUF 40 /* number of RX buffers */
|
||||
#define ATH_TXBUF 200 /* number of TX buffers */
|
||||
|
||||
-#define ATH_BCBUF 4 /* number of beacon buffers */
|
||||
+#define ATH_BCBUF 8 /* number of beacon buffers */
|
||||
|
||||
/* free buffer threshold to restart net dev */
|
||||
#define ATH_TXBUF_FREE_THRESHOLD (ATH_TXBUF / 20)
|
||||
@@ -667,6 +667,7 @@
|
||||
u_int16_t sc_nvaps; /* # of active virtual APs */
|
||||
u_int8_t sc_nstavaps; /* # of active station VAPs */
|
||||
u_int8_t sc_nmonvaps; /* # of monitor VAPs */
|
||||
+ u_int8_t sc_nibssvaps; /* # of active ibss vaps */
|
||||
u_int8_t sc_nbcnvaps; /* # of vaps sending beacons */
|
||||
u_int sc_fftxqmin; /* aggregation threshold */
|
||||
HAL_INT sc_imask; /* interrupt mask copy */
|
||||
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_beacon.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_beacon.c 2007-11-27 21:18:08.265723374 +0100
|
||||
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_beacon.c 2007-11-27 21:18:30.034963929 +0100
|
||||
@@ -111,7 +111,7 @@
|
||||
bo->bo_tim = frm;
|
||||
|
||||
/* IBSS/TIM */
|
||||
- if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
||||
+ if (ic->ic_opmode == IEEE80211_M_IBSS) {
|
||||
*frm++ = IEEE80211_ELEMID_IBSSPARMS;
|
||||
*frm++ = 2;
|
||||
*frm++ = 0; *frm++ = 0; /* TODO: ATIM window */
|
||||
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_input.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_input.c 2007-11-27 21:18:08.269723596 +0100
|
||||
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_input.c 2007-11-27 21:18:30.038964155 +0100
|
||||
@@ -3069,7 +3069,13 @@
|
||||
return;
|
||||
}
|
||||
if (ni == vap->iv_bss) {
|
||||
- if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
||||
+ /* this probe request may have been sent to all vaps
|
||||
+ * to give each a chance of creating a node for this.
|
||||
+ * important for hostap+ibss mode */
|
||||
+ ni = ieee80211_find_rxnode(ic, (const struct ieee80211_frame_min *) skb->data);
|
||||
+ if (ni) {
|
||||
+ allocbs = 0;
|
||||
+ } else if (vap->iv_opmode == IEEE80211_M_IBSS) {
|
||||
/*
|
||||
* XXX Cannot tell if the sender is operating
|
||||
* in ibss mode. But we need a new node to
|
||||
@@ -3078,12 +3084,13 @@
|
||||
*/
|
||||
ni = ieee80211_fakeup_adhoc_node(vap,
|
||||
wh->i_addr2);
|
||||
+ allocbs = 1;
|
||||
} else {
|
||||
ni = ieee80211_dup_bss(vap, wh->i_addr2, 1);
|
||||
+ allocbs = 1;
|
||||
}
|
||||
if (ni == NULL)
|
||||
return;
|
||||
- allocbs = 1;
|
||||
}
|
||||
|
||||
IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_INPUT, wh->i_addr2,
|
||||
Index: madwifi-ng-r2978-20071127/net80211/ieee80211_node.c
|
||||
===================================================================
|
||||
--- madwifi-ng-r2978-20071127.orig/net80211/ieee80211_node.c 2007-11-27 21:18:08.281724279 +0100
|
||||
+++ madwifi-ng-r2978-20071127/net80211/ieee80211_node.c 2007-11-27 21:24:30.083481925 +0100
|
||||
@@ -1326,13 +1326,26 @@
|
||||
IEEE80211_NODE_TABLE_LOCK_ASSERT(nt);
|
||||
|
||||
hash = IEEE80211_NODE_HASH(macaddr);
|
||||
+
|
||||
+ /* look for non-ibss nodes first */
|
||||
LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
|
||||
- if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr)) {
|
||||
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode != IEEE80211_M_IBSS) {
|
||||
#ifdef IEEE80211_DEBUG_REFCNT
|
||||
ieee80211_ref_node_debug(ni, func, line);
|
||||
#else
|
||||
ieee80211_ref_node(ni);
|
||||
-#endif
|
||||
+#endif
|
||||
+ return ni;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ LIST_FOREACH(ni, &nt->nt_hash[hash], ni_hash) {
|
||||
+ if (IEEE80211_ADDR_EQ(ni->ni_macaddr, macaddr) && ni->ni_vap->iv_opmode == IEEE80211_M_IBSS) {
|
||||
+#ifdef IEEE80211_DEBUG_REFCNT
|
||||
+ ieee80211_ref_node_debug(ni, func, line);
|
||||
+#else
|
||||
+ ieee80211_ref_node(ni);
|
||||
+#endif
|
||||
return ni;
|
||||
}
|
||||
}
|
||||
@@ -1345,7 +1358,7 @@
|
||||
return ieee80211_ref_node_debug(wds->wds_ni, func, line);
|
||||
#else
|
||||
return ieee80211_ref_node(wds->wds_ni);
|
||||
-#endif
|
||||
+#endif
|
||||
}
|
||||
}
|
||||
return NULL;
|
@ -0,0 +1,312 @@
|
||||
Index: madwifi-dfs-r2996/ath_hal/ah_os.h
|
||||
===================================================================
|
||||
--- madwifi-dfs-r2996.orig/ath_hal/ah_os.h 2007-12-01 19:36:04.943396719 +0100
|
||||
+++ madwifi-dfs-r2996/ath_hal/ah_os.h 2007-12-01 19:37:06.182886560 +0100
|
||||
@@ -33,7 +33,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
* THE POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
- * $Id: ah_os.h 2727 2007-10-05 17:42:53Z mtaylor $
|
||||
+ * $Id: ah_os.h 2933 2007-11-23 09:38:18Z proski $
|
||||
*/
|
||||
#ifndef _ATH_AH_OS_H_
|
||||
#define _ATH_AH_OS_H_
|
||||
@@ -42,16 +42,16 @@
|
||||
* Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
|
||||
*/
|
||||
|
||||
-/*
|
||||
-MadWifi safe register operations:
|
||||
+/*
|
||||
+ MadWifi safe register operations:
|
||||
|
||||
- When hacking on registers directly we need to use the macros
|
||||
- below, to avoid concurrent PCI access and abort mode errors.
|
||||
+ When hacking on registers directly, we need to use the macros below to
|
||||
+ avoid concurrent PCI access and abort mode errors.
|
||||
|
||||
* ath_reg_read
|
||||
* ATH_REG_WRITE
|
||||
|
||||
-HAL-ONLY register operations:
|
||||
+ HAL-ONLY register operations:
|
||||
|
||||
* _OS_REG_READ
|
||||
* _OS_REG_WRITE
|
||||
@@ -60,26 +60,27 @@
|
||||
* ath_hal_reg_read.
|
||||
* ath_hal_reg_write
|
||||
|
||||
- When compiled in HAL:
|
||||
- * We do not require locking overhead and function call unless user is debugging.
|
||||
- * All HAL operations are executed in the context of a MadWifi wrapper call which holds
|
||||
- the HAL lock.
|
||||
- * Normally HAL is build with the non-modified version of this file so it doesnt have our
|
||||
- funny macros anyway.
|
||||
-
|
||||
- When compiled in MadWifi:
|
||||
- * The HAL wrapper API takes the HAL lock before invoking the HAL.
|
||||
- * HAL access is already protected, and MadWifi must NOT access the functions listed above.
|
||||
-
|
||||
+ When compiled in HAL:
|
||||
+ * We don't require locking overhead and function call except for
|
||||
+ debugging.
|
||||
+ * All HAL operations are executed in the context of a MadWifi wrapper
|
||||
+ call that holds the HAL lock.
|
||||
+ * Normally HAL is built with the non-modified version of this file, so
|
||||
+ it doesn't have our funny macros anyway.
|
||||
+
|
||||
+ When compiled in MadWifi:
|
||||
+ * The HAL wrapper API takes the HAL lock before invoking the HAL.
|
||||
+ * HAL access is already protected, and MadWifi must NOT access the
|
||||
+ functions listed above.
|
||||
*/
|
||||
|
||||
/*
|
||||
- * When building the HAL proper we use no GPL-contaminated include
|
||||
- * files and must define these types ourself. Beware of these being
|
||||
- * mismatched against the contents of <linux/types.h>
|
||||
+ * When building the HAL proper, we use no GPL-licensed include files and must
|
||||
+ * define Linux types ourselves. Please note that the definitions below don't
|
||||
+ * exactly match those in <linux/types.h>
|
||||
*/
|
||||
#ifndef _LINUX_TYPES_H
|
||||
-/* NB: arm defaults to unsigned so be explicit */
|
||||
+/* NB: ARM defaults to unsigned, so be explicit */
|
||||
typedef signed char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
@@ -93,36 +94,33 @@
|
||||
typedef unsigned int size_t;
|
||||
typedef unsigned int u_int;
|
||||
typedef void* va_list;
|
||||
-#endif
|
||||
+#endif /* !_LINUX_TYPES_H */
|
||||
|
||||
/*
|
||||
* Linux/BSD gcc compatibility shims.
|
||||
*/
|
||||
-#define __printflike(_a,_b) \
|
||||
- __attribute__ ((__format__ (__printf__, _a, _b)))
|
||||
-#define __va_list va_list
|
||||
+#define __va_list va_list
|
||||
#define OS_INLINE __inline
|
||||
|
||||
extern int ath_hal_dma_beacon_response_time;
|
||||
extern int ath_hal_sw_beacon_response_time;
|
||||
extern int ath_hal_additional_swba_backoff;
|
||||
|
||||
-void __ahdecl ath_hal_vprintf(struct ath_hal *ah, const char* fmt,
|
||||
- va_list ap);
|
||||
-void __ahdecl ath_hal_printf(struct ath_hal *ah, const char* fmt, ...);
|
||||
-const char* __ahdecl ath_hal_ether_sprintf(const u_int8_t *mac);
|
||||
+void __ahdecl ath_hal_vprintf(struct ath_hal *ah, const char *fmt, va_list ap);
|
||||
+void __ahdecl ath_hal_printf(struct ath_hal *ah, const char *fmt, ...);
|
||||
+const char *__ahdecl ath_hal_ether_sprintf(const u_int8_t *mac);
|
||||
int __ahdecl ath_hal_memcmp(const void *a, const void *b, size_t n);
|
||||
-void * __ahdecl ath_hal_malloc(size_t size);
|
||||
-void __ahdecl ath_hal_free(void* p);
|
||||
+void *__ahdecl ath_hal_malloc(size_t size);
|
||||
+void __ahdecl ath_hal_free(void *p);
|
||||
|
||||
/* Delay n microseconds. */
|
||||
-extern void __ahdecl ath_hal_delay(int);
|
||||
+extern void __ahdecl ath_hal_delay(int);
|
||||
#define OS_DELAY(_n) ath_hal_delay(_n)
|
||||
|
||||
#define OS_MEMZERO(_a, _n) ath_hal_memzero((_a), (_n))
|
||||
extern void __ahdecl ath_hal_memzero(void *, size_t);
|
||||
#define OS_MEMCPY(_d, _s, _n) ath_hal_memcpy(_d,_s,_n)
|
||||
-extern void * __ahdecl ath_hal_memcpy(void *, const void *, size_t);
|
||||
+extern void *__ahdecl ath_hal_memcpy(void *, const void *, size_t);
|
||||
|
||||
#ifndef abs
|
||||
#define abs(_a) __builtin_abs(_a)
|
||||
@@ -133,7 +131,7 @@
|
||||
#endif
|
||||
|
||||
struct ath_hal;
|
||||
-extern u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
|
||||
+extern u_int32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
|
||||
#define OS_GETUPTIME(_ah) ath_hal_getuptime(_ah)
|
||||
|
||||
/* Byte order/swapping support. */
|
||||
@@ -142,9 +140,8 @@
|
||||
|
||||
#ifndef AH_BYTE_ORDER
|
||||
/*
|
||||
- * When the .inc file is not available (e.g. when building
|
||||
- * in a kernel source tree); look for some other way to
|
||||
- * setup the host byte order.
|
||||
+ * When the .inc file is not available (e.g. when building in the kernel source
|
||||
+ * tree), look for some other way to determine the host byte order.
|
||||
*/
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define AH_BYTE_ORDER AH_LITTLE_ENDIAN
|
||||
@@ -155,93 +152,98 @@
|
||||
#ifndef AH_BYTE_ORDER
|
||||
#error "Do not know host byte order"
|
||||
#endif
|
||||
-#endif /* AH_BYTE_ORDER */
|
||||
+#endif /* AH_BYTE_ORDER */
|
||||
|
||||
/*
|
||||
- * Note that register accesses are done using target-specific
|
||||
- * functions when debugging is enabled (AH_DEBUG) or we are
|
||||
- * explicitly configured this way.
|
||||
- *
|
||||
- * The hardware registers are native little-endian byte order.
|
||||
- * Big-endian hosts are handled by enabling hardware byte-swap
|
||||
- * of register reads and writes at reset. But the PCI clock
|
||||
- * domain registers are not byte swapped! Thus, on big-endian
|
||||
- * platforms we have to byte-swap thoese registers specifically.
|
||||
- * Most of this code is collapsed at compile time because the
|
||||
- * register values are constants.
|
||||
- *
|
||||
- * Presumably when talking about hardware byte-swapping, the above
|
||||
- * text is referring to the Atheros chipset, as the registers
|
||||
- * referred to are in the PCI memory address space, and these are
|
||||
- * never byte-swapped by PCI chipsets or bridges, but always
|
||||
- * written directly (i.e. the format defined by the manufacturer).
|
||||
+ * Some big-endian architectures don't set CONFIG_GENERIC_IOMAP, but fail to
|
||||
+ * implement iowrite32be and ioread32be. Provide compatibility macros when
|
||||
+ * it's needed.
|
||||
+ *
|
||||
+ * As of Linux 2.6.24, only MIPS, PARISC and PowerPC implement iowrite32be and
|
||||
+ * ioread32be as functions.
|
||||
+ *
|
||||
+ * The downside or the replacement macros it that we may be byte-swapping data
|
||||
+ * for the second time, so the native implementations should be preferred.
|
||||
*/
|
||||
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)) && \
|
||||
+ !defined(CONFIG_GENERIC_IOMAP) && (AH_BYTE_ORDER == AH_BIG_ENDIAN) && \
|
||||
+ !defined(__mips__) && !defined(__hppa__) && !defined(__powerpc__)
|
||||
+# ifndef iowrite32be
|
||||
+# define iowrite32be(_val, _addr) iowrite32(swab32((_val)), (_addr))
|
||||
+# endif
|
||||
+# ifndef ioread32be
|
||||
+# define ioread32be(_addr) swab32(ioread32((_addr)))
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
+/*
|
||||
+ * The register accesses are done using target-specific functions when
|
||||
+ * debugging is enabled (AH_DEBUG) or it's explicitly requested for the target.
|
||||
+ *
|
||||
+ * The hardware registers use little-endian byte order natively. Big-endian
|
||||
+ * systems are configured by HAL to enable hardware byte-swap of register reads
|
||||
+ * and writes at reset. This avoid the need to byte-swap the data in software.
|
||||
+ * However, the registers in a certain area from 0x4000 to 0x4fff (PCI clock
|
||||
+ * domain registers) are not byte swapped!
|
||||
+ *
|
||||
+ * Since Linux I/O primitives default to little-endian operations, we only
|
||||
+ * need to suppress byte-swapping on big-endian systems outside the area used
|
||||
+ * by the PCI clock domain registers.
|
||||
+ */
|
||||
+#if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
|
||||
+#define is_reg_le(__reg) ((0x4000 <= (__reg) && (__reg) < 0x5000))
|
||||
+#else
|
||||
+#define is_reg_le(__reg) 1
|
||||
+#endif
|
||||
+
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12)
|
||||
-# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
|
||||
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
|
||||
- (0x4000 <= (_reg) && (_reg) < 0x5000) ? \
|
||||
+ is_reg_le(_reg) ? \
|
||||
iowrite32((_val), (_ah)->ah_sh + (_reg)) : \
|
||||
iowrite32be((_val), (_ah)->ah_sh + (_reg)); \
|
||||
} while (0)
|
||||
#define _OS_REG_READ(_ah, _reg) \
|
||||
- ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
|
||||
+ (is_reg_le(_reg) ? \
|
||||
ioread32((_ah)->ah_sh + (_reg)) : \
|
||||
- ioread32be((_ah)->ah_sh + (_reg)));
|
||||
-# else /* AH_LITTLE_ENDIAN */
|
||||
-#define _OS_REG_WRITE(_ah, _reg, _val) do { \
|
||||
- iowrite32(_val, (_ah)->ah_sh + (_reg)); \
|
||||
- } while (0)
|
||||
-#define _OS_REG_READ(_ah, _reg) \
|
||||
- ioread32((_ah)->ah_sh + (_reg))
|
||||
-
|
||||
-# endif /* AH_BYTE_ORDER */
|
||||
+ ioread32be((_ah)->ah_sh + (_reg)))
|
||||
#else
|
||||
-# if (AH_BYTE_ORDER == AH_BIG_ENDIAN)
|
||||
#define _OS_REG_WRITE(_ah, _reg, _val) do { \
|
||||
- writel((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
|
||||
+ writel(is_reg_le(_reg) ? \
|
||||
(_val) : cpu_to_le32(_val), \
|
||||
(_ah)->ah_sh + (_reg)); \
|
||||
} while (0)
|
||||
#define _OS_REG_READ(_ah, _reg) \
|
||||
- ((0x4000 <= (_reg) && (_reg) < 0x5000) ? \
|
||||
+ (is_reg_le(_reg) ? \
|
||||
readl((_ah)->ah_sh + (_reg)) : \
|
||||
cpu_to_le32(readl((_ah)->ah_sh + (_reg))))
|
||||
-# else /* AH_LITTLE_ENDIAN */
|
||||
-#define _OS_REG_WRITE(_ah, _reg, _val) do { \
|
||||
- writel(_val, (_ah)->ah_sh + (_reg)); \
|
||||
- } while (0)
|
||||
-#define _OS_REG_READ(_ah, _reg) \
|
||||
- readl((_ah)->ah_sh + (_reg))
|
||||
-# endif /* AH_BYTE_ORDER */
|
||||
-#endif /* KERNEL_VERSON(2,6,12) */
|
||||
-
|
||||
-/*
|
||||
-The functions in this section are not intended to be invoked by MadWifi driver
|
||||
-code, but by the HAL. They are NOT safe for direct invocation when the
|
||||
-sc->sc_hal_lock is not held. Use ath_reg_read and ATH_REG_WRITE instead!
|
||||
+#endif /* KERNEL_VERSION(2,6,12) */
|
||||
+
|
||||
+/*
|
||||
+ * The functions in this section are not intended to be invoked by MadWifi
|
||||
+ * driver code, but by the HAL. They are NOT safe to call directly when the
|
||||
+ * sc->sc_hal_lock is not held. Use ath_reg_read and ATH_REG_WRITE instead!
|
||||
*/
|
||||
#if defined(AH_DEBUG) || defined(AH_REGOPS_FUNC) || defined(AH_DEBUG_ALQ)
|
||||
#define OS_REG_WRITE(_ah, _reg, _val) ath_hal_reg_write(_ah, _reg, _val)
|
||||
#define OS_REG_READ(_ah, _reg) ath_hal_reg_read(_ah, _reg)
|
||||
-extern void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int reg, u_int32_t val);
|
||||
-extern u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg);
|
||||
+extern void __ahdecl ath_hal_reg_write(struct ath_hal *ah, u_int reg,
|
||||
+ u_int32_t val);
|
||||
+extern u_int32_t __ahdecl ath_hal_reg_read(struct ath_hal *ah, u_int reg);
|
||||
#else
|
||||
#define OS_REG_WRITE(_ah, _reg, _val) _OS_REG_WRITE(_ah, _reg, _val)
|
||||
#define OS_REG_READ(_ah, _reg) _OS_REG_READ(_ah, _reg)
|
||||
-#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */
|
||||
+#endif /* AH_DEBUG || AH_REGFUNC || AH_DEBUG_ALQ */
|
||||
|
||||
extern char *ath_hal_func;
|
||||
static inline void ath_hal_set_function(const char *name)
|
||||
-#if defined(AH_DEBUG)
|
||||
{
|
||||
+#ifdef AH_DEBUG
|
||||
ath_hal_func = (char *)name;
|
||||
-}
|
||||
-#else
|
||||
-{ }
|
||||
#endif
|
||||
+}
|
||||
|
||||
#ifdef AH_DEBUG_ALQ
|
||||
-extern void __ahdecl OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
|
||||
+extern void __ahdecl OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
|
||||
#else
|
||||
#define OS_MARK(_ah, _id, _v)
|
||||
#endif
|
||||
@@ -253,8 +255,9 @@
|
||||
* compiled with the default calling convention and are not called
|
||||
* from within the HAL.
|
||||
*/
|
||||
-extern struct ath_hal *_ath_hal_attach(u_int16_t devid, HAL_SOFTC,
|
||||
- HAL_BUS_TAG, HAL_BUS_HANDLE, HAL_STATUS*);
|
||||
-extern void _ath_hal_detach(struct ath_hal *);
|
||||
+extern struct ath_hal *_ath_hal_attach(u_int16_t devid, HAL_SOFTC,
|
||||
+ HAL_BUS_TAG, HAL_BUS_HANDLE,
|
||||
+ HAL_STATUS *);
|
||||
+extern void _ath_hal_detach(struct ath_hal *);
|
||||
|
||||
-#endif /* _ATH_AH_OSDEP_H_ */
|
||||
+#endif /* _ATH_AH_OSDEP_H_ */
|
Loading…
Reference in New Issue