From: Jiri Pirko <jiri@resnulli.us>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Ido Schimmel <idosch@mellanox.com>,
open list <linux-kernel@vger.kernel.org>,
"open list:MELLANOX MLX5 core VPI driver"
<linux-rdma@vger.kernel.org>,
"open list:NETRONOME ETHERNET DRIVERS"
<oss-drivers@netronome.com>,
"open list:STAGING SUBSYSTEM" <devel@driverdev.osuosl.org>,
"moderated list:ETHERNET BRIDGE"
<bridge@lists.linux-foundation.org>
Subject: Re: [PATCH net-next v3 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
Date: Wed, 6 Feb 2019 14:34:31 +0100 [thread overview]
Message-ID: <20190206133431.GL2189@nanopsycho> (raw)
In-Reply-To: <20190205235326.14600-13-f.fainelli@gmail.com>
Wed, Feb 06, 2019 at 12:53:26AM CET, f.fainelli@gmail.com wrote:
>Now that we have a dedicated NDO for getting a port's parent ID, get rid
>of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
>NDO exclusively. This is a preliminary change to getting rid of
>switchdev_ops eventually.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
[...]
>@@ -24,19 +23,12 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
>
> int nbp_switchdev_mark_set(struct net_bridge_port *p)
> {
>- const struct net_device_ops *ops = p->dev->netdev_ops;
>- struct switchdev_attr attr = {
>- .orig_dev = p->dev,
>- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
>- };
>- int err;
>+ struct netdev_phys_item_id ppid = { };
>+ int err = -EOPNOTSUPP;
Pointless init.
>
> ASSERT_RTNL();
>
>- if (ops->ndo_get_port_parent_id)
>- err = dev_get_port_parent_id(p->dev, &attr.u.ppid, true);
>- else
>- err = switchdev_port_attr_get(p->dev, &attr);
>+ err = dev_get_port_parent_id(p->dev, &ppid, true);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
[...]
>@@ -1146,26 +1145,17 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
>
> static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
> {
>- const struct net_device_ops *ops = dev->netdev_ops;
>- int err;
>- struct switchdev_attr attr = {
>- .orig_dev = dev,
>- .id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
>- .flags = SWITCHDEV_F_NO_RECURSE,
>- };
>+ struct netdev_phys_item_id ppid = { };
>+ int err = -EOPNOTSUPP;
Pointless init.
>
>- if (ops->ndo_get_port_parent_id)
>- err = dev_get_port_parent_id(dev, &attr.u.ppid, false);
>- else
>- err = switchdev_port_attr_get(dev, &attr);
>+ err = dev_get_port_parent_id(dev, &ppid, false);
> if (err) {
> if (err == -EOPNOTSUPP)
> return 0;
> return err;
> }
>
>- if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
>- attr.u.ppid.id))
>+ if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
> return -EMSGSIZE;
>
> return 0;
[...]
>@@ -920,15 +917,10 @@ static int vif_add(struct net *net, struct mr_table *mrt,
> vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0),
> (VIFF_TUNNEL | VIFF_REGISTER));
>
>- attr.orig_dev = dev;
> ops = dev->netdev_ops;
>- if (ops->ndo_get_port_parent_id &&
>- !dev_get_port_parent_id(dev, &attr.u.ppid, true)) {
>- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
>- v->dev_parent_id.id_len = attr.u.ppid.id_len;
>- } else if (!switchdev_port_attr_get(dev, &attr)) {
>- memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
>- v->dev_parent_id.id_len = attr.u.ppid.id_len;
>+ if (!dev_get_port_parent_id(dev, &ppid, true)) {
Please split this to:
err = dev_get_port_parent_id(dev, &ppid, true);
if (err) {
>+ memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
>+ v->dev_parent_id.id_len = ppid.id_len;
> } else {
> v->dev_parent_id.id_len = 0;
> }
[...]
next prev parent reply other threads:[~2019-02-06 13:34 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-05 23:53 [Bridge] [PATCH net-next v3 00/12] net: Introduce ndo_get_port_parent_id() Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 01/12] " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 12:54 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 02/12] bnxt: Implement ndo_get_port_parent_id() Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 12:59 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 03/12] liquidio: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:10 ` Jiri Pirko
2019-02-06 13:10 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 04/12] net/mlx5e: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:12 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 05/12] mlxsw: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:14 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 06/12] mscc: ocelot: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:16 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 07/12] nfp: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:23 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 08/12] rocker: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:23 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 09/12] netdevsim: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:24 ` Jiri Pirko
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 10/12] staging: fsl-dpaa2: ethsw: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 11/12] net: dsa: " Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:27 ` Jiri Pirko
2019-02-06 18:21 ` [Bridge] " Vivien Didelot
2019-02-06 18:21 ` Vivien Didelot
2019-02-06 18:21 ` Vivien Didelot
2019-02-05 23:53 ` [Bridge] [PATCH net-next v3 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-05 23:53 ` Florian Fainelli
2019-02-06 13:34 ` Jiri Pirko [this message]
2019-02-06 7:51 ` [Bridge] [PATCH net-next v3 00/12] net: Introduce ndo_get_port_parent_id() Ido Schimmel
2019-02-06 7:51 ` Ido Schimmel
2019-02-06 14:24 ` [Bridge] " Ido Schimmel
2019-02-06 14:24 ` Ido Schimmel
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=20190206133431.GL2189@nanopsycho \
--to=jiri@resnulli.us \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=devel@driverdev.osuosl.org \
--cc=f.fainelli@gmail.com \
--cc=idosch@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.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.