lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220308165727.4088656-1-horatiu.vultur@microchip.com>
Date:   Tue, 8 Mar 2022 17:57:27 +0100
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC:     <UNGLinuxDriver@...rochip.com>, <davem@...emloft.net>,
        <kuba@...nel.org>, Horatiu Vultur <horatiu.vultur@...rochip.com>
Subject: [PATCH net-next] net: lan966x: Improve the CPU TX bitrate.

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@...rochip.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