]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
wilc1000: Improve WILC TX performance when power_save is off
authorDavid Mosberger-Tang <davidm@egauge.net>
Fri, 10 Dec 2021 20:30:22 +0000 (20:30 +0000)
committerKalle Valo <kvalo@kernel.org>
Thu, 16 Dec 2021 08:30:21 +0000 (10:30 +0200)
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>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20211210203016.3680425-2-davidm@egauge.net
drivers/net/wireless/microchip/wilc1000/hif.c
drivers/net/wireless/microchip/wilc1000/netdev.h
drivers/net/wireless/microchip/wilc1000/wlan.c

index a019da0bfc3f8f1fb11b6f30c5edf7fa9a83468a..71b44cfe0dfca290cf0dab130bc80b89f7553e4e 100644 (file)
@@ -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;
 }
index b9a88b3e322f1332670b7df2c7bfd7e38f314725..6c0e634d02499f56267119b360634271d977d207 100644 (file)
@@ -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;
index 1aa4236a2fe41086d98e8c5d2d0c829e1ce862b5..3f339c2f46f114fd8aee227ea282be72a7f55f6a 100644 (file)
@@ -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);
 }