wcn36xx: Add support for Factory Test Mode (FTM)
Subsystems (4)
PATCH v3 1/1 wcn36xx: Add support for Factory Test Mode (FTM)
From: Eyal Ilsar <[email protected]>
Introduce infrastructure for supporting Factory Test Mode (FTM) of the wireless LAN subsystem. In order for the user space to access the firmware in test mode the relevant netlink channel needs to be exposed from the kernel driver.
The above is achieved as follows:
1) Register wcn36xx driver to testmode callback from netlink
2) Add testmode callback implementation to handle incoming FTM commands
3) Add FTM command packet structure
4) Add handling for GET_BUILD_RELEASE_NUMBER (msgid=0x32A2)
5) Add generic handling for all PTT_MSG packets
---
v3:
* fixed kbuild warning
v2:
* check for NULL after kmalloc
* don't assign value to ret.
drivers/net/wireless/ath/wcn36xx/Makefile | 2 + drivers/net/wireless/ath/wcn36xx/hal.h | 16 ++ drivers/net/wireless/ath/wcn36xx/main.c | 3 + drivers/net/wireless/ath/wcn36xx/smd.c | 81 ++++++++++ drivers/net/wireless/ath/wcn36xx/smd.h | 4 + drivers/net/wireless/ath/wcn36xx/testmode.c | 149 ++++++++++++++++++ drivers/net/wireless/ath/wcn36xx/testmode.h | 46 ++++++ drivers/net/wireless/ath/wcn36xx/testmode_i.h | 29 ++++ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 + 9 files changed, 332 insertions(+) create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.c create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode.h create mode 100644 drivers/net/wireless/ath/wcn36xx/testmode_i.h
drivers/net/wireless/ath/wcn36xx/Makefile +2 -0
@@ -6,3 +6,5 @@ wcn36xx-y += main.o \ smd.o \ pmc.o \ debug.o + +wcn36xx-$(CONFIG_NL80211_TESTMODE) += testmode.o
drivers/net/wireless/ath/wcn36xx/hal.h +16 -0
@@ -2230,6 +2230,22 @@ struct wcn36xx_hal_switch_channel_rsp_msg { } __packed; +struct wcn36xx_hal_process_ptt_msg_req_msg { +struct wcn36xx_hal_msg_header header; + +/* Actual FTM Command body */ +u8 ptt_msg[0 ]; +} __packed; + +struct wcn36xx_hal_process_ptt_msg_rsp_msg { +struct wcn36xx_hal_msg_header header; + +/* FTM Command response status */ +u32 ptt_msg_resp_status; +/* Actual FTM Command body */ +u8 ptt_msg[0 ]; +} __packed; +struct update_edca_params_req_msg {struct wcn36xx_hal_msg_header header;
drivers/net/wireless/ath/wcn36xx/main.c +3 -0
@@ -26,6 +26,7 @@#include <linux/soc/qcom/smem_state.h> #include <linux/soc/qcom/wcnss_ctrl.h> #include "wcn36xx.h" +#include "testmode.h" unsigned int wcn36xx_dbg_mask;module_param_named (debug_mask, wcn36xx_dbg_mask, uint,0644 );
@@ -1116,6 +1117,8 @@ static const struct ieee80211_ops wcn36xx_ops = { .sta_add = wcn36xx_sta_add, .sta_remove = wcn36xx_sta_remove, .ampdu_action = wcn36xx_ampdu_action, + +CFG80211_TESTMODE_CMD (wcn36xx_tm_cmd) };static int wcn36xx_init_ieee80211 (struct wcn36xx *wcn)
drivers/net/wireless/ath/wcn36xx/smd.c +81 -0
111 lines not on this page · raw message
drivers/net/wireless/ath/wcn36xx/smd.h +4 -0
@@ -86,6 +86,10 @@ int wcn36xx_smd_send_beacon(struct wcn36xx *wcn, struct ieee80211_vif *vif, u16 p2p_off);int wcn36xx_smd_switch_channel (struct wcn36xx *wcn,struct ieee80211_vif *vif,int ch); +int wcn36xx_smd_process_ptt_msg (struct wcn36xx *wcn, +struct ieee80211_vif *vif, +void *ptt_msg,size_t len, +void **ptt_rsp_msg);int wcn36xx_smd_update_proberesp_tmpl (struct wcn36xx *wcn,struct ieee80211_vif *vif,struct sk_buff *skb);
drivers/net/wireless/ath/wcn36xx/testmode.c new file +149 -0
149 lines not on this page · raw message
drivers/net/wireless/ath/wcn36xx/testmode.h new file +46 -0
46 lines not on this page · raw message
drivers/net/wireless/ath/wcn36xx/testmode_i.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* Copyright (c) 2018, The Linux Foundation. All rights reserved. +* +* Permission to use, copy, modify, and/or distribute this software for any +* purpose with or without fee is hereby granted, provided that the above +* copyright notice and this permission notice appear in all copies. +* +* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +#define WCN36XX_TM_DATA_MAX_LEN 5000 + +enum wcn36xx_tm_attr { + __WCN36XX_TM_ATTR_INVALID =0 , +WCN36XX_TM_ATTR_CMD =1 , +WCN36XX_TM_ATTR_DATA =2 , + +/* keep last */ + __WCN36XX_TM_ATTR_AFTER_LAST, +WCN36XX_TM_ATTR_MAX = __WCN36XX_TM_ATTR_AFTER_LAST -1 , +}; + +#define WCN36XX_TM_CMD_PTT 3
drivers/net/wireless/ath/wcn36xx/wcn36xx.h +2 -0
@@ -56,6 +56,8 @@ enum wcn36xx_debug_mask {WCN36XX_DBG_BEACON_DUMP =0x00001000 ,WCN36XX_DBG_PMC =0x00002000 ,WCN36XX_DBG_PMC_DUMP =0x00004000 , +WCN36XX_DBG_TESTMODE =0x00008000 , +WCN36XX_DBG_TESTMODE_DUMP =0x00010000 , WCN36XX_DBG_ANY = 0xffffffff, };
Signature · 1 line
2.17.0
Quoted 12 lines · Ramon Fried
Introduce infrastructure for supporting Factory Test Mode (FTM) of the wireless LAN subsystem. In order for the user space to access the firmware in test mode the relevant netlink channel needs to be exposed from the kernel driver.
The above is achieved as follows:
1) Register wcn36xx driver to testmode callback from netlink
2) Add testmode callback implementation to handle incoming FTM commands
3) Add FTM command packet structure
4) Add handling forGET_BUILD_RELEASE_NUMBER(msgid=0x32A2)
5) Add generic handling for allPTT_MSGpackets
Quoted 3 lines
Signed-off-by Eyal Ilsar <[email protected]>Signed-off-by Ramon Fried <[email protected]>Signed-off-by Kalle Valo <[email protected]>
Patch applied to ath-next branch of ath.git, thanks.
87f825e6e246 wcn36xx: Add support for Factory Test Mode (FTM)
Signature · 3 lines
https://patchwork.kernel.org/patch/10419423/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches