Netdev List
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>, <netdev@vger.kernel.org>,
	Madhur Agrawal <madhur.agrawal@airoha.com>
Subject: Re: [PATCH RFC net-next v2] net: airoha: Add TCP LRO support
Date: Wed, 27 May 2026 16:12:47 +0200	[thread overview]
Message-ID: <ddeb02d4-27f4-4c81-85b5-928f2b5cc95e@intel.com> (raw)
In-Reply-To: <ahYLvlIYH60cvkWB@lore-desk>

From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: Tue, 26 May 2026 23:08:14 +0200

>> From: Lorenzo Bianconi <lorenzo@kernel.org>
>> Date: Tue, 26 May 2026 08:58:05 +0200

[...]

>>> @@ -587,6 +630,85 @@ static int airoha_qdma_get_gdm_port(struct airoha_eth *eth,
>>>  	return port >= ARRAY_SIZE(eth->ports) ? -EINVAL : port;
>>>  }
>>>  
>>> +static int airoha_qdma_lro_rx_process(struct airoha_queue *q,
>>> +				      struct airoha_qdma_desc *desc)
>>> +{
>>> +	u32 desc_ctrl = le32_to_cpu(READ_ONCE(desc->ctrl));
>>> +	u32 msg1 = le32_to_cpu(READ_ONCE(desc->msg1));
>>> +	u32 msg2 = le32_to_cpu(READ_ONCE(desc->msg2));
>>> +	u32 msg3 = le32_to_cpu(READ_ONCE(desc->msg3));
>>
>> Why are these READ_ONCE()s needed? Does desc come from the HW (sorry I
>> didn't follow the whole code flow) or...?
> 
> Correct, ctrl, msg1, msg2 and msg3 are subfields of the DMA descriptor read by
> airoha_qdma_rx_process() from the NIC. I guess here we have a similar issue as
> the one fixed in [0]
> 
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=4ae0604a0673e11e2075b178387151fcad5111b5

Hmm, I never believed that we need READ_ONCE()s when reading HW
descriptors, I always thought dma_alloc_coherent() is enough.
But maybe I've been mistaking...

[...]
>>> +
>>> +		if (*topt == cpu_to_be32((TCPOPT_NOP << 24) |
>>
>> Shouldn't this be `((u32)TCPOPT_NOP) << 24` to avoid sign issues?
> 
> I guess this is same approach used in [1]. Am I missing something?
> 
> [1] https://github.com/torvalds/linux/blob/master/net/ipv4/tcp_ipv4.c#L823

Yeah I also notice this in one more patch when scrolling netdev
yesterday. I guess it's okay here since TCPOPT_NOP is small and
constant and doesn't reach bit 31.

> 
> Regards,
> Lorenzo

Thanks,
Olek

      reply	other threads:[~2026-05-27 14:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  6:58 [PATCH RFC net-next v2] net: airoha: Add TCP LRO support Lorenzo Bianconi
2026-05-26 16:01 ` Alexander Lobakin
2026-05-26 21:08   ` Lorenzo Bianconi
2026-05-27 14:12     ` Alexander Lobakin [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=ddeb02d4-27f4-4c81-85b5-928f2b5cc95e@intel.com \
    --to=aleksander.lobakin@intel.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-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    --cc=madhur.agrawal@airoha.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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