Netdev List
 help / color / mirror / Atom feed
* [PATCH net] bnge: add missing ndo_set_features
@ 2026-08-24  8:50 Vikas Gupta
  2026-08-26 12:30 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Vikas Gupta @ 2026-08-24  8:50 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, andrew+netdev, horms
  Cc: netdev, linux-kernel, bhargava.marreddy, rahul-rg.gupta,
	vsrama-krishna.nemani, rajashekar.hudumula, dharmender.garg,
	ajit.khaparde, Vikas Gupta

The driver advertises togglable RX aggregation offloads (LRO and
GRO_HW) in netdev->hw_features but is missing the ndo_set_features
callback, so it is never notified of a feature change.

For example:

  ethtool -K ethX rx-gro-hw off

is accepted - netdev_update_features() clears the bit in dev->features
but the driver never reprograms the hardware, so the TPA engine keeps
aggregating and dev->features no longer reflects the actual hardware
state.

Add ndo_set_features to reprogram TPA (LRO/GRO_HW) and the RX ring
parameters when these features change.

Fixes: c2effd12c96d ("bng_en: Add support for TPA events")
Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
---
 .../net/ethernet/broadcom/bnge/bnge_netdev.c  | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
index a4288f0258f8..0973cc25a3ec 100644
--- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
+++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
@@ -3267,6 +3267,33 @@ static const struct netdev_stat_ops bnge_stat_ops = {
 	.get_base_stats		= bnge_get_base_stats,
 };
 
+static int bnge_set_features(struct net_device *dev, netdev_features_t features)
+{
+	struct bnge_net *bn = netdev_priv(dev);
+	struct bnge_dev *bd = bn->bd;
+	u32 flags = bn->priv_flags;
+
+	flags &= ~BNGE_NET_EN_TPA;
+	if (features & NETIF_F_GRO_HW)
+		flags |= BNGE_NET_EN_GRO;
+	else if (features & NETIF_F_LRO)
+		flags |= BNGE_NET_EN_LRO;
+
+	if (flags == bn->priv_flags)
+		return 0;
+
+	bn->priv_flags = flags;
+
+	if (!netif_running(dev)) {
+		bnge_set_ring_params(bd);
+		return 0;
+	}
+
+	bnge_close_core(bn);
+	bnge_set_ring_params(bd);
+	return bnge_open_core(bn);
+}
+
 static const struct net_device_ops bnge_netdev_ops = {
 	.ndo_open		= bnge_open,
 	.ndo_stop		= bnge_close,
@@ -3274,6 +3301,7 @@ static const struct net_device_ops bnge_netdev_ops = {
 	.ndo_get_stats64	= bnge_get_stats64,
 	.ndo_set_rx_mode_async	= bnge_set_rx_mode,
 	.ndo_features_check	= bnge_features_check,
+	.ndo_set_features	= bnge_set_features,
 };
 
 static void bnge_init_mac_addr(struct bnge_dev *bd)
-- 
2.47.1


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

end of thread, other threads:[~2026-08-26 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-24  8:50 [PATCH net] bnge: add missing ndo_set_features Vikas Gupta
2026-08-26 12:30 ` Simon Horman

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