All of lore.kernel.org
 help / color / mirror / Atom feed
From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jiri Pirko <jiri@resnulli.us>
Cc: <netdev@vger.kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shannon Nelson <shannon.nelson@amd.com>,
	Michael Chan <michael.chan@broadcom.com>,
	Cai Huoqing <cai.huoqing@linux.dev>,
	"George Cherian" <george.cherian@marvell.com>,
	Danielle Ratson <danieller@nvidia.com>,
	Moshe Shemesh <moshe@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	"Ariel Elior" <aelior@marvell.com>,
	Manish Chopra <manishc@marvell.com>,
	"Igor Russkikh" <irusskikh@marvell.com>,
	Coiby Xu <coiby.xu@gmail.com>,
	"Brett Creeley" <brett.creeley@amd.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	"Linu Cherian" <lcherian@marvell.com>,
	Geetha sowjanya <gakula@marvell.com>,
	"Jerin Jacob" <jerinj@marvell.com>,
	hariprasad <hkelam@marvell.com>,
	"Subbaraya Sundeep" <sbhatta@marvell.com>,
	Ido Schimmel <idosch@nvidia.com>, Petr Machata <petrm@nvidia.com>,
	Eran Ben Elisha <eranbe@nvidia.com>,
	Aya Levin <ayal@mellanox.com>, Leon Romanovsky <leon@kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Jesse Brandeburg <jesse.brandeburg@intel.com>
Subject: Re: [PATCH net-next v2 03/11] pds_core: devlink health: use retained error fmsg API
Date: Tue, 17 Oct 2023 13:35:03 +0200	[thread overview]
Message-ID: <9fcf96ac-e480-fa22-7357-04760ed1e47d@intel.com> (raw)
In-Reply-To: <ZS5s7QE07YkO55O7@nanopsycho>

On 10/17/23 13:15, Jiri Pirko wrote:
> Tue, Oct 17, 2023 at 01:06:54PM CEST, jiri@resnulli.us wrote:
>> Tue, Oct 17, 2023 at 12:53:33PM CEST, przemyslaw.kitszel@intel.com wrote:
>>> Drop unneeded error checking.
>>>
>>> devlink_fmsg_*() family of functions is now retaining errors,
>>> so there is no need to check for them after each call.
>>>
>>> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
>>> Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
>>> ---
>>> add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-57 (-57)
>>> ---
>>> drivers/net/ethernet/amd/pds_core/devlink.c | 29 ++++++---------------
>>> 1 file changed, 8 insertions(+), 21 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/amd/pds_core/devlink.c b/drivers/net/ethernet/amd/pds_core/devlink.c
>>> index d9607033bbf2..8b2b9e0d59f3 100644
>>> --- a/drivers/net/ethernet/amd/pds_core/devlink.c
>>> +++ b/drivers/net/ethernet/amd/pds_core/devlink.c
>>> @@ -154,33 +154,20 @@ int pdsc_fw_reporter_diagnose(struct devlink_health_reporter *reporter,
>>> 			      struct netlink_ext_ack *extack)
>>> {
>>> 	struct pdsc *pdsc = devlink_health_reporter_priv(reporter);
>>> -	int err;
>>>
>>> 	mutex_lock(&pdsc->config_lock);
>>> -
>>> 	if (test_bit(PDSC_S_FW_DEAD, &pdsc->state))
>>> -		err = devlink_fmsg_string_pair_put(fmsg, "Status", "dead");
>>> +		devlink_fmsg_string_pair_put(fmsg, "Status", "dead");
>>> 	else if (!pdsc_is_fw_good(pdsc))
>>> -		err = devlink_fmsg_string_pair_put(fmsg, "Status", "unhealthy");
>>> +		devlink_fmsg_string_pair_put(fmsg, "Status", "unhealthy");
>>> 	else
>>> -		err = devlink_fmsg_string_pair_put(fmsg, "Status", "healthy");
>>> -
>>> +		devlink_fmsg_string_pair_put(fmsg, "Status", "healthy");
>>> 	mutex_unlock(&pdsc->config_lock);
>>>
>>> -	if (err)
>>> -		return err;
>>> -
>>> -	err = devlink_fmsg_u32_pair_put(fmsg, "State",
>>> -					pdsc->fw_status &
>>> -						~PDS_CORE_FW_STS_F_GENERATION);
>>> -	if (err)
>>> -		return err;
>>> -
>>> -	err = devlink_fmsg_u32_pair_put(fmsg, "Generation",
>>> -					pdsc->fw_generation >> 4);
>>> -	if (err)
>>> -		return err;
>>> +	devlink_fmsg_u32_pair_put(fmsg, "State",
>>> +				  pdsc->fw_status & ~PDS_CORE_FW_STS_F_GENERATION);
>>> +	devlink_fmsg_u32_pair_put(fmsg, "Generation", pdsc->fw_generation >> 4);
>>> +	devlink_fmsg_u32_pair_put(fmsg, "Recoveries", pdsc->fw_recoveries);
>>>
>>> -	return devlink_fmsg_u32_pair_put(fmsg, "Recoveries",
>>> -					 pdsc->fw_recoveries);
>>> +	return 0;
>>
>> Could you please covert the function to return void? Please make sure
>> to do this in the rest of the patchset as well.
>>
>> Thanks!
> 
> Sorry, I messed up, this is a cb. Looks fine.

Thanks :)

