From: Andrew Lunn <andrew@lunn.ch>
To: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
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>,
Jiri Pirko <jiri@resnulli.us>
Subject: Re: [RFC 03/20] net: dsa: pass dsa_port down to drivers bridge ops
Date: Thu, 28 Apr 2016 01:12:58 +0200 [thread overview]
Message-ID: <20160427231258.GI29024@lunn.ch> (raw)
In-Reply-To: <1461796217-18893-4-git-send-email-vivien.didelot@savoirfairelinux.com>
On Wed, Apr 27, 2016 at 06:30:00PM -0400, Vivien Didelot wrote:
> Now that DSA as proper structure for DSA ports, pass it down to the
> port_bridge_join and port_bridge_leave driver functions.
I should look at the later patches, but this looks like a step
backwards.
If your ports array is a member of ds, you have no need for this patch
at all.
What advantage does this change bring?
Andrew
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
> ---
> drivers/net/dsa/bcm_sf2.c | 28 ++++++++++++++--------------
> drivers/net/dsa/mv88e6xxx.c | 10 +++++-----
> drivers/net/dsa/mv88e6xxx.h | 4 ++--
> include/net/dsa.h | 4 ++--
> net/dsa/slave.c | 4 ++--
> 5 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
> index f394ea9..2d7b297 100644
> --- a/drivers/net/dsa/bcm_sf2.c
> +++ b/drivers/net/dsa/bcm_sf2.c
> @@ -491,15 +491,15 @@ static int bcm_sf2_sw_fast_age_port(struct dsa_switch *ds, int port)
> return 0;
> }
>
> -static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port,
> +static int bcm_sf2_sw_br_join(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge)
> {
> struct bcm_sf2_priv *priv = ds_to_priv(ds);
> unsigned int i;
> u32 reg, p_ctl;
>
> - priv->port_sts[port].bridge_dev = bridge;
> - p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port));
> + priv->port_sts[dp->port].bridge_dev = bridge;
> + p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(dp->port));
>
> for (i = 0; i < priv->hw_params.num_ports; i++) {
> if (priv->port_sts[i].bridge_dev != bridge)
> @@ -509,7 +509,7 @@ static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port,
> * membership and update the remote port bitmask
> */
> reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
> - reg |= 1 << port;
> + reg |= 1 << dp->port;
> core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(i));
> priv->port_sts[i].vlan_ctl_mask = reg;
>
> @@ -519,20 +519,20 @@ static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int port,
> /* Configure the local port VLAN control membership to include
> * remote ports and update the local port bitmask
> */
> - core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port));
> - priv->port_sts[port].vlan_ctl_mask = p_ctl;
> + core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(dp->port));
> + priv->port_sts[dp->port].vlan_ctl_mask = p_ctl;
>
> return 0;
> }
>
> -static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port,
> +static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge)
> {
> struct bcm_sf2_priv *priv = ds_to_priv(ds);
> unsigned int i;
> u32 reg, p_ctl;
>
> - p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(port));
> + p_ctl = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(dp->port));
>
> for (i = 0; i < priv->hw_params.num_ports; i++) {
> /* Don't touch the remaining ports */
> @@ -540,18 +540,18 @@ static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port,
> continue;
>
> reg = core_readl(priv, CORE_PORT_VLAN_CTL_PORT(i));
> - reg &= ~(1 << port);
> + reg &= ~(1 << dp->port);
> core_writel(priv, reg, CORE_PORT_VLAN_CTL_PORT(i));
> - priv->port_sts[port].vlan_ctl_mask = reg;
> + priv->port_sts[dp->port].vlan_ctl_mask = reg;
>
> /* Prevent self removal to preserve isolation */
> - if (port != i)
> + if (dp->port != i)
> p_ctl &= ~(1 << i);
> }
>
> - core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port));
> - priv->port_sts[port].vlan_ctl_mask = p_ctl;
> - priv->port_sts[port].bridge_dev = NULL;
> + core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(dp->port));
> + priv->port_sts[dp->port].vlan_ctl_mask = p_ctl;
> + priv->port_sts[dp->port].bridge_dev = NULL;
> }
>
> static void bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
> diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
> index 86f8f2f..3f78c73 100644
> --- a/drivers/net/dsa/mv88e6xxx.c
> +++ b/drivers/net/dsa/mv88e6xxx.c
> @@ -2203,7 +2203,7 @@ unlock:
> return err;
> }
>
> -int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
> +int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge)
> {
> struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
> @@ -2212,7 +2212,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
> mutex_lock(&ps->smi_mutex);
>
> /* Assign the bridge and remap each port's VLANTable */
> - ps->ports[port].bridge_dev = bridge;
> + ps->ports[dp->port].bridge_dev = bridge;
>
> for (i = 0; i < ps->info->num_ports; ++i) {
> if (ps->ports[i].bridge_dev == bridge) {
> @@ -2227,7 +2227,7 @@ int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
> return err;
> }
>
> -void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
> +void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge)
> {
> struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
> @@ -2236,10 +2236,10 @@ void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
> mutex_lock(&ps->smi_mutex);
>
> /* Unassign the bridge and remap each port's VLANTable */
> - ps->ports[port].bridge_dev = NULL;
> + ps->ports[dp->port].bridge_dev = NULL;
>
> for (i = 0; i < ps->info->num_ports; ++i)
> - if (i == port || ps->ports[i].bridge_dev == bridge)
> + if (i == dp->port || ps->ports[i].bridge_dev == bridge)
> if (_mv88e6xxx_port_based_vlan_map(ds, i))
> netdev_warn(ds->ports[i], "failed to remap\n");
>
> diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
> index 2eb9a82..55b8eac 100644
> --- a/drivers/net/dsa/mv88e6xxx.h
> +++ b/drivers/net/dsa/mv88e6xxx.h
> @@ -490,9 +490,9 @@ int mv88e6xxx_phy_write_indirect(struct dsa_switch *ds, int addr, int regnum,
> int mv88e6xxx_get_eee(struct dsa_switch *ds, int port, struct ethtool_eee *e);
> int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
> struct phy_device *phydev, struct ethtool_eee *e);
> -int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
> +int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge);
> -void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port,
> +void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge);
> void mv88e6xxx_port_stp_state_set(struct dsa_switch *ds, int port, u8 state);
> int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
> diff --git a/include/net/dsa.h b/include/net/dsa.h
> index ed33500..fb626ae 100644
> --- a/include/net/dsa.h
> +++ b/include/net/dsa.h
> @@ -303,9 +303,9 @@ struct dsa_switch_driver {
> /*
> * Bridge integration
> */
> - int (*port_bridge_join)(struct dsa_switch *ds, int port,
> + int (*port_bridge_join)(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge);
> - void (*port_bridge_leave)(struct dsa_switch *ds, int port,
> + void (*port_bridge_leave)(struct dsa_switch *ds, struct dsa_port *dp,
> struct net_device *bridge);
> void (*port_stp_state_set)(struct dsa_switch *ds, int port,
> u8 state);
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index f2ec13d..9a8ea9a 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -441,7 +441,7 @@ static int dsa_slave_bridge_port_join(struct net_device *dev,
> p->bridge_dev = br;
>
> if (ds->drv->port_bridge_join)
> - ret = ds->drv->port_bridge_join(ds, p->dp->port, br);
> + ret = ds->drv->port_bridge_join(ds, p->dp, br);
>
> if (ret && ret != -EOPNOTSUPP) {
> p->bridge_dev = NULL;
> @@ -460,7 +460,7 @@ static void dsa_slave_bridge_port_leave(struct net_device *dev)
> p->bridge_dev = NULL;
>
> if (ds->drv->port_bridge_leave)
> - ds->drv->port_bridge_leave(ds, p->dp->port, br);
> + ds->drv->port_bridge_leave(ds, p->dp, br);
>
> /* Port left the bridge, put in BR_STATE_DISABLED by the bridge layer,
> * so allow it to be in BR_STATE_FORWARDING to be kept functional
> --
> 2.8.0
>
next prev parent reply other threads:[~2016-04-27 23:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 22:29 [RFC 00/20] net: dsa: dsa_port structure and tree-wide ops Vivien Didelot
2016-04-27 22:29 ` [RFC 01/20] net: dsa: introduce a dsa_port structure Vivien Didelot
2016-04-27 23:07 ` Andrew Lunn
2016-04-27 22:29 ` [RFC 02/20] net: dsa: be consistent with NETDEV_CHANGEUPPER Vivien Didelot
2016-04-27 22:30 ` [RFC 03/20] net: dsa: pass dsa_port down to drivers bridge ops Vivien Didelot
2016-04-27 23:12 ` Andrew Lunn [this message]
2016-04-27 22:30 ` [RFC 04/20] net: dsa: pass dsa_port down to drivers FDB ops Vivien Didelot
2016-04-27 22:30 ` [RFC 05/20] net: dsa: pass dsa_port down to drivers VLAN ops Vivien Didelot
2016-04-27 22:30 ` [RFC 06/20] net: dsa: move bridge device in dsa_port Vivien Didelot
2016-04-27 22:30 ` [RFC 07/20] net: dsa: list ports in switch Vivien Didelot
2016-04-27 23:15 ` [RFC 07/20] net: dsa: list ports in switch\\ Andrew Lunn
2016-04-28 17:00 ` Florian Fainelli
2016-04-28 18:18 ` Vivien Didelot
2016-04-28 18:29 ` Florian Fainelli
2016-04-27 22:30 ` [RFC 08/20] net: dsa: bcm_sf2: use bridge device from dsa_port Vivien Didelot
2016-04-27 22:30 ` [RFC 09/20] net: dsa: mv88e6xxx: check HW vlan with dsa_port Vivien Didelot
2016-04-27 22:30 ` [RFC 10/20] net: dsa: mv88e6xxx: setup a dsa_port Vivien Didelot
2016-04-27 22:30 ` [RFC 11/20] net: dsa: mv88e6xxx: use bridge from dsa_port Vivien Didelot
2016-04-27 22:30 ` [RFC 12/20] net: dsa: rename dst->ds to dst->switches Vivien Didelot
2016-04-27 23:20 ` Andrew Lunn
2016-04-27 22:30 ` [RFC 13/20] net: dsa: list switches in tree Vivien Didelot
2016-04-27 22:30 ` [RFC 14/20] net: dsa: add tree-wide bridge ops Vivien Didelot
2016-04-27 22:30 ` [RFC 15/20] net: dsa: add tree-wide FDB ops Vivien Didelot
2016-04-27 22:30 ` [RFC 16/20] net: dsa: add tree-wide VLAN ops Vivien Didelot
2016-04-27 22:30 ` [RFC 17/20] net: dsa: mv88e6xxx: factorize port bridge change Vivien Didelot
2016-04-27 22:30 ` [RFC 18/20] net: dsa: mv88e6xxx: add flags to info Vivien Didelot
2016-04-27 22:30 ` [RFC 19/20] net: dsa: mv88e6xxx: conditionally init PVT Vivien Didelot
2016-04-27 22:30 ` [RFC 20/20] net: dsa: mv88e6xxx: setup PVT on cross-chip ops Vivien Didelot
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=20160427231258.GI29024@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=jiri@resnulli.us \
--cc=kernel@savoirfairelinux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vivien.didelot@savoirfairelinux.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.