Skip to contentSkip to conversation

rsi: sdio: add WOWLAN support for S3 suspend state

PATCH Superseded Amitkumar Karwar 2 participants 3 messages Sep 25, 2017 – Sep 27, 2017 Redpine wireless driver

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 rsi: sdio: add WOWLAN support for S3 suspend state

From: Karun Eagalapati <[email protected]>

WoWLAN is supported in RS9113 device through GPIO pin2. wowlan config frame is internally sent to firmware in mac80211 suspend handler. Also beacon miss threshold and keep-alive time values are increased to avoid un-necessary disconnection with AP.

---
 drivers/net/wireless/rsi/Kconfig            |   7 ++
 drivers/net/wireless/rsi/rsi_91x_core.c     |   9 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 125 ++++++++++++++++++++++++++++
 drivers/net/wireless/rsi/rsi_91x_mgmt.c     |  66 +++++++++++++--
 drivers/net/wireless/rsi/rsi_91x_sdio.c     |  11 +++
 drivers/net/wireless/rsi/rsi_common.h       |   3 +
 drivers/net/wireless/rsi/rsi_main.h         |  12 ++-
 drivers/net/wireless/rsi/rsi_mgmt.h         |  37 +++++++-
 8 files changed, 258 insertions(+), 12 deletions(-)
drivers/net/wireless/rsi/Kconfig +7 -0
index 7c5e4ca..0882b4e 100644
@@ -42,4 +42,11 @@ config RSI_USB
 	  This option enables the USB bus support in rsi drivers.
 	  Select M (recommended), if you have a RSI 1x1 wireless module.
 
+config RSI_WOW
+	bool "Redpine Signals WOWLAN support"
+	depends on RSI_SDIO && RSI_91X
+	default y
+	---help---
+	 Say Y, if you would like to enable wowlan support for RSI module.
+
 endif # WLAN_VENDOR_RSI
drivers/net/wireless/rsi/rsi_91x_core.c +8 -1
index bc18a19..2a081a4 100644
@@ -379,7 +379,14 @@ void rsi_core_xmit(struct rsi_common *common, struct sk_buff *skb)
 		rsi_dbg(ERR_ZONE, "%s: FSM state not open\n", __func__);
 		goto xmit_fail;
 	}
-
+#ifdef CONFIG_RSI_WOW
+	if (common->wow_flags & RSI_WOW_ENABLED) {
+		rsi_dbg(ERR_ZONE,
+			"%s: Blocking Tx_packets when WOWLAN is enabled\n",
+			__func__);
+		goto xmit_fail;
+	}
+#endif
 	info = IEEE80211_SKB_CB(skb);
 	tx_params = (struct skb_info *)info->driver_data;
 	wh = (struct ieee80211_hdr *)&skb->data[0];
drivers/net/wireless/rsi/rsi_91x_mac80211.c +125 -0

143 lines not on this page · raw message

drivers/net/wireless/rsi/rsi_91x_mgmt.c +57 -9

85 lines not on this page · raw message

drivers/net/wireless/rsi/rsi_91x_sdio.c +11 -0
index b3f8006..28efa17 100644
@@ -1124,6 +1124,10 @@ static int rsi_sdio_enable_interrupts(struct sdio_func *pfunc)
 {
 	u8 data;
 	int ret;
+#ifdef CONFIG_RSI_WOW
+	struct rsi_hw *adapter = sdio_get_drvdata(pfunc);
+	struct rsi_common *common = adapter->priv;
+#endif
 
 	sdio_claim_host(pfunc);
 	ret = rsi_cmd52readbyte(pfunc->card, RSI_INT_ENABLE_REGISTER, &data);
@@ -1142,6 +1146,13 @@ static int rsi_sdio_enable_interrupts(struct sdio_func *pfunc)
 			__func__);
 		goto done;
 	}
+#ifdef CONFIG_RSI_WOW
+	if ((common->wow_flags & RSI_WOW_ENABLED) &&
+	    (common->wow_flags & RSI_WOW_NO_CONNECTION))
+		rsi_dbg(ERR_ZONE,
+			"##### Device can not wake up through WLAN\n");
+
+#endif
 
 	ret = rsi_cmd52readbyte(pfunc->card, RSI_INT_ENABLE_REGISTER, &data);
 	if (ret < 0) {
drivers/net/wireless/rsi/rsi_common.h +3 -0
index 272e18d..fce6fb6 100644
@@ -83,6 +83,9 @@ u16 rsi_get_connected_channel(struct ieee80211_vif *vif);
 struct rsi_hw *rsi_91x_init(void);
 void rsi_91x_deinit(struct rsi_hw *adapter);
 int rsi_read_pkt(struct rsi_common *common, s32 rcv_pkt_len);
+#ifdef CONFIG_RSI_WOW
+int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan);
+#endif
 struct rsi_sta *rsi_find_sta(struct rsi_common *common, u8 *mac_addr);
 struct ieee80211_vif *rsi_get_vif(struct rsi_hw *adapter, u8 *mac);
 void rsi_roc_timeout(unsigned long data);
