2019-01-31 05:53:31

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 0/5] rsi: wowlan debig support and fixes

From: Siva Rebbagondla <[email protected]>

This set of patches consists wowlan debug support and common fixes
for redpine wireless driver.

Changes in v2:
02/05: removed ifdefs [Kvalo].

Siva Rebbagondla (5):
rsi: Add debug support for wowlan wakeup confirmation
rsi: add hci detach for hibernation and poweroff
rsi: fix wowlan wakeup issue for hibernate(S4)
rsi: resolve power save issue after S4 resume
rsi: fix for wowlan wakeup failure

drivers/net/wireless/rsi/rsi_91x_mac80211.c | 21 ++++++++++++++++++---
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 29 +++++++++++++++++++++++++++++
drivers/net/wireless/rsi/rsi_91x_sdio.c | 17 ++++++++++++++++-
drivers/net/wireless/rsi/rsi_91x_usb.c | 6 ++++++
drivers/net/wireless/rsi/rsi_main.h | 1 +
5 files changed, 70 insertions(+), 4 deletions(-)

--
2.5.5



2019-01-31 05:53:34

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 1/5] rsi: Add debug support for wowlan wakeup confirmation

From: Siva Rebbagondla <[email protected]>

When a wowlan magic-packet has received to wake up the device, currently
driver is not taking care of what kind of packet has received. This patch
will add debug support for wakeup reason in driver.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_mgmt.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
index 4042414..4c2c776 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c
@@ -2003,6 +2003,35 @@ int rsi_mgmt_pkt_recv(struct rsi_common *common, u8 *msg)
return -1;
rsi_send_beacon(common);
break;
+ case WOWLAN_WAKEUP_REASON:
+ rsi_dbg(ERR_ZONE, "\n\nWakeup Type: %x\n", msg[15]);
+ switch (msg[15]) {
+ case RSI_UNICAST_MAGIC_PKT:
+ rsi_dbg(ERR_ZONE,
+ "*** Wakeup for Unicast magic packet ***\n");
+ break;
+ case RSI_BROADCAST_MAGICPKT:
+ rsi_dbg(ERR_ZONE,
+ "*** Wakeup for Broadcast magic packet ***\n");
+ break;
+ case RSI_EAPOL_PKT:
+ rsi_dbg(ERR_ZONE,
+ "*** Wakeup for GTK renewal ***\n");
+ break;
+ case RSI_DISCONNECT_PKT:
+ rsi_dbg(ERR_ZONE,
+ "*** Wakeup for Disconnect ***\n");
+ break;
+ case RSI_HW_BMISS_PKT:
+ rsi_dbg(ERR_ZONE,
+ "*** Wakeup for HW Beacon miss ***\n");
+ break;
+ default:
+ rsi_dbg(ERR_ZONE,
+ "##### Un-intentional Wakeup #####\n");
+ break;
+ }
+ break;
case RX_DOT11_MGMT:
return rsi_mgmt_pkt_to_core(common, msg, msg_len);
default:
--
2.5.5


2019-01-31 05:53:37

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 2/5] rsi: add hci detach for hibernation and poweroff

From: Siva Rebbagondla <[email protected]>

As we missed to detach HCI, while entering power off or hibernation,
an extra hci interface gets created whenever system is woken up, to
avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
and rsi_shutdown() functions which are invoked for these tests.
This patch fixes the issue

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_sdio.c | 15 +++++++++++++++
drivers/net/wireless/rsi/rsi_91x_usb.c | 6 ++++++
2 files changed, 21 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index b412b65e..4005c1d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1132,6 +1132,11 @@ static void rsi_disconnect(struct sdio_func *pfunction)
rsi_mac80211_detach(adapter);
mdelay(10);

+ if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+ rsi_bt_ops.detach(adapter->priv->bt_adapter);
+ adapter->priv->bt_adapter = NULL;
+ }
+
/* Reset Chip */
rsi_reset_chip(adapter);

@@ -1308,6 +1313,11 @@ static int rsi_freeze(struct device *dev)
rsi_dbg(ERR_ZONE,
"##### Device can not wake up through WLAN\n");

