From: "Keller, Jacob E" <jacob.e.keller@intel.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Jakub Kicinski <kuba@kernel.org>
Subject: RE: [net-next v2 07/11] devlink: report error once U32_MAX snapshot ids have been used
Date: Thu, 26 Mar 2020 16:09:44 +0000 [thread overview]
Message-ID: <02874ECE860811409154E81DA85FBB58B6CA3E5E@fmsmsx101.amr.corp.intel.com> (raw)
In-Reply-To: <20200326073047.GJ11304@nanopsycho.orion>
> -----Original Message-----
> From: netdev-owner@vger.kernel.org <netdev-owner@vger.kernel.org> On
> Behalf Of Jiri Pirko
> Sent: Thursday, March 26, 2020 12:31 AM
> To: Keller, Jacob E <jacob.e.keller@intel.com>
> Cc: netdev@vger.kernel.org; Jakub Kicinski <kuba@kernel.org>
> Subject: Re: [net-next v2 07/11] devlink: report error once U32_MAX snapshot
> ids have been used
>
> Thu, Mar 26, 2020 at 04:51:53AM CET, jacob.e.keller@intel.com wrote:
> >The devlink_snapshot_id_get() function returns a snapshot id. The
> >snapshot id is a u32, so there is no way to indicate an error code.
> >
> >Indeed, the two current callers of devlink_snapshot_id_get() assume that
> >a negative value is an error.
>
> I don't see they do.
>
You're right, they don't. I was confused when I wrote this because the previous version of this patch did change them to check for error, and then I realized we didn't need that patch and removed it, but forgot to update this.
Can fix this if we need a respin for another reason.
>
> >
> >A future change is going to possibly add additional cases where this
> >function could fail. Refactor the function to return the snapshot id in
> >an argument, so that it can return zero or an error value.
> >
> >This ensures that snapshot ids cannot be confused with error values, and
> >aids in the future refactor of snapshot id allocation management.
> >
> >Because there is no current way to release previously used snapshot ids,
> >add a simple check ensuring that an error is reported in case the
> >snapshot_id would over flow.
> >
> >Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
>
> The code looks good.
>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
next prev parent reply other threads:[~2020-03-26 16:09 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-26 3:51 [net-next v2 00/11] implement DEVLINK_CMD_REGION_NEW Jacob Keller
2020-03-26 3:51 ` [net-next v2 01/11] devlink: prepare to support region operations Jacob Keller
2020-03-26 3:51 ` [net-next v2 02/11] devlink: convert snapshot destructor callback to region op Jacob Keller
2020-03-26 3:51 ` [net-next v2 03/11] devlink: trivial: fix tab in function documentation Jacob Keller
2020-03-26 3:51 ` [net-next v2 04/11] devlink: add function to take snapshot while locked Jacob Keller
2020-03-26 3:51 ` [net-next v2 05/11] devlink: use -ENOSPC to indicate no more room for snapshots Jacob Keller
2020-03-26 7:24 ` Jiri Pirko
2020-03-26 3:51 ` [net-next v2 06/11] devlink: extract snapshot id allocation to helper function Jacob Keller
2020-03-26 7:25 ` Jiri Pirko
2020-03-26 3:51 ` [net-next v2 07/11] devlink: report error once U32_MAX snapshot ids have been used Jacob Keller
2020-03-26 7:30 ` Jiri Pirko
2020-03-26 16:09 ` Keller, Jacob E [this message]
2020-03-26 3:51 ` [net-next v2 08/11] devlink: track snapshot id usage count using an xarray Jacob Keller
2020-03-26 8:35 ` Jiri Pirko
2020-03-26 3:51 ` [net-next v2 09/11] devlink: implement DEVLINK_CMD_REGION_NEW Jacob Keller
2020-03-26 8:51 ` Jiri Pirko
2020-03-26 8:52 ` Jiri Pirko
2020-03-26 16:19 ` Jacob Keller
2020-03-26 21:10 ` Jiri Pirko
2020-03-26 3:51 ` [net-next v2 10/11] netdevsim: support taking immediate snapshot via devlink Jacob Keller
2020-03-26 9:00 ` Jiri Pirko
2020-03-26 3:51 ` [net-next v2 11/11] ice: add a devlink region for dumping NVM contents Jacob Keller
2020-03-26 9:02 ` Jiri Pirko
2020-03-26 16:23 ` Jacob Keller
2020-03-26 21:11 ` Jiri Pirko
2020-03-26 7:23 ` [net-next v2 00/11] implement DEVLINK_CMD_REGION_NEW Jiri Pirko
2020-03-26 7:51 ` Jiri Pirko
2020-03-26 16:15 ` Jacob Keller
2020-03-26 21:12 ` Jiri Pirko
2020-03-26 8:36 ` Jiri Pirko
2020-03-26 8:54 ` Jiri Pirko
2020-03-26 18:27 ` David Miller
2020-03-26 18:29 ` Jacob Keller
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=02874ECE860811409154E81DA85FBB58B6CA3E5E@fmsmsx101.amr.corp.intel.com \
--to=jacob.e.keller@intel.com \
--cc=jiri@resnulli.us \
--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;
as well as URLs for NNTP newsgroup(s).