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,
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 {
......
......@@ -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;
......
......@@ -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) {
......
......@@ -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 {
......
......@@ -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)) {
......
......@@ -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.
*
......
......@@ -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);
......
......@@ -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;
......
......@@ -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));
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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