Skip to content

Commit da106a1

Browse files
ffainellidavem330
authored andcommitted
net: systemport: Unmap queues upon DSA unregister event
Binding and unbinding the switch driver which creates the DSA slave network devices for which we set-up inspection would lead to undesireable effects since we were not clearing the port/queue mapping to the SYSTEMPORT TX queue. Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 25c4407 commit da106a1

File tree

1 file changed

+50
-6
lines changed

1 file changed

+50
-6
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2383,17 +2383,61 @@ static int bcm_sysport_map_queues(struct notifier_block *nb,
23832383
return 0;
23842384
}
23852385

2386+
static int bcm_sysport_unmap_queues(struct notifier_block *nb,
2387+
struct dsa_notifier_register_info *info)
2388+
{
2389+
struct bcm_sysport_tx_ring *ring;
2390+
struct bcm_sysport_priv *priv;
2391+
struct net_device *slave_dev;
2392+
unsigned int num_tx_queues;
2393+
struct net_device *dev;
2394+
unsigned int q, port;
2395+
2396+
priv = container_of(nb, struct bcm_sysport_priv, dsa_notifier);
2397+
if (priv->netdev != info->master)
2398+
return 0;
2399+
2400+
dev = info->master;
2401+
2402+
if (dev->netdev_ops != &bcm_sysport_netdev_ops)
2403+
return 0;
2404+
2405+
port = info->port_number;
2406+
slave_dev = info->info.dev;
2407+
2408+
num_tx_queues = slave_dev->real_num_tx_queues;
2409+
2410+
for (q = 0; q < dev->num_tx_queues; q++) {
2411+
ring = &priv->tx_rings[q];
2412+
2413+
if (ring->switch_port != port)
2414+
continue;
2415+
2416+
if (!ring->inspect)
2417+
continue;
2418+
2419+
ring->inspect = false;
2420+
priv->ring_map[q + port * num_tx_queues] = NULL;
2421+
}
2422+
2423+
return 0;
2424+
}
2425+
23862426
static int bcm_sysport_dsa_notifier(struct notifier_block *nb,
23872427
unsigned long event, void *ptr)
23882428
{
2389-
struct dsa_notifier_register_info *info;
2429+
int ret = NOTIFY_DONE;
23902430

2391-
if (event != DSA_PORT_REGISTER)
2392-
return NOTIFY_DONE;
2393-
2394-
info = ptr;
2431+
switch (event) {
2432+
case DSA_PORT_REGISTER:
2433+
ret = bcm_sysport_map_queues(nb, ptr);
2434+
break;
2435+
case DSA_PORT_UNREGISTER:
2436+
ret = bcm_sysport_unmap_queues(nb, ptr);
2437+
break;
2438+
}
23952439

2396-
return notifier_from_errno(bcm_sysport_map_queues(nb, info));
2440+
return notifier_from_errno(ret);
23972441
}
23982442

23992443
#define REV_FMT "v%2x.%02x"

0 commit comments

Comments
 (0)