4a5c0b093a59eadaac9699e7987aeb498027c5c4
[openwrt/openwrt.git] / package / madwifi / patches / 420-diversity_fix.patch
1 --- a/ath/if_ath.c
2 +++ b/ath/if_ath.c
3 @@ -797,7 +797,6 @@ ath_attach(u_int16_t devid, struct net_d
4 break;
5 }
6
7 - sc->sc_setdefantenna = ath_setdefantenna;
8 sc->sc_rc = ieee80211_rate_attach(sc, ratectl);
9 if (sc->sc_rc == NULL) {
10 error = EIO;
11 @@ -2624,9 +2623,6 @@ ath_init(struct net_device *dev)
12 ath_radar_update(sc);
13 ath_rp_flush(sc);
14
15 - /* Set the default RX antenna; it may get lost on reset. */
16 - ath_setdefantenna(sc, sc->sc_defant);
17 -
18 /*
19 * Setup the hardware after reset: the key cache
20 * is filled as needed and the receive engine is
21 @@ -3019,7 +3015,6 @@ ath_reset(struct net_device *dev)
22 ath_setintmit(sc);
23 ath_update_txpow(sc); /* update tx power state */
24 ath_radar_update(sc);
25 - ath_setdefantenna(sc, sc->sc_defant);
26 if (ath_startrecv(sc) != 0) /* restart recv */
27 EPRINTF(sc, "Unable to start receive logic.\n");
28 if (sc->sc_softled)
29 @@ -5353,27 +5348,6 @@ ath_beacon_send(struct ath_softc *sc, in
30 } else if ((sc->sc_updateslot == COMMIT) && (sc->sc_slotupdate == slot))
31 ath_setslottime(sc); /* commit change to hardware */
32
33 - if ((!sc->sc_stagbeacons || slot == 0) && (!sc->sc_diversity)) {
34 - unsigned int otherant;
35 - /*
36 - * Check recent per-antenna transmit statistics and flip
37 - * the default rx antenna if noticeably more frames went out
38 - * on the non-default antenna. Only do this if rx diversity
39 - * is off.
40 - * XXX assumes 2 antennae
41 - */
42 - otherant = sc->sc_defant & 1 ? 2 : 1;
43 - if (sc->sc_ant_tx[otherant] > sc->sc_ant_tx[sc->sc_defant] +
44 - ATH_ANTENNA_DIFF) {
45 - DPRINTF(sc, ATH_DEBUG_BEACON,
46 - "Flip default antenna to %u, %u > %u\n",
47 - otherant, sc->sc_ant_tx[otherant],
48 - sc->sc_ant_tx[sc->sc_defant]);
49 - ath_setdefantenna(sc, otherant);
50 - }
51 - sc->sc_ant_tx[1] = sc->sc_ant_tx[2] = 0;
52 - }
53 -
54 if (bfaddr != 0) {
55 /*
56 * Stop any current DMA and put the new frame(s) on the queue.
57 @@ -6734,9 +6708,8 @@ ath_setdefantenna(struct ath_softc *sc,
58 {
59 struct ath_hal *ah = sc->sc_ah;
60
61 - /* XXX block beacon interrupts */
62 - ath_hal_setdiversity(ah, (sc->sc_diversity != 0));
63 ath_hal_setdefantenna(ah, antenna);
64 + ath_hal_setantennaswitch(ah, sc->sc_diversity ? 0 : antenna);
65 if (sc->sc_defant != antenna)
66 sc->sc_stats.ast_ant_defswitch++;
67 sc->sc_defant = antenna;
68 @@ -11160,7 +11133,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl
69 break;
70 }
71 sc->sc_diversity = val;
72 - ath_hal_setdiversity(ah, val);
73 + ath_setdefantenna(sc, sc->sc_defant);
74 break;
75 case ATH_TXINTRPERIOD:
76 /* XXX: validate? */
77 --- a/ath/if_athvar.h
78 +++ b/ath/if_athvar.h
79 @@ -640,7 +640,6 @@ struct ath_softc {
80 spinlock_t sc_hal_lock; /* hardware access lock */
81 struct ath_ratectrl *sc_rc; /* tx rate control support */
82 struct ath_tx99 *sc_tx99; /* tx99 support */
83 - void (*sc_setdefantenna)(struct ath_softc *, u_int);
84 const struct ath_hw_detect *sc_hwinfo;
85
86 unsigned int sc_invalid:1; /* being detached */