From: Guenter Roeck <linux@roeck-us.net>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
vivien.didelot@savoirfairelinux.com,
jerome.oufella@savoirfairelinux.com, andrew@lunn.ch,
cphealy@gmail.com
Subject: Re: [PATCH net-next v2 2/3] net: dsa: integrate with SWITCHDEV for HW bridging
Date: Tue, 24 Feb 2015 12:43:36 -0800 [thread overview]
Message-ID: <20150224204336.GA18025@roeck-us.net> (raw)
In-Reply-To: <1424808511-18222-3-git-send-email-f.fainelli@gmail.com>
Hi Florian,
On Tue, Feb 24, 2015 at 12:08:30PM -0800, Florian Fainelli wrote:
> In order to support bridging offloads in DSA switch drivers, select
> NET_SWITCHDEV to get access to the port_stp_update and parent_get_id
> NDOs that we are required to implement.
>
> To facilitate the integratation at the DSA driver level, we implement 3
> types of operations:
>
> - port_join_bridge
> - port_leave_bridge
> - port_stp_update
>
> DSA will resolve which switch ports that are currently bridge port
> members as some Switch hardware/drivers need to know about that to limit
> the register programming to just the relevant registers (especially for
> slow MDIO buses).
>
> We also take care of setting the correct STP state when slave network
> devices are brought up/down while being bridge members.
>
> Finally, when a port is leaving the bridge, we make sure we set in
> BR_STATE_FORWARDING state, otherwise the bridge layer would leave it
> disabled as a result of having left the bridge.
>
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
[ ... ]
>
> +/* Return a bitmask of all ports being currently bridged within a given bridge
> + * device. Note that on leave, the mask will still return the bitmask of ports
> + * currently bridged, prior to port removal, and this is exactly what we want.
> + */
> +static u32 dsa_slave_br_port_mask(struct dsa_switch *ds,
> + struct net_device *bridge)
> +{
> + struct dsa_slave_priv *p;
> + unsigned int port;
> + u32 mask = 0;
> +
> + for (port = 0; port < DSA_MAX_PORTS; port++) {
> + if (!((1 << port) & ds->phys_port_mask))
> + continue;
> +
> + p = netdev_priv(ds->ports[port]);
> +
ds->ports[port] can still be NULL here since the function can be called
before all ports are initialized (which is what I had actually seen).
Thanks,
Guenter
next prev parent reply other threads:[~2015-02-24 20:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 20:08 [PATCH net-next v2 0/3] net: dsa: integration with SWITCHDEV for HW bridging Florian Fainelli
2015-02-24 20:08 ` [PATCH net-next v2 1/3] net: dsa: Ensure that port array elements are initialized before being used Florian Fainelli
2015-02-24 20:08 ` [PATCH net-next v2 2/3] net: dsa: integrate with SWITCHDEV for HW bridging Florian Fainelli
2015-02-24 20:43 ` Guenter Roeck [this message]
2015-02-24 20:49 ` Florian Fainelli
2015-02-24 20:58 ` Guenter Roeck
2015-02-24 21:04 ` Florian Fainelli
2015-02-24 21:15 ` Guenter Roeck
2015-02-24 21:21 ` Florian Fainelli
2015-02-24 20:08 ` [PATCH net-next v2 3/3] net: dsa: bcm_sf2: add HW bridging support Florian Fainelli
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=20150224204336.GA18025@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew@lunn.ch \
--cc=cphealy@gmail.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=jerome.oufella@savoirfairelinux.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).