From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel@savoirfairelinux.com,
"David S. Miller" <davem@davemloft.net>,
Florian Fainelli <f.fainelli@gmail.com>
Subject: Re: [PATCH v2 net-next v2 12/12] net: dsa: mv88e6xxx: add support for DSA ageing time
Date: Mon, 18 Jul 2016 16:40:03 -0400 [thread overview]
Message-ID: <87k2gibrz0.fsf@ketchup.mtl.sfl> (raw)
In-Reply-To: <20160718201334.GS31103@lunn.ch>
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
> On Mon, Jul 18, 2016 at 03:59:38PM -0400, Vivien Didelot wrote:
>> Andrew Lunn <andrew@lunn.ch> writes:
>>
>> >> Nope, the bridge ageing time is not per-port, even though switchdev ops
>> >> are per-port by design. This is a switch-wide attribute.
>> >
>> > So you are saying the core is doing all the reference counting, etc,
>> > when swapping between fast and slow ageing?
>>
>> I don't see how checking for the fastest ageing time would fix support
>> for multiple bridges...
>
> The bridge should switch to fast ageing after a topology change to
> flush out entries which are now wrong. Using the short age time for
> too long results in a bit more inefficiency, in that entries time out
> faster than they need to. But if we go back to slow ageing too
> quickly, e.g. because of another bridge, we get wrong operation, in
> that bad entries can get stuck in the table for up to 5 minutes.
>
> So either we need to keep fast ageing as long as there is one bridge
> fast ageing, or we need to flush the whole MAC cache for a bridge on
> topology change and don't bother with fast ageing at all.
>
>> Maybe we can keep it simple for the moment with this switch-wide
>> set_ageing_time operation, and later add a patch for the DSA layer to
>> cache and elect the ageing time per-port or per-bridge.
>
> I don't think it can be done at the DSA layer. It does not have the
> information needed.
OK. I think caching per-port (and thus per-bridge) ageing time would do
the trick and keep DSA drivers simple. What about the following patch?
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 238fad9..2217a3f 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -141,6 +141,7 @@ struct dsa_switch_tree {
struct dsa_port {
struct net_device *netdev;
struct device_node *dn;
+ unsigned int ageing_time;
};
struct dsa_switch {
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 1074cb6..fc91967 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -333,6 +333,21 @@ static int dsa_slave_vlan_filtering(struct net_device *dev,
return 0;
}
+static int dsa_fastest_ageing_time(struct dsa_switch *ds,
+ unsigned int ageing_time)
+{
+ int i;
+
+ for (i = 0; i < DSA_MAX_PORTS; ++i) {
+ struct dsa_port *dp = &ds->ports[i];
+
+ if (dp && dp->ageing_time && dp->ageing_time < ageing_time)
+ ageing_time = dp->ageing_time;
+ }
+
+ return ageing_time;
+}
+
static int dsa_slave_ageing_time(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
@@ -346,6 +361,10 @@ static int dsa_slave_ageing_time(struct net_device *dev,
if (switchdev_trans_ph_prepare(trans))
return 0;
+ /* Keep the fastest ageing time in case of multiple bridges */
+ ds->ports[p->port].ageing_time = ageing_time;
+ ageing_time = dsa_fastest_ageing_time(ds, ageing_time);
+
if (ds->drv->set_ageing_time)
return ds->drv->set_ageing_time(ds, ageing_time);
Thanks,
Vivien
next prev parent reply other threads:[~2016-07-18 20:40 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-18 18:46 [PATCH v2 net-next v2 00/12] net: dsa: mv88e6xxx: Global2 cleanup and STP Vivien Didelot
2016-07-18 18:46 ` [PATCH v2 net-next v2 01/12] net: dsa: mv88e6xxx: remove basic function flags Vivien Didelot
2016-07-18 19:25 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 02/12] net: dsa: mv88e6xxx: split setup of Global 1 and 2 Vivien Didelot
2016-07-18 19:27 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 03/12] net: dsa: mv88e6xxx: extract device mapping Vivien Didelot
2016-07-18 19:35 ` Andrew Lunn
2016-07-18 19:42 ` Vivien Didelot
2016-07-18 18:46 ` [PATCH v2 net-next v2 04/12] net: dsa: mv88e6xxx: extract trunk mapping Vivien Didelot
2016-07-18 19:36 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 05/12] net: dsa: mv88e6xxx: add cap for MGMT Enables bits Vivien Didelot
2016-07-18 19:38 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 06/12] net: dsa: mv88e6xxx: rework Switch MAC setter Vivien Didelot
2016-07-18 19:39 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 07/12] net: dsa: mv88e6xxx: add cap for PVT Vivien Didelot
2016-07-18 19:40 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 08/12] net: dsa: mv88e6xxx: add cap for Priority Override Vivien Didelot
2016-07-18 19:41 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 09/12] net: dsa: mv88e6xxx: add cap for IRL Vivien Didelot
2016-07-18 19:42 ` Andrew Lunn
2016-07-18 18:46 ` [PATCH v2 net-next v2 10/12] net: dsa: support switchdev ageing time attr Vivien Didelot
2016-07-18 18:46 ` [PATCH v2 net-next v2 11/12] net: dsa: mv88e6xxx: add G1 helper for ageing time Vivien Didelot
2016-07-18 18:46 ` [PATCH v2 net-next v2 12/12] net: dsa: mv88e6xxx: add support for DSA " Vivien Didelot
2016-07-18 19:16 ` Andrew Lunn
2016-07-18 19:26 ` Vivien Didelot
2016-07-18 19:32 ` Andrew Lunn
2016-07-18 19:59 ` Vivien Didelot
2016-07-18 20:13 ` Andrew Lunn
2016-07-18 20:40 ` Vivien Didelot [this message]
2016-07-18 21:26 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2gibrz0.fsf@ketchup.mtl.sfl \
--to=vivien.didelot@savoirfairelinux.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox