From: Ido Schimmel <idosch@idosch.org>
To: Aya Levin <ayal@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Jiri Pirko <jiri@mellanox.com>,
netdev@vger.kernel.org, Moshe Shemesh <moshe@mellanox.com>,
Eran Ben Elisha <eranbe@mellanox.com>,
Ido Schimmel <idosch@mellanox.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next RFC v1 3/4] devlink: Add hierarchy between traps in device level and port level
Date: Sun, 6 Sep 2020 18:58:58 +0300 [thread overview]
Message-ID: <20200906155858.GB2431016@shredder> (raw)
In-Reply-To: <1599060734-26617-4-git-send-email-ayal@mellanox.com>
On Wed, Sep 02, 2020 at 06:32:13PM +0300, Aya Levin wrote:
> Managing large scale port's traps may be complicated. This patch
> introduces a shortcut: when setting a trap on a device and this trap is
> not registered on this device, the action will take place on all related
> ports that did register this trap.
I'm not really a fan of this and I'm not sure there is precedent for
something similar. Also, it's an optimization, so I wouldn't put it as
part of the first submission before you gather some operational
experience with the initial interface.
In addition, I find it very unintuitive for users. When I do 'devlink
trap show' I will not see anything. I will only see the traps when I
issue 'devlink port trap show', yet 'devlink trap set ...' is expected
to work.
Lets assume that this is a valid change, it would be better implemented
with my suggestion from the previous patch: When devlink sees that a
trap is registered on all the ports it can auto-register a new
per-device trap and user space gets the appropriate notification.
>
> Signed-off-by: Aya Levin <ayal@mellanox.com>
> ---
> net/core/devlink.c | 43 +++++++++++++++++++++++++++++++++----------
> 1 file changed, 33 insertions(+), 10 deletions(-)
>
> diff --git a/net/core/devlink.c b/net/core/devlink.c
> index b13e1b40bf1c..dea5482b2517 100644
> --- a/net/core/devlink.c
> +++ b/net/core/devlink.c
> @@ -6501,23 +6501,46 @@ static int devlink_nl_cmd_trap_set_doit(struct sk_buff *skb,
> struct devlink *devlink = info->user_ptr[0];
> struct devlink_trap_mngr *trap_mngr;
> struct devlink_trap_item *trap_item;
> + struct devlink_port *devlink_port;
> int err;
>
> - trap_mngr = devlink_trap_get_trap_mngr_from_info(devlink, info);
> - if (list_empty(&trap_mngr->trap_list))
> - return -EOPNOTSUPP;
> + devlink_port = devlink_port_get_from_attrs(devlink, info->attrs);
> + if (IS_ERR(devlink_port)) {
> + trap_mngr = &devlink->trap_mngr;
> + if (list_empty(&trap_mngr->trap_list))
> + goto loop_over_ports;
>
> - trap_item = devlink_trap_item_get_from_info(trap_mngr, info);
> - if (!trap_item) {
> - NL_SET_ERR_MSG_MOD(extack, "Device did not register this trap");
> - return -ENOENT;
> + trap_item = devlink_trap_item_get_from_info(trap_mngr, info);
> + if (!trap_item)
> + goto loop_over_ports;
> + } else {
> + trap_mngr = &devlink_port->trap_mngr;
> + if (list_empty(&trap_mngr->trap_list))
> + return -EOPNOTSUPP;
> +
> + trap_item = devlink_trap_item_get_from_info(trap_mngr, info);
> + if (!trap_item) {
> + NL_SET_ERR_MSG_MOD(extack, "Port did not register this trap");
> + return -ENOENT;
> + }
> }
> return devlink_trap_action_set(devlink, trap_mngr, trap_item, info);
>
> - err = devlink_trap_action_set(devlink, trap_mngr, trap_item, info);
> - if (err)
> - return err;
> +loop_over_ports:
> + if (list_empty(&devlink->port_list))
> + return -EOPNOTSUPP;
> + list_for_each_entry(devlink_port, &devlink->port_list, list) {
> + trap_mngr = &devlink_port->trap_mngr;
> + if (list_empty(&trap_mngr->trap_list))
> + continue;
>
> + trap_item = devlink_trap_item_get_from_info(trap_mngr, info);
> + if (!trap_item)
> + continue;
> + err = devlink_trap_action_set(devlink, trap_mngr, trap_item, info);
> + if (err)
> + return err;
> + }
> return 0;
> }
>
> --
> 2.14.1
>
next prev parent reply other threads:[~2020-09-06 15:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-02 15:32 [PATCH net-next RFC v1 0/4] Add devlink traps in devlink port context Aya Levin
2020-09-02 15:32 ` [PATCH net-next RFC v1 1/4] devlink: Wrap trap related lists and ops in trap_mngr Aya Levin
2020-09-08 14:12 ` Jiri Pirko
2020-09-02 15:32 ` [PATCH net-next RFC v1 2/4] devlink: Add devlink traps under devlink_ports context Aya Levin
2020-09-06 15:44 ` Ido Schimmel
2020-09-07 16:52 ` Aya Levin
2020-09-08 14:04 ` Jiri Pirko
2020-09-10 6:16 ` Aya Levin
2020-09-02 15:32 ` [PATCH net-next RFC v1 3/4] devlink: Add hierarchy between traps in device level and port level Aya Levin
2020-09-06 15:58 ` Ido Schimmel [this message]
2020-09-07 16:26 ` Aya Levin
2020-09-02 15:32 ` [PATCH net-next RFC v1 4/4] net/mlx5e: Add devlink trap to catch oversize packets Aya Levin
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=20200906155858.GB2431016@shredder \
--to=idosch@idosch.org \
--cc=ayal@mellanox.com \
--cc=davem@davemloft.net \
--cc=eranbe@mellanox.com \
--cc=idosch@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=moshe@mellanox.com \
--cc=netdev@vger.kernel.org \
/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