mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
net: ethernet: mtk_eth_soc: add support for configuring vlan rx offload
Keep the vlan rx offload feature in sync across all netdevs belonging to the device, since the feature is global and can't be turned off per MAC Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
1904870315
commit
08666cbb7d
@ -2724,15 +2724,30 @@ static netdev_features_t mtk_fix_features(struct net_device *dev,
|
||||
|
||||
static int mtk_set_features(struct net_device *dev, netdev_features_t features)
|
||||
{
|
||||
int err = 0;
|
||||
struct mtk_mac *mac = netdev_priv(dev);
|
||||
struct mtk_eth *eth = mac->hw;
|
||||
netdev_features_t diff = dev->features ^ features;
|
||||
int i;
|
||||
|
||||
if (!((dev->features ^ features) & NETIF_F_LRO))
|
||||
return 0;
|
||||
|
||||
if (!(features & NETIF_F_LRO))
|
||||
if ((diff & NETIF_F_LRO) && !(features & NETIF_F_LRO))
|
||||
mtk_hwlro_netdev_disable(dev);
|
||||
|
||||
return err;
|
||||
/* Set RX VLAN offloading */
|
||||
if (!(diff & NETIF_F_HW_VLAN_CTAG_RX))
|
||||
return 0;
|
||||
|
||||
mtk_w32(eth, !!(features & NETIF_F_HW_VLAN_CTAG_RX),
|
||||
MTK_CDMP_EG_CTRL);
|
||||
|
||||
/* sync features with other MAC */
|
||||
for (i = 0; i < MTK_MAC_COUNT; i++) {
|
||||
if (!eth->netdev[i] || eth->netdev[i] == dev)
|
||||
continue;
|
||||
eth->netdev[i]->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
|
||||
eth->netdev[i]->features |= features & NETIF_F_HW_VLAN_CTAG_RX;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* wait for DMA to finish whatever it is doing before we start using it again */
|
||||
|
Loading…
Reference in New Issue
Block a user