I was also tempted to convert, but there are other possibilities of
error to report from callbacks :)
There are still some places in mlx5 that seems as possible candidates,
but this series is big enough to draw the line here.

> 
> pw-bot: under-review
> 
>>
>> pw-bot: cr
>>
>>
>>> }
>>> -- 
>>> 2.40.1
>>>


  reply	other threads:[~2023-10-17 11:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 10:53 [PATCH net-next v2 00/11] devlink: retain error in struct devlink_fmsg Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 01/11] " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 02/11] netdevsim: devlink health: use retained error fmsg API Przemek Kitszel
2023-10-18  1:20   ` Jakub Kicinski
2023-10-17 10:53 ` [PATCH net-next v2 03/11] pds_core: " Przemek Kitszel
2023-10-17 11:06   ` Jiri Pirko
2023-10-17 11:15     ` Jiri Pirko
2023-10-17 11:35       ` Przemek Kitszel [this message]
2023-10-17 16:52   ` Nelson, Shannon
2023-10-17 10:53 ` [PATCH net-next v2 04/11] bnxt_en: " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 05/11] hinic: " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 06/11] octeontx2-af: " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 07/11] mlxsw: core: " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 08/11] net/mlx5: " Przemek Kitszel
2023-10-18 16:08   ` Simon Horman
2023-10-17 10:53 ` [PATCH net-next v2 09/11] qed: " Przemek Kitszel
2023-10-17 10:53 ` [PATCH net-next v2 10/11] staging: qlge: " Przemek Kitszel
2023-10-18  1:15   ` Jakub Kicinski
2023-10-19 14:28     ` Benjamin Poirier
2023-10-19 14:42       ` Jakub Kicinski
2023-10-19 18:32         ` Benjamin Poirier
2023-10-17 10:53 ` [PATCH net-next v2 11/11] devlink: convert most of devlink_fmsg_*() to return void Przemek Kitszel
2023-10-18 16:10   ` Simon Horman
2023-10-17 11:17 ` [PATCH net-next v2 00/11] devlink: retain error in struct devlink_fmsg Jiri Pirko

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=9fcf96ac-e480-fa22-7357-04760ed1e47d@intel.com \
    --to=przemyslaw.kitszel@intel.com \
    --cc=aelior@marvell.com \
    --cc=ayal@mellanox.com \
    --cc=brett.creeley@amd.com \
    --cc=cai.huoqing@linux.dev \
    --cc=coiby.xu@gmail.com \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eranbe@nvidia.com \
    --cc=gakula@marvell.com \
    --cc=george.cherian@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=idosch@nvidia.com \
    --cc=irusskikh@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=jesse.brandeburg@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=moshe@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=saeedm@nvidia.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=shannon.nelson@amd.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.