All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] wilc1000: Improve WILC TX performance when power_save is off
@ 2021-12-10 20:30 David Mosberger-Tang
  2021-12-10 20:30 ` [PATCH v2 1/1] " David Mosberger-Tang
  0 siblings, 1 reply; 3+ messages in thread
From: David Mosberger-Tang @ 2021-12-10 20:30 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, David Mosberger-Tang

v2 fixes a typo in the commit text and a merge error in netdev.h where
bool power_save_mode ended up in the wrong struct.  Sorry about that.

David Mosberger-Tang (1):
  wilc1000: Improve WILC TX performance when power_save is off

 drivers/net/wireless/microchip/wilc1000/hif.c    | 3 +++
 drivers/net/wireless/microchip/wilc1000/netdev.h | 1 +
 drivers/net/wireless/microchip/wilc1000/wlan.c   | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/1] wilc1000: Improve WILC TX performance when power_save is off
  2021-12-10 20:30 [PATCH v2 0/1] wilc1000: Improve WILC TX performance when power_save is off David Mosberger-Tang
@ 2021-12-10 20:30 ` David Mosberger-Tang
  2021-12-16  8:30   ` Kalle Valo
  0 siblings, 1 reply; 3+ messages in thread
From: David Mosberger-Tang @ 2021-12-10 20:30 UTC (permalink / raw)
  To: Ajay Singh
  Cc: Claudiu Beznea, Kalle Valo, David S. Miller, Jakub Kicinski,
	linux-wireless, David Mosberger-Tang

The wakeup and sleep commands need to be sent to the WILC chip only
when it is in power save mode (PSM, as controlled by "iw dev wlan0 set
power_save on/off").  The commands are relatively costly, so it pays
to skip them when possible.

iperf3 without this patch (no significant different with PSM on/off):
  TX   0.00-120.01 sec   140 MBytes  9.82 Mbits/sec
  RX   0.00-120.69 sec   283 MBytes  19.6 Mbits/sec

with this patch applied:

PSM off (TX is 46% improved, RX slightly improved; may not be significant):
  TX   0.00-120.00 sec   206 MBytes  14.4 Mbits/sec
  RX   0.00-120.48 sec   322 MBytes  22.4 Mbits/sec

PSM on (no significant change):
  TX   0.00-120.00 sec   140 MBytes  9.78 Mbits/sec
  RX   0.00-120.08 sec   257 MBytes  18.0 Mbits/sec

Signed-off-by: David Mosberger-Tang <davidm@egauge.net>
---
 drivers/net/wireless/microchip/wilc1000/hif.c    | 3 +++
 drivers/net/wireless/microchip/wilc1000/netdev.h | 1 +
 drivers/net/wireless/microchip/wilc1000/wlan.c   | 4 ++--
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/microchip/wilc1000/hif.c b/drivers/net/wireless/microchip/wilc1000/hif.c
index e69b9c7f3d31..29a42bc47017 100644
--- a/drivers/net/wireless/microchip/wilc1000/hif.c
+++ b/drivers/net/wireless/microchip/wilc1000/hif.c
@@ -1929,6 +1929,7 @@ int wilc_edit_station(struct wilc_vif *vif, const u8 *mac,
 
 int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
 {
+	struct wilc *wilc = vif->wilc;
 	struct wid wid;
 	int result;
 	s8 power_mode;
@@ -1944,6 +1945,8 @@ int wilc_set_power_mgmt(struct wilc_vif *vif, bool enabled, u32 timeout)
 	result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
 	if (result)
 		netdev_err(vif->ndev, "Failed to send power management\n");
+	else
+		wilc->power_save_mode = enabled;
 
 	return result;
 }
diff --git a/drivers/net/wireless/microchip/wilc1000/netdev.h b/drivers/net/wireless/microchip/wilc1000/netdev.h
index b9a88b3e322f..6c0e634d0249 100644
--- a/drivers/net/wireless/microchip/wilc1000/netdev.h
+++ b/drivers/net/wireless/microchip/wilc1000/netdev.h
@@ -212,6 +212,7 @@ struct wilc {
 	s8 mac_status;
 	struct clk *rtc_clk;
 	bool initialized;
+	bool power_save_mode;
 	int dev_irq_num;
 	int close;
 	u8 vif_num;
diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c
index 82566544419a..c63219fc634b 100644
--- a/drivers/net/wireless/microchip/wilc1000/wlan.c
+++ b/drivers/net/wireless/microchip/wilc1000/wlan.c
@@ -20,13 +20,13 @@ static inline bool is_wilc1000(u32 id)
 static inline void acquire_bus(struct wilc *wilc, enum bus_acquire acquire)
 {
 	mutex_lock(&wilc->hif_cs);
-	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP)
+	if (acquire == WILC_BUS_ACQUIRE_AND_WAKEUP && wilc->power_save_mode)
 		chip_wakeup(wilc);
 }
 
 static inline void release_bus(struct wilc *wilc, enum bus_release release)
 {
-	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP)
+	if (release == WILC_BUS_RELEASE_ALLOW_SLEEP && wilc->power_save_mode)
 		chip_allow_sleep(wilc);
 	mutex_unlock(&wilc->hif_cs);
 }
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2 1/1] wilc1000: Improve WILC TX performance when power_save is off
  2021-12-10 20:30 ` [PATCH v2 1/1] " David Mosberger-Tang
@ 2021-12-16  8:30   ` Kalle Valo
  0 siblings, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-12-16  8:30 UTC (permalink / raw)
  To: David Mosberger-Tang
  Cc: Ajay Singh, Claudiu Beznea, Kalle Valo, David S. Miller,
	Jakub Kicinski, linux-wireless, David Mosberger-Tang

David Mosberger-Tang <davidm@egauge.net> wrote:

> The wakeup and sleep commands need to be sent to the WILC chip only
> when it is in power save mode (PSM, as controlled by "iw dev wlan0 set
> power_save on/off").  The commands are relatively costly, so it pays
> to skip them when possible.
> 
> iperf3 without this patch (no significant different with PSM on/off):
>   TX   0.00-120.01 sec   140 MBytes  9.82 Mbits/sec
>   RX   0.00-120.69 sec   283 MBytes  19.6 Mbits/sec
> 
> with this patch applied:
> 
> PSM off (TX is 46% improved, RX slightly improved; may not be significant):
>   TX   0.00-120.00 sec   206 MBytes  14.4 Mbits/sec
>   RX   0.00-120.48 sec   322 MBytes  22.4 Mbits/sec
> 
> PSM on (no significant change):
>   TX   0.00-120.00 sec   140 MBytes  9.78 Mbits/sec
>   RX   0.00-120.08 sec   257 MBytes  18.0 Mbits/sec
> 
> Signed-off-by: David Mosberger-Tang <davidm@egauge.net>

Patch applied to wireless-drivers-next.git, thanks.

b530d5f39c2f wilc1000: Improve WILC TX performance when power_save is off

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20211210203016.3680425-2-davidm@egauge.net/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-16  8:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 20:30 [PATCH v2 0/1] wilc1000: Improve WILC TX performance when power_save is off David Mosberger-Tang
2021-12-10 20:30 ` [PATCH v2 1/1] " David Mosberger-Tang
2021-12-16  8:30   ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.