[PATCH v1 2/8] drivers: net: stmmac_main: fix vlan toggle option.

From: Boon Khai Ng
Date: Thu Mar 30 2023 - 03:03:21 EST


This patch is to fix toggling rx vlan offload from the ethool.

Signed-off-by: Boon Khai Ng <boon.khai.ng@xxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 8ee595d46481..664c32d61622 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4565,10 +4565,8 @@ static void stmmac_rx_vlan(struct net_device *dev, struct sk_buff *skb)
veth = (struct vlan_ethhdr *)skb->data;
vlan_proto = veth->h_vlan_proto;

- if ((vlan_proto == htons(ETH_P_8021Q) &&
- dev->features & NETIF_F_HW_VLAN_CTAG_RX) ||
- (vlan_proto == htons(ETH_P_8021AD) &&
- dev->features & NETIF_F_HW_VLAN_STAG_RX)) {
+ if (vlan_proto == htons(ETH_P_8021Q) ||
+ vlan_proto == htons(ETH_P_8021AD)) {
/* pop the vlan tag */
vlanid = ntohs(veth->h_vlan_TCI);
memmove(skb->data + VLAN_HLEN, veth, ETH_ALEN * 2);
@@ -5685,6 +5683,8 @@ static int stmmac_set_features(struct net_device *netdev,

if (changed & NETIF_F_HW_VLAN_CTAG_RX)
stmmac_set_hw_vlan_mode(priv, priv->ioaddr, features);
+ priv->plat->use_hw_vlan = features & NETIF_F_HW_VLAN_CTAG_RX;
+ }

return 0;
}
--
2.25.1