public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Ioana Ciornei <ioana.ciornei@nxp.com>
To: Ido Schimmel <idosch@idosch.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"jiri@nvidia.com" <jiri@nvidia.com>,
	"idosch@nvidia.com" <idosch@nvidia.com>
Subject: Re: [PATCH net-next v2 2/4] devlink: add .trap_group_action_set() callback
Date: Thu, 1 Oct 2020 13:21:23 +0000	[thread overview]
Message-ID: <20201001132122.ylyroyd5c45mvbsw@skbuf> (raw)
In-Reply-To: <20200930195331.GB1850258@shredder>

On Wed, Sep 30, 2020 at 10:53:31PM +0300, Ido Schimmel wrote:
> On Wed, Sep 30, 2020 at 10:16:43PM +0300, Ioana Ciornei wrote:
> > Add a new devlink callback, .trap_group_action_set(), which can be used
> > by device drivers which do not support controlling the action (drop,
> > trap) on each trap but rather on the entire group trap.
> > If this new callback is populated, it will take precedence over the
> > .trap_action_set() callback when the user requests a change of all the
> > traps in a group.
> > 
> > Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
> 
> Did you test this change with
> 
> tools/testing/selftests/drivers/net/netdevsim/devlink_trap.sh
> 
> ?
> 
> Just to make sure you didn't add a regression

Yes, everything seems alright.

[root@bionic ~/.../drivers/net/netdevsim] # ./devlink_trap.sh 
TEST: Initialization                                                [ OK ]
TEST: Trap action                                                   [ OK ]
TEST: Trap metadata                                                 [ OK ]
TEST: Non-existing trap                                             [ OK ]
TEST: Non-existing trap action                                      [ OK ]
TEST: Trap statistics                                               [ OK ]
TEST: Trap group action                                             [ OK ]
TEST: Non-existing trap group                                       [ OK ]
TEST: Trap group statistics                                         [ OK ]
TEST: Trap policer                                                  [ OK ]
TEST: Trap policer binding                                          [ OK ]
TEST: Port delete                                                   [ OK ]
TEST: Device delete                                                 [ OK ]

> 
> > ---
> > Changes in v2:
> >  - none
> > 
> >  include/net/devlink.h | 10 ++++++++++
> >  net/core/devlink.c    | 18 ++++++++++++++++++
> >  2 files changed, 28 insertions(+)
> > 
> > diff --git a/include/net/devlink.h b/include/net/devlink.h
> > index 20db4a070fc8..307937efa83a 100644
> > --- a/include/net/devlink.h
> > +++ b/include/net/devlink.h
> > @@ -1226,6 +1226,16 @@ struct devlink_ops {
> >  			      const struct devlink_trap_group *group,
> >  			      const struct devlink_trap_policer *policer,
> >  			      struct netlink_ext_ack *extack);
> > +	/**
> > +	 * @trap_group_action_set: Group action set function.
> 
> To be consistent with other operations:
> 
> Trap group action set function.

You mean the comment, right? Sure, will change.
> 
> > +	 *
> > +	 * If this callback is populated, it will take precedence over looping
> > +	 * over all traps in a group and calling .trap_action_set().
> > +	 */
> > +	int (*trap_group_action_set)(struct devlink *devlink,
> > +				     const struct devlink_trap_group *group,
> > +				     enum devlink_trap_action action,
> > +				     struct netlink_ext_ack *extack);
> >  	/**
> >  	 * @trap_policer_init: Trap policer initialization function.
> >  	 *
> > diff --git a/net/core/devlink.c b/net/core/devlink.c
> > index 10fea5854bc2..18136ad413e6 100644
> > --- a/net/core/devlink.c
> > +++ b/net/core/devlink.c
> > @@ -6720,6 +6720,24 @@ __devlink_trap_group_action_set(struct devlink *devlink,
> >  	struct devlink_trap_item *trap_item;
> >  	int err;
> >  
> > +	if (devlink->ops->trap_group_action_set) {
> > +		err = devlink->ops->trap_group_action_set(devlink, group_item->group,
> > +							  trap_action, extack);
> > +		if (err)
> > +			return err;
> > +
> > +		list_for_each_entry(trap_item, &devlink->trap_list, list) {
> > +			if (strcmp(trap_item->group_item->group->name, group_name))
> > +				continue;
> > +			if (trap_item->action != trap_action &&
> > +			    trap_item->trap->type != DEVLINK_TRAP_TYPE_DROP)
> > +				continue;
> > +			trap_item->action = trap_action;
> > +		}
> > +
> > +		return 0;
> > +	}
> > +
> >  	list_for_each_entry(trap_item, &devlink->trap_list, list) {
> >  		if (strcmp(trap_item->group_item->group->name, group_name))
> >  			continue;
> > -- 
> > 2.28.0
> > 

  reply	other threads:[~2020-10-01 13:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 19:16 [PATCH net-next v2 0/4] dpaa2-eth: add devlink parser error drop trap support Ioana Ciornei
2020-09-30 19:16 ` [PATCH net-next v2 1/4] devlink: add parser error drop packet traps Ioana Ciornei
2020-09-30 19:16 ` [PATCH net-next v2 2/4] devlink: add .trap_group_action_set() callback Ioana Ciornei
2020-09-30 19:53   ` Ido Schimmel
2020-10-01 13:21     ` Ioana Ciornei [this message]
2020-09-30 19:16 ` [PATCH net-next v2 3/4] dpaa2-eth: add basic devlink support Ioana Ciornei
2020-09-30 19:16 ` [PATCH net-next v2 4/4] dpaa2-eth: add support for devlink parser error drop traps Ioana Ciornei
2020-09-30 19:44   ` Ido Schimmel
2020-10-01 13:19     ` Ioana Ciornei
2020-10-01  0:25   ` Jakub Kicinski

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=20201001132122.ylyroyd5c45mvbsw@skbuf \
    --to=ioana.ciornei@nxp.com \
    --cc=davem@davemloft.net \
    --cc=idosch@idosch.org \
    --cc=idosch@nvidia.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --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