mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "G Thomas, Rohan" <rohan.g.thomas@altera.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: "Russell King (Oracle)" <linux@armlinux.org.uk>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <Jose.Abreu@synopsys.com>,
	Rohan G Thomas <rohan.g.thomas@intel.com>,
	netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Matthew Gerlach <matthew.gerlach@altera.com>
Subject: Re: [PATCH net 1/2] net: stmmac: est: Fix GCL bounds checks
Date: Fri, 12 Sep 2025 10:34:21 +0530	[thread overview]
Message-ID: <bb5f6f98-75aa-44df-a70a-0f25b1efa4a3@altera.com> (raw)
In-Reply-To: <20250911170159.383edcc6@kernel.org>

Hi Jakub,

Thanks for reviewing the patch.

On 9/12/2025 5:31 AM, Jakub Kicinski wrote:
> On Thu, 11 Sep 2025 18:12:16 +0530 G Thomas, Rohan wrote:
>> On 9/11/2025 4:54 PM, Russell King (Oracle) wrote:
>>> On Thu, Sep 11, 2025 at 04:22:59PM +0800, Rohan G Thomas via B4 Relay wrote:
>>>> @@ -1012,7 +1012,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv,
>>>>    		s64 delta_ns = qopt->entries[i].interval;
>>>>    		u32 gates = qopt->entries[i].gate_mask;
>>>>    
>>>> -		if (delta_ns > GENMASK(wid, 0))
>>>> +		if (delta_ns >= BIT(wid))
>>>
>>> While I agree this makes it look better, you don't change the version
>>> below, which makes the code inconsistent. I also don't see anything
>>> wrong with the original comparison.
>>
>> Just to clarify the intent behind this change:
>> For example, if wid = 3, then GENMASK(3, 0) = 0b1111 = 15. But the
>> maximum supported gate interval in this case is actually 7, since only 3
>> bits are available to represent the value. So in the patch, the
>> condition delta_ns >= BIT(wid) effectively checks if delta_ns is 8 or
>> more, which correctly returns an error for values that exceed the 3-bit
>> limit.
> 
> Comparison to BIT() looks rather odd, I think it's better to correct
> the GENMASK() bound?

Sure I'll update the condition to use GENMASK(wid - 1, 0) in the next
version. That should make the logic consistent with the checks below.

Best Regards,
Rohan

  reply	other threads:[~2025-09-12  5:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-11  8:22 [PATCH net 0/2] net: stmmac: Minor fixes for stmmac EST implementation Rohan G Thomas via B4 Relay
2025-09-11  8:22 ` [PATCH net 1/2] net: stmmac: est: Fix GCL bounds checks Rohan G Thomas via B4 Relay
2025-09-11 11:24   ` Russell King (Oracle)
2025-09-11 12:42     ` G Thomas, Rohan
2025-09-12  0:01       ` Jakub Kicinski
2025-09-12  5:04         ` G Thomas, Rohan [this message]
2025-09-11  8:23 ` [PATCH net 2/2] net: stmmac: Consider Tx VLAN offload tag length for maxSDU Rohan G Thomas via B4 Relay

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=bb5f6f98-75aa-44df-a70a-0f25b1efa4a3@altera.com \
    --to=rohan.g.thomas@altera.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=matthew.gerlach@altera.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rohan.g.thomas@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

all inboxes | Powered by JetHome®