From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: hongbo.wang@nxp.com, xiaoliang.yang_1@nxp.com,
allan.nielsen@microchip.com, po.liu@nxp.com,
claudiu.manoil@nxp.com, alexandru.marginean@nxp.com,
vladimir.oltean@nxp.com, leoyang.li@nxp.com, mingkai.hu@nxp.com,
andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com,
davem@davemloft.net, jiri@resnulli.us, idosch@idosch.org,
kuba@kernel.org, vinicius.gomes@intel.com,
roopa@cumulusnetworks.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, horatiu.vultur@microchip.com,
alexandre.belloni@bootlin.com, UNGLinuxDriver@microchip.com,
ivecera@redhat.com
Subject: Re: [PATCH v5 1/2] net: dsa: Add protocol support for 802.1AD when adding or deleting vlan for dsa switch port
Date: Fri, 7 Aug 2020 14:25:45 +0300 [thread overview]
Message-ID: <1ae01bfb-437b-345d-f000-2c4de103f7b1@cumulusnetworks.com> (raw)
In-Reply-To: <20200807111349.20649-2-hongbo.wang@nxp.com>
On 07/08/2020 14:13, hongbo.wang@nxp.com wrote:
> From: "hongbo.wang" <hongbo.wang@nxp.com>
>
> the following command will be supported:
>
> Set bridge's vlan protocol:
> ip link set br0 type bridge vlan_protocol 802.1ad
> Add VLAN:
> ip link add link swp1 name swp1.100 type vlan protocol 802.1ad id 100
> Delete VLAN:
> ip link del link swp1 name swp1.100
>
> Signed-off-by: hongbo.wang <hongbo.wang@nxp.com>
> ---
> include/net/switchdev.h | 1 +
> net/bridge/br_switchdev.c | 22 ++++++++++++++++
> net/dsa/dsa_priv.h | 4 +--
> net/dsa/port.c | 6 +++--
> net/dsa/slave.c | 53 ++++++++++++++++++++++++++-------------
> net/dsa/tag_8021q.c | 4 +--
> 6 files changed, 66 insertions(+), 24 deletions(-)
>
Hi,
Please put the bridge changes in a separate patch with proper description.
Reviewers would easily miss these bridge changes. Also I believe net-next
is currently closed and that's where these patches should be targeted (i.e.
have net-next after PATCH in the subject). Few more comments below.
Thanks,
Nik
> diff --git a/include/net/switchdev.h b/include/net/switchdev.h
> index ff2246914301..7594ea82879f 100644
> --- a/include/net/switchdev.h
> +++ b/include/net/switchdev.h
> @@ -97,6 +97,7 @@ struct switchdev_obj_port_vlan {
> u16 flags;
> u16 vid_begin;
> u16 vid_end;
> + u16 proto;
> };
>
> #define SWITCHDEV_OBJ_PORT_VLAN(OBJ) \
> diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
> index 015209bf44aa..bcfa00d6d5eb 100644
> --- a/net/bridge/br_switchdev.c
> +++ b/net/bridge/br_switchdev.c
> @@ -146,6 +146,26 @@ br_switchdev_fdb_notify(const struct net_bridge_fdb_entry *fdb, int type)
> }
> }
>
> +static u16 br_switchdev_get_bridge_vlan_proto(struct net_device *dev)
const
> +{
> + u16 vlan_proto = ETH_P_8021Q;
> + struct net_device *br = NULL;
> + struct net_bridge_port *p;
> +
> + if (netif_is_bridge_master(dev)) {
> + br = dev;
> + } else if (netif_is_bridge_port(dev)) {
You can use br_port_get_rtnl_rcu() and just check if p is not NULL.
But in general these helpers are used only on bridge devices, I don't think you
can reach them with a device that's not either a bridge or a port. So you can just
check if it's a bridge master else it's a port.
> + p = br_port_get_rcu(dev);
> + if (p && p->br)
No need to check for p->br, it always exists.
> + br = p->br->dev;
> + }
> +
> + if (br)
> + br_vlan_get_proto(br, &vlan_proto);
> +
> + return vlan_proto;
> +}
> +
> int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags,
> struct netlink_ext_ack *extack)
> {
> @@ -157,6 +177,7 @@ int br_switchdev_port_vlan_add(struct net_device *dev, u16 vid, u16 flags,
> .vid_end = vid,
> };
>
> + v.proto = br_switchdev_get_bridge_vlan_proto(dev);
> return switchdev_port_obj_add(dev, &v.obj, extack);
> }
>
> @@ -169,5 +190,6 @@ int br_switchdev_port_vlan_del(struct net_device *dev, u16 vid)
> .vid_end = vid,
> };
>
> + v.proto = br_switchdev_get_bridge_vlan_proto(dev);
> return switchdev_port_obj_del(dev, &v.obj);
> }
next prev parent reply other threads:[~2020-08-07 11:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-07 11:13 [PATCH v5 0/2] Add 802.1AD protocol support for dsa switch and ocelot driver hongbo.wang
2020-08-07 11:13 ` [PATCH v5 1/2] net: dsa: Add protocol support for 802.1AD when adding or deleting vlan for dsa switch port hongbo.wang
2020-08-07 11:25 ` Nikolay Aleksandrov [this message]
2020-08-07 11:13 ` [PATCH v5 2/2] net: dsa: ocelot: Add support for QinQ Operation hongbo.wang
2020-08-08 0:24 ` [PATCH v5 0/2] Add 802.1AD protocol support for dsa switch and ocelot driver David Miller
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=1ae01bfb-437b-345d-f000-2c4de103f7b1@cumulusnetworks.com \
--to=nikolay@cumulusnetworks.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandru.marginean@nxp.com \
--cc=allan.nielsen@microchip.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hongbo.wang@nxp.com \
--cc=horatiu.vultur@microchip.com \
--cc=idosch@idosch.org \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=leoyang.li@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingkai.hu@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=po.liu@nxp.com \
--cc=roopa@cumulusnetworks.com \
--cc=vinicius.gomes@intel.com \
--cc=vivien.didelot@gmail.com \
--cc=vladimir.oltean@nxp.com \
--cc=xiaoliang.yang_1@nxp.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).