Le Wed, 4 May 2022 19:24:57 +0300, Vladimir Oltean <olteanv@xxxxxxxxx> a écrit : > On Wed, May 04, 2022 at 11:29:56AM +0200, Clément Léger wrote: > > +static int a5psw_port_fdb_del(struct dsa_switch *ds, int port, > > + const unsigned char *addr, u16 vid, > > + struct dsa_db db) > > +{ > > + struct a5psw *a5psw = ds->priv; > > + union lk_data lk_data = {0}; > > + bool clear = false; > > + int ret = 0; > > + u16 entry; > > + u32 reg; > > + > > + ether_addr_copy(lk_data.entry.mac, addr); > > + > > + spin_lock(&a5psw->lk_lock); > > + > > + ret = a5psw_lk_execute_lookup(a5psw, &lk_data, &entry); > > + if (ret) { > > + dev_err(a5psw->dev, "Failed to lookup mac address\n"); > > + goto lk_unlock; > > + } > > + > > + lk_data.hi = a5psw_reg_readl(a5psw, A5PSW_LK_DATA_HI); > > + if (!lk_data.entry.valid) { > > + dev_err(a5psw->dev, "Tried to remove non-existing entry\n"); > > + ret = -ENOENT; > > + goto lk_unlock; > > These error messages can happen under quite normal use with your hardware. > For example: > > ip link add br0 type bridge && ip link set br0 master br0 > bridge fdb add dev swp0 00:01:02:03:04:05 vid 1 master static > bridge fdb add dev swp0 00:01:02:03:04:05 vid 2 master static > bridge fdb del dev swp0 00:01:02:03:04:05 vid 2 master static > bridge fdb del dev swp0 00:01:02:03:04:05 vid 1 master static > > Because the driver ignores the VID, then as soon as the VID 2 FDB entry > is removed, the VID 1 FDB entry doesn't exist anymore, either. Argh did not thought about that but indeed, that will for sure trigger the error. > > The above is a bit artificial. More practically, the bridge installs > local FDB entries (MAC address of bridge device, MAC addresses of ports) > once in the VLAN-unaware database (VID 0), and once per VLAN installed > on br0. Ok, seems clear. > > When the MAC address of br0 is different from that of the ports, and it > is changed by the user, you'll get these errors too, since those changes > translate into a deletion of the old local FDB entries (installed as FDB > entries towards the CPU port). Do you want the users to see them and > think something is wrong? I mean, something _is_ wrong (the hardware), > but you have to work with that somehow. Indeed, I'll simply remove these error message. Should I still return an error value however ? Seems like I should not to avoid triggering any error that might confuse the user. -- Clément Léger, Embedded Linux and Kernel engineer at Bootlin https://bootlin.com