devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Parvathi Pudi <parvathi@couthit.com>
To: kuba <kuba@kernel.org>
Cc: parvathi <parvathi@couthit.com>, danishanwar <danishanwar@ti.com>,
	 rogerq <rogerq@kernel.org>,
	andrew+netdev <andrew+netdev@lunn.ch>,
	 davem <davem@davemloft.net>, edumazet <edumazet@google.com>,
	 pabeni <pabeni@redhat.com>, robh <robh@kernel.org>,
	 krzk+dt <krzk+dt@kernel.org>, conor+dt <conor+dt@kernel.org>,
	 ssantosh <ssantosh@kernel.org>,
	 richardcochran <richardcochran@gmail.com>,
	 s hauer <s.hauer@pengutronix.de>,
	m-karicheri2 <m-karicheri2@ti.com>,
	 glaroque <glaroque@baylibre.com>, afd <afd@ti.com>,
	 saikrishnag <saikrishnag@marvell.com>,
	m-malladi <m-malladi@ti.com>,
	 jacob e keller <jacob.e.keller@intel.com>,
	 diogo ivo <diogo.ivo@siemens.com>,
	 javier carrasco cruz <javier.carrasco.cruz@gmail.com>,
	 horms <horms@kernel.org>, s-anna <s-anna@ti.com>,
	 basharath <basharath@couthit.com>,
	 linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	 netdev <netdev@vger.kernel.org>,
	 devicetree <devicetree@vger.kernel.org>,
	 linux-kernel <linux-kernel@vger.kernel.org>,
	 Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	 pratheesh <pratheesh@ti.com>, Prajith Jayarajan <prajith@ti.com>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	praneeth <praneeth@ti.com>,  srk <srk@ti.com>,
	rogerq <rogerq@ti.com>,  krishna <krishna@couthit.com>,
	pmohan <pmohan@couthit.com>,  mohan <mohan@couthit.com>
Subject: Re: [PATCH net-next v10 04/11] net: ti: prueth: Adds link detection, RX and TX support.
Date: Fri, 18 Jul 2025 16:17:05 +0530 (IST)	[thread overview]
Message-ID: <3177386.41994.1752835625751.JavaMail.zimbra@couthit.local> (raw)
In-Reply-To: <20250716140926.3aa10894@kernel.org>

Hi,

> On Wed, 16 Jul 2025 18:41:11 +0530 (IST) Parvathi Pudi wrote:
>> >> Something needs to stop the queue, right? Otherwise the stack will
>> >> send the frame right back to the driver.
>> > 
>> > Yes, we will notify upper layer with “netif_tx_stop_queue()” when returning
>> > “NETDEV_TX_BUSY” to not push again immediately.
>> 
>> We reviewed the flow and found that the reason for NETDEV_TX_BUSY being
>> notified to the upper layers is due lack of support for reliably detecting
>> the TX completion event.
>> 
>> In case of ICSSM PRU Ethernet, we do not have support for TX complete
>> notification back to the driver from firmware and its like store and
>> forget approach. So it will be tricky to enable back/resume the queue
>> if we stop it when we see busy status.
> 
> IIUC this is all implemented in SW / FW. You either need to add
> the notification or use a timer to unblock the queue.

We tried out a "hrtimer" based TX queue resume logic whenever
the driver finds that the queue is busy. The results look good.

Now the driver notifies the upper layer to stop re-queuing and
a timeout of HR_TIMER_TX_DELAY_US microseconds is used to
resume the queuing. Currently HR_TIMER_TX_DELAY_US is set as
100us as the PRU can approximately drain a maximum packet size
in this window.

Soon after timer expiry, the driver will notify the upper
layers to resume the queuing by invoking netif_tx_wake_queue().

This helps to avoid the stack from sending the frame right
back to the driver.

With these changes we have performed throughput tests for
various packet lengths using "iperf" and there is no
degradation in throughput for AM57x, AM437x and AM335x.

Below are the "hrtimer" changes for reference. We will post
the next version of patch series with reduced number of patches
and with this hrtimer logic.

We appreciate any feedback in the meantime.

diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
index a263df1fa511..9582246b1d87 100644
--- a/drivers/net/ethernet/ti/icssm/icssm_prueth.c
+++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
@@ -36,6 +36,7 @@
 
 #define TX_START_DELAY		0x40
 #define TX_CLK_DELAY_100M	0x6
