[PATCH 3/4] Use correct sta_index and dpu_desc_index
Eugene Krasnikov
k.eugene.e at gmail.com
Mon May 27 07:39:51 EDT 2013
When transmitting frames set correct sta_index and
dpu_desc_index that were returned from config_bss_rsp
Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
dxe.c | 2 +-
main.c | 7 +++++--
smd.c | 38 ++++++++++++++++++++++++++++++++++----
txrx.c | 5 +++--
txrx.h | 2 +-
wcn36xx.h | 6 ++++--
6 files changed, 48 insertions(+), 12 deletions(-)
diff --git a/dxe.c b/dxe.c
index d972a56..a5eba6c 100644
--- a/dxe.c
+++ b/dxe.c
@@ -445,7 +445,7 @@ int wcn36xx_dxe_tx(struct wcn36xx *wcn, struct sk_buff *skb, u8 broadcast, bool
}
wcn36xx_prepare_tx_bd(mem_pool->virt_addr, skb->len);
- wcn36xx_fill_tx_bd(mem_pool->virt_addr, broadcast);
+ wcn36xx_fill_tx_bd(wcn, mem_pool->virt_addr, broadcast);
cur_dxe_ctl = cur_ch->head_blk_ctl;
cur_dxe_desc = cur_dxe_ctl->desc;
diff --git a/main.c b/main.c
index c9f452d..7db3a8e 100644
--- a/main.c
+++ b/main.c
@@ -223,6 +223,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
struct wcn36xx *wcn = hw->priv;
struct sk_buff *skb = NULL;
u16 tim_off, tim_len;
+ wcn->current_vif = (struct wcn36xx_vif *)vif->drv_priv;
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac bss info changed vif %p changed 0x%08x",
vif, changed);
@@ -325,9 +326,10 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
wcn36xx_dbg(WCN36XX_DBG_MAC, "mac add interface vif %p type %d",
vif, vif->type);
-
+ wcn->current_vif = (struct wcn36xx_vif *)vif->drv_priv;
switch (vif->type) {
case NL80211_IFTYPE_STATION:
+
wcn36xx_smd_add_sta_self(wcn, vif->addr, 0);
break;
case NL80211_IFTYPE_AP:
@@ -545,7 +547,7 @@ static int wcn36xx_init_ieee80211(struct wcn36xx *wcn)
SET_IEEE80211_DEV(wcn->hw, wcn->dev);
wcn->hw->sta_data_size = sizeof(struct wcn_sta);
- wcn->hw->vif_data_size = sizeof(struct wcn_vif);
+ wcn->hw->vif_data_size = sizeof(struct wcn36xx_vif);
return ret;
@@ -661,6 +663,7 @@ static int __init wcn36xx_init(void)
wcn->supported_rates.supported_mcs_set[0] = 0xFF;
wcn->aid = 0;
+ wcn->current_vif = NULL;
wcn->hw->wiphy->n_addresses = ARRAY_SIZE(wcn->addresses);
wcn->hw->wiphy->addresses = wcn->addresses;
diff --git a/smd.c b/smd.c
index 76085a9..7a2129d 100644
--- a/smd.c
+++ b/smd.c
@@ -329,6 +329,31 @@ int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, u8 *addr, u32 status)
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
+static int wcn36xx_smd_add_sta_self_rsp(struct wcn36xx *wcn,
+ void *buf,
+ size_t len)
+{
+ struct wcn36xx_hal_add_sta_self_rsp_msg *rsp;
+
+ if (len < sizeof(*rsp))
+ return -EINVAL;
+
+ rsp = (struct wcn36xx_hal_add_sta_self_rsp_msg *)buf;
+
+ if (rsp->status != WCN36XX_FW_MSG_RESULT_SUCCESS) {
+ wcn36xx_warn("hal add sta self failure: %d",
+ rsp->status);
+ return -EIO;
+ }
+
+ wcn36xx_dbg(WCN36XX_DBG_HAL, "hal add sta self status %d "
+ "self_sta_index %d dpu_index %d",
+ rsp->status, rsp->self_sta_index, rsp->dpu_index);
+ wcn->current_vif->sta_index = rsp->self_sta_index;
+ wcn->current_vif->dpu_desc_index = rsp->dpu_index;
+
+ return 0;
+}
int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, u8 *addr)
{
struct wcn36xx_hal_del_sta_self_req_msg msg_body;
@@ -765,10 +790,14 @@ static int wcn36xx_smd_config_bss_rsp(struct wcn36xx *wcn, void *buf, size_t len
}
wcn36xx_dbg(WCN36XX_DBG_HAL,
- "hal config bss rsp status %d bss_idx %d sta_idx %d self_idx %d bcast_idx %d mac %pM power %d",
- params->status, params->bss_index, params->bss_sta_index,
- params->bss_self_sta_index, params->bss_bcast_sta_idx,
- params->mac, params->tx_mgmt_power);
+ "hal config bss rsp status %d bss_idx %d dpu_desc_index %d"
+ "sta_idx %d self_idx %d bcast_idx %d mac %pM power %d",
+ params->status, params->bss_index, params->dpu_desc_index,
+ params->bss_sta_index, params->bss_self_sta_index,
+ params->bss_bcast_sta_idx, params->mac,
+ params->tx_mgmt_power);
+ wcn->current_vif->sta_index = params->bss_sta_index;
+ wcn->current_vif->dpu_desc_index = params->dpu_desc_index;
return 0;
}
@@ -886,6 +915,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
break;
case WCN36XX_HAL_STOP_RSP:
case WCN36XX_HAL_ADD_STA_SELF_RSP:
+ wcn36xx_smd_add_sta_self_rsp(wcn, buf, len);
case WCN36XX_HAL_DEL_STA_SELF_RSP:
case WCN36XX_HAL_DELETE_STA_RSP:
case WCN36XX_HAL_INIT_SCAN_RSP:
diff --git a/txrx.c b/txrx.c
index c469e68..0ff50e9 100644
--- a/txrx.c
+++ b/txrx.c
@@ -66,7 +66,7 @@ void wcn36xx_prepare_tx_bd(void * pBd, u32 len)
bd->pdu.mpdu_header_off;
bd->pdu.mpdu_len = len;
}
-void wcn36xx_fill_tx_bd(void * pBd, u8 broadcast)
+void wcn36xx_fill_tx_bd(struct wcn36xx *wcn, void *pBd, u8 broadcast)
{
struct wcn36xx_tx_bd * bd = (struct wcn36xx_tx_bd *)pBd;
bd->dpu_rf = WCN36XX_BMU_WQ_TX;
@@ -90,7 +90,8 @@ void wcn36xx_fill_tx_bd(void * pBd, u8 broadcast)
bd->ack_policy = 0;
}
- bd->sta_index = 1;
+ bd->sta_index = wcn->current_vif->sta_index;
+ bd->dpu_desc_idx = wcn->current_vif->dpu_desc_index;
// no encription
bd->dpu_ne = 1;
diff --git a/txrx.h b/txrx.h
index d7b59e2..f7838c4 100644
--- a/txrx.h
+++ b/txrx.h
@@ -144,5 +144,5 @@ struct wcn36xx_tx_bd {
};
int wcn36xx_rx_skb(struct wcn36xx *wcn, struct sk_buff *skb);
void wcn36xx_prepare_tx_bd(void * pBd, u32 len);
-void wcn36xx_fill_tx_bd(void * pBd, u8 broadcast);
+void wcn36xx_fill_tx_bd(struct wcn36xx *wcn, void *pBd, u8 broadcast);
#endif /* _TXRX_H_ */
diff --git a/wcn36xx.h b/wcn36xx.h
index 4fb26b6..bd81222 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -82,8 +82,9 @@ struct nv_data {
int is_valid;
void *table;
};
-struct wcn_vif {
- u8 vif_id;
+struct wcn36xx_vif {
+ u8 sta_index;
+ u8 dpu_desc_index;
};
struct wcn_sta {
u8 sta_id;
@@ -101,6 +102,7 @@ struct wcn36xx {
struct wcn36xx_hal_mac_ssid ssid;
enum nl80211_iftype iftype;
u16 aid;
+ struct wcn36xx_vif *current_vif;
u8 fw_revision;
u8 fw_version;
u8 fw_minor;
--
1.7.11.3
More information about the wcn36xx
mailing list