Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev <netdev@vger.kernel.org>,
Florian Fainelli <f.fainelli@gmail.com>,
Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@nvidia.com>,
Chris Healy <cphealy@gmail.com>
Subject: Re: [PATCH net-next RFC v1 1/4] net: devlink: Add support for port regions
Date: Sun, 20 Sep 2020 23:45:39 +0000 [thread overview]
Message-ID: <20200920234539.ayzonwdptqp27zgl@skbuf> (raw)
In-Reply-To: <20200919144332.3665538-2-andrew@lunn.ch>
On Sat, Sep 19, 2020 at 04:43:29PM +0200, Andrew Lunn wrote:
> Allow regions to be registered to a devlink port. The same netlink API
> is used, but the port index is provided to indicate when a region is a
> port region as opposed to a device region.
>
> Signed-off-by: Andrew Lunn <andrew@lunn.ch>
> ---
> include/net/devlink.h | 27 +++++
> net/core/devlink.c | 251 +++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 252 insertions(+), 26 deletions(-)
>
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index 045468390480..66469cdcdc1e 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -4198,16 +4225,30 @@ static int devlink_nl_cmd_region_get_doit(struct sk_buff *skb,
> struct genl_info *info)
> {
> struct devlink *devlink = info->user_ptr[0];
> + struct devlink_port *port = NULL;
> struct devlink_region *region;
> const char *region_name;
> struct sk_buff *msg;
> + unsigned int index;
> int err;
>
> if (!info->attrs[DEVLINK_ATTR_REGION_NAME])
> return -EINVAL;
>
> + if (info->attrs[DEVLINK_ATTR_PORT_INDEX]) {
> + index = nla_get_u32(info->attrs[DEVLINK_ATTR_PORT_INDEX]);
> +
> + port = devlink_port_get_by_index(devlink, index);
> + if (!port)
> + return -ENODEV;
> + }
> +
> region_name = nla_data(info->attrs[DEVLINK_ATTR_REGION_NAME]);
> - region = devlink_region_get_by_name(devlink, region_name);
> + if (port)
> + region = devlink_port_region_get_by_name(port, region_name);
> + else
> + region = devlink_region_get_by_name(devlink, region_name);
> +
This looks like a simple enough solution, but am I right that old
kernels, which ignore this new DEVLINK_ATTR_PORT_INDEX netlink
attribute, will consequently interpret any devlink command for a port as
being for a global region? Sure, in the end, that kernel will probably
fail anyway, due to the region name mismatch. And at the moment there
isn't any driver that registers a global and a port region with the same
name. But when that will happen, the user space tools of the future will
trigger incorrect behavior into the kernel of today, instead of it
reporting an unsupported operation as it should. Or am I
misunderstanding?
> if (!region)
> return -EINVAL;
>
Thanks,
-Vladimir
next prev parent reply other threads:[~2020-09-20 23:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-19 14:43 [PATCH net-next RFC v1 0/4] Add per port devlink regions Andrew Lunn
2020-09-19 14:43 ` [PATCH net-next RFC v1 1/4] net: devlink: Add support for port regions Andrew Lunn
2020-09-20 23:45 ` Vladimir Oltean [this message]
2020-09-21 0:23 ` Vladimir Oltean
2020-09-21 3:02 ` Andrew Lunn
2020-09-21 10:09 ` Vladimir Oltean
2020-09-19 14:43 ` [PATCH net-next RFC v1 2/4] net: dsa: Add devlink port regions support to DSA Andrew Lunn
2020-09-20 23:23 ` Vladimir Oltean
2020-09-21 2:32 ` Andrew Lunn
2020-09-19 14:43 ` [PATCH net-next RFC v1 3/4] net: dsa: Add helper for converting devlink port to ds and port Andrew Lunn
2020-09-20 23:52 ` Vladimir Oltean
2020-09-26 17:28 ` Andrew Lunn
2020-09-26 17:45 ` Vladimir Oltean
2020-09-19 14:43 ` [PATCH net-next RFC v1 4/4] net: dsa: mv88e6xxx: Add per port devlink regions Andrew Lunn
2020-09-20 23:59 ` Vladimir Oltean
2020-09-20 23:33 ` [PATCH net-next RFC v1 0/4] " Vladimir Oltean
2020-09-20 23:44 ` Florian Fainelli
2020-09-21 2:50 ` Andrew Lunn
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=20200920234539.ayzonwdptqp27zgl@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=andrew@lunn.ch \
--cc=cphealy@gmail.com \
--cc=f.fainelli@gmail.com \
--cc=jiri@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--subject='Re: [PATCH net-next RFC v1 1/4] net: devlink: Add support for port regions' \
/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
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).