Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1445959 > unrolled thread
| Started by | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| First post | 2016-07-19 02:50 +0200 |
| Last post | 2016-07-19 21:00 +0200 |
| Articles | 6 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-07-19 02:50 +0200
Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Andrew Lunn <andrew@lunn.ch> - 2016-07-19 05:30 +0200
Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Florian Fainelli <f.fainelli@gmail.com> - 2016-07-19 06:30 +0200
Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Andrew Lunn <andrew@lunn.ch> - 2016-07-19 16:30 +0200
Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Florian Fainelli <f.fainelli@gmail.com> - 2016-07-19 19:30 +0200
Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr Andrew Lunn <andrew@lunn.ch> - 2016-07-19 21:00 +0200
| From | Vivien Didelot <vivien.didelot@savoirfairelinux.com> |
|---|---|
| Date | 2016-07-19 02:50 +0200 |
| Subject | [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWrot-5bF-1@gated-at.bofh.it> |
Add a new function for DSA drivers to handle the switchdev
SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.
The ageing time is passed as milliseconds.
Also because we can have multiple logical bridges on top of a physical
switch and ageing time are switch-wide, call the driver function with
the fastest ageing time in use on the chip instead of the requested one.
Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
include/net/dsa.h | 2 ++
net/dsa/slave.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 43 insertions(+)
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 52ab18b..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 {
@@ -329,6 +330,7 @@ struct dsa_switch_driver {
/*
* Bridge integration
*/
+ int (*set_ageing_time)(struct dsa_switch *ds, unsigned int msecs);
int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
void (*port_bridge_leave)(struct dsa_switch *ds, int port);
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 7236eb2..fc91967 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -333,6 +333,44 @@ 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)
+{
+ struct dsa_slave_priv *p = netdev_priv(dev);
+ struct dsa_switch *ds = p->parent;
+ unsigned long ageing_jiffies = clock_t_to_jiffies(attr->u.ageing_time);
+ unsigned int ageing_time = jiffies_to_msecs(ageing_jiffies);
+
+ /* bridge skips -EOPNOTSUPP, so skip the prepare phase */
+ 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);
+
+ return 0;
+}
+
static int dsa_slave_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr,
struct switchdev_trans *trans)
@@ -346,6 +384,9 @@ static int dsa_slave_port_attr_set(struct net_device *dev,
case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
ret = dsa_slave_vlan_filtering(dev, attr, trans);
break;
+ case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
+ ret = dsa_slave_ageing_time(dev, attr, trans);
+ break;
default:
ret = -EOPNOTSUPP;
break;
--
2.9.0
[toc] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2016-07-19 05:30 +0200 |
| Subject | Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWtTj-6Zc-1@gated-at.bofh.it> |
| In reply to | #1445959 |
On Mon, Jul 18, 2016 at 08:45:38PM -0400, Vivien Didelot wrote:
> Add a new function for DSA drivers to handle the switchdev
> SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.
>
> The ageing time is passed as milliseconds.
>
> Also because we can have multiple logical bridges on top of a physical
> switch and ageing time are switch-wide, call the driver function with
> the fastest ageing time in use on the chip instead of the requested one.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> include/net/dsa.h | 2 ++
> net/dsa/slave.c | 41 +++++++++++++++++++++++++++++++++++++++++
Hi Florian
It looks like the SF2 can do fast ageing per port. What i don't see if
what configuration options you have. Can you get the fast and the
normal age time per port? Or is it global?
Andrew
[toc] | [prev] | [next] | [standalone]
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Date | 2016-07-19 06:30 +0200 |
| Subject | Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWuPn-7DW-1@gated-at.bofh.it> |
| In reply to | #1446001 |
Le 18/07/2016 à 20:24, Andrew Lunn a écrit : > On Mon, Jul 18, 2016 at 08:45:38PM -0400, Vivien Didelot wrote: >> Add a new function for DSA drivers to handle the switchdev >> SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute. >> >> The ageing time is passed as milliseconds. >> >> Also because we can have multiple logical bridges on top of a physical >> switch and ageing time are switch-wide, call the driver function with >> the fastest ageing time in use on the chip instead of the requested one. >> >> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> >> --- >> include/net/dsa.h | 2 ++ >> net/dsa/slave.c | 41 +++++++++++++++++++++++++++++++++++++++++ > Hi Andrew, > Hi Florian > > It looks like the SF2 can do fast ageing per port. What i don't see if > what configuration options you have. Can you get the fast and the > normal age time per port? Or is it global? The normal ageing is global and the value needs to be programmed in seconds, can can range from 10 to 1,048,575 (encoded on 20 bits). The fast-ageing can actually be per-port, per-VLAN id, for just dynamic or static entries etc. and is just a poor name for a flush based on any of these criteria. -- Florian
[toc] | [prev] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2016-07-19 16:30 +0200 |
| Subject | Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWEc1-57V-3@gated-at.bofh.it> |
| In reply to | #1446013 |
On Mon, Jul 18, 2016 at 09:26:00PM -0700, Florian Fainelli wrote: > Le 18/07/2016 à 20:24, Andrew Lunn a écrit : > > On Mon, Jul 18, 2016 at 08:45:38PM -0400, Vivien Didelot wrote: > >> Add a new function for DSA drivers to handle the switchdev > >> SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute. > >> > >> The ageing time is passed as milliseconds. > >> > >> Also because we can have multiple logical bridges on top of a physical > >> switch and ageing time are switch-wide, call the driver function with > >> the fastest ageing time in use on the chip instead of the requested one. > >> > >> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> > >> --- > >> include/net/dsa.h | 2 ++ > >> net/dsa/slave.c | 41 +++++++++++++++++++++++++++++++++++++++++ > > > > Hi Andrew, > > > Hi Florian > > > > It looks like the SF2 can do fast ageing per port. What i don't see if > > what configuration options you have. Can you get the fast and the > > normal age time per port? Or is it global? > > The normal ageing is global and the value needs to be programmed in > seconds, can can range from 10 to 1,048,575 (encoded on 20 bits). The > fast-ageing can actually be per-port, per-VLAN id, for just dynamic or > static entries etc. and is just a poor name for a flush based on any of > these criteria. Hi Florian So fast ageing does not have a timer value associated to it? It is just a flush? If so, the code Vivien is proposing in DSA slave is O.K. If however there was a per port timer, Vivien's code is too high in the stack, blocking SF2 from being able to use per-port timers. That is what i'm trying to get at. Andrew
[toc] | [prev] | [next] | [standalone]
| From | Florian Fainelli <f.fainelli@gmail.com> |
|---|---|
| Date | 2016-07-19 19:30 +0200 |
| Subject | Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWH0d-6Rp-13@gated-at.bofh.it> |
| In reply to | #1446517 |
On 07/19/2016 07:20 AM, Andrew Lunn wrote: > On Mon, Jul 18, 2016 at 09:26:00PM -0700, Florian Fainelli wrote: >> Le 18/07/2016 à 20:24, Andrew Lunn a écrit : >>> On Mon, Jul 18, 2016 at 08:45:38PM -0400, Vivien Didelot wrote: >>>> Add a new function for DSA drivers to handle the switchdev >>>> SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute. >>>> >>>> The ageing time is passed as milliseconds. >>>> >>>> Also because we can have multiple logical bridges on top of a physical >>>> switch and ageing time are switch-wide, call the driver function with >>>> the fastest ageing time in use on the chip instead of the requested one. >>>> >>>> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> >>>> --- >>>> include/net/dsa.h | 2 ++ >>>> net/dsa/slave.c | 41 +++++++++++++++++++++++++++++++++++++++++ >>> >> >> Hi Andrew, >> >>> Hi Florian >>> >>> It looks like the SF2 can do fast ageing per port. What i don't see if >>> what configuration options you have. Can you get the fast and the >>> normal age time per port? Or is it global? >> >> The normal ageing is global and the value needs to be programmed in >> seconds, can can range from 10 to 1,048,575 (encoded on 20 bits). The >> fast-ageing can actually be per-port, per-VLAN id, for just dynamic or >> static entries etc. and is just a poor name for a flush based on any of >> these criteria. > > Hi Florian > > So fast ageing does not have a timer value associated to it? It is > just a flush? Correct, it's a flush operation which is internally implemented/named as a fast aging, as in fast enough it is almost instantenous from the programmer's perspective. > > If so, the code Vivien is proposing in DSA slave is O.K. If however > there was a per port timer, Vivien's code is too high in the stack, > blocking SF2 from being able to use per-port timers. That is what i'm > trying to get at. Browsing through all the generations, there does not seem to be any per-port aging, it's always global. -- Florian
[toc] | [prev] | [next] | [standalone]
| From | Andrew Lunn <andrew@lunn.ch> |
|---|---|
| Date | 2016-07-19 21:00 +0200 |
| Subject | Re: [PATCH net-next v3 10/12] net: dsa: support switchdev ageing time attr |
| Message-ID | <rWIpk-7BQ-21@gated-at.bofh.it> |
| In reply to | #1445959 |
On Mon, Jul 18, 2016 at 08:45:38PM -0400, Vivien Didelot wrote:
> Add a new function for DSA drivers to handle the switchdev
> SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME attribute.
>
> The ageing time is passed as milliseconds.
>
> Also because we can have multiple logical bridges on top of a physical
> switch and ageing time are switch-wide, call the driver function with
> the fastest ageing time in use on the chip instead of the requested one.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web