All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@idosch.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net, jiri@mellanox.com,
	andrew@lunn.ch, f.fainelli@gmail.com, vivien.didelot@gmail.com,
	roopa@cumulusnetworks.com, nikolay@cumulusnetworks.com,
	mlxsw@mellanox.com, Ido Schimmel <idosch@mellanox.com>
Subject: Re: [PATCH net-next 01/15] devlink: Add packet trap policers support
Date: Wed, 25 Mar 2020 11:41:43 +0200	[thread overview]
Message-ID: <20200325094143.GA1332836@splinter> (raw)
In-Reply-To: <20200324203109.71e1efc6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On Tue, Mar 24, 2020 at 08:31:09PM -0700, Jakub Kicinski wrote:
> On Tue, 24 Mar 2020 21:32:36 +0200 Ido Schimmel wrote:
> > +/**
> > + * devlink_trap_policers_register - Register packet trap policers with devlink.
> > + * @devlink: devlink.
> > + * @policers: Packet trap policers.
> > + * @policers_count: Count of provided packet trap policers.
> > + *
> > + * Return: Non-zero value on failure.
> > + */
> > +int
> > +devlink_trap_policers_register(struct devlink *devlink,
> > +			       const struct devlink_trap_policer *policers,
> > +			       size_t policers_count)
> > +{
> > +	int i, err;
> > +
> > +	mutex_lock(&devlink->lock);
> > +	for (i = 0; i < policers_count; i++) {
> > +		const struct devlink_trap_policer *policer = &policers[i];
> > +
> > +		if (WARN_ON(policer->id == 0)) {
> > +			err = -EINVAL;
> > +			goto err_trap_policer_verify;
> > +		}
> > +
> > +		err = devlink_trap_policer_register(devlink, policer);
> > +		if (err)
> > +			goto err_trap_policer_register;
> > +	}
> > +	mutex_unlock(&devlink->lock);
> > +
> > +	return 0;
> > +
> > +err_trap_policer_register:
> > +err_trap_policer_verify:
> 
> nit: as you probably know the label names are not really in compliance
> with:
> https://www.kernel.org/doc/html/latest/process/coding-style.html#centralized-exiting-of-functions
> ;)

Hi Jakub, thanks for the thorough review!

I assume you're referring to the fact that the label does not say what
the goto does? It seems that the coding style guide also allows for
labels that indicate why the label exists: "Choose label names which say
what the goto does or why the goto exists".

This is the form I'm used to, but I do adjust the names in code that
uses the other form (such as in netdevsim).

I already used this form in previous devlink submissions, so I would
like to stick to it unless you/Jiri have strong preference here.

> 
> > +	for (i--; i >= 0; i--)
> > +		devlink_trap_policer_unregister(devlink, &policers[i]);
> > +	mutex_unlock(&devlink->lock);
> > +	return err;
> > +}
> > +EXPORT_SYMBOL_GPL(devlink_trap_policers_register);

  reply	other threads:[~2020-03-25  9:41 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24 19:32 [PATCH net-next 00/15] Add packet trap policers support Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 01/15] devlink: " Ido Schimmel
2020-03-25  3:31   ` Jakub Kicinski
2020-03-25  9:41     ` Ido Schimmel [this message]
2020-03-25 10:41       ` Jiri Pirko
2020-03-25 16:43       ` Jakub Kicinski
2020-03-25  3:37   ` Jakub Kicinski
2020-03-25  9:46     ` Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 02/15] Documentation: Add description of packet trap policers Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 03/15] netdevsim: Add devlink-trap policer support Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 04/15] devlink: Add packet trap group parameters support Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 05/15] devlink: Allow setting of packet trap group parameters Ido Schimmel
2020-03-25  3:53   ` Jakub Kicinski
2020-03-25 10:37     ` Ido Schimmel
2020-03-25 16:45       ` Jakub Kicinski
2020-03-24 19:32 ` [PATCH net-next 06/15] netdevsim: Add support for " Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 07/15] selftests: netdevsim: Add test cases for devlink-trap policers Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 08/15] mlxsw: reg: Extend QPCR register Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 09/15] mlxsw: spectrum: Track used packet trap policer IDs Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 10/15] mlxsw: spectrum_trap: Prepare policers for registration with devlink Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 11/15] mlxsw: spectrum_trap: Add devlink-trap policer support Ido Schimmel
2020-03-25  3:33   ` Jakub Kicinski
2020-03-25 10:51     ` Ido Schimmel
2020-03-25 16:45       ` Jakub Kicinski
2020-03-24 19:32 ` [PATCH net-next 12/15] mlxsw: spectrum_trap: Do not initialize dedicated discard policer Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 13/15] mlxsw: spectrum_trap: Switch to use correct packet trap group Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 14/15] mlxsw: spectrum_trap: Add support for setting of packet trap group parameters Ido Schimmel
2020-03-24 19:32 ` [PATCH net-next 15/15] selftests: mlxsw: Add test cases for devlink-trap policers 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=20200325094143.GA1332836@splinter \
    --to=idosch@idosch.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=idosch@mellanox.com \
    --cc=jiri@mellanox.com \
    --cc=kuba@kernel.org \
    --cc=mlxsw@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    --cc=vivien.didelot@gmail.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.