[svn-upgrade] new version madwifi (0.9.4+r4133.20100922)
[debian/madwifi.git] / ath / if_ath.c
index 76532aabbcb70c11ef03bdac98e5693081d706c4..db6cfbb7cf0dcc06714b81999d9b24a507a66f0e 100644 (file)
@@ -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: if_ath.c 4005 2009-04-15 12:04:43Z proski $
+ * $Id: if_ath.c 4133 2010-06-20 12:13:10Z proski $
  */
 
 /*
@@ -3496,7 +3496,7 @@ ath_merge_mcast(struct ath_softc *sc, u_int32_t mfilt[2])
 {
        struct ieee80211com *ic = &sc->sc_ic;
        struct ieee80211vap *vap;
-       struct dev_mc_list *mc;
+       struct ath_netdev_hw_addr *ha;
        u_int32_t val;
        u_int8_t pos;
 
@@ -3504,11 +3504,11 @@ ath_merge_mcast(struct ath_softc *sc, u_int32_t mfilt[2])
        /* XXX locking */
        TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) {
                struct net_device *dev = vap->iv_dev;
-               for (mc = dev->mc_list; mc; mc = mc->next) {
+               netdev_for_each_mc_addr (ha, dev) {
                        /* calculate XOR of eight 6-bit values */
-                       val = LE_READ_4(mc->dmi_addr + 0);
+                       val = LE_READ_4(ath_ha_addr(ha) + 0);
                        pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
-                       val = LE_READ_4(mc->dmi_addr + 3);
+                       val = LE_READ_4(ath_ha_addr(ha) + 3);
                        pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
                        pos &= 0x3f;
                        mfilt[pos / 32] |= (1 << (pos % 32));
@@ -4190,15 +4190,19 @@ ath_beacon_generate(struct ath_softc *sc, struct ieee80211vap *vap, int *needmar
                ATH_TXQ_LOCK(&avp->av_mcastq);
                ATH_TXQ_LOCK(cabq);
                bfmcast = STAILQ_FIRST(&avp->av_mcastq.axq_q);
-               /* link the descriptors */
-               if (cabq->axq_link == NULL)
-                       ath_hal_puttxbuf(ah, cabq->axq_qnum, bfmcast->bf_daddr);
-               else {
+               if (bfmcast != NULL) {
+                       /* link the descriptors */
+                       if (cabq->axq_link == NULL)
+                               ath_hal_puttxbuf(ah, cabq->axq_qnum,
+                                                bfmcast->bf_daddr);
+                       else {
 #ifdef AH_NEED_DESC_SWAP
-                       *cabq->axq_link = cpu_to_le32(bfmcast->bf_daddr);
+                               *cabq->axq_link =
+                                       cpu_to_le32(bfmcast->bf_daddr);
 #else
-                       *cabq->axq_link = bfmcast->bf_daddr;
+                               *cabq->axq_link = bfmcast->bf_daddr;
 #endif
+                       }
                }
 
                /* Set the MORE_DATA bit for each packet except the last one */
@@ -9586,119 +9590,119 @@ static int mincalibrate = 1;                  /* once a second */
 static int maxint = 0x7fffffff;                /* 32-bit big */
 
 static const ctl_table ath_sysctl_template[] = {
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "slottime",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_SLOTTIME,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "acktimeout",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_ACKTIMEOUT,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "ctstimeout",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_CTSTIMEOUT,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "softled",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_SOFTLED,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "ledpin",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_LEDPIN,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "countrycode",
          .mode         = 0444,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_COUNTRYCODE,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "maxvaps",
          .mode         = 0444,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_MAXVAPS,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "regdomain",
          .mode         = 0444,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_REGDOMAIN,
        },
 #ifdef AR_DEBUG
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "debug",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_DEBUG,
        },
 #endif
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "txantenna",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_TXANTENNA,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "rxantenna",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_RXANTENNA,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "diversity",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_DIVERSITY,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "txintrperiod",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_TXINTRPERIOD,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "fftxqmin",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_FFTXQMIN,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "tkipmic",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_TKIPMIC,
        },
 #ifdef ATH_SUPERG_XR
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "xrpollperiod",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_XR_POLL_PERIOD,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "xrpollcount",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_XR_POLL_COUNT,
        },
 #endif
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "ackrate",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
          .extra2       = (void *)ATH_ACKRATE,
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "intmit",
          .mode         = 0644,
          .proc_handler = ath_sysctl_halparam,
@@ -9736,12 +9740,12 @@ ath_dynamic_sysctl_register(struct ath_softc *sc)
 
        /* setup the table */
        memset(sc->sc_sysctls, 0, space);
-       sc->sc_sysctls[0].ctl_name = CTL_DEV;
+       ATH_SET_CTL_NAME(sc->sc_sysctls[0], CTL_DEV);
        sc->sc_sysctls[0].procname = "dev";
        sc->sc_sysctls[0].mode = 0555;
        sc->sc_sysctls[0].child = &sc->sc_sysctls[2];
        /* [1] is NULL terminator */
-       sc->sc_sysctls[2].ctl_name = CTL_AUTO;
+       ATH_SET_CTL_NAME(sc->sc_sysctls[2], CTL_AUTO);
        sc->sc_sysctls[2].procname = dev_name;
        sc->sc_sysctls[2].mode = 0555;
        sc->sc_sysctls[2].child = &sc->sc_sysctls[4];
@@ -9844,7 +9848,7 @@ ath_announce(struct net_device *dev)
  */
 static ctl_table ath_static_sysctls[] = {
 #ifdef AR_DEBUG
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "debug",
          .mode         = 0644,
          .data         = &ath_debug,
@@ -9852,35 +9856,35 @@ static ctl_table ath_static_sysctls[] = {
          .proc_handler = proc_dointvec
        },
 #endif
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "countrycode",
          .mode         = 0444,
          .data         = &ath_countrycode,
          .maxlen       = sizeof(ath_countrycode),
          .proc_handler = proc_dointvec
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "maxvaps",
          .mode         = 0444,
          .data         = &ath_maxvaps,
          .maxlen       = sizeof(ath_maxvaps),
          .proc_handler = proc_dointvec
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "outdoor",
          .mode         = 0444,
          .data         = &ath_outdoor,
          .maxlen       = sizeof(ath_outdoor),
          .proc_handler = proc_dointvec
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "xchanmode",
          .mode         = 0444,
          .data         = &ath_xchanmode,
          .maxlen       = sizeof(ath_xchanmode),
          .proc_handler = proc_dointvec
        },
-       { .ctl_name     = CTL_AUTO,
+       { ATH_INIT_CTL_NAME(CTL_AUTO)
          .procname     = "calibrate",
          .mode         = 0644,
          .data         = &ath_calinterval,
@@ -9892,14 +9896,14 @@ static ctl_table ath_static_sysctls[] = {
        { 0 }
 };
 static ctl_table ath_ath_table[] = {
-       { .ctl_name     = DEV_ATH,
+       { ATH_INIT_CTL_NAME(DEV_ATH)
          .procname     = "ath",
          .mode         = 0555,
          .child        = ath_static_sysctls
        }, { 0 }
 };
 static ctl_table ath_root_table[] = {
-       { .ctl_name     = CTL_DEV,
+       { ATH_INIT_CTL_NAME(CTL_DEV)
          .procname     = "dev",
          .mode         = 0555,
          .child        = ath_ath_table