Message ID | 20210929210349.130099-4-linus.walleij@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | RTL8366RB enhancements | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 8 of 8 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 26 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On Wed, Sep 29, 2021 at 11:03:48PM +0200, Linus Walleij wrote: > This implements fast aging per-port using the special "security" > register, which will flush any learned L2 LUT entries on a port. > > Suggested-by: Vladimir Oltean <olteanv@gmail.com> > Cc: Mauri Sandberg <sandberg@mailfence.com> > Cc: DENG Qingfang <dqfext@gmail.com> > Cc: Florian Fainelli <f.fainelli@gmail.com> > Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > ChangeLog v3->v4: > - No changes, rebased on the other patches. > ChangeLog v2->v3: > - Underscore that this only affects learned L2 entries, not > static ones. > ChangeLog v1->v2: > - New patch suggested by Vladimir. > --- > drivers/net/dsa/rtl8366rb.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c > index 52e750ea790e..748f22ab9130 100644 > --- a/drivers/net/dsa/rtl8366rb.c > +++ b/drivers/net/dsa/rtl8366rb.c > @@ -1359,6 +1359,19 @@ rtl8366rb_port_bridge_flags(struct dsa_switch *ds, int port, > return 0; > } > > +static void > +rtl8366rb_port_fast_age(struct dsa_switch *ds, int port) > +{ > + struct realtek_smi *smi = ds->priv; > + > + /* This will age out any learned L2 entries */ > + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, > + BIT(port), BIT(port)); Is there any delay that needs to be added between these two operations? > + /* Restore the normal state of things */ > + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, > + BIT(port), 0); > +} > + > static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu) > { > struct realtek_smi *smi = ds->priv; > @@ -1771,6 +1784,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = { > .port_disable = rtl8366rb_port_disable, > .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags, > .port_bridge_flags = rtl8366rb_port_bridge_flags, > + .port_fast_age = rtl8366rb_port_fast_age, > .port_change_mtu = rtl8366rb_change_mtu, > .port_max_mtu = rtl8366rb_max_mtu, > }; > -- > 2.31.1 >
On Wed, Sep 29, 2021 at 11:45 PM Vladimir Oltean <olteanv@gmail.com> wrote: > On Wed, Sep 29, 2021 at 11:03:48PM +0200, Linus Walleij wrote: > > + /* This will age out any learned L2 entries */ > > + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, > > + BIT(port), BIT(port)); > > Is there any delay that needs to be added between these two operations? > > > + /* Restore the normal state of things */ > > + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, > > + BIT(port), 0); Absolutely no idea. The API from the vendor essentially just set/clear this bit with no comments on use. Yours, Linus Walleij
diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 52e750ea790e..748f22ab9130 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1359,6 +1359,19 @@ rtl8366rb_port_bridge_flags(struct dsa_switch *ds, int port, return 0; } +static void +rtl8366rb_port_fast_age(struct dsa_switch *ds, int port) +{ + struct realtek_smi *smi = ds->priv; + + /* This will age out any learned L2 entries */ + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, + BIT(port), BIT(port)); + /* Restore the normal state of things */ + regmap_update_bits(smi->map, RTL8366RB_SECURITY_CTRL, + BIT(port), 0); +} + static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct realtek_smi *smi = ds->priv; @@ -1771,6 +1784,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = { .port_disable = rtl8366rb_port_disable, .port_pre_bridge_flags = rtl8366rb_port_pre_bridge_flags, .port_bridge_flags = rtl8366rb_port_bridge_flags, + .port_fast_age = rtl8366rb_port_fast_age, .port_change_mtu = rtl8366rb_change_mtu, .port_max_mtu = rtl8366rb_max_mtu, };