Skip to content

Commit 08666cb

Browse files
nbd168kuba-moo
authored andcommitted
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 <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 1904870 commit 08666cb

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

drivers/net/ethernet/mediatek/mtk_eth_soc.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2724,15 +2724,30 @@ static netdev_features_t mtk_fix_features(struct net_device *dev,
27242724

27252725
static int mtk_set_features(struct net_device *dev, netdev_features_t features)
27262726
{
2727-
int err = 0;
2727+
struct mtk_mac *mac = netdev_priv(dev);
2728+
struct mtk_eth *eth = mac->hw;
2729+
netdev_features_t diff = dev->features ^ features;
2730+
int i;
27282731

2729-
if (!((dev->features ^ features) & NETIF_F_LRO))
2732+
if ((diff & NETIF_F_LRO) && !(features & NETIF_F_LRO))
2733+
mtk_hwlro_netdev_disable(dev);
2734+
2735+
/* Set RX VLAN offloading */
2736+
if (!(diff & NETIF_F_HW_VLAN_CTAG_RX))
27302737
return 0;
27312738

2732-
if (!(features & NETIF_F_LRO))
2733-
mtk_hwlro_netdev_disable(dev);
2739+
mtk_w32(eth, !!(features & NETIF_F_HW_VLAN_CTAG_RX),
2740+
MTK_CDMP_EG_CTRL);
27342741

2735-
return err;
2742+
/* sync features with other MAC */
2743+
for (i = 0; i < MTK_MAC_COUNT; i++) {
2744+
if (!eth->netdev[i] || eth->netdev[i] == dev)
2745+
continue;
2746+
eth->netdev[i]->features &= ~NETIF_F_HW_VLAN_CTAG_RX;
2747+
eth->netdev[i]->features |= features & NETIF_F_HW_VLAN_CTAG_RX;
2748+
}
2749+
2750+
return 0;
27362751
}
27372752

27382753
/* wait for DMA to finish whatever it is doing before we start using it again */

0 commit comments

Comments
 (0)