Merge git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6
[safe/jmp/linux-2.6] / drivers / net / wireless / libertas_tf / main.c
index 68e47fb..ba3eb01 100644 (file)
@@ -318,14 +318,14 @@ static void lbtf_op_stop(struct ieee80211_hw *hw)
 }
 
 static int lbtf_op_add_interface(struct ieee80211_hw *hw,
-                       struct ieee80211_if_init_conf *conf)
+                       struct ieee80211_vif *vif)
 {
        struct lbtf_private *priv = hw->priv;
        if (priv->vif != NULL)
                return -EOPNOTSUPP;
 
-       priv->vif = conf->vif;
-       switch (conf->type) {
+       priv->vif = vif;
+       switch (vif->type) {
        case NL80211_IFTYPE_MESH_POINT:
        case NL80211_IFTYPE_AP:
                lbtf_set_mode(priv, LBTF_AP_MODE);
@@ -337,12 +337,12 @@ static int lbtf_op_add_interface(struct ieee80211_hw *hw,
                priv->vif = NULL;
                return -EOPNOTSUPP;
        }
-       lbtf_set_mac_address(priv, (u8 *) conf->mac_addr);
+       lbtf_set_mac_address(priv, (u8 *) vif->addr);
        return 0;
 }
 
 static void lbtf_op_remove_interface(struct ieee80211_hw *hw,
-                       struct ieee80211_if_init_conf *conf)
+                       struct ieee80211_vif *vif)
 {
        struct lbtf_private *priv = hw->priv;
 
@@ -366,45 +366,35 @@ static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed)
        return 0;
 }
 
-static int lbtf_op_config_interface(struct ieee80211_hw *hw,
-                       struct ieee80211_vif *vif,
-                       struct ieee80211_if_conf *conf)
+static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw,
+                                    int mc_count, struct dev_addr_list *mclist)
 {
        struct lbtf_private *priv = hw->priv;
-       struct sk_buff *beacon;
+       int i;
 
-       switch (priv->vif->type) {
-       case NL80211_IFTYPE_AP:
-       case NL80211_IFTYPE_MESH_POINT:
-               beacon = ieee80211_beacon_get(hw, vif);
-               if (beacon) {
-                       lbtf_beacon_set(priv, beacon);
-                       kfree_skb(beacon);
-                       lbtf_beacon_ctrl(priv, 1, vif->bss_conf.beacon_int);
-               }
-               break;
-       default:
-               break;
-       }
+       if (!mc_count || mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE)
+               return mc_count;
 
-       if (conf->bssid) {
-               u8 null_bssid[ETH_ALEN] = {0};
-               bool activate = compare_ether_addr(conf->bssid, null_bssid);
-               lbtf_set_bssid(priv, activate, conf->bssid);
+       priv->nr_of_multicastmacaddr = mc_count;
+       for (i = 0; i < mc_count; i++) {
+               if (!mclist)
+                       break;
+               memcpy(&priv->multicastlist[i], mclist->da_addr,
+                               ETH_ALEN);
+               mclist = mclist->next;
        }
 
-       return 0;
+       return mc_count;
 }
 
 #define SUPPORTED_FIF_FLAGS  (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)
 static void lbtf_op_configure_filter(struct ieee80211_hw *hw,
                        unsigned int changed_flags,
                        unsigned int *new_flags,
-                       int mc_count, struct dev_mc_list *mclist)
+                       u64 multicast)
 {
        struct lbtf_private *priv = hw->priv;
        int old_mac_control = priv->mac_control;
-       int i;
        changed_flags &= SUPPORTED_FIF_FLAGS;
        *new_flags &= SUPPORTED_FIF_FLAGS;
 
@@ -416,20 +406,12 @@ static void lbtf_op_configure_filter(struct ieee80211_hw *hw,
        else
                priv->mac_control &= ~CMD_ACT_MAC_PROMISCUOUS_ENABLE;
        if (*new_flags & (FIF_ALLMULTI) ||
-           mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE) {
+           multicast > MRVDRV_MAX_MULTICAST_LIST_SIZE) {
                priv->mac_control |= CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
                priv->mac_control &= ~CMD_ACT_MAC_MULTICAST_ENABLE;
-       } else if (mc_count) {
+       } else if (multicast) {
                priv->mac_control |= CMD_ACT_MAC_MULTICAST_ENABLE;
                priv->mac_control &= ~CMD_ACT_MAC_ALL_MULTICAST_ENABLE;
-               priv->nr_of_multicastmacaddr = mc_count;
-               for (i = 0; i < mc_count; i++) {
-                       if (!mclist)
-                               break;
-                       memcpy(&priv->multicastlist[i], mclist->da_addr,
-                                       ETH_ALEN);
-                       mclist = mclist->next;
-               }
                lbtf_cmd_set_mac_multicast_addr(priv);
        } else {
                priv->mac_control &= ~(CMD_ACT_MAC_MULTICAST_ENABLE |
@@ -451,6 +433,29 @@ static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw,
                        u32 changes)
 {
        struct lbtf_private *priv = hw->priv;
+       struct sk_buff *beacon;
+
+       if (changes & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_INT)) {
+               switch (priv->vif->type) {
+               case NL80211_IFTYPE_AP:
+               case NL80211_IFTYPE_MESH_POINT:
+                       beacon = ieee80211_beacon_get(hw, vif);
+                       if (beacon) {
+                               lbtf_beacon_set(priv, beacon);
+                               kfree_skb(beacon);
+                               lbtf_beacon_ctrl(priv, 1,
+                                                bss_conf->beacon_int);
+                       }
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       if (changes & BSS_CHANGED_BSSID) {
+               bool activate = !is_zero_ether_addr(bss_conf->bssid);
+               lbtf_set_bssid(priv, activate, bss_conf->bssid);
+       }
 
        if (changes & BSS_CHANGED_ERP_PREAMBLE) {
                if (bss_conf->use_short_preamble)
@@ -459,8 +464,6 @@ static void lbtf_op_bss_info_changed(struct ieee80211_hw *hw,
                        priv->preamble = CMD_TYPE_LONG_PREAMBLE;
                lbtf_set_radio_control(priv);
        }
-
-       return;
 }
 
 static const struct ieee80211_ops lbtf_ops = {
@@ -470,7 +473,7 @@ static const struct ieee80211_ops lbtf_ops = {
        .add_interface          = lbtf_op_add_interface,
        .remove_interface       = lbtf_op_remove_interface,
        .config                 = lbtf_op_config,
-       .config_interface       = lbtf_op_config_interface,
+       .prepare_multicast      = lbtf_op_prepare_multicast,
        .configure_filter       = lbtf_op_configure_filter,
        .bss_info_changed       = lbtf_op_bss_info_changed,
 };
@@ -492,7 +495,6 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
        stats.band = IEEE80211_BAND_2GHZ;
        stats.signal = prxpd->snr;
        stats.noise = prxpd->nf;
-       stats.qual = prxpd->snr - prxpd->nf;
        /* Marvell rate index has a hole at value 4 */
        if (prxpd->rx_rate > 4)
                --prxpd->rx_rate;
@@ -513,7 +515,8 @@ int lbtf_rx(struct lbtf_private *priv, struct sk_buff *skb)
                skb_reserve(skb, 2);
        }
 
-       ieee80211_rx_irqsafe(priv->hw, skb, &stats);
+       memcpy(IEEE80211_SKB_RXCB(skb), &stats, sizeof(stats));
+       ieee80211_rx_irqsafe(priv->hw, skb);
        return 0;
 }
 EXPORT_SYMBOL_GPL(lbtf_rx);