[PATCH 3/4] Implement set_rts_threshold

Eugene Krasnikov k.eugene.e at gmail.com
Thu Aug 8 10:23:38 EDT 2013


In supplicant conf file set flag rts_threshold=2346

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

diff --git a/hal.h b/hal.h
index bcd09a9..eb4e1a5 100644
--- a/hal.h
+++ b/hal.h
@@ -881,7 +881,7 @@ struct wcn36xx_hal_update_cfg_req_msg {
 	 * |   CFG_ID   |   CFG_LEN   |   CFG_BODY    |  CFG_ID  |......|
 	 */
 
-};
+} __packed;
 
 struct wcn36xx_hal_update_cfg_rsp_msg {
 	struct wcn36xx_hal_msg_header header;
@@ -889,7 +889,7 @@ struct wcn36xx_hal_update_cfg_rsp_msg {
 	/* success or failure */
 	u32 status;
 
-};
+} __packed;
 
 /* Frame control field format (2 bytes) */
 struct wcn36xx_hal_mac_frame_ctl {
diff --git a/main.c b/main.c
index a000369..62b229e 100644
--- a/main.c
+++ b/main.c
@@ -640,6 +640,10 @@ out:
 /* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
 static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
 {
+	struct wcn36xx *wcn = hw->priv;
+	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d", value);
+
+	wcn36xx_smd_update_cfg(wcn, WCN36XX_HAL_CFG_RTS_THRESHOLD, value);
 	return 0;
 }
 
diff --git a/smd.c b/smd.c
index a2769c4..114566f 100644
--- a/smd.c
+++ b/smd.c
@@ -20,6 +20,30 @@
 #include <linux/bitops.h>
 #include "smd.h"
 
+static int put_cfg_tlv_u32(struct wcn36xx *wcn, size_t *len, u32 id, u32 value)
+{
+	struct wcn36xx_hal_cfg *entry;
+	u32 *val;
+
+	if (*len + sizeof(*entry) + sizeof(u32) >= WCN36XX_SMD_BUF_SIZE) {
+		wcn36xx_error("Not enough room for TLV entry");
+		return -ENOMEM;
+	}
+
+	entry = (struct wcn36xx_hal_cfg *) (wcn->smd_buf + *len);
+	entry->id = id;
+	entry->len = sizeof(u32);
+	entry->pad_bytes = 0;
+	entry->reserve = 0;
+
+	val = (u32 *) (entry + 1);
+	*val = value;
+
+	*len += sizeof(*entry) + sizeof(u32);
+
+	return 0;
+}
+
 static void wcn36xx_smd_set_bss_nw_type(struct wcn36xx *wcn,
 		struct ieee80211_sta *sta,
 		struct wcn36xx_hal_config_bss_params *bss_params)
@@ -1405,6 +1429,24 @@ static int wcn36xx_smd_delete_sta_context_ind(struct wcn36xx *wcn,
 	return 0;
 }
 
+int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value)
+{
+	struct wcn36xx_hal_update_cfg_req_msg msg_body, *body;
+	size_t len;
+
+	INIT_HAL_MSG(msg_body, WCN36XX_HAL_UPDATE_CFG_REQ);
+
+	PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
+
+	body = (struct wcn36xx_hal_update_cfg_req_msg *) wcn->smd_buf;
+	len = msg_body.header.len;
+
+	put_cfg_tlv_u32(wcn, &len, cfg_id, value);
+	body->header.len = len;
+	body->len = len - sizeof(*body);
+
+	return wcn36xx_smd_send_and_wait(wcn, len);
+}
 static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
 {
 	struct wcn36xx_hal_msg_header *msg_header = buf;
@@ -1448,6 +1490,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
 	case WCN36XX_HAL_ADD_BA_RSP:
 	case WCN36XX_HAL_DEL_BA_RSP:
 	case WCN36XX_HAL_TRIGGER_BA_RSP:
+	case WCN36XX_HAL_UPDATE_CFG_RSP:
 		if (wcn36xx_smd_rsp_status_check(buf, len)) {
 			wcn36xx_warn("error response from hal request %d",
 				     msg_header->msg_type);
diff --git a/smd.h b/smd.h
index c7430ea..c505b37 100644
--- a/smd.h
+++ b/smd.h
@@ -109,6 +109,8 @@ int wcn36xx_smd_add_ba_session(struct wcn36xx *wcn,
 int wcn36xx_smd_add_ba(struct wcn36xx *wcn);
 int wcn36xx_smd_del_ba(struct wcn36xx *wcn, u16 tid, u8 sta_index);
 int wcn36xx_smd_trigger_ba(struct wcn36xx *wcn, u8 sta_index);
+
+int wcn36xx_smd_update_cfg(struct wcn36xx *wcn, u32 cfg_id, u32 value);
 /* WCN36XX configuration parameters */
 struct wcn36xx_fw_cfg {
 	u16		id;
-- 
1.8.2.2




More information about the wcn36xx mailing list