mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
net: hsr: Disable promiscuous mode in offload mode
When port-to-port forwarding for interfaces in HSR node is enabled, disable promiscuous mode since L2 frame forward happens at the offloaded hardware. Signed-off-by: Ravi Gunasekaran <r-gunasekaran@ti.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Link: https://lore.kernel.org/r/20230614114710.31400-1-r-gunasekaran@ti.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
ff9b63c80b
commit
e748d0fd66
3 changed files with 17 additions and 4 deletions
|
@ -531,6 +531,11 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
|
||||||
if (res)
|
if (res)
|
||||||
goto err_add_master;
|
goto err_add_master;
|
||||||
|
|
||||||
|
/* HSR forwarding offload supported in lower device? */
|
||||||
|
if ((slave[0]->features & NETIF_F_HW_HSR_FWD) &&
|
||||||
|
(slave[1]->features & NETIF_F_HW_HSR_FWD))
|
||||||
|
hsr->fwd_offloaded = true;
|
||||||
|
|
||||||
res = register_netdevice(hsr_dev);
|
res = register_netdevice(hsr_dev);
|
||||||
if (res)
|
if (res)
|
||||||
goto err_unregister;
|
goto err_unregister;
|
||||||
|
|
|
@ -208,6 +208,7 @@ struct hsr_priv {
|
||||||
u8 net_id; /* for PRP, it occupies most significant 3 bits
|
u8 net_id; /* for PRP, it occupies most significant 3 bits
|
||||||
* of lan_id
|
* of lan_id
|
||||||
*/
|
*/
|
||||||
|
bool fwd_offloaded; /* Forwarding offloaded to HW */
|
||||||
unsigned char sup_multicast_addr[ETH_ALEN] __aligned(sizeof(u16));
|
unsigned char sup_multicast_addr[ETH_ALEN] __aligned(sizeof(u16));
|
||||||
/* Align to u16 boundary to avoid unaligned access
|
/* Align to u16 boundary to avoid unaligned access
|
||||||
* in ether_addr_equal
|
* in ether_addr_equal
|
||||||
|
|
|
@ -131,9 +131,14 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
|
||||||
struct hsr_port *master;
|
struct hsr_port *master;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
/* Don't use promiscuous mode for offload since L2 frame forward
|
||||||
|
* happens at the offloaded hardware.
|
||||||
|
*/
|
||||||
|
if (!port->hsr->fwd_offloaded) {
|
||||||
res = dev_set_promiscuity(dev, 1);
|
res = dev_set_promiscuity(dev, 1);
|
||||||
if (res)
|
if (res)
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
|
master = hsr_port_get_hsr(hsr, HSR_PT_MASTER);
|
||||||
hsr_dev = master->dev;
|
hsr_dev = master->dev;
|
||||||
|
@ -152,7 +157,9 @@ static int hsr_portdev_setup(struct hsr_priv *hsr, struct net_device *dev,
|
||||||
fail_rx_handler:
|
fail_rx_handler:
|
||||||
netdev_upper_dev_unlink(dev, hsr_dev);
|
netdev_upper_dev_unlink(dev, hsr_dev);
|
||||||
fail_upper_dev_link:
|
fail_upper_dev_link:
|
||||||
|
if (!port->hsr->fwd_offloaded)
|
||||||
dev_set_promiscuity(dev, -1);
|
dev_set_promiscuity(dev, -1);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue