mwifiex: use bss_type and bss_num to retrieve priv
authorYogesh Ashok Powar <yogeshp@marvell.com>
Thu, 12 Jan 2012 04:06:11 +0000 (20:06 -0800)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 24 Jan 2012 19:21:12 +0000 (14:21 -0500)
Current implementation, for retrieving priv from adapter,
uses bss_index. In multi interface environment supporting
different types, bss_index may not be unique.

Use bss_type along with bss_num to retrieve the priv.
bss_index is removed with this change.

Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: Kiran Divekar <dkiran@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
12 files changed:
drivers/net/wireless/mwifiex/11n_aggr.c
drivers/net/wireless/mwifiex/cfg80211.c
drivers/net/wireless/mwifiex/cmdevt.c
drivers/net/wireless/mwifiex/decl.h
drivers/net/wireless/mwifiex/init.c
drivers/net/wireless/mwifiex/main.c
drivers/net/wireless/mwifiex/main.h
drivers/net/wireless/mwifiex/sta_rx.c
drivers/net/wireless/mwifiex/sta_tx.c
drivers/net/wireless/mwifiex/txrx.c
drivers/net/wireless/mwifiex/util.c
drivers/net/wireless/mwifiex/wmm.c

index 079e5532e686c0c9f4256fc5b4207316b0248f1c..ea6832dc6677d7e689b8ac1bd6b620f7be2706b5 100644 (file)
@@ -182,7 +182,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
        skb_reserve(skb_aggr, headroom + sizeof(struct txpd));
        tx_info_aggr =  MWIFIEX_SKB_TXCB(skb_aggr);
 
-       tx_info_aggr->bss_index = tx_info_src->bss_index;
+       tx_info_aggr->bss_type = tx_info_src->bss_type;
+       tx_info_aggr->bss_num = tx_info_src->bss_num;
        skb_aggr->priority = skb_src->priority;
 
        do {
index c3b6c4652cd6cd87d6a5fd8e22506013bcfe1e92..36f67da8fa4f685df1f702fc8a07b79ab1981abd 100644 (file)
@@ -1217,7 +1217,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
                priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II;
                priv->bss_priority = 0;
                priv->bss_role = MWIFIEX_BSS_ROLE_STA;
-               priv->bss_index = 0;
                priv->bss_num = 0;
 
                break;
index 6e0a3eaecf7070bcdcce90eb91e63d7fe6cc6aab..6623db69e1571693df899ccd6e26d03c8b92620b 100644 (file)
@@ -391,7 +391,8 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
 
        if (skb) {
                rx_info = MWIFIEX_SKB_RXCB(skb);
-               rx_info->bss_index = priv->bss_index;
+               rx_info->bss_num = priv->bss_num;
+               rx_info->bss_type = priv->bss_type;
        }
 
        if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) {
index ae17ce02a3d0f074d24924a39f54a8a59748f30f..3735c775495c24d4d0b6ef01e0be55426f71a3b9 100644 (file)
@@ -102,7 +102,8 @@ struct mwifiex_wait_queue {
 };
 
 struct mwifiex_rxinfo {
-       u8 bss_index;
+       u8 bss_num;
+       u8 bss_type;
        struct sk_buff *parent;
        u8 use_count;
 };
@@ -110,7 +111,8 @@ struct mwifiex_rxinfo {
 struct mwifiex_txinfo {
        u32 status_code;
        u8 flags;
-       u8 bss_index;
+       u8 bss_num;
+       u8 bss_type;
 };
 
 enum mwifiex_wmm_ac_e {
index e05b417a3fae8b54d5e632f477dc5885c8a2697f..e13b6d99171ab9e76a64b44abec39a4b85e90b7f 100644 (file)
@@ -526,8 +526,9 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv)
                cur = &adapter->bss_prio_tbl[i].bss_prio_cur;
                lock = &adapter->bss_prio_tbl[i].bss_prio_lock;
                dev_dbg(adapter->dev, "info: delete BSS priority table,"
-                               " index = %d, i = %d, head = %p, cur = %p\n",
-                             priv->bss_index, i, head, *cur);
+                               " bss_type = %d, bss_num = %d, i = %d,"
+                               " head = %p, cur = %p\n",
+                             priv->bss_type, priv->bss_num, i, head, *cur);
                if (*cur) {
                        spin_lock_irqsave(lock, flags);
                        if (list_empty(head)) {
index 84be196188ccc75bfbaf97f1e7bd8c4ab2fd654b..1a0775d19ade94ca66b9010437d6186f32224feb 100644 (file)
@@ -424,8 +424,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct sk_buff *new_skb;
        struct mwifiex_txinfo *tx_info;
 
-       dev_dbg(priv->adapter->dev, "data: %lu BSS(%d): Data <= kernel\n",
-                               jiffies, priv->bss_index);
+       dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n",
+                               jiffies, priv->bss_type, priv->bss_num);
 
        if (priv->adapter->surprise_removed) {
                kfree_skb(skb);
@@ -458,7 +458,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
        }
 
        tx_info = MWIFIEX_SKB_TXCB(skb);
-       tx_info->bss_index = priv->bss_index;
+       tx_info->bss_num = priv->bss_num;
+       tx_info->bss_type = priv->bss_type;
        mwifiex_fill_buffer(skb);
 
        mwifiex_wmm_add_buf_txqueue(priv->adapter, skb);
@@ -531,8 +532,8 @@ mwifiex_tx_timeout(struct net_device *dev)
 {
        struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
 
-       dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n",
-                               jiffies, priv->bss_index);
+       dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_type-num = %d-%d\n",
+                               jiffies, priv->bss_type, priv->bss_num);
        mwifiex_set_trans_start(dev);
        priv->num_tx_timeout++;
 }