+#define HR_TIMER_TX_DELAY_US	100
 
 static void icssm_prueth_write_reg(struct prueth *prueth,
 				   enum prueth_mem region,
@@ -1022,6 +1023,7 @@ static int icssm_emac_ndo_stop(struct net_device *ndev)
 	phy_stop(emac->phydev);
 
 	napi_disable(&emac->napi);
+	hrtimer_cancel(&emac->tx_hrtimer);
 
 	/* stop the PRU */
 	rproc_shutdown(emac->pru);
@@ -1109,6 +1111,9 @@ static enum netdev_tx icssm_emac_ndo_start_xmit(struct sk_buff *skb,
 
 fail_tx:
 	if (ret == -ENOBUFS) {
+		netif_stop_queue(ndev);
+		hrtimer_start(&emac->tx_hrtimer, us_to_ktime(HR_TIMER_TX_DELAY_US),
+			      HRTIMER_MODE_REL_PINNED);
 		ret = NETDEV_TX_BUSY;
 	} else {
 		/* error */
@@ -1161,6 +1166,17 @@ static int icssm_prueth_node_mac(struct device_node *eth_node)
 		return PRUETH_MAC_INVALID;
 }
 
+static enum hrtimer_restart icssm_emac_tx_timer_callback(struct hrtimer *timer)
+{
+        struct prueth_emac *emac =
+                        container_of(timer, struct prueth_emac, tx_hrtimer);
+
+	if (netif_queue_stopped(emac->ndev))
+		netif_wake_queue(emac->ndev);
+
+	return HRTIMER_NORESTART;
+}
+
 static int icssm_prueth_netdev_init(struct prueth *prueth,
 				    struct device_node *eth_node)
 {
@@ -1254,6 +1270,9 @@ static int icssm_prueth_netdev_init(struct prueth *prueth,
 
 	netif_napi_add(ndev, &emac->napi, icssm_emac_napi_poll);
 
+	hrtimer_setup(&emac->tx_hrtimer, &icssm_emac_tx_timer_callback,
+		      CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
+
 	return 0;
 free:
 	emac->ndev = NULL;
diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.h b/drivers/net/ethernet/ti/icssm/icssm_prueth.h
index 01586e6dbb66..c3f9c59ac6ff 100644
--- a/drivers/net/ethernet/ti/icssm/icssm_prueth.h
+++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.h
@@ -221,6 +221,8 @@ struct prueth_emac {
 	 * during link configuration
 	 */
 	spinlock_t lock;
+
+	struct hrtimer tx_hrtimer;
 };
 
 struct prueth {


Thanks and Regards,
Parvathi.

  reply	other threads:[~2025-07-18 10:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-02 14:06 [PATCH net-next v10 00/11] PRU-ICSSM Ethernet Driver Parvathi Pudi
2025-07-02 14:06 ` [PATCH net-next v10 01/11] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx, AM43xx and AM33xx SOCs Parvathi Pudi
2025-07-02 14:06 ` [PATCH net-next v10 02/11] net: ti: prueth: Adds ICSSM Ethernet driver Parvathi Pudi
2025-07-09  0:44   ` Jakub Kicinski
2025-07-11 12:25     ` Parvathi Pudi
2025-07-02 14:06 ` [PATCH net-next v10 03/11] net: ti: prueth: Adds PRUETH HW and SW configuration Parvathi Pudi
2025-07-09  0:53   ` Jakub Kicinski
2025-07-11 12:28     ` Parvathi Pudi
2025-07-02 15:17 ` [PATCH net-next v10 04/11] net: ti: prueth: Adds link detection, RX and TX support Parvathi Pudi
2025-07-09  1:01   ` Jakub Kicinski
2025-07-11 12:33     ` Parvathi Pudi
2025-07-16 13:11       ` Parvathi Pudi
2025-07-16 21:09         ` Jakub Kicinski
2025-07-18 10:47           ` Parvathi Pudi [this message]
2025-07-18 17:09             ` Jakub Kicinski
2025-07-02 15:17 ` [PATCH net-next v10 05/11] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Parvathi Pudi
2025-07-02 15:17 ` [PATCH net-next v10 06/11] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Parvathi Pudi
2025-07-03 22:52   ` Vadim Fedorenko
2025-07-02 15:17 ` [PATCH net-next v10 07/11] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Parvathi Pudi
2025-07-02 16:24 ` [PATCH net-next v10 08/11] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Parvathi Pudi
2025-07-02 16:24 ` [PATCH net-next v10 09/11] net: ti: prueth: Adds power management support for PRU-ICSS Parvathi Pudi
2025-07-02 16:24 ` [PATCH net-next v10 10/11] net: ti: prueth: Adds support for PRUETH on AM33x and AM43x SOCs Parvathi Pudi
2025-07-02 16:24 ` [PATCH net-next v10 11/11] net: ti: prueth: Adds PTP OC Support for AM335x and AM437x Parvathi Pudi
2025-07-09  0:33 ` [PATCH net-next v10 00/11] PRU-ICSSM Ethernet Driver Jakub Kicinski
2025-07-11 12:20   ` Parvathi Pudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3177386.41994.1752835625751.JavaMail.zimbra@couthit.local \
    --to=parvathi@couthit.com \
    --cc=afd@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=basharath@couthit.com \
    --cc=conor+dt@kernel.org \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=diogo.ivo@siemens.com \
    --cc=edumazet@google.com \
    --cc=glaroque@baylibre.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=krishna@couthit.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=m-malladi@ti.com \
    --cc=mohan@couthit.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pmohan@couthit.com \
    --cc=prajith@ti.com \
    --cc=praneeth@ti.com \
    --cc=pratheesh@ti.com \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=saikrishnag@marvell.com \
    --cc=srk@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=vadim.fedorenko@linux.dev \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).