netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, Jiri Pirko <jiri@resnulli.us>,
	Madhu Chittim <madhu.chittim@intel.com>,
	Sridhar Samudrala <sridhar.samudrala@intel.com>,
	Simon Horman <horms@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Jamal Hadi Salim <jhs@mojatatu.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com,
	intel-wired-lan@lists.osuosl.org, edumazet@google.com
Subject: Re: [PATCH v5 net-next 04/12] net-shapers: implement NL group operation
Date: Fri, 30 Aug 2024 11:48:51 -0700	[thread overview]
Message-ID: <20240830114851.58cd02c4@kernel.org> (raw)
In-Reply-To: <d0244464-0596-4309-89ff-d8dcd9aa3d35@redhat.com>

On Fri, 30 Aug 2024 18:48:41 +0200 Paolo Abeni wrote:
> >> +	const struct net_shaper_ops *ops = net_shaper_binding_ops(binding);
> >> +	struct net_shaper_info *parent = NULL;
> >> +	struct net_shaper_handle leaf_handle;
> >> +	int i, ret;
> >> +
> >> +	if (node_handle->scope == NET_SHAPER_SCOPE_NODE) {
> >> +		if (node_handle->id != NET_SHAPER_ID_UNSPEC &&
> >> +		    !net_shaper_cache_lookup(binding, node_handle)) {
> >> +			NL_SET_ERR_MSG_FMT(extack, "Node shaper %d:%d does not exists",
> >> +					   node_handle->scope, node_handle->id);  
> > 
> > BAD_ATTR would do?  
> 
> We can reach here from the delete() op (next patch), there will be no 
> paired attribute is such case. Even for the group() operation it will 
> need to push here towards several callers additional context to identify 
> the attribute, it should be quite ugly, can we keep with ERR_MSG_FMT here?

Alright. But TBH I haven't grasped the semantics of how you use UNSPEC.
So I reserve the right to complain again in v6 if I think of a better
way ;)

> >> +	if (ret < 0)
> >> +		goto free_shapers;
> >> +
> >> +	ret = net_shaper_group_send_reply(info, &node_handle);
> >> +	if (ret) {
> >> +		/* Error on reply is not fatal to avoid rollback a successful
> >> +		 * configuration.  
> > 
> > Slight issues with the grammar here, but I think it should be fatal.
> > The sender will most likely block until they get a response.
> > Not to mention that the caller will not know what the handle
> > we allocated is.  
> 
> You mean we should return a negative error code, and _not_ that we 
> should additionally attempt a rollback, right? The rollback will be very 
> difficult at best: at this point destructive action have taken place.

net_shaper_group_send_reply() does a bit too much, TBH.
Given the rollback complexity propagating the failure just
from genlmsg_reply() is fine. I think the only case it fails
is if the socket is congested, which is in senders control.
But genlmsg_new() can be done before we start. And we should 
size the skb so that nla_puts sever fail (just pop a WARN_ON()
on their error path, to make sure we catch it if they grow,
I don't think they can fail with your current code).

  reply	other threads:[~2024-08-30 18:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-29 15:16 [PATCH v5 net-next 00/12] net: introduce TX H/W shaping API Paolo Abeni
2024-08-29 15:16 ` [PATCH v5 net-next 01/12] netlink: spec: add shaper YAML spec Paolo Abeni
2024-08-29 15:16 ` [PATCH v5 net-next 02/12] net-shapers: implement NL get operation Paolo Abeni
2024-08-29 23:28   ` Jakub Kicinski
2024-08-30  1:20   ` Jakub Kicinski
2024-08-30 10:55     ` Paolo Abeni
2024-08-30 18:39       ` Jakub Kicinski
2024-08-30 23:42         ` Jakub Kicinski
2024-09-02 13:00         ` Paolo Abeni
2024-08-30 15:43     ` Paolo Abeni
2024-08-30 19:14       ` Jakub Kicinski
2024-09-02 10:10         ` Paolo Abeni
2024-09-03  0:37           ` Jakub Kicinski
2024-08-29 15:16 ` [PATCH v5 net-next 03/12] net-shapers: implement NL set and delete operations Paolo Abeni
2024-08-30  1:43   ` Jakub Kicinski
2024-08-29 15:16 ` [PATCH v5 net-next 04/12] net-shapers: implement NL group operation Paolo Abeni
2024-08-30  2:04   ` Jakub Kicinski
2024-08-30 16:48     ` Paolo Abeni
2024-08-30 18:48       ` Jakub Kicinski [this message]
2024-08-29 15:16 ` [PATCH v5 net-next 05/12] net-shapers: implement delete support for NODE scope shaper Paolo Abeni
2024-08-29 15:16 ` [PATCH v5 net-next 06/12] netlink: spec: add shaper introspection support Paolo Abeni
2024-08-29 15:17 ` [PATCH v5 net-next 07/12] net: shaper: implement " Paolo Abeni
2024-08-30  2:11   ` Jakub Kicinski
2024-08-29 15:17 ` [PATCH v5 net-next 08/12] testing: net-drv: add basic shaper test Paolo Abeni
2024-08-29 15:17 ` [PATCH v5 net-next 09/12] virtchnl: support queue rate limit and quanta size configuration Paolo Abeni
2024-08-29 15:17 ` [PATCH v5 net-next 10/12] ice: Support VF " Paolo Abeni
2024-08-29 15:17 ` [PATCH v5 net-next 11/12] iavf: Add net_shaper_ops support Paolo Abeni
2024-08-30  2:09   ` Jakub Kicinski
2024-08-29 15:17 ` [PATCH v5 net-next 12/12] iavf: add support to exchange qos capabilities Paolo Abeni

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=20240830114851.58cd02c4@kernel.org \
    --to=kuba@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=john.fastabend@gmail.com \
    --cc=madhu.chittim@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=sgoutham@marvell.com \
    --cc=sridhar.samudrala@intel.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 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).