+ if (common->coex_mode > 1 && common->bt_adapter) {
+ rsi_bt_ops.detach(common->bt_adapter);
+ common->bt_adapter = NULL;
+ }
+
ret = rsi_sdio_disable_interrupts(pfunction);

if (sdev->write_fail)
@@ -1355,6 +1365,11 @@ static void rsi_shutdown(struct device *dev)
if (rsi_config_wowlan(adapter, wowlan))
rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");

+ if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+ rsi_bt_ops.detach(adapter->priv->bt_adapter);
+ adapter->priv->bt_adapter = NULL;
+ }
+
rsi_sdio_disable_interrupts(sdev->pfunction);

if (sdev->write_fail)
diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
index f360690..38b4880b 100644
--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
+++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
@@ -816,6 +816,12 @@ static void rsi_disconnect(struct usb_interface *pfunction)
return;

rsi_mac80211_detach(adapter);
+
+ if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
+ rsi_bt_ops.detach(adapter->priv->bt_adapter);
+ adapter->priv->bt_adapter = NULL;
+ }
+
rsi_reset_card(adapter);
rsi_deinit_usb_interface(adapter);
rsi_91x_deinit(adapter);
--
2.5.5


2019-01-31 05:53:40

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 3/5] rsi: fix wowlan wakeup issue for hibernate(S4)

From: Siva Rebbagondla <[email protected]>

At SDIO restore ieee80211_restart_hw() is getting called to restart all
MAC operations. This step is not required.
Returning 1 from mac80211_resume() will serve this purpose.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 8 ++++++--
drivers/net/wireless/rsi/rsi_91x_sdio.c | 1 -
2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index aded1ae..8d1282f 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -1938,8 +1938,12 @@ static int rsi_mac80211_resume(struct ieee80211_hw *hw)

rsi_dbg(INFO_ZONE, "%s: mac80211 resume\n", __func__);

- if (common->hibernate_resume)
- return 0;
+ if (common->hibernate_resume) {
+ /* Device need a complete restart of all MAC operations.
+ * returning 1 will serve this purpose.
+ */
+ return 1;
+ }

mutex_lock(&common->mutex);
rsi_send_wowlan_request(common, 0, 0);
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index 4005c1d..43e8a0d 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1393,7 +1393,6 @@ static int rsi_restore(struct device *dev)
common->iface_down = true;

adapter->sc_nvifs = 0;
- ieee80211_restart_hw(adapter->hw);

common->wow_flags = 0;
common->iface_down = false;
--
2.5.5


2019-01-31 05:53:43

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 4/5] rsi: resolve power save issue after S4 resume

From: Siva Rebbagondla <[email protected]>

