mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
To: <nicolas.ferre@microchip.com>, <claudiu.beznea@tuxon.dev>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <git@amd.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <vineeth.karumanchi@amd.com>
Subject: [PATCH net-next 4/6] net: macb: Implement TAPRIO DESTROY command offload for gate cleanup
Date: Tue, 22 Jul 2025 21:11:09 +0530	[thread overview]
Message-ID: <20250722154111.1871292-5-vineeth.karumanchi@amd.com> (raw)
In-Reply-To: <20250722154111.1871292-1-vineeth.karumanchi@amd.com>

Add hardware offload support for "tc qdisc destroy" operations to safely
remove IEEE 802.1Qbv time-gated scheduling configuration and restore
default queue behavior.

Cleanup sequence:
- Reset network device TC configuration state
- Disable Enhanced Network Scheduling and Timing for all queues
- Clear all ENST timing control registers (START_TIME, ON_TIME, OFF_TIME)
- Atomic register programming with proper synchronization

This ensures complete removal of time-aware scheduling state, returning
the controller to standard FIFO queue operation without residual timing
constraints

Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 28 ++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 4518b59168d5..6b3eff28a842 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4239,6 +4239,34 @@ static int macb_taprio_setup_replace(struct net_device *ndev,
 	return err;
 }
 
+static void macb_taprio_destroy(struct net_device *ndev)
+{
+	struct macb *bp = netdev_priv(ndev);
+	struct macb_queue *queue;
+	unsigned long flags;
+	u32 enst_disable_mask;
+	u8 i;
+
+	netdev_reset_tc(ndev);
+	enst_disable_mask = GENMASK(bp->num_queues - 1, 0) << GEM_ENST_DISABLE_QUEUE_OFFSET;
+	netdev_dbg(ndev, "TAPRIO destroy: disabling all gates\n");
+
+	spin_lock_irqsave(&bp->lock, flags);
+
+	/* Single disable command for all queues */
+	gem_writel(bp, ENST_CONTROL, enst_disable_mask);
+
+	/* Clear all queue ENST registers in batch */
+	for (i = 0; i < bp->num_queues; i++) {
+		queue = &bp->queues[i];
+		queue_writel(queue, ENST_START_TIME, 0);
+		queue_writel(queue, ENST_ON_TIME, 0);
+		queue_writel(queue, ENST_OFF_TIME, 0);
+	}
+
+	spin_unlock_irqrestore(&bp->lock, flags);
+}
+
 static const struct net_device_ops macb_netdev_ops = {
 	.ndo_open		= macb_open,
 	.ndo_stop		= macb_close,
-- 
2.34.1


  parent reply	other threads:[~2025-07-22 15:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 15:41 [PATCH net-next 0/6] net: macb: Add TAPRIO traffic scheduling support Vineeth Karumanchi
2025-07-22 15:41 ` [PATCH net-next 1/6] net: macb: Define ENST hardware registers for time-aware scheduling Vineeth Karumanchi
2025-07-26 12:23   ` claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 2/6] net: macb: Integrate ENST timing parameters and hardware unit conversion Vineeth Karumanchi
2025-07-26 12:24   ` claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 3/6] net: macb: Add IEEE 802.1Qbv TAPRIO REPLACE command offload support Vineeth Karumanchi
2025-07-23 10:02   ` kernel test robot
2025-07-26 12:25   ` claudiu beznea (tuxon)
2025-07-26 15:32     ` Andrew Lunn
2025-07-29  8:59     ` Karumanchi, Vineeth
2025-07-31  9:07       ` Claudiu Beznea
2025-07-22 15:41 ` Vineeth Karumanchi [this message]
2025-07-26 12:26   ` [PATCH net-next 4/6] net: macb: Implement TAPRIO DESTROY command offload for gate cleanup claudiu beznea (tuxon)
2025-07-22 15:41 ` [PATCH net-next 5/6] net: macb: Implement TAPRIO TC offload command interface Vineeth Karumanchi
2025-07-26 12:29   ` claudiu beznea (tuxon)
2025-07-29  9:38     ` Karumanchi, Vineeth
2025-07-31  9:07       ` Claudiu Beznea
2025-07-28 16:31   ` kernel test robot
2025-07-22 15:41 ` [PATCH net-next 6/6] net: macb: Add MACB_CAPS_QBV capability flag for IEEE 802.1Qbv support Vineeth Karumanchi
2025-07-23 19:05   ` Simon Horman
2025-07-29  9:42     ` Karumanchi, Vineeth
2025-07-24  0:46   ` kernel test robot

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=20250722154111.1871292-5-vineeth.karumanchi@amd.com \
    --to=vineeth.karumanchi@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=git@amd.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.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®