* [RFC PATCH net-next] net: Modify CSUM capability check for USO
@ 2025-03-12 11:54 Radharapu Rakesh
2025-03-12 16:14 ` Paolo Abeni
0 siblings, 1 reply; 5+ messages in thread
From: Radharapu Rakesh @ 2025-03-12 11:54 UTC (permalink / raw)
To: git, davem, edumazet, kuba, pabeni, horms, kuniyu, bigeasy
Cc: netdev, linux-kernel, rakesh.radharapu, harini.katakam,
radhey.shyam.pandey, michal.simek
Some devices supporting USO have only ipv4 checksum enabled,
but USO gets disabled because both ipv4 and ipv6 functionality is checked.
IPv4 or IPv6 or both checksums, can be utilized with UDP segmentation
offload. Separate checks for both IPv4 and IPv6 checksums.
Fixes: 2b2bc3bab158 ("net: Make USO depend on CSUM offload")
Signed-off-by: Radharapu Rakesh <rakesh.radharapu@amd.com>
---
net/core/dev.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 1cb134ff7327..a22f8f6e2ed1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -10465,11 +10465,13 @@ static void netdev_sync_lower_features(struct net_device *upper,
static bool netdev_has_ip_or_hw_csum(netdev_features_t features)
{
- netdev_features_t ip_csum_mask = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
- bool ip_csum = (features & ip_csum_mask) == ip_csum_mask;
+ netdev_features_t ipv4_csum_mask = NETIF_F_IP_CSUM;
+ netdev_features_t ipv6_csum_mask = NETIF_F_IPV6_CSUM;
+ bool ipv4_csum = (features & ipv4_csum_mask) == ipv4_csum_mask;
+ bool ipv6_csum = (features & ipv6_csum_mask) == ipv6_csum_mask;
bool hw_csum = features & NETIF_F_HW_CSUM;
- return ip_csum || hw_csum;
+ return ipv4_csum || ipv6_csum || hw_csum;
}
static netdev_features_t netdev_fix_features(struct net_device *dev,
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH net-next] net: Modify CSUM capability check for USO
2025-03-12 11:54 [RFC PATCH net-next] net: Modify CSUM capability check for USO Radharapu Rakesh
@ 2025-03-12 16:14 ` Paolo Abeni
2025-03-12 16:59 ` Radharapu, Rakesh
0 siblings, 1 reply; 5+ messages in thread
From: Paolo Abeni @ 2025-03-12 16:14 UTC (permalink / raw)
To: Radharapu Rakesh, git, davem, edumazet, kuba, horms, kuniyu, bigeasy
Cc: netdev, linux-kernel, harini.katakam, radhey.shyam.pandey, michal.simek
On 3/12/25 12:54 PM, Radharapu Rakesh wrote:
> net/core/dev.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 1cb134ff7327..a22f8f6e2ed1 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -10465,11 +10465,13 @@ static void netdev_sync_lower_features(struct net_device *upper,
>
> static bool netdev_has_ip_or_hw_csum(netdev_features_t features)
> {
> - netdev_features_t ip_csum_mask = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
> - bool ip_csum = (features & ip_csum_mask) == ip_csum_mask;
> + netdev_features_t ipv4_csum_mask = NETIF_F_IP_CSUM;
> + netdev_features_t ipv6_csum_mask = NETIF_F_IPV6_CSUM;
> + bool ipv4_csum = (features & ipv4_csum_mask) == ipv4_csum_mask;
> + bool ipv6_csum = (features & ipv6_csum_mask) == ipv6_csum_mask;
> bool hw_csum = features & NETIF_F_HW_CSUM;
>
> - return ip_csum || hw_csum;
> + return ipv4_csum || ipv6_csum || hw_csum;
> }
The above will additionally affect TLS offload, and will likely break
i.e. USO over IPv6 traffic landing on devices supporting only USO over
IPv4, unless such devices additionally implement a suitable
ndo_features_check().
Such situation will be quite bug prone, I'm unsure we want this kind of
change - even without looking at the TLS side of it.
/P
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [RFC PATCH net-next] net: Modify CSUM capability check for USO
2025-03-12 16:14 ` Paolo Abeni
@ 2025-03-12 16:59 ` Radharapu, Rakesh
2025-03-16 2:04 ` Willem de Bruijn
0 siblings, 1 reply; 5+ messages in thread
From: Radharapu, Rakesh @ 2025-03-12 16:59 UTC (permalink / raw)
To: Paolo Abeni, git (AMD-Xilinx),
davem, edumazet, kuba, horms, kuniyu, bigeasy
Cc: netdev, linux-kernel, Katakam, Harini, Pandey, Radhey Shyam,
Simek, Michal
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Paolo Abeni <pabeni@redhat.com>
> Sent: Wednesday, March 12, 2025 9:44 PM
> To: Radharapu, Rakesh <Rakesh.Radharapu@amd.com>; git (AMD-Xilinx)
> <git@amd.com>; davem@davemloft.net; edumazet@google.com;
> kuba@kernel.org; horms@kernel.org; kuniyu@amazon.com;
> bigeasy@linutronix.de
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Katakam, Harini
> <harini.katakam@amd.com>; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Simek, Michal
> <michal.simek@amd.com>
> Subject: Re: [RFC PATCH net-next] net: Modify CSUM capability check for USO
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> On 3/12/25 12:54 PM, Radharapu Rakesh wrote:
> > net/core/dev.c | 8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c index
> > 1cb134ff7327..a22f8f6e2ed1 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -10465,11 +10465,13 @@ static void
> > netdev_sync_lower_features(struct net_device *upper,
> >
> > static bool netdev_has_ip_or_hw_csum(netdev_features_t features) {
> > - netdev_features_t ip_csum_mask = NETIF_F_IP_CSUM |
> NETIF_F_IPV6_CSUM;
> > - bool ip_csum = (features & ip_csum_mask) == ip_csum_mask;
> > + netdev_features_t ipv4_csum_mask = NETIF_F_IP_CSUM;
> > + netdev_features_t ipv6_csum_mask = NETIF_F_IPV6_CSUM;
> > + bool ipv4_csum = (features & ipv4_csum_mask) == ipv4_csum_mask;
> > + bool ipv6_csum = (features & ipv6_csum_mask) == ipv6_csum_mask;
> > bool hw_csum = features & NETIF_F_HW_CSUM;
> >
> > - return ip_csum || hw_csum;
> > + return ipv4_csum || ipv6_csum || hw_csum;
> > }
>
> The above will additionally affect TLS offload, and will likely break i.e. USO
> over IPv6 traffic landing on devices supporting only USO over IPv4, unless
> such devices additionally implement a suitable ndo_features_check().
>
> Such situation will be quite bug prone, I'm unsure we want this kind of change
> - even without looking at the TLS side of it.
>
> /P
Thanks for your review. I understand that this will lead to an issue.
We have a device that supports only IPv4 CSUM and are unable to enable the
USO feature because of this check. Can you please let me know if splitting
GSO feature for IPv4 and IPv6 would be helpful? That way corresponding
CSUM offloads can be checked. But this would be a major change.
Will appreciate any other suggestions.
Regards,
Rakesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [RFC PATCH net-next] net: Modify CSUM capability check for USO
2025-03-12 16:59 ` Radharapu, Rakesh
@ 2025-03-16 2:04 ` Willem de Bruijn
2025-03-18 7:01 ` Radharapu, Rakesh
0 siblings, 1 reply; 5+ messages in thread
From: Willem de Bruijn @ 2025-03-16 2:04 UTC (permalink / raw)
To: Radharapu, Rakesh, Paolo Abeni, git (AMD-Xilinx),
davem, edumazet, kuba, horms, kuniyu, bigeasy
Cc: netdev, linux-kernel, Katakam, Harini, Pandey, Radhey Shyam,
Simek, Michal
Radharapu, Rakesh wrote:
> [AMD Official Use Only - AMD Internal Distribution Only]
>
> > -----Original Message-----
> > From: Paolo Abeni <pabeni@redhat.com>
> > Sent: Wednesday, March 12, 2025 9:44 PM
> > To: Radharapu, Rakesh <Rakesh.Radharapu@amd.com>; git (AMD-Xilinx)
> > <git@amd.com>; davem@davemloft.net; edumazet@google.com;
> > kuba@kernel.org; horms@kernel.org; kuniyu@amazon.com;
> > bigeasy@linutronix.de
> > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Katakam, Harini
> > <harini.katakam@amd.com>; Pandey, Radhey Shyam
> > <radhey.shyam.pandey@amd.com>; Simek, Michal
> > <michal.simek@amd.com>
> > Subject: Re: [RFC PATCH net-next] net: Modify CSUM capability check for USO
> >
> > Caution: This message originated from an External Source. Use proper
> > caution when opening attachments, clicking links, or responding.
> >
> >
> > On 3/12/25 12:54 PM, Radharapu Rakesh wrote:
> > > net/core/dev.c | 8 +++++---
> > > 1 file changed, 5 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/net/core/dev.c b/net/core/dev.c index
> > > 1cb134ff7327..a22f8f6e2ed1 100644
> > > --- a/net/core/dev.c
> > > +++ b/net/core/dev.c
> > > @@ -10465,11 +10465,13 @@ static void
> > > netdev_sync_lower_features(struct net_device *upper,
> > >
> > > static bool netdev_has_ip_or_hw_csum(netdev_features_t features) {
> > > - netdev_features_t ip_csum_mask = NETIF_F_IP_CSUM |
> > NETIF_F_IPV6_CSUM;
> > > - bool ip_csum = (features & ip_csum_mask) == ip_csum_mask;
> > > + netdev_features_t ipv4_csum_mask = NETIF_F_IP_CSUM;
> > > + netdev_features_t ipv6_csum_mask = NETIF_F_IPV6_CSUM;
> > > + bool ipv4_csum = (features & ipv4_csum_mask) == ipv4_csum_mask;
> > > + bool ipv6_csum = (features & ipv6_csum_mask) == ipv6_csum_mask;
> > > bool hw_csum = features & NETIF_F_HW_CSUM;
> > >
> > > - return ip_csum || hw_csum;
> > > + return ipv4_csum || ipv6_csum || hw_csum;
> > > }
> >
> > The above will additionally affect TLS offload, and will likely break i.e. USO
> > over IPv6 traffic landing on devices supporting only USO over IPv4, unless
> > such devices additionally implement a suitable ndo_features_check().
> >
> > Such situation will be quite bug prone, I'm unsure we want this kind of change
> > - even without looking at the TLS side of it.
> >
> > /P
> Thanks for your review. I understand that this will lead to an issue.
> We have a device that supports only IPv4 CSUM and are unable to enable the
> USO feature because of this check. Can you please let me know if splitting
> GSO feature for IPv4 and IPv6 would be helpful? That way corresponding
> CSUM offloads can be checked. But this would be a major change.
> Will appreciate any other suggestions.
Splitting NETIF_F_GSO_UDP_L4 would incur significant churn.
Since this is a limitation of a specific device, can you instead
advertise the feature, but for IPv6 packets drop the flag in
ndo_features_check?
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [RFC PATCH net-next] net: Modify CSUM capability check for USO
2025-03-16 2:04 ` Willem de Bruijn
@ 2025-03-18 7:01 ` Radharapu, Rakesh
0 siblings, 0 replies; 5+ messages in thread
From: Radharapu, Rakesh @ 2025-03-18 7:01 UTC (permalink / raw)
To: Willem de Bruijn, Paolo Abeni, git (AMD-Xilinx),
davem, edumazet, kuba, horms, kuniyu, bigeasy
Cc: netdev, linux-kernel, Katakam, Harini, Pandey, Radhey Shyam,
Simek, Michal
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Sent: Sunday, March 16, 2025 7:35 AM
> To: Radharapu, Rakesh <Rakesh.Radharapu@amd.com>; Paolo Abeni
> <pabeni@redhat.com>; git (AMD-Xilinx) <git@amd.com>;
> davem@davemloft.net; edumazet@google.com; kuba@kernel.org;
> horms@kernel.org; kuniyu@amazon.com; bigeasy@linutronix.de
> Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Katakam, Harini
> <harini.katakam@amd.com>; Pandey, Radhey Shyam
> <radhey.shyam.pandey@amd.com>; Simek, Michal
> <michal.simek@amd.com>
> Subject: RE: [RFC PATCH net-next] net: Modify CSUM capability check for USO
>
> Caution: This message originated from an External Source. Use proper
> caution when opening attachments, clicking links, or responding.
>
>
> Radharapu, Rakesh wrote:
> > [AMD Official Use Only - AMD Internal Distribution Only]
> >
> > > -----Original Message-----
> > > From: Paolo Abeni <pabeni@redhat.com>
> > > Sent: Wednesday, March 12, 2025 9:44 PM
> > > To: Radharapu, Rakesh <Rakesh.Radharapu@amd.com>; git (AMD-Xilinx)
> > > <git@amd.com>; davem@davemloft.net; edumazet@google.com;
> > > kuba@kernel.org; horms@kernel.org; kuniyu@amazon.com;
> > > bigeasy@linutronix.de
> > > Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org; Katakam,
> > > Harini <harini.katakam@amd.com>; Pandey, Radhey Shyam
> > > <radhey.shyam.pandey@amd.com>; Simek, Michal
> <michal.simek@amd.com>
> > > Subject: Re: [RFC PATCH net-next] net: Modify CSUM capability check
> > > for USO
> > >
> > > Caution: This message originated from an External Source. Use proper
> > > caution when opening attachments, clicking links, or responding.
> > >
> > >
> > > On 3/12/25 12:54 PM, Radharapu Rakesh wrote:
> > > > net/core/dev.c | 8 +++++---
> > > > 1 file changed, 5 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/net/core/dev.c b/net/core/dev.c index
> > > > 1cb134ff7327..a22f8f6e2ed1 100644
> > > > --- a/net/core/dev.c
> > > > +++ b/net/core/dev.c
> > > > @@ -10465,11 +10465,13 @@ static void
> > > > netdev_sync_lower_features(struct net_device *upper,
> > > >
> > > > static bool netdev_has_ip_or_hw_csum(netdev_features_t features) {
> > > > - netdev_features_t ip_csum_mask = NETIF_F_IP_CSUM |
> > > NETIF_F_IPV6_CSUM;
> > > > - bool ip_csum = (features & ip_csum_mask) == ip_csum_mask;
> > > > + netdev_features_t ipv4_csum_mask = NETIF_F_IP_CSUM;
> > > > + netdev_features_t ipv6_csum_mask = NETIF_F_IPV6_CSUM;
> > > > + bool ipv4_csum = (features & ipv4_csum_mask) ==
> ipv4_csum_mask;
> > > > + bool ipv6_csum = (features & ipv6_csum_mask) ==
> > > > + ipv6_csum_mask;
> > > > bool hw_csum = features & NETIF_F_HW_CSUM;
> > > >
> > > > - return ip_csum || hw_csum;
> > > > + return ipv4_csum || ipv6_csum || hw_csum;
> > > > }
> > >
> > > The above will additionally affect TLS offload, and will likely
> > > break i.e. USO over IPv6 traffic landing on devices supporting only
> > > USO over IPv4, unless such devices additionally implement a suitable
> ndo_features_check().
> > >
> > > Such situation will be quite bug prone, I'm unsure we want this kind
> > > of change
> > > - even without looking at the TLS side of it.
> > >
> > > /P
> > Thanks for your review. I understand that this will lead to an issue.
> > We have a device that supports only IPv4 CSUM and are unable to enable
> > the USO feature because of this check. Can you please let me know if
> > splitting GSO feature for IPv4 and IPv6 would be helpful? That way
> > corresponding CSUM offloads can be checked. But this would be a major
> change.
> > Will appreciate any other suggestions.
>
> Splitting NETIF_F_GSO_UDP_L4 would incur significant churn.
>
> Since this is a limitation of a specific device, can you instead advertise the
> feature, but for IPv6 packets drop the flag in ndo_features_check?
Yes, Thanks for your reply. I'm making the recommended modification
to the driver and will also monitor performance numbers.
If everything goes well this RFC patch can be dropped.
Regards,
Rakesh
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-03-18 7:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12 11:54 [RFC PATCH net-next] net: Modify CSUM capability check for USO Radharapu Rakesh
2025-03-12 16:14 ` Paolo Abeni
2025-03-12 16:59 ` Radharapu, Rakesh
2025-03-16 2:04 ` Willem de Bruijn
2025-03-18 7:01 ` Radharapu, Rakesh
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®