We are redownloading the firmware after S4 restore and observed in
stress test that mac80211 sometimes gives power save request after
resume which causes the firmware in bad state. mac_ops_resumed flag
is added to skip that request until initialisation is done and Keeping
power save state is NONE.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 9 ++++++++-
drivers/net/wireless/rsi/rsi_91x_sdio.c | 1 +
drivers/net/wireless/rsi/rsi_main.h | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 8d1282f..7bc8da6 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -239,6 +239,7 @@ static int rsi_mac80211_hw_scan_start(struct ieee80211_hw *hw,
struct ieee80211_bss_conf *bss = &vif->bss_conf;

rsi_dbg(INFO_ZONE, "***** Hardware scan start *****\n");
+ common->mac_ops_resumed = false;

if (common->fsm_state != FSM_MAC_INIT_DONE)
return -ENODEV;
@@ -370,6 +371,10 @@ static void rsi_mac80211_tx(struct ieee80211_hw *hw,
{
struct rsi_hw *adapter = hw->priv;
struct rsi_common *common = adapter->priv;
+ struct ieee80211_hdr *wlh = (struct ieee80211_hdr *)skb->data;
+
+ if (ieee80211_is_auth(wlh->frame_control))
+ common->mac_ops_resumed = false;

rsi_core_xmit(common, skb);
}
@@ -677,7 +682,8 @@ static int rsi_mac80211_config(struct ieee80211_hw *hw,
}

/* Power save parameters */
- if (changed & IEEE80211_CONF_CHANGE_PS) {
+ if ((changed & IEEE80211_CONF_CHANGE_PS) &&
+ !common->mac_ops_resumed) {
struct ieee80211_vif *vif, *sta_vif = NULL;
unsigned long flags;
int i, set_ps = 1;
@@ -1939,6 +1945,7 @@ static int rsi_mac80211_resume(struct ieee80211_hw *hw)
rsi_dbg(INFO_ZONE, "%s: mac80211 resume\n", __func__);

if (common->hibernate_resume) {
+ common->mac_ops_resumed = true;
/* Device need a complete restart of all MAC operations.
* returning 1 will serve this purpose.
*/
diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
index 43e8a0d..f8db5f5 100644
--- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
+++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
@@ -1393,6 +1393,7 @@ static int rsi_restore(struct device *dev)
common->iface_down = true;

adapter->sc_nvifs = 0;
+ adapter->ps_state = PS_NONE;

common->wow_flags = 0;
common->iface_down = false;
diff --git a/drivers/net/wireless/rsi/rsi_main.h b/drivers/net/wireless/rsi/rsi_main.h
index 4dc0c01..35d13f3 100644
--- a/drivers/net/wireless/rsi/rsi_main.h
+++ b/drivers/net/wireless/rsi/rsi_main.h
@@ -311,6 +311,7 @@ struct rsi_common {
struct cfg80211_scan_request *hwscan;
struct rsi_bgscan_params bgscan;
u8 bgscan_en;
+ u8 mac_ops_resumed;
};

struct eepromrw_info {
--
2.5.5


2019-01-31 05:53:46

by Siva Rebbagondla

[permalink] [raw]
Subject: [v2 5/5] rsi: fix for wowlan wakeup failure

From: Siva Rebbagondla <[email protected]>

During wowlan regression tests, sometimes radio is not waking up for wowlan
packet in coex mode. This is because of power save is enabled by default
in case of coex mode greater than one. Hence, disable power save in coex
mode to avoid radio loss.

Signed-off-by: Siva Rebbagondla <[email protected]>
---
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 7bc8da6..3fd2571 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -1901,6 +1901,10 @@ int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan)
return 0;
}
rsi_dbg(INFO_ZONE, "TRIGGERS %x\n", triggers);
+
+ if (common->coex_mode > 1)
+ rsi_disable_ps(adapter, adapter->vifs[0]);
+
rsi_send_wowlan_request(common, triggers, 1);

/**
--
2.5.5


2019-02-01 13:38:57

by kernel test robot

[permalink] [raw]
Subject: Re: [v2 2/5] rsi: add hci detach for hibernation and poweroff

Hi Siva,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v5.0-rc4 next-20190131]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Siva-Rebbagondla/rsi-wowlan-debig-support-and-fixes/20190201-002929
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: x86_64-randconfig-s1-02011457 (attached as .config)
compiler: gcc-6 (Debian 6.5.0-2) 6.5.0 20181026
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

ld: drivers/net/wireless/rsi/rsi_91x_usb.o: in function `rsi_disconnect':
>> drivers/net/wireless/rsi/rsi_91x_usb.c:821: undefined reference to `rsi_bt_ops'
>> ld: drivers/net/wireless/rsi/rsi_91x_usb.c:821: undefined reference to `rsi_bt_ops'

vim +821 drivers/net/wireless/rsi/rsi_91x_usb.c

803
804 /**
805 * rsi_disconnect() - This function performs the reverse of the probe function,
806 * it deinitialize the driver structure.
807 * @pfunction: Pointer to the USB interface structure.
808 *
809 * Return: None.
810 */
811 static void rsi_disconnect(struct usb_interface *pfunction)
812 {
813 struct rsi_hw *adapter = usb_get_intfdata(pfunction);
814
815 if (!adapter)
816 return;
817
818 rsi_mac80211_detach(adapter);
819
820 if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> 821 rsi_bt_ops.detach(adapter->priv->bt_adapter);
822 adapter->priv->bt_adapter = NULL;
823 }
824
825 rsi_reset_card(adapter);
826 rsi_deinit_usb_interface(adapter);
827 rsi_91x_deinit(adapter);
828
829 rsi_dbg(INFO_ZONE, "%s: Deinitialization completed\n", __func__);
830 }
831

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (2.03 kB)
.config.gz (34.75 kB)
Download all attachments

2019-02-01 15:06:00

by kernel test robot

[permalink] [raw]
Subject: Re: [v2 2/5] rsi: add hci detach for hibernation and poweroff

Hi Siva,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on wireless-drivers-next/master]
[also build test ERROR on v5.0-rc4 next-20190131]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Siva-Rebbagondla/rsi-wowlan-debig-support-and-fixes/20190201-002929
base: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git master
config: x86_64-randconfig-s0-02011939 (attached as .config)
compiler: gcc-6 (Debian 6.5.0-2) 6.5.0 20181026
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64

All errors (new ones prefixed by >>):

>> ERROR: "rsi_bt_ops" [drivers/net/wireless/rsi/rsi_sdio.ko] undefined!

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (955.00 B)
.config.gz (30.05 kB)
Download all attachments

2019-02-01 15:32:45

by Siva Rebbagondla

[permalink] [raw]
Subject: Re: [v2 2/5] rsi: add hci detach for hibernation and poweroff

Hi Kalle,
On Thu, Jan 31, 2019 at 11:23 AM Siva Rebbagondla <[email protected]> wrote:
>
> From: Siva Rebbagondla <[email protected]>
>
> As we missed to detach HCI, while entering power off or hibernation,
> an extra hci interface gets created whenever system is woken up, to
> avoid this we added hci_detach() in rsi_disconnect(), rsi_freeze(),
> and rsi_shutdown() functions which are invoked for these tests.
> This patch fixes the issue
>
> Signed-off-by: Siva Rebbagondla <[email protected]>
> ---
> drivers/net/wireless/rsi/rsi_91x_sdio.c | 15 +++++++++++++++
> drivers/net/wireless/rsi/rsi_91x_usb.c | 6 ++++++
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> index b412b65e..4005c1d 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c
> @@ -1132,6 +1132,11 @@ static void rsi_disconnect(struct sdio_func *pfunction)
> rsi_mac80211_detach(adapter);
> mdelay(10);
>
> + if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> + rsi_bt_ops.detach(adapter->priv->bt_adapter);
> + adapter->priv->bt_adapter = NULL;
> + }
> +
> /* Reset Chip */
> rsi_reset_chip(adapter);
>
> @@ -1308,6 +1313,11 @@ static int rsi_freeze(struct device *dev)
> rsi_dbg(ERR_ZONE,
> "##### Device can not wake up through WLAN\n");
>
> + if (common->coex_mode > 1 && common->bt_adapter) {
> + rsi_bt_ops.detach(common->bt_adapter);
> + common->bt_adapter = NULL;
> + }
> +
> ret = rsi_sdio_disable_interrupts(pfunction);
>
> if (sdev->write_fail)
> @@ -1355,6 +1365,11 @@ static void rsi_shutdown(struct device *dev)
> if (rsi_config_wowlan(adapter, wowlan))
> rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n");
>
> + if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> + rsi_bt_ops.detach(adapter->priv->bt_adapter);
> + adapter->priv->bt_adapter = NULL;
> + }
> +
> rsi_sdio_disable_interrupts(sdev->pfunction);
>
> if (sdev->write_fail)
> diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
> index f360690..38b4880b 100644
> --- a/drivers/net/wireless/rsi/rsi_91x_usb.c
> +++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
> @@ -816,6 +816,12 @@ static void rsi_disconnect(struct usb_interface *pfunction)
> return;
>
> rsi_mac80211_detach(adapter);
> +
> + if (adapter->priv->coex_mode > 1 && adapter->priv->bt_adapter) {
> + rsi_bt_ops.detach(adapter->priv->bt_adapter);
> + adapter->priv->bt_adapter = NULL;
> + }
> +
> rsi_reset_card(adapter);
> rsi_deinit_usb_interface(adapter);
> rsi_91x_deinit(adapter);
> --
> 2.5.5
>
Kindly ignore this patch series as kbuild test got failed. It is
because of "rsi_bt_ops". These ops are defined in
drivers/bluetooth/btrsi.c and this file is under CONFIG_RSI_COEX flag.
I was overlooked on this.
As you suggested in v1 series, I will resend these patches with
"IS_ENABLED(CONFIG_RSI_COEX)" check.

Thanks,
Siva Rebbagondla