mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	Jakub Kicinski <kuba@kernel.org>,
	davem@davemloft.net, Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	Willem de Bruijn <willemb@google.com>,
	Chen-Yu Tsai <wens@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Russell King <linux@armlinux.org.uk>,
	Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>,
	Nicolai Buchwitz <nb@tipi-net.de>
Cc: "Maxime Chevallier" <maxime.chevallier@bootlin.com>,
	thomas.petazzoni@bootlin.com,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev
Subject: [PATCH net-next 3/3] net: stmmac: dwmac-sun8i: configure the pause time for TX flow control
Date: Sun, 22 Nov 2026 15:49:25 +0100	[thread overview]
Message-ID: <20261122144926.284857-4-maxime.chevallier@bootlin.com> (raw)
In-Reply-To: <20261122144926.284857-1-maxime.chevallier@bootlin.com>

When sending pause frames for flow control, we need to indicate the
number of quantums the peer should wait before sending more frames.

This is maintained in stmmac's "pause_time" global variable (it's a
module param).

Let's program the pause time value, and also allow sending the
zero-quanta pause frame when the peer can resume sending traffic.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 75c743dfe348..613199da57c1 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -232,6 +232,8 @@ static const struct emac_variant emac_variant_h616_emac1 = {
 
 /* Used in EMAC_TX_FLOW_CTL */
 #define EMAC_TX_FLOW_CTL_EN             BIT(0)
+#define EMAC_TX_FLOW_CTL_ZQP_FRM_EN	BIT(1)
+#define EMAC_TX_FLOW_CTL_PAUSE_TIME	GENMASK(19, 4)
 
 /* Used in EMAC_INT_STA */
 #define EMAC_TX_INT             BIT(0)
@@ -784,10 +786,11 @@ static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw,
 	writel(v, ioaddr + EMAC_RX_CTL1);
 
 	v = readl(ioaddr + EMAC_TX_FLOW_CTL);
+	v &= ~(EMAC_TX_FLOW_CTL_EN | EMAC_TX_FLOW_CTL_ZQP_FRM_EN |
+	       EMAC_TX_FLOW_CTL_PAUSE_TIME);
 	if (fc & FLOW_TX)
-		v |= EMAC_TX_FLOW_CTL_EN;
-	else
-		v &= ~EMAC_TX_FLOW_CTL_EN;
+		v |= EMAC_TX_FLOW_CTL_EN | EMAC_TX_FLOW_CTL_ZQP_FRM_EN |
+		     FIELD_PREP(EMAC_TX_FLOW_CTL_PAUSE_TIME, pause_time);
 	writel(v, ioaddr + EMAC_TX_FLOW_CTL);
 }
 
-- 
2.56.1


  parent reply	other threads:[~2026-11-22 14:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 14:49 [PATCH net-next 0/3] net: stmmac: dwmac-sun8i: enable Flow Control Maxime Chevallier
2026-11-22 14:49 ` [PATCH net-next 1/3] net: stmmac: dwmac-sun8i: allow controlling TX and RX flow control separately Maxime Chevallier
2026-11-22 15:54   ` Nicolai Buchwitz
2026-11-22 16:00   ` Chen-Yu Tsai
2026-11-22 14:49 ` [PATCH net-next 2/3] net: stmmac: dwmac-sun8i: emit pause frames when the RX FIFO fills Maxime Chevallier
2026-11-22 15:57   ` Nicolai Buchwitz
2026-11-22 16:11   ` Chen-Yu Tsai
2026-11-22 14:49 ` Maxime Chevallier [this message]
2026-11-22 15:58   ` [PATCH net-next 3/3] net: stmmac: dwmac-sun8i: configure the pause time for TX flow control Nicolai Buchwitz

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=20261122144926.284857-4-maxime.chevallier@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=samuel@sholland.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wens@kernel.org \
    --cc=willemb@google.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

all inboxes | Powered by JetHome®