include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit...
[safe/jmp/linux-2.6] / drivers / net / wireless / libertas_tf / main.c
index 10a99e2..7945ff5 100644 (file)
@@ -7,6 +7,8 @@
  *  the Free Software Foundation; either version 2 of the License, or (at
  *  your option) any later version.
  */
+#include <linux/slab.h>
+
 #include "libertas_tf.h"
 #include "linux/etherdevice.h"
 
@@ -318,14 +320,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 +339,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,15 +368,35 @@ static int lbtf_op_config(struct ieee80211_hw *hw, u32 changed)
        return 0;
 }
 
+static u64 lbtf_op_prepare_multicast(struct ieee80211_hw *hw,
+                                    int mc_count, struct dev_addr_list *mclist)
+{
+       struct lbtf_private *priv = hw->priv;
+       int i;
+
+       if (!mc_count || mc_count > MRVDRV_MAX_MULTICAST_LIST_SIZE)
+               return mc_count;
+
+       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 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;
 
@@ -386,20 +408,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 |
@@ -461,6 +475,7 @@ static const struct ieee80211_ops lbtf_ops = {
        .add_interface          = lbtf_op_add_interface,
        .remove_interface       = lbtf_op_remove_interface,
        .config                 = lbtf_op_config,
+       .prepare_multicast      = lbtf_op_prepare_multicast,
        .configure_filter       = lbtf_op_configure_filter,
        .bss_info_changed       = lbtf_op_bss_info_changed,
 };
@@ -482,7 +497,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;
@@ -503,7 +517,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);
@@ -542,6 +557,9 @@ struct lbtf_private *lbtf_add_card(void *card, struct device *dmdev)
        priv->band.n_channels = ARRAY_SIZE(lbtf_channels);
        priv->band.channels = priv->channels;
        hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &priv->band;
+       hw->wiphy->interface_modes =
+               BIT(NL80211_IFTYPE_STATION) |
+               BIT(NL80211_IFTYPE_ADHOC);
        skb_queue_head_init(&priv->bc_ps_buf);
 
        SET_IEEE80211_DEV(hw, dmdev);