From: Ratheesh Kannoth <rkannoth@marvell.com>
To: "Jagielski, Jedrzej" <jedrzej.jagielski@intel.com>
Cc: "cjacob@marvell.com" <cjacob@marvell.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"hkelam@marvell.com" <hkelam@marvell.com>,
"jbrandeb@kernel.org" <jbrandeb@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"sgoutham@marvell.com" <sgoutham@marvell.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
Naveen Mamindlapalli <naveenm@marvell.com>
Subject: Re: [PATCH net] octeontx2-af: poll for TX link credits before link mode change
Date: Wed, 19 Aug 2026 10:08:55 +0530 [thread overview]
Message-ID: <aoUzX2qMMDmp2_fB@rkannoth-OptiPlex-7090> (raw)
In-Reply-To: <PH0PR11MB5902CB2559DB564EA0F2488EF0A62@PH0PR11MB5902.namprd11.prod.outlook.com>
On 2026-08-18 at 13:08:48, Jagielski, Jedrzej (jedrzej.jagielski@intel.com) wrote:
> From: Ratheesh Kannoth <rkannoth@marvell.com>
> Sent: Tuesday, August 18, 2026 5:37 AM
>
> >+int rvu_nix_tl1_xoff_wait_for_link_credits(struct rvu *rvu, u16 pcifunc)
> >+{
> >+ int link, blkaddr, count = 1000;
>
> count can be declared inside the loop as it's not used outside
> same for regval
historically the Linux kernel required declaring all variables at the beginning of a function or block.
>
> moreover defs instead of magic is always better choice
AFAIK, this is not a magic number but a counter.
Could you show me the Kernel coding guidilines which mandates this ?
>
> >+ u64 tx_credits, regval;
> >+ struct nix_hw *nix_hw;
> >+
> >+ blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NIX, pcifunc);
> >+ if (blkaddr < 0)
> >+ return NIX_AF_ERR_AF_LF_INVALID;
> >+
> >+ nix_hw = get_nix_hw(rvu->hw, blkaddr);
> >+ if (!nix_hw)
> >+ return NIX_AF_ERR_INVALID_NIXBLK;
> >+
> >+ /* set TL1 sw_xoff */
> >+ link = nix_get_tx_link(rvu, pcifunc);
> >+ rvu_write64(rvu, blkaddr, NIX_AF_TL1X_SW_XOFF(link), 1);
> >+
> >+ /* wait for link credits to return */
> >+ tx_credits = nix_hw->tx_credits[link];
> >+ while (1) {
>
> cant we use just for loop if this is simple cnt decrementing?
Do we see any advantage ?
>
> >+ regval = rvu_read64(rvu, blkaddr, NIX_AF_TX_LINKX_NORM_CREDIT(link));
> >+ if (((regval >> 12) & 0xFFFFF) == tx_credits)
>
> FIELD_GET(GENMASK(31, 12), regval) ?
ACK
prev parent reply other threads:[~2026-08-19 4:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 3:36 [PATCH net] octeontx2-af: poll for TX link credits before link mode change Ratheesh Kannoth
2026-08-18 7:38 ` Jagielski, Jedrzej
2026-08-19 4:38 ` Ratheesh Kannoth [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=aoUzX2qMMDmp2_fB@rkannoth-OptiPlex-7090 \
--to=rkannoth@marvell.com \
--cc=andrew+netdev@lunn.ch \
--cc=cjacob@marvell.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkelam@marvell.com \
--cc=jbrandeb@kernel.org \
--cc=jedrzej.jagielski@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naveenm@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sgoutham@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