net: usb: lan78xx: disable VLAN filter in promiscuous mode
Subsystems (5)
PATCH v3 1/1 net: usb: lan78xx: disable VLAN filter in promiscuous mode
The hardware VLAN filter (RFE_CTL_VLAN_FILTER_) drops VLAN-tagged frames whose VID has not been registered via lan78xx_vlan_rx_add_vid(). It is left enabled in promiscuous mode, so packet capture (e.g. tcpdump or Wireshark) does not see tagged frames for unregistered VIDs.
Clear the filter while the interface is promiscuous and restore it from NETIF_F_HW_VLAN_CTAG_FILTER otherwise. Enforce the same condition in lan78xx_set_features() so netdev_update_features() cannot re-enable the filter while promiscuous.
---
Currently, on microchip lan7801, enabling promiscuous mode does not
result in VLAN tagged packets being captured. This patch fixes this,
forcing the RFE_CTL_VLAN_FILTER_ flag to be off when promiscuous mode is
enabled.
---
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- moved VLAN filter logic into lan78xx_update_vlan_filter()
- Link to v1: https://patch.msgid.link/[email protected]
To: Thangaraj Samynathan <[email protected]>
To: Rengarajan Sundararajan <[email protected]>
To: [email protected]
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
--- drivers/net/usb/lan78xx.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
drivers/net/usb/lan78xx.c +14 -4
@@ -1499,6 +1499,17 @@ static void lan78xx_deferred_multicast_write(struct work_struct *param)return ; } +static void lan78xx_update_vlan_filter (struct lan78xx_priv *pdata, +struct net_device *netdev, +netdev_features_t features) +{ +if ((features &NETIF_F_HW_VLAN_CTAG_FILTER ) && + !(netdev->flags &IFF_PROMISC )) + pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; +else + pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; +} +static void lan78xx_set_multicast (struct net_device *netdev) {struct lan78xx_net *dev =netdev_priv (netdev);
@@ -1533,6 +1544,8 @@ static void lan78xx_set_multicast(struct net_device *netdev) } } +lan78xx_update_vlan_filter (pdata, dev->net, dev->net->features); +if (netdev_mc_count (dev->net)) {struct netdev_hw_addr *ha;int i;
@@ -3074,10 +3087,7 @@ static int lan78xx_set_features(struct net_device *netdev,else pdata->rfe_ctl &= ~RFE_CTL_VLAN_STRIP_ ; -if (features &NETIF_F_HW_VLAN_CTAG_FILTER ) - pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; -else - pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; +lan78xx_update_vlan_filter (pdata, netdev, features);spin_unlock_irqrestore (&pdata->rfe_ctl_lock, flags);
---
base-commit: dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260623-lan78xx-vlan-promisc-83af8a48a7ec
Best regards,
Signature · 1 line
Enrico Pozzobon <[email protected]>
Quoted 98 lines · On 1.7.2026 16:47, Enrico Pozzobon via B4 Relay wrote:
From: Enrico Pozzobon <[email protected]>
The hardware VLAN filter (
RFE_CTL_VLAN_FILTER_) drops VLAN-tagged frames whose VID has not been registered vialan78xx_vlan_rx_add_vid(). It is left enabled in promiscuous mode, so packet capture (e.g. tcpdump or Wireshark) does not see tagged frames for unregistered VIDs.Clear the filter while the interface is promiscuous and restore it from
NETIF_F_HW_VLAN_CTAG_FILTERotherwise. Enforce the same condition inlan78xx_set_features()sonetdev_update_features()cannot re-enable the filter while promiscuous.Fixes 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")Signed-off-by Enrico Pozzobon <[email protected]>---
Currently, on microchip lan7801, enabling promiscuous mode does not result in VLAN tagged packets being captured. This patch fixes this, forcing theRFE_CTL_VLAN_FILTER_flag to be off when promiscuous mode is enabled.
---
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2:
https://patch.msgid.link/[email protected]Changes in v2:
- moved VLAN filter logic intolan78xx_update_vlan_filter()
- Link to v1:
https://patch.msgid.link/[email protected]To: Thangaraj Samynathan <[email protected]>
To: Rengarajan Sundararajan <[email protected]>
To: [email protected]
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/net/usb/lan78xx.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/net/usb/lan78xx.c +11
-0@@ -1499,6 +1499,17 @@ static void lan78xx_deferred_multicast_write(struct work_struct *param) return; } +static void lan78xx_update_vlan_filter (struct lan78xx_priv *pdata, +struct net_device *netdev, +netdev_features_t features) +{ +if ((features &NETIF_F_HW_VLAN_CTAG_FILTER ) && + !(netdev->flags &IFF_PROMISC )) + pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; +else + pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; +} +static void lan78xx_set_multicast (struct net_device *netdev) {drivers/net/usb/lan78xx.c +2
-0struct lan78xx_net *dev =netdev_priv (netdev);@@ -1533,6 +1544,8 @@ static void lan78xx_set_multicast(struct net_device *netdev) } } +lan78xx_update_vlan_filter (pdata, dev->net, dev->net->features); +if (netdev_mc_count (dev->net)) {struct netdev_hw_addr *ha;drivers/net/usb/lan78xx.c +1
-5int i;@@ -3074,10 +3087,7 @@ static int lan78xx_set_features(structnet_device *netdev, else pdata->rfe_ctl &= ~RFE_CTL_VLAN_STRIP_; -if (features &NETIF_F_HW_VLAN_CTAG_FILTER ) - pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; -else - pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; +lan78xx_update_vlan_filter (pdata, netdev, features);spin_unlock_irqrestore (&pdata->rfe_ctl_lock, flags); ---base-commit:
dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260623-lan78xx-vlan-promisc-83af8a48a7ec
Quoted 3 lines
Best regards,
--
Enrico Pozzobon <[email protected]>
v2 is marked superseded in patchwork, so FWIW
Thanks
Nicolai
Hi,
Quoted 126 lines
-----Original Message-----
From: Nicolai Buchwitz <[email protected]>
Sent: Monday, July 6, 2026 1:08 PM
To: [email protected]
Cc: Thangaraj Samynathan - I53494 <[email protected]>; Rengarajan Sundararajan <[email protected]>; UNGLinuxDriver <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; Woojung Huh - C21699 <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH net v3] net: usb: lan78xx: disable VLAN filter in promiscuous modeEXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
Quoted 10 lines · On 1.7.2026 16:47, Enrico Pozzobon via B4 Relay wrote:
From: Enrico Pozzobon <[email protected]>
The hardware VLAN filter (
RFE_CTL_VLAN_FILTER_) drops VLAN-tagged frames whose VID has not been registered vialan78xx_vlan_rx_add_vid(). It is left enabled in promiscuous mode, so packet capture (e.g. tcpdump or
Wireshark) does not see tagged frames for unregistered VIDs.Clear the filter while the interface is promiscuous and restore it from
NETIF_F_HW_VLAN_CTAG_FILTERotherwise. Enforce the samecondition
Quoted 90 lines
in
lan78xx_set_features()sonetdev_update_features()cannot re-enable the filter while promiscuous.Fixes 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to10/100/1000 Ethernet device driver")
Signed-off-by Enrico Pozzobon <[email protected]>---
Currently, on microchip lan7801, enabling promiscuous mode does not result in VLAN tagged packets being captured. This patch fixes this, forcing theRFE_CTL_VLAN_FILTER_flag to be off when promiscuous mode is enabled.
---
Changes in v3:
- EDITME: describe what is new in this series revision.
- EDITME: use bulletpoints and terse descriptions.
- Link to v2:
https://patch.msgid.link/20260701-lan78xx-vlan-promisc-v2-1-fe3b180667
[email protected]Changes in v2:
- moved VLAN filter logic intolan78xx_update_vlan_filter()
- Link to v1:
https://patch.msgid.link/20260630-lan78xx-vlan-promisc-v1-1-fbf0f903bd
[email protected]To: Thangaraj Samynathan <[email protected]>
To: Rengarajan Sundararajan <[email protected]>
To: [email protected]
To: Andrew Lunn <[email protected]>
To: "David S. Miller" <[email protected]>
To: Eric Dumazet <[email protected]>
To: Jakub Kicinski <[email protected]>
To: Paolo Abeni <[email protected]>
To: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]--- drivers/net/usb/lan78xx.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)drivers/net/usb/lan78xx.c +10
-0@@ -1499,6 +1499,17 @@ static void lan78xx_deferred_multicast_write(struct work_struct *param) return; } +static void lan78xx_update_vlan_filter (struct lan78xx_priv *pdata, +struct net_device *netdev, +netdev_features_t features) { +if ((features &NETIF_F_HW_VLAN_CTAG_FILTER ) && + !(netdev->flags &IFF_PROMISC )) + pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; +else + pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; } +static void lan78xx_set_multicast (struct net_device *netdev) { struct lan78xx_net *dev = netdev_priv(netdev); @@ -1533,6 +1544,8 @@ static void lan78xx_set_multicast(struct net_device*netdev)
} }drivers/net/usb/lan78xx.c +3
-5+lan78xx_update_vlan_filter (pdata, dev->net, dev->net->features); +if (netdev_mc_count (dev->net)) {struct netdev_hw_addr *ha;int i;@@ -3074,10 +3087,7 @@ static int lan78xx_set_features(structnet_device *netdev, else pdata->rfe_ctl &= ~RFE_CTL_VLAN_STRIP_; -if (features &NETIF_F_HW_VLAN_CTAG_FILTER ) - pdata->rfe_ctl |=RFE_CTL_VLAN_FILTER_ ; -else - pdata->rfe_ctl &= ~RFE_CTL_VLAN_FILTER_ ; +lan78xx_update_vlan_filter (pdata, netdev, features);spin_unlock_irqrestore (&pdata->rfe_ctl_lock, flags); ---base-commit:
dc59e4fea9d83f03bad6bddf3fa2e52491777482
change-id: 20260623-lan78xx-vlan-promisc-83af8a48a7ecQuoted 3 lines
Best regards,
--
Enrico Pozzobon <[email protected]>v2 is marked superseded in patchwork, so FWIW
Quoted 4 lines
Reviewed-by Nicolai Buchwitz <[email protected]>Thanks
Nicolai
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Wed, 01 Jul 2026 16:47:23 +0200 you wrote:
From: Enrico Pozzobon <[email protected]>
The hardware VLAN filter (
RFE_CTL_VLAN_FILTER_) drops VLAN-tagged frames whose VID has not been registered vialan78xx_vlan_rx_add_vid(). It is left enabled in promiscuous mode, so packet capture (e.g. tcpdump or Wireshark) does not see tagged frames for unregistered VIDs.[...]
Here is the summary with links:
- [net,v3] net: usb: lan78xx: disable VLAN filter in promiscuous mode
https://git.kernel.org/netdev/net/c/60444706aa17
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html