drivers/net/wireless/rsi/rsi_main.h +11 -1
index a118b7a..768e697 100644
@@ -66,6 +66,8 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
 #define FRAME_DESC_SZ                   16
 #define MIN_802_11_HDR_LEN              24
 #define RSI_DEF_KEEPALIVE               90
+#define RSI_WOW_KEEPALIVE                5
+#define RSI_BCN_MISS_THRESHOLD           24
 
 #define DATA_QUEUE_WATER_MARK           400
 #define MIN_DATA_QUEUE_WATER_MARK       300
@@ -108,6 +110,12 @@ extern __printf(2, 3) void rsi_dbg(u32 zone, const char *fmt, ...);
 	((_q) == VI_Q) ? IEEE80211_AC_VI : \
 	IEEE80211_AC_VO)
 
+#ifdef CONFIG_RSI_WOW
+/* WoWLAN flags */
+#define RSI_WOW_ENABLED			BIT(0)
+#define RSI_WOW_NO_CONNECTION		BIT(1)
+#endif
+
 #define RSI_DEV_9113		1
 
 struct version_info {
@@ -266,7 +274,9 @@ struct rsi_common {
 	u8 obm_ant_sel_val;
 	int tx_power;
 	u8 ant_in_use;
-
+#ifdef CONFIG_RSI_WOW
+	u8 wow_flags;
+#endif
 	u16 beacon_interval;
 	u8 dtim_cnt;
 
drivers/net/wireless/rsi/rsi_mgmt.h +36 -1
index b9d0802..fe0e11d 100644
@@ -45,6 +45,19 @@
 #define MAGIC_WORD                      0x5A
 #define WLAN_EEPROM_RFTYPE_ADDR		424
 
+#ifdef CONFIG_RSI_WOW
+/*WOWLAN RESUME WAKEUP TYPES*/
+#define RSI_UNICAST_MAGIC_PKT		BIT(0)
+#define RSI_BROADCAST_MAGICPKT		BIT(1)
+#define RSI_EAPOL_PKT			BIT(2)
+#define RSI_DISCONNECT_PKT		BIT(3)
+#define RSI_HW_BMISS_PKT		BIT(4)
+#define RSI_INSERT_SEQ_IN_FW		BIT(2)
+
+#define WOW_MAX_FILTERS_PER_LIST 16
+#define WOW_PATTERN_SIZE 256
+#endif
+
 /* Receive Frame Types */
 #define TA_CONFIRM_TYPE                 0x01
 #define RX_DOT11_MGMT                   0x02
@@ -201,6 +214,13 @@
 #define RSI_DATA_DESC_INSERT_TSF	BIT(15)
 #define RSI_DATA_DESC_INSERT_SEQ_NO	BIT(2)
 
+#ifdef CONFIG_PM
+#define RSI_WOW_ANY			BIT(1)
+#define RSI_WOW_GTK_REKEY		BIT(3)
+#define RSI_WOW_MAGIC_PKT		BIT(4)
+#define RSI_WOW_DISCONNECT		BIT(5)
+#endif
+
 enum opmode {
 	RSI_OPMODE_UNSUPPORTED = -1,
 	RSI_OPMODE_AP = 0,
@@ -262,7 +282,9 @@ enum cmd_frame_type {
 	ANT_SEL_FRAME = 0x20,
 	VAP_DYNAMIC_UPDATE = 0x27,
 	COMMON_DEV_CONFIG = 0x28,
-	RADIO_PARAMS_UPDATE = 0x29
+	RADIO_PARAMS_UPDATE = 0x29,
+	WOWLAN_CONFIG_PARAMS = 0x2B,
+	WOWLAN_WAKEUP_REASON = 0xc5
 };
 
 struct rsi_mac_frame {
@@ -581,6 +603,15 @@ struct rsi_request_ps {
 	__le16 ps_num_dtim_intervals;
 } __packed;
 
+#ifdef CONFIG_RSI_WOW
+struct rsi_wowlan_req {
+	struct rsi_cmd_desc desc;
+	u8 sourceid[ETH_ALEN];
+	u16 wow_flags;
+	u16 host_sleep_status;
+} __packed;
+#endif
+
 static inline u32 rsi_get_queueno(u8 *addr, u16 offset)
 {
 	return (le16_to_cpu(*(__le16 *)&addr[offset]) & 0x7000) >> 12;
@@ -641,6 +672,10 @@ int rsi_band_check(struct rsi_common *common, struct ieee80211_channel *chan);
 int rsi_send_rx_filter_frame(struct rsi_common *common, u16 rx_filter_word);
 int rsi_send_radio_params_update(struct rsi_common *common);
 int rsi_set_antenna(struct rsi_common *common, u8 antenna);
+#ifdef CONFIG_RSI_WOW
+int rsi_send_wowlan_request(struct rsi_common *common, u16 flags,
+			    u16 sleep_status);
+#endif
 int rsi_send_ps_request(struct rsi_hw *adapter, bool enable,
 			struct ieee80211_vif *vif);
 #endif
Signature · 1 line
2.7.4
#1 lore raw
Quoted 25 lines · Amitkumar Karwar

From: Karun Eagalapati <[email protected]>

WoWLAN is supported in RS9113 device through GPIO pin2. wowlan config frame is internally sent to firmware in mac80211 suspend handler. Also beacon miss threshold and keep-alive time values are increased to avoid un-necessary disconnection with AP.

---
 drivers/net/wireless/rsi/Kconfig            |   7 ++
 drivers/net/wireless/rsi/rsi_91x_core.c     |   9 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 125 ++++++++++++++++++++++++++++
 drivers/net/wireless/rsi/rsi_91x_mgmt.c     |  66 +++++++++++++--
 drivers/net/wireless/rsi/rsi_91x_sdio.c     |  11 +++
 drivers/net/wireless/rsi/rsi_common.h       |   3 +
 drivers/net/wireless/rsi/rsi_main.h         |  12 ++-
 drivers/net/wireless/rsi/rsi_mgmt.h         |  37 +++++++-
 8 files changed, 258 insertions(+), 12 deletions(-)
drivers/net/wireless/rsi/Kconfig +0 -0
index 7c5e4ca..0882b4e 100644

drivers/net/wireless/rsi/Kconfig config RSI_USB · line 50

Quoted 9 lines
drivers/net/wireless/rsi/Kconfig +6 -0
@@ -42,4 +42,11 @@ config RSI_USB
 	  This option enables the USB bus support in rsi drivers.
 	  Select M (recommended), if you have a RSI 1x1 wireless module.
 
+config RSI_WOW
+	bool "Redpine Signals WOWLAN support"
+	depends on RSI_SDIO && RSI_91X
+	default y
+	---help---
+	 Say Y, if you would like to enable wowlan support for RSI module.

This adds a lot of ifdefs to the code. Is the Kconfig option really needed?

Signature · 1 line
Kalle Valo
#2 lore raw
Quoted 30 lines · Kalle Valo
Quoted 28 lines · Amitkumar Karwar

From: Karun Eagalapati <[email protected]>

WoWLAN is supported in RS9113 device through GPIO pin2. wowlan config frame is internally sent to firmware in mac80211 suspend handler. Also beacon miss threshold and keep-alive time values are increased to avoid un-necessary disconnection with AP.

---
 drivers/net/wireless/rsi/Kconfig            |   7 ++
 drivers/net/wireless/rsi/rsi_91x_core.c     |   9 +-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c | 125 ++++++++++++++++++++++++++++
 drivers/net/wireless/rsi/rsi_91x_mgmt.c     |  66 +++++++++++++--
 drivers/net/wireless/rsi/rsi_91x_sdio.c     |  11 +++
 drivers/net/wireless/rsi/rsi_common.h       |   3 +
 drivers/net/wireless/rsi/rsi_main.h         |  12 ++-
 drivers/net/wireless/rsi/rsi_mgmt.h         |  37 +++++++-
 8 files changed, 258 insertions(+), 12 deletions(-)
drivers/net/wireless/rsi/Kconfig +0 -0
index 7c5e4ca..0882b4e 100644
@@ -42,4 +42,11 @@ config RSI_USB
        This option enables the USB bus support in rsi drivers.
        Select M (recommended), if you have a RSI 1x1 wireless module.
 
Quoted 9 lines

drivers/net/wireless/rsi/Kconfig config RSI_USB · line 50

Quoted 6 lines
drivers/net/wireless/rsi/Kconfig +6 -0
+config RSI_WOW
+     bool "Redpine Signals WOWLAN support"
+     depends on RSI_SDIO && RSI_91X
+     default y
+     ---help---
+      Say Y, if you would like to enable wowlan support for RSI module.

This adds a lot of ifdefs to the code. Is the Kconfig option really needed?

Thanks for the review.
Kconfig option can be removed. I will get rid of it.

Regards,
Amitkumar Karwar