[PATCH 2/3] Pass vif instead of iftype

Eugene Krasnikov k.eugene.e at gmail.com
Thu Jul 11 14:04:48 EDT 2013


config_bss/sta will need other properties from vif.
So let's pass vif pointer instead of iftype.

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

diff --git a/main.c b/main.c
index 7f9de6d..3271714 100644
--- a/main.c
+++ b/main.c
@@ -385,7 +385,7 @@ static int wcn36xx_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 			sta_priv->is_data_encrypted = true;
 			/* Reconfigure bss with encrypt_type */
 			wcn36xx_smd_config_bss(wcn,
-					       NL80211_IFTYPE_STATION,
+					       vif,
 					       sta->addr,
 					       true,
 					       wcn->beacon_interval);
@@ -523,7 +523,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 			wcn->is_joining = true;
 			wcn36xx_smd_join(wcn, bss_conf->bssid,
 					 vif->addr, WCN36XX_HW_CHANNEL(wcn));
-			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
+			wcn36xx_smd_config_bss(wcn, vif,
 					       bss_conf->bssid, false,
 					       wcn->beacon_interval);
 		} else {
@@ -564,10 +564,11 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 			wcn36xx_smd_set_link_st(wcn, bss_conf->bssid,
 						vif->addr,
 						WCN36XX_HAL_LINK_POSTASSOC_STATE);
-			wcn36xx_smd_config_bss(wcn, NL80211_IFTYPE_STATION,
+			wcn36xx_smd_config_bss(wcn, vif,
 					       bss_conf->bssid,
 					       true, wcn->beacon_interval);
-			wcn36xx_smd_config_sta(wcn, bss_conf->bssid, vif->addr, vif->type);
+			wcn36xx_smd_config_sta(wcn, vif, bss_conf->bssid,
+					       vif->addr);
 
 		} else {
 			wcn36xx_dbg(WCN36XX_DBG_MAC,
@@ -602,7 +603,7 @@ static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 
 		if (bss_conf->enable_beacon) {
 			wcn->beacon_enable = true;
-			wcn36xx_smd_config_bss(wcn, vif->type,
+			wcn36xx_smd_config_bss(wcn, vif,
 					       wcn->addresses[0].addr, false,
 					       wcn->beacon_interval);
 			skb = ieee80211_beacon_get_tim(hw, vif, &tim_off,
@@ -685,7 +686,7 @@ static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	    vif->type == NL80211_IFTYPE_AP ||
 	    vif->type == NL80211_IFTYPE_MESH_POINT) {
 		wcn->aid = sta->aid;
-		wcn36xx_smd_config_sta(wcn, vif->addr, sta->addr, vif->type);
+		wcn36xx_smd_config_sta(wcn, vif, vif->addr, sta->addr);
 	}
 	return 0;
 }
diff --git a/smd.c b/smd.c
index d3597ca..a87b372 100644
--- a/smd.c
+++ b/smd.c
@@ -489,8 +489,8 @@ static int wcn36xx_smd_config_sta_v1(struct wcn36xx *wcn,
 	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
 }
 
-int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
-			   const u8 *sta_mac, enum nl80211_iftype iftype)
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			   const u8 *bssid, const u8 *sta_mac)
 {
 	struct wcn36xx_hal_config_sta_req_msg msg;
 	struct wcn36xx_hal_config_sta_params *sta;
@@ -503,9 +503,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
 
 	sta->aid = wcn->aid;
 
-	if (iftype == NL80211_IFTYPE_ADHOC ||
-	    iftype == NL80211_IFTYPE_AP ||
-	    iftype == NL80211_IFTYPE_MESH_POINT)
+	if (vif->type == NL80211_IFTYPE_ADHOC ||
+	    vif->type == NL80211_IFTYPE_AP ||
+	    vif->type == NL80211_IFTYPE_MESH_POINT)
 		sta->type = 1;
 	else
 		sta->type = 0;
@@ -538,9 +538,9 @@ int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
 	sta->delayed_ba_support = 0;
 	sta->max_ampdu_duration = 0;
 	sta->dsss_cck_mode_40mhz = 0;
-	if (iftype == NL80211_IFTYPE_ADHOC ||
-	    iftype == NL80211_IFTYPE_AP ||
-	    iftype == NL80211_IFTYPE_MESH_POINT)
+	if (vif->type == NL80211_IFTYPE_ADHOC ||
+	    vif->type == NL80211_IFTYPE_AP ||
+	    vif->type == NL80211_IFTYPE_MESH_POINT)
 		sta->sta_index = 0xFF;
 	else
 		sta->sta_index = 1;
@@ -703,9 +703,8 @@ static int wcn36xx_smd_config_bss_v1(struct wcn36xx *wcn,
 	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
 }
 
-int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
-			   const u8 *bssid, bool update,
-			   u16 beacon_interval)
+int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			   const u8 *bssid, bool update, u16 beacon_interval)
 {
 	struct wcn36xx_hal_config_bss_req_msg msg;
 	struct wcn36xx_hal_config_bss_params *bss;
@@ -722,25 +721,25 @@ int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
 
 	memcpy(&bss->self_mac_addr, &wcn->addresses[0], ETH_ALEN);
 
-	if (type == NL80211_IFTYPE_STATION) {
+	if (vif->type == NL80211_IFTYPE_STATION) {
 		bss->bss_type = WCN36XX_HAL_INFRASTRUCTURE_MODE;
 
 		/* STA */
 		bss->oper_mode = 1;
 
-	} else if (type == NL80211_IFTYPE_AP) {
+	} else if (vif->type == NL80211_IFTYPE_AP) {
 		bss->bss_type = WCN36XX_HAL_INFRA_AP_MODE;
 
 		/* AP */
 		bss->oper_mode = 0;
-	} else if (type == NL80211_IFTYPE_ADHOC ||
-		   type == NL80211_IFTYPE_MESH_POINT) {
+	} else if (vif->type == NL80211_IFTYPE_ADHOC ||
+		   vif->type == NL80211_IFTYPE_MESH_POINT) {
 		bss->bss_type = WCN36XX_HAL_IBSS_MODE;
 
 		/* STA */
 		bss->oper_mode = 1;
 	} else {
-		wcn36xx_warn("Unknown type for bss config: %d", type);
+		wcn36xx_warn("Unknown type for bss config: %d", vif->type);
 	}
 
 	bss->nw_type = WCN36XX_HAL_11N_NW_TYPE;
diff --git a/smd.h b/smd.h
index f6799e2..e7ee5be 100644
--- a/smd.h
+++ b/smd.h
@@ -62,11 +62,11 @@ int wcn36xx_smd_join(struct wcn36xx *wcn, const u8 *bssid, u8 *vif, u8 ch);
 int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, const u8 *bssid,
 			    const u8 *sta_mac,
 			    enum wcn36xx_hal_link_state state);
-int wcn36xx_smd_config_bss(struct wcn36xx *wcn, enum nl80211_iftype type,
+int wcn36xx_smd_config_bss(struct wcn36xx *wcn, struct ieee80211_vif *vif,
 			   const u8 *bssid, bool update, u16 beacon_interval);
 int wcn36xx_smd_delete_bss(struct wcn36xx *wcn);
-int wcn36xx_smd_config_sta(struct wcn36xx *wcn, const u8 *bssid,
-			   const u8 *sta_mac, enum nl80211_iftype iftype);
+int wcn36xx_smd_config_sta(struct wcn36xx *wcn, struct ieee80211_vif *vif,
+			   const u8 *bssid, const u8 *sta_mac);
 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);
-- 
1.7.11.3




More information about the wcn36xx mailing list