lan7801 looses VLAN Filter Table
From: Sven Schuchmann <hidden>
Date: 2026-06-18 15:18:44
Hi,
I have a problem with a lan7801 chip in Kernel 6.18. I configure VLAN-ID (2) and an IP address.
But if I disconnect and connect the network-cable several times at some point no packets are
received anymore. Without using VLAN this does not happen.
I tracked this down that sometimes the VLAN Filter table seems
to get cleared. I hooked into the lan78xx.c driver to dump the vlan table:
static void lan78xx_get_stats(struct net_device *netdev,
struct ethtool_stats *stats, u64 *data)
{
struct lan78xx_net *dev = netdev_priv(netdev);
struct lan78xx_priv *pdata = (struct lan78xx_priv *)(dev->data[0]);
lan78xx_update_stats(dev);
for (int i = 0; i < 3; i++) {
u32 buf;
lan78xx_dataport_read(dev, DP_SEL_RSEL_VLAN_DA_, i, 1, &buf);
if (pdata->vlan_table[i] != buf)
netdev_err(dev->net, "VLAN TABLE %d: 0x%08x 0x%08x", i, pdata->vlan_table[i], buf);
else
netdev_info(dev->net, "VLAN TABLE %d: 0x%08x 0x%08x", i, pdata->vlan_table[i], buf);
}
So I can "read out" the table if I do "ethtool -S" and see it in the kernel log.
Normally the output looks like this:
VLAN TABLE 0: 0x00000005 0x00000005
So the table looks as expected. The Local Filter table from pdata is the same as in the chip itself.
But after some cable disconnects and connects I see this:
VLAN TABLE 0: 0x00000005 0x00000000
So the table got cleared or deleted and no paketes on VLAN-ID 2 go through.
I even can do this after I read out the table in lan78xx_get_stats():
lan78xx_dataport_write(dev, DP_SEL_RSEL_VLAN_DA_, 0,
DP_SEL_VHF_VLAN_LEN, pdata->vlan_table);
...and with this I can "fix" the table again from the ethtool and it starts working again.
Has someone seen something like this or can point me to a direction where
I could reinit this table (I already tried at the end of lan78xx_mac_link_up() without success...)
Thanks!
Regards, Sven