Re: [PATCH net-next 5/5 v2] net: dsa: rtl8366rb: Support fast aging
From: Linus Walleij <hidden>
Date: 2021-09-10 13:59:33
On Wed, Sep 8, 2021 at 10:10 PM Vladimir Oltean [off-list ref] wrote:
Your interpretation seems correct (I can't think of anything else being meant), but I don't know why you say "duh" about the update of STP state resulting in the port losing its dynamic L2 entries. Sure, it makes sense, but many other vendors do not do that automatically, and DSA calls .port_fast_age whenever the STP state transitions from a value capable of learning (LEARNING, FORWARDING) to one incapable of learning (DISABLED, BLOCKING, LISTENING). To prove/disprove, it would be interesting to implement port STP states, without implementing .port_fast_age, force a port down and then back up, and then run "bridge fdb" and see whether it is true that STP state changes also lead to FDB flushing but at a hardware level (whether there is any 'self' entry being reported).
I have been looking into this.
What makes RTL8366RB so confusing is a compulsive use of FIDs.
For example Linux DSA has:
ds->ops->port_stp_state_set(ds, port, state);
This is pretty straight forward. The vendor RTL8366RB API however has this:
int32 rtl8368s_setAsicSpanningTreeStatus(enum PORTID port, enum
FIDVALUE fid, enum SPTSTATE state)
So this is set per FID instead of per VID.
I also looked into proper FDB support and there is the same problem.
For example I want to implement:
static int rtl8366rb_port_fdb_add(struct dsa_switch *ds, int port,
const unsigned char *addr, u16 vid)
But the FDB static (also autolearn) entries has this format:
struct l2tb_macstatic_st{
ether_addr_t mac;
uint16 fid:3;
uint16 reserved1:13;
uint16 mbr:8;
uint16 reserved2:4;
uint16 block:1;
uint16 auth:1;
uint16 swst:1;
uint16 ipmulti:1;
uint16 reserved3;
};
(swst indicates a static entry ipmulti a multicast entry, mbr is apparently
for S-VLAN, which I'm not familiar with.)
So again using a FID rather than port or VID in the database.
I am starting to wonder whether I should just associate 1-1 the FID:s
with the 6 ports (0..5) to simplify things. Or one FID per defined VID
until they run out, as atleast OpenWRT connects VLAN1 to all ports on
a bridge.
Yours,
Linus Walleij