Skip to content

Commit cfeb84a

Browse files
vladimirolteanPaolo Abeni
authored andcommitted
net: dsa: suppress appending ethtool stats to LAG DSA masters
Similar to the discussion about tracking the admin/oper state of LAG DSA masters, we have the problem here that struct dsa_port *cpu_dp caches a single pair of orig_ethtool_ops and netdev_ops pointers. So if we call dsa_master_setup(bond0, cpu_dp) where cpu_dp is also the dev->dsa_ptr of one of the physical DSA masters, we'd effectively overwrite what we cached from that physical netdev with what replaced from the bonding interface. We don't need DSA ethtool stats on the bonding interface when used as DSA master, it's good enough to have them just on the physical DSA masters, so suppress this logic. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 6e61b55 commit cfeb84a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

net/dsa/master.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ static int dsa_master_ethtool_setup(struct net_device *dev)
226226
struct dsa_switch *ds = cpu_dp->ds;
227227
struct ethtool_ops *ops;
228228

229+
if (netif_is_lag_master(dev))
230+
return 0;
231+
229232
ops = devm_kzalloc(ds->dev, sizeof(*ops), GFP_KERNEL);
230233
if (!ops)
231234
return -ENOMEM;
@@ -250,13 +253,19 @@ static void dsa_master_ethtool_teardown(struct net_device *dev)
250253
{
251254
struct dsa_port *cpu_dp = dev->dsa_ptr;
252255

256+
if (netif_is_lag_master(dev))
257+
return;
258+
253259
dev->ethtool_ops = cpu_dp->orig_ethtool_ops;
254260
cpu_dp->orig_ethtool_ops = NULL;
255261
}
256262

257263
static void dsa_netdev_ops_set(struct net_device *dev,
258264
const struct dsa_netdevice_ops *ops)
259265
{
266+
if (netif_is_lag_master(dev))
267+
return;
268+
260269
dev->dsa_ptr->netdev_ops = ops;
261270
}
262271

0 commit comments

Comments
 (0)