Messages in this thread Patch in this message | | | From | Horatiu Vultur <> | Subject | [PATCH net-next] net: lan966x: Improve the CPU TX bitrate. | Date | Tue, 8 Mar 2022 17:57:27 +0100 |
| |
Replace 'readx_poll_timeout_atomic' with a simple while loop + timeout when checking if it is possible to write to the HW the next word of the frame. Doing this will improve the TX bitrate by 65%. The measurements were done using iperf3.
Before: [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.03 sec 55.2 MBytes 46.2 Mbits/sec 0 sender [ 5] 0.00-10.04 sec 53.8 MBytes 45.0 Mbits/sec receiver
After: [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-10.02 sec 91.4 MBytes 76.6 Mbits/sec 0 sender [ 5] 0.00-10.03 sec 90.2 MBytes 75.5 Mbits/sec receiver
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> --- .../ethernet/microchip/lan966x/lan966x_main.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index 81c01665d01e..f6cef29b9d36 100644 --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -176,18 +176,20 @@ static int lan966x_port_stop(struct net_device *dev) return 0; } -static int lan966x_port_inj_status(struct lan966x *lan966x) -{ - return lan_rd(lan966x, QS_INJ_STATUS); -} - static int lan966x_port_inj_ready(struct lan966x *lan966x, u8 grp) { - u32 val; + unsigned long time = jiffies + usecs_to_jiffies(READL_TIMEOUT_US); + int ret = 0; - return readx_poll_timeout_atomic(lan966x_port_inj_status, lan966x, val, - QS_INJ_STATUS_FIFO_RDY_GET(val) & BIT(grp), - READL_SLEEP_US, READL_TIMEOUT_US); + while (!(lan_rd(lan966x, QS_INJ_STATUS) & + QS_INJ_STATUS_FIFO_RDY_SET(BIT(grp)))) { + if (time_after(jiffies, time)) { + ret = -ETIMEDOUT; + break; + } + } + + return ret; } static int lan966x_port_ifh_xmit(struct sk_buff *skb, -- 2.33.0
| |