public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH net] net: taprio: Validate offload support using NETIF_F_HW_TC in hw_features
@ 2025-07-29  6:10 Vineeth Karumanchi
  2025-07-29  6:45 ` Eric Dumazet
  0 siblings, 1 reply; 5+ messages in thread
From: Vineeth Karumanchi @ 2025-07-29  6:10 UTC (permalink / raw)
  To: git, vinicius.gomes, jhs, xiyou.wangcong, jiri, davem, edumazet,
	kuba, pabeni, horms, netdev, linux-kernel
  Cc: vineeth.karumanchi

The current taprio offload validation relies solely on the presence of
.ndo_setup_tc, which is insufficient. Some IP versions of a driver expose
.ndo_setup_tc but lack actual hardware offload support for taprio.

To address this, add a check for NETIF_F_HW_TC in netdev->hw_features.
This ensures that taprio offload is only enabled on devices that
explicitly advertise hardware traffic control capabilities.

Note: Some drivers already set NETIF_F_HW_TC alongside .ndo_setup_tc.
Follow-up patches will be submitted to update remaining drivers if this
approach is accepted.

Signed-off-by: Vineeth Karumanchi <vineeth.karumanchi@amd.com>
---
 net/sched/sch_taprio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
index 2b14c81a87e5..a797995bdc8d 100644
--- a/net/sched/sch_taprio.c
+++ b/net/sched/sch_taprio.c
@@ -1506,7 +1506,7 @@ static int taprio_enable_offload(struct net_device *dev,
 	struct tc_taprio_caps caps;
 	int tc, err = 0;
 
-	if (!ops->ndo_setup_tc) {
+	if (!ops->ndo_setup_tc || !(dev->hw_features & NETIF_F_HW_TC)) {
 		NL_SET_ERR_MSG(extack,
 			       "Device does not support taprio offload");
 		return -EOPNOTSUPP;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-30  5:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29  6:10 [RFC PATCH net] net: taprio: Validate offload support using NETIF_F_HW_TC in hw_features Vineeth Karumanchi
2025-07-29  6:45 ` Eric Dumazet
2025-07-29 10:40   ` Karumanchi, Vineeth
2025-07-29 13:36     ` Eric Dumazet
2025-07-30  5:49       ` Karumanchi, Vineeth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox