Commit 9da9a3b2 authored by Yogesh Ashok Powar's avatar Yogesh Ashok Powar Committed by John W. Linville

mwifiex: use bss_type and bss_num to retrieve priv

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: default avatarYogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: default avatarKiran Divekar <dkiran@marvell.com>
Signed-off-by: default avatarBing Zhao <bzhao@marvell.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent cebcab9e
...@@ -182,7 +182,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, ...@@ -182,7 +182,8 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
skb_reserve(skb_aggr, headroom + sizeof(struct txpd)); skb_reserve(skb_aggr, headroom + sizeof(struct txpd));
tx_info_aggr = MWIFIEX_SKB_TXCB(skb_aggr); 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; skb_aggr->priority = skb_src->priority;
do { do {
......
...@@ -1217,7 +1217,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy, ...@@ -1217,7 +1217,6 @@ struct net_device *mwifiex_add_virtual_intf(struct wiphy *wiphy,
priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II;
priv->bss_priority = 0; priv->bss_priority = 0;
priv->bss_role = MWIFIEX_BSS_ROLE_STA; priv->bss_role = MWIFIEX_BSS_ROLE_STA;
priv->bss_index = 0;
priv->bss_num = 0; priv->bss_num = 0;
break; break;
......
...@@ -391,7 +391,8 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter) ...@@ -391,7 +391,8 @@ int mwifiex_process_event(struct mwifiex_adapter *adapter)
if (skb) { if (skb) {
rx_info = MWIFIEX_SKB_RXCB(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) { if (eventcause != EVENT_PS_SLEEP && eventcause != EVENT_PS_AWAKE) {
......
...@@ -102,7 +102,8 @@ struct mwifiex_wait_queue { ...@@ -102,7 +102,8 @@ struct mwifiex_wait_queue {
}; };
struct mwifiex_rxinfo { struct mwifiex_rxinfo {
u8 bss_index; u8 bss_num;
u8 bss_type;
struct sk_buff *parent; struct sk_buff *parent;
u8 use_count; u8 use_count;
}; };
...@@ -110,7 +111,8 @@ struct mwifiex_rxinfo { ...@@ -110,7 +111,8 @@ struct mwifiex_rxinfo {
struct mwifiex_txinfo { struct mwifiex_txinfo {
u32 status_code; u32 status_code;
u8 flags; u8 flags;
u8 bss_index; u8 bss_num;
u8 bss_type;
}; };
enum mwifiex_wmm_ac_e { enum mwifiex_wmm_ac_e {
......
...@@ -526,8 +526,9 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv) ...@@ -526,8 +526,9 @@ static void mwifiex_delete_bss_prio_tbl(struct mwifiex_private *priv)
cur = &adapter->bss_prio_tbl[i].bss_prio_cur; cur = &adapter->bss_prio_tbl[i].bss_prio_cur;
lock = &adapter->bss_prio_tbl[i].bss_prio_lock; lock = &adapter->bss_prio_tbl[i].bss_prio_lock;
dev_dbg(adapter->dev, "info: delete BSS priority table," dev_dbg(adapter->dev, "info: delete BSS priority table,"
" index = %d, i = %d, head = %p, cur = %p\n", " bss_type = %d, bss_num = %d, i = %d,"
priv->bss_index, i, head, *cur); " head = %p, cur = %p\n",
priv->bss_type, priv->bss_num, i, head, *cur);
if (*cur) { if (*cur) {
spin_lock_irqsave(lock, flags); spin_lock_irqsave(lock, flags);
if (list_empty(head)) { if (list_empty(head)) {
......
...@@ -424,8 +424,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -424,8 +424,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *new_skb; struct sk_buff *new_skb;
struct mwifiex_txinfo *tx_info; struct mwifiex_txinfo *tx_info;
dev_dbg(priv->adapter->dev, "data: %lu BSS(%d): Data <= kernel\n", dev_dbg(priv->adapter->dev, "data: %lu BSS(%d-%d): Data <= kernel\n",
jiffies, priv->bss_index); jiffies, priv->bss_type, priv->bss_num);
if (priv->adapter->surprise_removed) { if (priv->adapter->surprise_removed) {
kfree_skb(skb); kfree_skb(skb);
...@@ -458,7 +458,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -458,7 +458,8 @@ mwifiex_hard_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
tx_info = MWIFIEX_SKB_TXCB(skb); 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_fill_buffer(skb);
mwifiex_wmm_add_buf_txqueue(priv->adapter, skb); mwifiex_wmm_add_buf_txqueue(priv->adapter, skb);
...@@ -531,8 +532,8 @@ mwifiex_tx_timeout(struct net_device *dev) ...@@ -531,8 +532,8 @@ mwifiex_tx_timeout(struct net_device *dev)
{ {
struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_index=%d\n", dev_err(priv->adapter->dev, "%lu : Tx timeout, bss_type-num = %d-%d\n",
jiffies, priv->bss_index); jiffies, priv->bss_type, priv->bss_num);
mwifiex_set_trans_start(dev); mwifiex_set_trans_start(dev);
priv->num_tx_timeout++; priv->num_tx_timeout++;
} }
...@@ -604,18 +605,6 @@ int is_command_pending(struct mwifiex_adapter *adapter) ...@@ -604,18 +605,6 @@ int is_command_pending(struct mwifiex_adapter *adapter)
return !is_cmd_pend_q_empty; 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. * This is the main work queue function.
* *
......
...@@ -352,7 +352,6 @@ struct mwifiex_private; ...@@ -352,7 +352,6 @@ struct mwifiex_private;
struct mwifiex_private { struct mwifiex_private {
struct mwifiex_adapter *adapter; struct mwifiex_adapter *adapter;
u8 bss_index;
u8 bss_type; u8 bss_type;
u8 bss_role; u8 bss_role;
u8 bss_priority; u8 bss_priority;
...@@ -884,8 +883,6 @@ mwifiex_netdev_get_priv(struct net_device *dev) ...@@ -884,8 +883,6 @@ mwifiex_netdev_get_priv(struct net_device *dev)
return (struct mwifiex_private *) (*(unsigned long *) netdev_priv(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, int mwifiex_init_shutdown_fw(struct mwifiex_private *priv,
u32 func_init_shutdown); u32 func_init_shutdown);
int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8); int mwifiex_add_card(void *, struct semaphore *, struct mwifiex_if_ops *, u8);
......
...@@ -43,7 +43,8 @@ int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter, ...@@ -43,7 +43,8 @@ int mwifiex_process_rx_packet(struct mwifiex_adapter *adapter,
{ {
int ret; int ret;
struct mwifiex_rxinfo *rx_info = MWIFIEX_SKB_RXCB(skb); 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 rx_packet_hdr *rx_pkt_hdr;
struct rxpd *local_rx_pd; struct rxpd *local_rx_pd;
int hdr_chop; int hdr_chop;
...@@ -124,7 +125,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter, ...@@ -124,7 +125,8 @@ int mwifiex_process_sta_rx_packet(struct mwifiex_adapter *adapter,
struct rx_packet_hdr *rx_pkt_hdr; struct rx_packet_hdr *rx_pkt_hdr;
u8 ta[ETH_ALEN]; u8 ta[ETH_ALEN];
u16 rx_pkt_type; 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) if (!priv)
return -1; return -1;
......
...@@ -136,7 +136,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags) ...@@ -136,7 +136,8 @@ int mwifiex_send_null_packet(struct mwifiex_private *priv, u8 flags)
return -1; return -1;
tx_info = MWIFIEX_SKB_TXCB(skb); 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_reserve(skb, sizeof(struct txpd) + INTF_HEADER_LEN);
skb_push(skb, sizeof(struct txpd)); skb_push(skb, sizeof(struct txpd));
......
...@@ -48,7 +48,8 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, ...@@ -48,7 +48,8 @@ int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter,
if (!priv) if (!priv)
priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY); 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); return mwifiex_process_sta_rx_packet(adapter, skb);
} }
...@@ -130,7 +131,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter, ...@@ -130,7 +131,8 @@ int mwifiex_write_data_complete(struct mwifiex_adapter *adapter,
return 0; return 0;
tx_info = MWIFIEX_SKB_TXCB(skb); 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) if (!priv)
goto done; goto done;
......
...@@ -159,7 +159,8 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb) ...@@ -159,7 +159,8 @@ int mwifiex_recv_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb)
return -1; return -1;
rx_info = MWIFIEX_SKB_RXCB(skb); 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) if (!priv)
return -1; return -1;
......
...@@ -603,7 +603,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter, ...@@ -603,7 +603,8 @@ mwifiex_wmm_add_buf_txqueue(struct mwifiex_adapter *adapter,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct mwifiex_txinfo *tx_info = MWIFIEX_SKB_TXCB(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; u32 tid;
struct mwifiex_ra_list_tbl *ra_list; struct mwifiex_ra_list_tbl *ra_list;
u8 ra[ETH_ALEN], tid_down; u8 ra[ETH_ALEN], tid_down;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment