summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Gunasekaran <r-gunasekaran@ti.com>2024-03-12 15:56:59 +0530
committerPraneeth Bajjuri <praneeth@ti.com>2024-03-12 15:51:03 -0500
commita082ce3b5578703fd9379919a1a9aab7c64e8c96 (patch)
tree2ce61ff60156cd04a3cd7c1a3699431a2466b58e
parent0553610ace3e1b55eda28ca15863146c90080d83 (diff)
net: hsr: hsr_slave: Fix the promiscuous mode
commit 4322af8c3aec ("net: hsr: Disable promiscuous mode in offload mode") disables promiscuous mode of slave devices while creating an HSR interface. But while deleting the HSR interface, it does not take care of it. It decreases the promiscuous mode count, which eventually enables promiscuous mode on the slave devices when creating HSR interface again. Fix this by not decrementing the promiscuous mode count while deleting the HSR interface when offload is enabled. Fixes: 4322af8c3aec ("net: hsr: Disable promiscuous mode in offload mode") Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
-rw-r--r--net/hsr/hsr_slave.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/hsr/hsr_slave.c b/net/hsr/hsr_slave.c
index fa81035321ae..1b6457f357bd 100644
--- a/net/hsr/hsr_slave.c
+++ b/net/hsr/hsr_slave.c
@@ -157,7 +157,7 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
fail_rx_handler:
netdev_upper_dev_unlink(dev, hsr_dev);
fail_upper_dev_link:
- if (port->hsr->fwd_offloaded)
+ if (!port->hsr->fwd_offloaded)
dev_set_promiscuity(dev, -1);
return res;
@@ -220,7 +220,8 @@ void hsr_del_port(struct hsr_port *port)
netdev_update_features(master->dev);
dev_set_mtu(master->dev, hsr_get_max_mtu(hsr));
netdev_rx_handler_unregister(port->dev);
- dev_set_promiscuity(port->dev, -1);
+ if (!port->hsr->fwd_offloaded)
+ dev_set_promiscuity(port->dev, -1);
netdev_upper_dev_unlink(port->dev, master->dev);
}