@@ -604,18 +605,6 @@ int is_command_pending(struct mwifiex_adapter *adapter)
        return !is_cmd_pend_q_empty;
 }
 
-/*
- * This function returns the correct private structure pointer based
- * upon the BSS number.
- */
-struct mwifiex_private *
-mwifiex_bss_index_to_priv(struct mwifiex_adapter *adapter, u8 bss_index)
-{
-       if (!adapter || (bss_index >= adapter->priv_num))
-               return NULL;
-       return adapter->priv[bss_index];
-}
-
 /*
  * This is the main work queue function.
  *
index 3186aa437f421272f929ebdfb8872312c768782f..6712ea89ef781a184239f1ee65dc6be8214ea21c 100644 (file)
@@ -352,7 +352,6 @@ struct mwifiex_private;
 
 struct mwifiex_private {
        struct mwifiex_adapter *adapter;
-       u8 bss_index;
        u8 bss_type;
        u8 bss_role;
        u8 bss_priority;
@@ -884,8 +883,6 @@ mwifiex_netdev_get_priv(struct net_device *dev)
        return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(dev));
 }
 
-struct mwifiex_private *mwifiex_bss_index_to_priv(struct mwifiex_adapter
-                                               *adapter, u8 bss_index);
 int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
                             u32 func_init_shutdown);
 int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
index 5e1ef7e5da4f3f5b2679c47d012588e642be093f..d7a5d7616f227cfa14f181062c625c2b2ed15381 100644 (file)
@@ -43,7 +43,8 @@ int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
 {
        int ret;
        struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb);
-       struct mwifiex_private *priv = adapter->priv[rx_info->bss_index];
+       struct mwifiex_private *priv = mwifiex_get_priv_by_id(adapter,
+                       rx_info->bss_num, rx_info->bss_type);
        struct rx_packet_hdr *rx_pkt_hdr;
        struct rxpd *local_rx_pd;
        int hdr_chop;
@@ -124,7 +125,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
        struct rx_packet_hdr *rx_pkt_hdr;
        u8 ta[ETH_ALEN];
        u16 rx_pkt_type;
-       struct mwifiex_private *priv = adapter->priv[rx_info->bss_index];
+       struct mwifiex_private *priv = mwifiex_get_priv_by_id(adapter,
+                       rx_info->bss_num, rx_info->bss_type);
 
        if (!priv)
                return -1;
index d97facd70e88b48c45c6f0602f7bfb259d0c1a7c..94d31a94620a75cc4e1ead5384b4ed87ae7d567c 100644 (file)
@@ -136,7 +136,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
                return -1;
 
        tx_info = MWIFIEX_SKB_TXCB(skb);
-       tx_info->bss_index = priv->bss_index;
+       tx_info->bss_num = priv->bss_num;
+       tx_info->bss_type = priv->bss_type;
        skb_reserve(skb, sizeof(struct txpd) + INTF_HEADER_LEN);
        skb_push(skb, sizeof(struct txpd));
 
index d9274a1b77acabce253e6400af854d71c29b814b..9a6eacc9d6f9fee4b1f1374a2e006cf532523b15 100644 (file)
@@ -48,7 +48,8 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
        if (!priv)
                priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
 
-       rx_info->bss_index = priv->bss_index;
+       rx_info->bss_num = priv->bss_num;
+       rx_info->bss_type = priv->bss_type;
 
        return mwifiex_process_sta_rx_packet(adapter, skb);
 }
@@ -130,7 +131,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
                return 0;
 
        tx_info = MWIFIEX_SKB_TXCB(skb);
-       priv = mwifiex_bss_index_to_priv(adapter, tx_info->bss_index);
+       priv = mwifiex_get_priv_by_id(adapter, tx_info->bss_num,
+                       tx_info->bss_type);
        if (!priv)
                goto done;
 
index 06976f517f6603998a43e419988aa50b79378d48..9c48f37069f70b17096c75c2382e49aecc8f40e0 100644 (file)
@@ -159,7 +159,8 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
                return -1;
 
        rx_info = MWIFIEX_SKB_RXCB(skb);
-       priv = mwifiex_bss_index_to_priv(adapter, rx_info->bss_index);
+       priv = mwifiex_get_priv_by_id(adapter, rx_info->bss_num,
+                       rx_info->bss_type);
        if (!priv)
                return -1;
 
index 6c239c3c8249c31395d337213b5a1c0e3176e4ab..e6a2cb127d2bc946781c13af0dbda44585a679d6 100644 (file)
@@ -603,7 +603,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter,
                            struct sk_buff *skb)
 {
        struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(skb);
-       struct mwifiex_private *priv = adapter->priv[tx_info->bss_index];
+       struct mwifiex_private *priv = mwifiex_get_priv_by_id(adapter,
+                       tx_info->bss_num, tx_info->bss_type);
        u32 tid;
        struct mwifiex_ra_list_tbl *ra_list;
        u8 ra[ETH_ALEN], tid_down;