netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Suman Ghosh <sumang@marvell.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	Sunil Kovvuri Goutham <sgoutham@marvell.com>,
	Subbaraya Sundeep Bhatta <sbhatta@marvell.com>,
	Jerin Jacob Kollanukkaran <jerinj@marvell.com>,
	Geethasowjanya Akula <gakula@marvell.com>,
	Hariprasad Kelam <hkelam@marvell.com>,
	Linu Cherian <lcherian@marvell.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXT] Re: [net PATCH] octeontx2-pf: Fix graceful exit during PFC configuration failure
Date: Mon, 18 Dec 2023 16:26:04 +0000	[thread overview]
Message-ID: <20231218162604.GH6288@kernel.org> (raw)
In-Reply-To: <SJ0PR18MB52169B706EB4F8F8D8FAB20CDB91A@SJ0PR18MB5216.namprd18.prod.outlook.com>

On Sun, Dec 17, 2023 at 06:26:24AM +0000, Suman Ghosh wrote:

...

> >Perhaps I am on the wrong track here, but if
> >1. otx2_pfc_txschq_stop() was called by otx2_pfc_txschq_update()
> >   (or otx2_pfc_txschq_config()) for relevant error cases; and
> >2. pfc_en was passed as a parameter to otx2_config_priority_flow_ctrl()
> >
> >Then I think that the unwind logic in the if condition above could
> >be expressed as unwind ladder with goto labels whereby the order
> >of unwinding is strictly the reverse of configuration.
> >
> >This is a subjective opinion, but the advantage of this approach is that
> >it
> >tends to lead to more maintainable code and fewer errors in... error
> >paths.
> >
> >(Completely untested!)
> >
> >	...
> >	if (err)
> >		goto err_pfc_en;
> >	...
> >	err = otx2_pfc_txschq_update(pfvf);
> >	if (err)
> >		goto err_config;
> >
> >	return 0;
> >
> >err_config:
> >	if (pfc->pfc_en)
> >		otx2_nix_config_bp(pfvf, false);
> >	otx2_config_priority_flow_ctrl(pfvf, old_pfc_en);
> >err_pfc_en:
> >	pfvf->pfc_en = old_pfc_en;
> >
> >	return err;
> [Suman] Let me think through it. I need to check if some cases will be missed, will update, and push a new patch in that case. Thanks for your feedback, Simon!!

Thanks, much appreciated.

      reply	other threads:[~2023-12-18 16:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 18:10 [net PATCH] octeontx2-pf: Fix graceful exit during PFC configuration failure Suman Ghosh
2023-12-15 10:30 ` patchwork-bot+netdevbpf
2023-12-15 12:50 ` Simon Horman
2023-12-17  6:26   ` [EXT] " Suman Ghosh
2023-12-18 16:26     ` Simon Horman [this message]

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=20231218162604.GH6288@kernel.org \
    --to=horms@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    --cc=sumang@marvell.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).