[PATCH 1/2] wcn36xx: do not use addresses from wcn36xx struct

Eugene Krasnikov k.eugene.e at gmail.com
Fri Sep 13 13:16:46 EDT 2013


address from vif must be used instead.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 main.c | 15 +++++++++++----
 smd.c  | 20 ++++++++++++--------
 smd.h  | 12 ++++++++----
 3 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/main.c b/main.c
index b8f9aa7..e028496 100644
--- a/main.c
+++ b/main.c
@@ -274,6 +274,8 @@ static void wcn36xx_stop(struct ieee80211_hw *hw)
 static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 {
 	struct wcn36xx *wcn = hw->priv;
+	struct ieee80211_vif *vif = NULL;
+	struct wcn36xx_vif *tmp;
 
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac config changed 0x%08x\n", changed);
 
@@ -281,7 +283,12 @@ static int wcn36xx_config(struct ieee80211_hw *hw, u32 changed)
 		int ch = WCN36XX_HW_CHANNEL(wcn);
 		wcn36xx_dbg(WCN36XX_DBG_MAC, "wcn36xx_config channel switch=%d\n",
 			    ch);
-		wcn36xx_smd_switch_channel(wcn, ch);
+		list_for_each_entry(tmp, &wcn->vif_list, list) {
+			vif = container_of((void *)tmp,
+					   struct ieee80211_vif,
+					   drv_priv);
+			wcn36xx_smd_switch_channel(wcn, vif, ch);
+		}
 	}
 
 	return 0;
@@ -603,7 +610,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 			goto out;
 		}
 
-		wcn36xx_smd_update_proberesp_tmpl(wcn, skb);
+		wcn36xx_smd_update_proberesp_tmpl(wcn, vif, skb);
 		dev_kfree_skb(skb);
 	}
 
@@ -615,14 +622,14 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 		if (bss_conf->enable_beacon) {
 			vif_priv->bss_index = 0xff;
 			wcn36xx_smd_config_bss(wcn, vif, NULL,
-					       wcn->addresses.addr, false);
+					       vif->addr, false);
 			skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
 						       &tim_len);
 			if (!skb) {
 				wcn36xx_err("failed to alloc beacon skb\n");
 				goto out;
 			}
-			wcn36xx_smd_send_beacon(wcn, skb, tim_off, 0);
+			wcn36xx_smd_send_beacon(wcn, vif, skb, tim_off, 0);
 			dev_kfree_skb(skb);
 
 			if (vif->type == NL80211_IFTYPE_ADHOC ||
diff --git a/smd.c b/smd.c
index 830179f..f63436c 100644
--- a/smd.c
+++ b/smd.c
@@ -522,7 +522,8 @@ static int wcn36xx_smd_switch_channel_rsp(void *buf, size_t len)
 	return ret;
 }
 
-int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, int ch)
+int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
+			       struct ieee80211_vif *vif, int ch)
 {
 	struct wcn36xx_hal_switch_channel_req_msg msg_body;
 	int ret = 0;
@@ -533,7 +534,7 @@ int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, int ch)
 	msg_body.channel_number = (u8)ch;
 	msg_body.tx_mgmt_power = 0xbf;
 	msg_body.max_tx_power = 0xbf;
-	memcpy(msg_body.self_sta_mac_addr, wcn->addresses.addr, ETH_ALEN);
+	memcpy(msg_body.self_sta_mac_addr, vif->addr, ETH_ALEN);
 
 	PREPARE_HAL_BUF(wcn->hal_buf, msg_body);
 
@@ -1118,7 +1119,7 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 
 	memcpy(&bss->bssid, bssid, ETH_ALEN);
 
-	memcpy(&bss->self_mac_addr, &wcn->addresses, ETH_ALEN);
+	memcpy(bss->self_mac_addr, vif->addr, ETH_ALEN);
 
 	if (vif->type == NL80211_IFTYPE_STATION) {
 		bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE;
@@ -1258,8 +1259,9 @@ out:
 	return ret;
 }
 
-int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon,
-			    u16 tim_off, u16 p2p_off)
+int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			    struct sk_buff *skb_beacon, u16 tim_off,
+			    u16 p2p_off)
 {
 	struct wcn36xx_hal_send_beacon_req_msg msg_body;
 	int ret = 0;
@@ -1279,7 +1281,7 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon,
 			      msg_body.beacon_length);
 		return -ENOMEM;
 	}
-	memcpy(&msg_body.bssid, &wcn->addresses, ETH_ALEN);
+	memcpy(msg_body.bssid, vif->addr, ETH_ALEN);
 
 	/* TODO need to find out why this is needed? */
 	msg_body.tim_ie_offset = tim_off+4;
@@ -1305,7 +1307,9 @@ out:
 	return ret;
 }
 
-int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, struct sk_buff *skb)
+int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
+				      struct ieee80211_vif *vif,
+				      struct sk_buff *skb)
 {
 	struct wcn36xx_hal_send_probe_resp_req_msg msg;
 	int ret = 0;
@@ -1322,7 +1326,7 @@ int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, struct sk_buff *skb)
 	msg.probe_resp_template_len = skb->len;
 	memcpy(&msg.probe_resp_template, skb->data, skb->len);
 
-	memcpy(&msg.bssid, &wcn->addresses, ETH_ALEN);
+	memcpy(msg.bssid, vif->addr, ETH_ALEN);
 
 	PREPARE_HAL_BUF(wcn->hal_buf, msg);
 
diff --git a/smd.h b/smd.h
index ef6309c..cd66089 100644
--- a/smd.h
+++ b/smd.h
@@ -76,10 +76,14 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif);
 int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 			   struct ieee80211_sta *sta);
-int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct sk_buff *skb_beacon,
-			    u16 tim_off, u16 p2p_off);
-int wcn36xx_smd_switch_channel(struct wcn36xx *wcn, int ch);
-int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn, struct sk_buff *skb);
+int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			    struct sk_buff *skb_beacon, u16 tim_off,
+			    u16 p2p_off);
+int wcn36xx_smd_switch_channel(struct wcn36xx *wcn,
+			       struct ieee80211_vif *vif, int ch);
+int wcn36xx_smd_update_proberesp_tmpl(struct wcn36xx *wcn,
+				      struct ieee80211_vif *vif,
+				      struct sk_buff *skb);
 int wcn36xx_smd_set_stakey(struct wcn36xx *wcn,
 			   enum ani_ed_type enc_type,
 			   u8 keyidx,
-- 
1.8.2.2




More information about the wcn36xx mailing list