[PATCH v2 4/5] Enable Config the keep alive function
dreamfly281 at gmail.com
dreamfly281 at gmail.com
Mon Jul 8 12:43:27 EDT 2013
From: Yanbo Li <yanbol at qti.qualcomm.com>
Impelmentation the keep alive function which can be used to set the
FW send the NULL packet to AP after associated.
Signed-off-by: Yanbo Li <yanbol at qti.qualcomm.com>
---
debug.c | 1 +
hal.h | 3 ++-
pmc.c | 6 ++++++
pmc.h | 1 +
smd.c | 26 ++++++++++++++++++++++++++
smd.h | 2 +-
wcn36xx.h | 2 ++
7 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/debug.c b/debug.c
index 3e0c5e8..d418ea1 100644
--- a/debug.c
+++ b/debug.c
@@ -64,6 +64,7 @@ static ssize_t write_file_bool_bmps(struct file *file,
case 'y':
case 'Y':
case '1':
+ wcn36xx_enable_keep_alive_null_packet(wcn);
wcn36xx_pmc_enter_bmps_state(wcn, vif->bss_conf.sync_tsf);
break;
case 'n':
diff --git a/hal.h b/hal.h
index de08f86..69b3702 100644
--- a/hal.h
+++ b/hal.h
@@ -3044,6 +3044,7 @@ struct wcn36xx_hal_host_offload_req_msg {
/* Enable or disable keep alive */
#define WCN36XX_HAL_KEEP_ALIVE_DISABLE 0
#define WCN36XX_HAL_KEEP_ALIVE_ENABLE 1
+#define WCN36XX_KEEP_ALIVE_TIME_PERIOD 30 /* unit: s */
/* Keep Alive request. */
struct wcn36xx_hal_keep_alive_req_msg {
@@ -3055,7 +3056,7 @@ struct wcn36xx_hal_keep_alive_req_msg {
u8 dest_ipv4_addr[WCN36XX_HAL_IPV4_ADDR_LEN];
u8 dest_addr[ETH_ALEN];
u8 bss_index;
-};
+} __packed;
struct wcn36xx_hal_rssi_threshold_req_msg {
struct wcn36xx_hal_msg_header header;
diff --git a/pmc.c b/pmc.c
index 8108239..31f4086 100644
--- a/pmc.c
+++ b/pmc.c
@@ -40,3 +40,9 @@ int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn)
wcn->pw_state = WCN36XX_FULL_POWER;
return 0;
}
+
+int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn)
+{
+ wcn36xx_dbg(WCN36XX_DBG_PMC, "%s", __func__);
+ return wcn36xx_smd_keep_alive_req(wcn, WCN36XX_HAL_KEEP_ALIVE_NULL_PKT);
+}
diff --git a/pmc.h b/pmc.h
index 47ff1ea..2fd8b1e 100644
--- a/pmc.h
+++ b/pmc.h
@@ -32,4 +32,5 @@ int wcn36xx_pmc_init(struct wcn36xx *wcn);
int wcn36xx_pmc_enter_bmps_state(struct wcn36xx *wcn, u64 tbtt);
int wcn36xx_pmc_exit_bmps_state(struct wcn36xx *wcn);
int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn);
+int wcn36xx_enable_keep_alive_null_packet(struct wcn36xx *wcn);
#endif /* _WCN36XX_PMC_H_ */
diff --git a/smd.c b/smd.c
index bd65bad..9fa2f0f 100644
--- a/smd.c
+++ b/smd.c
@@ -1067,6 +1067,31 @@ int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn)
return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
}
+/* Notice: This function should be called after associated, or else it
+ * will be invalid
+ */
+int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int packet_type)
+{
+ struct wcn36xx_hal_keep_alive_req_msg msg_body;
+
+ INIT_HAL_MSG(msg_body, WCN36XX_HAL_KEEP_ALIVE_REQ);
+
+ if (packet_type == WCN36XX_HAL_KEEP_ALIVE_NULL_PKT) {
+ msg_body.bss_index = 0;
+ msg_body.packet_type = WCN36XX_HAL_KEEP_ALIVE_NULL_PKT;
+ msg_body.time_period = WCN36XX_KEEP_ALIVE_TIME_PERIOD;
+ } else if (packet_type == WCN36XX_HAL_KEEP_ALIVE_UNSOLICIT_ARP_RSP) {
+ /* TODO: it also support ARP response type */
+ } else {
+ wcn36xx_warn("unknow keep alive packet type %d", packet_type);
+ return -1;
+ }
+
+ PREPARE_HAL_BUF(wcn->smd_buf, msg_body);
+
+ return wcn36xx_smd_send_and_wait(wcn, msg_body.header.len);
+}
+
int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
u32 arg3, u32 arg4, u32 arg5)
{
@@ -1183,6 +1208,7 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len)
case WCN36XX_HAL_RMV_BSSKEY_RSP:
case WCN36XX_HAL_ENTER_BMPS_RSP:
case WCN36XX_HAL_EXIT_BMPS_RSP:
+ case WCN36XX_HAL_KEEP_ALIVE_RSP:
case WCN36XX_HAL_DUMP_COMMAND_RSP:
if (wcn36xx_smd_rsp_status_check(buf, len)) {
wcn36xx_warn("error response from hal request %d",
diff --git a/smd.h b/smd.h
index fc5c684..964e3c2 100644
--- a/smd.h
+++ b/smd.h
@@ -89,7 +89,7 @@ int wcn36xx_smd_remove_bsskey(struct wcn36xx *wcn,
u8 keyidx);
int wcn36xx_smd_enter_bmps(struct wcn36xx *wcn, u64 tbtt);
int wcn36xx_smd_exit_bmps(struct wcn36xx *wcn);
-
+int wcn36xx_smd_keep_alive_req(struct wcn36xx *wcn, int packet_type);
int wcn36xx_smd_dump_cmd_req(struct wcn36xx *wcn, u32 arg1, u32 arg2,
u32 arg3, u32 arg4, u32 arg5);
diff --git a/wcn36xx.h b/wcn36xx.h
index 8bf0c86..830ae2a 100644
--- a/wcn36xx.h
+++ b/wcn36xx.h
@@ -52,6 +52,8 @@ enum wcn36xx_debug_mask {
WCN36XX_DBG_MAC = 0x00000400,
WCN36XX_DBG_BEACON = 0x00000800,
WCN36XX_DBG_BEACON_DUMP = 0x00001000,
+ WCN36XX_DBG_PMC = 0x00002000,
+ WCN36XX_DBG_PMC_DUMP = 0x00004000,
WCN36XX_DBG_ANY = 0xffffffff,
};
--
1.7.9.5
More information about the wcn36xx
mailing list