[PATCH] Implement remove_interface and stop functionality

Eugene Krasnikov k.eugene.e at gmail.com
Fri May 17 11:51:02 EDT 2013


Send DEL_STA_SELF on remove_interface and STOP when driver is stopped.

Signed-off-by: Eugene Krasnikov <k.eugene.e at gmail.com>
---
 hal.h  | 16 ++++++++--------
 main.c | 16 ++++++++++------
 smd.c  | 25 +++++++++++++++++++++++++
 smd.h  |  2 ++
 4 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/hal.h b/hal.h
index ec44d4e..75f9bf6 100644
--- a/hal.h
+++ b/hal.h
@@ -734,19 +734,19 @@ struct wcn36xx_hal_mac_stop_req_params {
 	/* The reason for which the device is being stopped */
 	enum wcn36xx_hal_stop_type reason;
 
-};
+} __packed;
 
 struct wcn36xx_hal_mac_stop_req_msg {
 	struct wcn36xx_hal_msg_header header;
-	struct wcn36xx_hal_mac_stop_req_params stopReqParams;
-};
+	struct wcn36xx_hal_mac_stop_req_params stop_req_params;
+} __packed;
 
 struct wcn36xx_hal_mac_stop_rsp_msg {
 	struct wcn36xx_hal_msg_header header;
 
 	/* success or failure */
 	u32 status;
-};
+} __packed;
 
 struct wcn36xx_hal_update_cfg_req_msg {
 	/*
@@ -3593,20 +3593,20 @@ struct wcn36xx_hal_add_sta_self_rsp_msg {
 	u8 dpu_signature;
 } __packed;
 
-struct del_sta_self_req_msg {
+struct wcn36xx_hal_del_sta_self_req_msg {
 	struct wcn36xx_hal_msg_header header;
 
 	u8 self_addr[ETH_ALEN];
-};
+} __packed;
 
-struct del_sta_self_rsp_msg {
+struct wcn36xx_hal_del_sta_self_rsp_msg {
 	struct wcn36xx_hal_msg_header header;
 
 	/*success or failure */
 	u32 status;
 
 	u8 self_addr[ETH_ALEN];
-};
+} __packed;
 
 struct aggr_add_ts_req {
 	struct wcn36xx_hal_msg_header header;
diff --git a/main.c b/main.c
index 22dcd9a..11ed64a 100644
--- a/main.c
+++ b/main.c
@@ -80,18 +80,13 @@ static void wcn36xx_stop(struct ieee80211_hw *hw)
 
 	ENTER();
 
+	wcn36xx_smd_stop(wcn);
 	wcn36xx_dxe_deinit(wcn);
 	wcn36xx_smd_close(wcn);
 
 	kfree(wcn->smd_buf);
 }
 
-static void wcn36xx_remove_interface(struct ieee80211_hw *hw,
-				   struct ieee80211_vif *vif)
-{
-	ENTER();
-}
-
 static int wcn36xx_change_interface(struct ieee80211_hw *hw,
 				      struct ieee80211_vif *vif,
 				      enum nl80211_iftype new_type, bool p2p)
@@ -294,6 +289,15 @@ static int wcn36xx_add_interface(struct ieee80211_hw *hw,
 	return 0;
 }
 
+
+static void wcn36xx_remove_interface(struct ieee80211_hw *hw,
+				   struct ieee80211_vif *vif)
+{
+	struct wcn36xx *wcn = hw->priv;
+	ENTER();
+	wcn36xx_smd_delete_sta_self(wcn, wcn->addresses[0]);
+}
+
 static int wcn36xx_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		       struct ieee80211_sta *sta)
 {
diff --git a/smd.c b/smd.c
index 6d1566a..59fcad0 100644
--- a/smd.c
+++ b/smd.c
@@ -146,7 +146,18 @@ static int wcn36xx_smd_start_rsp(void *buf, size_t len)
 		rsp->start_rsp_params.wlan_version, rsp->start_rsp_params.crm_version);
 	return 0;
 }
+int wcn36xx_smd_stop(struct wcn36xx *wcn)
+{
+	struct wcn36xx_hal_mac_stop_req_msg msg_body;
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_STOP_REQ)
+
+	msg_body.stop_req_params.reason = HAL_STOP_TYPE_RF_KILL;
+
+	PREPARE_HAL_BUF(wcn->smd_buf, msg_body)
 
+	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
 int wcn36xx_smd_init_scan(struct wcn36xx *wcn)
 {
 	struct wcn36xx_hal_init_scan_req_msg msg_body;
@@ -238,6 +249,18 @@ int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct mac_address addr, u32 s
 
 	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
 }
+int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, struct mac_address addr)
+{
+	struct wcn36xx_hal_del_sta_self_req_msg msg_body;
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_DEL_STA_SELF_REQ)
+
+	memcpy(&msg_body.self_addr, &addr, ETH_ALEN);
+
+	PREPARE_HAL_BUF(wcn->smd_buf, msg_body)
+
+	return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn)
 {
 	struct wcn36xx_hal_delete_sta_req_msg msg_body;
@@ -464,7 +487,9 @@ static void wcn36xx_smd_rsp_process (void *buf, size_t len)
 	case WCN36XX_HAL_START_RSP:
 		wcn36xx_smd_start_rsp(buf, len);
 		break;
+	case WCN36XX_HAL_STOP_RSP:
 	case WCN36XX_HAL_ADD_STA_SELF_RSP:
+	case WCN36XX_HAL_DEL_STA_SELF_RSP:
 	case WCN36XX_HAL_DELETE_STA_RSP:
 	case WCN36XX_HAL_INIT_SCAN_RSP:
 	case WCN36XX_HAL_START_SCAN_RSP:
diff --git a/smd.h b/smd.h
index ad5af54..150a043 100644
--- a/smd.h
+++ b/smd.h
@@ -49,12 +49,14 @@ void wcn36xx_smd_close(struct wcn36xx *wcn);
 
 int wcn36xx_smd_load_nv(struct wcn36xx *wcn);
 int wcn36xx_smd_start(struct wcn36xx *wcn);
+int wcn36xx_smd_stop(struct wcn36xx *wcn);
 int wcn36xx_smd_init_scan(struct wcn36xx *wcn);
 int wcn36xx_smd_start_scan(struct wcn36xx *wcn, int ch);
 int wcn36xx_smd_end_scan(struct wcn36xx *wcn, int ch);
 int wcn36xx_smd_finish_scan(struct wcn36xx *wcn);
 int wcn36xx_smd_update_scan_params(struct wcn36xx *wcn);
 int wcn36xx_smd_add_sta_self(struct wcn36xx *wcn, struct mac_address addr, u32 status);
+int wcn36xx_smd_delete_sta_self(struct wcn36xx *wcn, struct mac_address addr);
 int wcn36xx_smd_delete_sta(struct wcn36xx *wcn);
 int wcn36xx_smd_join(struct wcn36xx *wcn, u8 *bssid, u8 *vif, u8 ch);
 int wcn36xx_smd_set_link_st(struct wcn36xx *wcn, u8 *bssid, u8 *sta_mac, enum wcn36xx_hal_link_state state);
-- 
1.7.11.3




More information about the wcn36xx mailing list