netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net] net: feature check mandating HW_CSUM is wrong
@ 2021-01-06 17:53 Rohit Maheshwari
  2021-01-06 19:17 ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Rohit Maheshwari @ 2021-01-06 17:53 UTC (permalink / raw)
  To: kuba, netdev, davem; +Cc: secdev, Rohit Maheshwari

Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
And it broke tls offload feature for the drivers, which are still
using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
NETIF_F_CSUM_MASK instead.

Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
---
 net/core/dev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index a46334906c94..b1f99287f280 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -9643,7 +9643,7 @@ static netdev_features_t netdev_fix_features(struct net_device *dev,
 		}
 	}
 
-	if ((features & NETIF_F_HW_TLS_TX) && !(features & NETIF_F_HW_CSUM)) {
+	if ((features & NETIF_F_HW_TLS_TX) && !(features & NETIF_F_CSUM_MASK)) {
 		netdev_dbg(dev, "Dropping TLS TX HW offload feature since no CSUM feature.\n");
 		features &= ~NETIF_F_HW_TLS_TX;
 	}
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-06 17:53 [net] net: feature check mandating HW_CSUM is wrong Rohit Maheshwari
@ 2021-01-06 19:17 ` Jakub Kicinski
  2021-01-12 21:17   ` rohit maheshwari
  0 siblings, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2021-01-06 19:17 UTC (permalink / raw)
  To: Rohit Maheshwari; +Cc: netdev, davem, secdev

On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
> And it broke tls offload feature for the drivers, which are still
> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
> NETIF_F_CSUM_MASK instead.
> 
> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>

Please use Tariq's suggestion.

Please learn to CC appropriate reviewers.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-06 19:17 ` Jakub Kicinski
@ 2021-01-12 21:17   ` rohit maheshwari
  2021-01-12 23:05     ` Jakub Kicinski
  2021-01-13  3:35     ` Alexander Duyck
  0 siblings, 2 replies; 8+ messages in thread
From: rohit maheshwari @ 2021-01-12 21:17 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, davem, secdev, ast, bjorn.topel, daniel, andriin, tariqt,
	edumazet, xiyou.wangcong, ap420073, jiri, borisp


On 07/01/21 12:47 AM, Jakub Kicinski wrote:
> On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
>> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
>> And it broke tls offload feature for the drivers, which are still
>> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
>> NETIF_F_CSUM_MASK instead.
>>
>> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
>> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
> Please use Tariq's suggestion.
HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
support only IPv4 checksum offload, TLS offload should be allowed for
that too. So I think putting a check of CSUM_MASK is enough.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-12 21:17   ` rohit maheshwari
@ 2021-01-12 23:05     ` Jakub Kicinski
  2021-01-13  3:35     ` Alexander Duyck
  1 sibling, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2021-01-12 23:05 UTC (permalink / raw)
  To: rohit maheshwari
  Cc: netdev, davem, secdev, ast, bjorn.topel, daniel, andriin, tariqt,
	edumazet, xiyou.wangcong, ap420073, jiri, borisp

On Wed, 13 Jan 2021 02:47:51 +0530 rohit maheshwari wrote:
> On 07/01/21 12:47 AM, Jakub Kicinski wrote:
> > On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:  
> >> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
> >> And it broke tls offload feature for the drivers, which are still
> >> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
> >> NETIF_F_CSUM_MASK instead.
> >>
> >> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
> >> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>  
> > Please use Tariq's suggestion.  
> HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
> support only IPv4 checksum offload, TLS offload should be allowed for
> that too. So I think putting a check of CSUM_MASK is enough.

If Tariq does not disagree please repost.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-12 21:17   ` rohit maheshwari
  2021-01-12 23:05     ` Jakub Kicinski
@ 2021-01-13  3:35     ` Alexander Duyck
  2021-01-13 17:07       ` Tariq Toukan
  1 sibling, 1 reply; 8+ messages in thread
From: Alexander Duyck @ 2021-01-13  3:35 UTC (permalink / raw)
  To: rohit maheshwari
  Cc: Jakub Kicinski, Netdev, David Miller, secdev, Alexei Starovoitov,
	Björn Töpel, Daniel Borkmann, andriin, tariqt,
	Eric Dumazet, Cong Wang, ap420073, Jiri Pirko, borisp

On Tue, Jan 12, 2021 at 6:43 PM rohit maheshwari <rohitm@chelsio.com> wrote:
>
>
> On 07/01/21 12:47 AM, Jakub Kicinski wrote:
> > On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
> >> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
> >> And it broke tls offload feature for the drivers, which are still
> >> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
> >> NETIF_F_CSUM_MASK instead.
> >>
> >> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
> >> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
> > Please use Tariq's suggestion.
> HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
> support only IPv4 checksum offload, TLS offload should be allowed for
> that too. So I think putting a check of CSUM_MASK is enough.

The issue is that there is no good software fallback if the packet
arrives at the NIC and it cannot handle the IPv6 TLS offload.

The problem with the earlier patch you had is that it was just
dropping frames if you couldn't handle the offload and "hoping" the
other end would catch it. That isn't a good practice for any offload.
If you have it enabled you have to have a software fallback and in
this case it sounds like you don't have that.

In order to do that you would have to alter the fast path to have to
check if the device is capable per packet which is really an
undesirable setup as it would add considerable overhead and is open to
race conditions.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-13  3:35     ` Alexander Duyck
@ 2021-01-13 17:07       ` Tariq Toukan
  2021-01-15  5:38         ` rohit maheshwari
  0 siblings, 1 reply; 8+ messages in thread
From: Tariq Toukan @ 2021-01-13 17:07 UTC (permalink / raw)
  To: Alexander Duyck, rohit maheshwari
  Cc: Jakub Kicinski, Netdev, David Miller, secdev, Alexei Starovoitov,
	Björn Töpel, Daniel Borkmann, andriin, Eric Dumazet,
	Cong Wang, ap420073, Jiri Pirko, borisp, Tariq Toukan,
	Tariq Toukan



On 1/13/2021 5:35 AM, Alexander Duyck wrote:
> On Tue, Jan 12, 2021 at 6:43 PM rohit maheshwari <rohitm@chelsio.com> wrote:
>>
>>
>> On 07/01/21 12:47 AM, Jakub Kicinski wrote:
>>> On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
>>>> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
>>>> And it broke tls offload feature for the drivers, which are still
>>>> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
>>>> NETIF_F_CSUM_MASK instead.
>>>>
>>>> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM is disabled")
>>>> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
>>> Please use Tariq's suggestion.
>> HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
>> support only IPv4 checksum offload, TLS offload should be allowed for
>> that too. So I think putting a check of CSUM_MASK is enough.
> 
> The issue is that there is no good software fallback if the packet
> arrives at the NIC and it cannot handle the IPv6 TLS offload.
> 
> The problem with the earlier patch you had is that it was just
> dropping frames if you couldn't handle the offload and "hoping" the
> other end would catch it. That isn't a good practice for any offload.
> If you have it enabled you have to have a software fallback and in
> this case it sounds like you don't have that.
> 
> In order to do that you would have to alter the fast path to have to
> check if the device is capable per packet which is really an
> undesirable setup as it would add considerable overhead and is open to
> race conditions.
> 

+1

Are there really such modern devices with missing IPv6 csum 
capabilities, or it's just a missing SW implementation in the device driver?

IMO, it sounds reasonable for this modern TLS device offload to asks for 
a basic requirement such as IPv6 csum offload capability, to save the 
overhead.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-13 17:07       ` Tariq Toukan
@ 2021-01-15  5:38         ` rohit maheshwari
  2021-01-15 16:59           ` Alexander Duyck
  0 siblings, 1 reply; 8+ messages in thread
From: rohit maheshwari @ 2021-01-15  5:38 UTC (permalink / raw)
  To: Tariq Toukan, Alexander Duyck
  Cc: Jakub Kicinski, Netdev, David Miller, secdev, Alexei Starovoitov,
	Björn Töpel, Daniel Borkmann, andriin, Eric Dumazet,
	Cong Wang, ap420073, Jiri Pirko, borisp, Tariq Toukan


On 13/01/21 10:37 PM, Tariq Toukan wrote:
>
>
> On 1/13/2021 5:35 AM, Alexander Duyck wrote:
>> On Tue, Jan 12, 2021 at 6:43 PM rohit maheshwari <rohitm@chelsio.com> 
>> wrote:
>>>
>>>
>>> On 07/01/21 12:47 AM, Jakub Kicinski wrote:
>>>> On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
>>>>> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
>>>>> And it broke tls offload feature for the drivers, which are still
>>>>> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
>>>>> NETIF_F_CSUM_MASK instead.
>>>>>
>>>>> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM 
>>>>> is disabled")
>>>>> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
>>>> Please use Tariq's suggestion.
>>> HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
>>> support only IPv4 checksum offload, TLS offload should be allowed for
>>> that too. So I think putting a check of CSUM_MASK is enough.
>>
>> The issue is that there is no good software fallback if the packet
>> arrives at the NIC and it cannot handle the IPv6 TLS offload.
>>
>> The problem with the earlier patch you had is that it was just
>> dropping frames if you couldn't handle the offload and "hoping" the
>> other end would catch it. That isn't a good practice for any offload.
>> If you have it enabled you have to have a software fallback and in
>> this case it sounds like you don't have that.
>>
>> In order to do that you would have to alter the fast path to have to
>> check if the device is capable per packet which is really an
>> undesirable setup as it would add considerable overhead and is open to
>> race conditions.
>>
>
> +1
>
> Are there really such modern devices with missing IPv6 csum 
> capabilities, or it's just a missing SW implementation in the device 
> driver?
>
> IMO, it sounds reasonable for this modern TLS device offload to asks 
> for a basic requirement such as IPv6 csum offload capability, to save 
> the overhead.
>
I agree with you, all modern devices support V6 csum, but still if we think
logically, we can't limit TLS offload to work only if both IPV4_CSUM  and
IPV6_CSUM are configured/supported. If there is no dependency of IPV6
in running TLS offload with IPv4  and vice-versa, then why should there
be any restriction as such.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [net] net: feature check mandating HW_CSUM is wrong
  2021-01-15  5:38         ` rohit maheshwari
@ 2021-01-15 16:59           ` Alexander Duyck
  0 siblings, 0 replies; 8+ messages in thread
From: Alexander Duyck @ 2021-01-15 16:59 UTC (permalink / raw)
  To: rohit maheshwari
  Cc: Tariq Toukan, Jakub Kicinski, Netdev, David Miller, secdev,
	Alexei Starovoitov, Björn Töpel, Daniel Borkmann,
	andriin, Eric Dumazet, Cong Wang, ap420073, Jiri Pirko, borisp,
	Tariq Toukan

On Thu, Jan 14, 2021 at 9:39 PM rohit maheshwari <rohitm@chelsio.com> wrote:
>
>
> On 13/01/21 10:37 PM, Tariq Toukan wrote:
> >
> >
> > On 1/13/2021 5:35 AM, Alexander Duyck wrote:
> >> On Tue, Jan 12, 2021 at 6:43 PM rohit maheshwari <rohitm@chelsio.com>
> >> wrote:
> >>>
> >>>
> >>> On 07/01/21 12:47 AM, Jakub Kicinski wrote:
> >>>> On Wed,  6 Jan 2021 23:23:27 +0530 Rohit Maheshwari wrote:
> >>>>> Mandating NETIF_F_HW_CSUM to enable TLS offload feature is wrong.
> >>>>> And it broke tls offload feature for the drivers, which are still
> >>>>> using NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM. We should use
> >>>>> NETIF_F_CSUM_MASK instead.
> >>>>>
> >>>>> Fixes: ae0b04b238e2 ("net: Disable NETIF_F_HW_TLS_TX when HW_CSUM
> >>>>> is disabled")
> >>>>> Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
> >>>> Please use Tariq's suggestion.
> >>> HW_TLS_TX feature is for both IPv4/v6. And If one device is limited to
> >>> support only IPv4 checksum offload, TLS offload should be allowed for
> >>> that too. So I think putting a check of CSUM_MASK is enough.
> >>
> >> The issue is that there is no good software fallback if the packet
> >> arrives at the NIC and it cannot handle the IPv6 TLS offload.
> >>
> >> The problem with the earlier patch you had is that it was just
> >> dropping frames if you couldn't handle the offload and "hoping" the
> >> other end would catch it. That isn't a good practice for any offload.
> >> If you have it enabled you have to have a software fallback and in
> >> this case it sounds like you don't have that.
> >>
> >> In order to do that you would have to alter the fast path to have to
> >> check if the device is capable per packet which is really an
> >> undesirable setup as it would add considerable overhead and is open to
> >> race conditions.
> >>
> >
> > +1
> >
> > Are there really such modern devices with missing IPv6 csum
> > capabilities, or it's just a missing SW implementation in the device
> > driver?
> >
> > IMO, it sounds reasonable for this modern TLS device offload to asks
> > for a basic requirement such as IPv6 csum offload capability, to save
> > the overhead.
> >
> I agree with you, all modern devices support V6 csum, but still if we think
> logically, we can't limit TLS offload to work only if both IPV4_CSUM  and
> IPV6_CSUM are configured/supported. If there is no dependency of IPV6
> in running TLS offload with IPv4  and vice-versa, then why should there
> be any restriction as such.

The requirement is to have a software fallback for any offload that
cannot be performed by the hardware if you are going to advertise it.
So if we were to disable IPv6 checksum offload and then request TLS
offload there isn't a software fallback for the combination since the
L4 header checksum cannot be performed on the packet if we are
expecting the hardware to handle the encryption. So in such a case the
TLS offload will need to occur before software can offload the header
checksum and so the hardware offload is disabled.

The basic idea is any offload combination should be functional so that
it doesn't mangle frames or cause the receiving end to drop packets.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-01-15 17:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 17:53 [net] net: feature check mandating HW_CSUM is wrong Rohit Maheshwari
2021-01-06 19:17 ` Jakub Kicinski
2021-01-12 21:17   ` rohit maheshwari
2021-01-12 23:05     ` Jakub Kicinski
2021-01-13  3:35     ` Alexander Duyck
2021-01-13 17:07       ` Tariq Toukan
2021-01-15  5:38         ` rohit maheshwari
2021-01-15 16:59           ` Alexander Duyck

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).