Ido Schimmel
2022-Jun-02 10:39 UTC
[Bridge] [PATCH V3 net-next 1/4] net: bridge: add fdb flag to extent locked port feature
On Thu, Jun 02, 2022 at 01:30:06PM +0300, Nikolay Aleksandrov wrote:> On 02/06/2022 13:17, Hans Schultz wrote: > > On tor, jun 02, 2022 at 12:33, Nikolay Aleksandrov <razor at blackwall.org> wrote: > >> On 02/06/2022 12:17, Hans Schultz wrote: > >>> On tis, maj 31, 2022 at 17:23, Ido Schimmel <idosch at nvidia.com> wrote: > >>>> On Tue, May 31, 2022 at 11:34:21AM +0200, Hans Schultz wrote: > > > >>> Another issue is that > >>> bridge fdb add MAC dev DEV master static > >>> seems to add the entry with the SELF flag set, which I don't think is > >>> what we would want it to do or? > >> > >> I don't see such thing (hacked iproute2 to print the flags before cmd): > >> $ bridge fdb add 00:11:22:33:44:55 dev vnet110 master static > >> flags 0x4 > >> > >> 0x4 = NTF_MASTER only > >> > > > > I also get 0x4 from iproute2, but I still get SELF entries when I look > > with: > > bridge fdb show dev DEV > > > > after the above add: > $ bridge fdb show dev vnet110 | grep 00:11 > 00:11:22:33:44:55 master virbr0 staticI think Hans is testing with mv88e6xxx which dumps entries directly from HW via ndo_fdb_dump(). See dsa_slave_port_fdb_do_dump() which sets NTF_SELF. Hans, are you seeing the entry twice? Once with 'master' and once with 'self'?> > >>> Also the replace command is not really supported properly as it is. I > >>> have made a fix for that which looks something like this: > >>> > >>> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c > >>> index 6cbb27e3b976..f43aa204f375 100644 > >>> --- a/net/bridge/br_fdb.c > >>> +++ b/net/bridge/br_fdb.c > >>> @@ -917,6 +917,9 @@ static int fdb_add_entry(struct net_bridge *br, struct net_bridge_port *source, > >>> if (flags & NLM_F_EXCL) > >>> return -EEXIST; > >>> > >>> + if (flags & NLM_F_REPLACE) > >>> + modified = true; > >>> + > >>> if (READ_ONCE(fdb->dst) != source) { > >>> WRITE_ONCE(fdb->dst, source); > >>> modified = true; > >>> > >>> The argument for always sending notifications to the driver in the case > >>> of replace is that a replace command will refresh the entries timeout if > >>> the entry is the same. Any thoughts on this? > >> > >> I don't think so. It always updates its "used" timer, not its "updated" timer which is the one > >> for expire. A replace that doesn't actually change anything on the entry shouldn't generate > >> a notification. > > > > Okay, so then there is missing checks on flags as the issue arose from > > replacing locked entries with dynamic entries. I will do another fix > > based on flags as modified needs to be true for the driver to get notified. >
Hans Schultz
2022-Jun-02 11:36 UTC
[Bridge] [PATCH V3 net-next 1/4] net: bridge: add fdb flag to extent locked port feature
On tor, jun 02, 2022 at 13:39, Ido Schimmel <idosch at nvidia.com> wrote:> On Thu, Jun 02, 2022 at 01:30:06PM +0300, Nikolay Aleksandrov wrote: >> On 02/06/2022 13:17, Hans Schultz wrote: >> > On tor, jun 02, 2022 at 12:33, Nikolay Aleksandrov <razor at blackwall.org> wrote: >> >> On 02/06/2022 12:17, Hans Schultz wrote: >> >>> On tis, maj 31, 2022 at 17:23, Ido Schimmel <idosch at nvidia.com> wrote: >> >>>> On Tue, May 31, 2022 at 11:34:21AM +0200, Hans Schultz wrote: >> > >> >>> Another issue is that >> >>> bridge fdb add MAC dev DEV master static >> >>> seems to add the entry with the SELF flag set, which I don't think is >> >>> what we would want it to do or? >> >> >> >> I don't see such thing (hacked iproute2 to print the flags before cmd): >> >> $ bridge fdb add 00:11:22:33:44:55 dev vnet110 master static >> >> flags 0x4 >> >> >> >> 0x4 = NTF_MASTER only >> >> >> > >> > I also get 0x4 from iproute2, but I still get SELF entries when I look >> > with: >> > bridge fdb show dev DEV >> > >> >> after the above add: >> $ bridge fdb show dev vnet110 | grep 00:11 >> 00:11:22:33:44:55 master virbr0 static> > I think Hans is testing with mv88e6xxx which dumps entries directly from > HW via ndo_fdb_dump(). See dsa_slave_port_fdb_do_dump() which sets > NTF_SELF. > > Hans, are you seeing the entry twice? Once with 'master' and once with > 'self'? >Well yes, but I get some additional entries with 'self' for different vlans. So from clean adding a random fdb entry I get 4 entries on the port, 2 with 'master' and two with 'self'. It looks like this: # bridge fdb add 00:22:33:44:55:66 dev eth6 master static # bridge fdb show dev eth6 | grep 55 00:22:33:44:55:66 vlan 1 master br0 offload static 00:22:33:44:55:66 master br0 offload static 00:22:33:44:55:66 vlan 1 self static 00:22:33:44:55:66 vlan 4095 self static If I do a replace of a locked entry I only get one with the 'self' flag.
Hans Schultz
2022-Jun-02 12:08 UTC
[Bridge] [PATCH V3 net-next 1/4] net: bridge: add fdb flag to extent locked port feature
> > I think Hans is testing with mv88e6xxx which dumps entries directly from > HW via ndo_fdb_dump(). See dsa_slave_port_fdb_do_dump() which sets > NTF_SELF. > > Hans, are you seeing the entry twice? Once with 'master' and once with > 'self'? >When replacing a locked entry it looks like this: # bridge fdb show dev eth6 | grep 4c 00:4c:4c:4c:4c:4c vlan 1 master br0 extern_learn offload locked # bridge fdb replace 00:4c:4c:4c:4c:4c dev eth6 vlan 1 master static ; bridge fdb show dev eth6 | grep 4c 00:4c:4c:4c:4c:4c vlan 1 self static The problem is then that the function br_fdb_find_rcu(br,eth_hdr(skb)->h_source, vid); , where the h_source and vid is the entry above, does not find the entry. My hypothesis was then that this is because of the 'self' flag that I see. I am thinking that the function dsa_slave_port_fdb_do_dump() is only for debug, and thus does not really set any flags in the bridge modules FDB, but then I don't understand why the above find function does not find the entry?