From: Leon Romanovsky <leon@kernel.org>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Paolo Abeni <pabeni@redhat.com>,
David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Herbert Xu <herbert@gondor.apana.org.au>,
netdev@vger.kernel.org
Subject: Re: [PATCH 2/5] xfrm: Pass UDP encapsulation in TX packet offload
Date: Tue, 12 Mar 2024 13:26:30 +0200 [thread overview]
Message-ID: <20240312112630.GU12921@unreal> (raw)
In-Reply-To: <ZfA6kauSNCbPLIuM@gauss3.secunet.de>
On Tue, Mar 12, 2024 at 12:20:49PM +0100, Steffen Klassert wrote:
> On Tue, Mar 12, 2024 at 01:15:28PM +0200, Leon Romanovsky wrote:
> > On Tue, Mar 12, 2024 at 07:20:06AM +0100, Steffen Klassert wrote:
> > > On Mon, Mar 11, 2024 at 05:25:03PM +0100, Paolo Abeni wrote:
> > > > Hi,
> > > >
> > > > On Wed, 2024-03-06 at 11:04 +0100, Steffen Klassert wrote:
> > > > > From: Leon Romanovsky <leonro@nvidia.com>
> > > > >
> > > > > In addition to citied commit in Fixes line, allow UDP encapsulation in
> > > > > TX path too.
> > > > >
> > > > > Fixes: 89edf40220be ("xfrm: Support UDP encapsulation in packet offload mode")
> > > > > CC: Steffen Klassert <steffen.klassert@secunet.com>
> > > > > Reported-by: Mike Yu <yumike@google.com>
> > > > > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > > > > Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
> > > > > Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> > > >
> > > > This is causing self-test failures:
> > > >
> > > > https://netdev.bots.linux.dev/flakes.html?tn-needle=pmtu-sh
> > > >
> > > > reverting this change locally resolves the issue.
> > > >
> > > > @Leon, @Steffen: could you please have a look?
> > >
> > > Looks like the check for x->encap was removed unconditionally.
> > > I should just be removed when XFRM_DEV_OFFLOAD_PACKET is set,
> > > otherwise we might create a GSO packet with UPD encapsulation.
> > >
> > > Leon?
> >
> > Right, I missed IPsec SW path, that x->encap check can be removed
> > in packet offload because HW supports it and in crypto offload, because
> > there is a check in xfrm_dev_state_add() to prevent it.
> >
> > What about this fix?
> >
> > diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
> > index 653e51ae3964..6e3e5a09cfeb 100644
> > --- a/net/xfrm/xfrm_device.c
> > +++ b/net/xfrm/xfrm_device.c
> > @@ -407,7 +407,7 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
> > struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
> > struct net_device *dev = x->xso.dev;
> >
> > - if (!x->type_offload)
> > + if (!x->type_offload || x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED)
> > return false;
>
> Then we can't generate GSO packets for the SW path anymore. We just need
> to reject UDP enacpsulation in SW here.
Is it better?
diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
index 653e51ae3964..6346690d5c69 100644
--- a/net/xfrm/xfrm_device.c
+++ b/net/xfrm/xfrm_device.c
@@ -407,7 +407,8 @@ bool xfrm_dev_offload_ok(struct sk_buff *skb, struct xfrm_state *x)
struct xfrm_dst *xdst = (struct xfrm_dst *)dst;
struct net_device *dev = x->xso.dev;
- if (!x->type_offload)
+ if (!x->type_offload ||
+ (x->xso.type == XFRM_DEV_OFFLOAD_UNSPECIFIED && x->encap))
return false;
if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET ||
>
next prev parent reply other threads:[~2024-03-12 11:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-06 10:04 [PATCH 0/5] pull request (net): ipsec 2024-03-06 Steffen Klassert
2024-03-06 10:04 ` [PATCH 1/5] xfrm: Clear low order bits of ->flowi4_tos in decode_session4() Steffen Klassert
2024-03-07 5:00 ` patchwork-bot+netdevbpf
2024-03-06 10:04 ` [PATCH 2/5] xfrm: Pass UDP encapsulation in TX packet offload Steffen Klassert
2024-03-11 16:25 ` Paolo Abeni
2024-03-11 17:05 ` Jakub Kicinski
2024-03-12 2:46 ` Jakub Kicinski
2024-03-12 6:20 ` Steffen Klassert
2024-03-12 11:15 ` Leon Romanovsky
2024-03-12 11:20 ` Steffen Klassert
2024-03-12 11:26 ` Leon Romanovsky [this message]
2024-03-12 11:36 ` Steffen Klassert
2024-03-06 10:04 ` [PATCH 3/5] xfrm: Avoid clang fortify warning in copy_to_user_tmpl() Steffen Klassert
2024-03-06 10:04 ` [PATCH 4/5] xfrm: fix xfrm child route lookup for packet offload Steffen Klassert
2024-03-06 10:04 ` [PATCH 5/5] xfrm: set skb control buffer based on packet offload as well Steffen Klassert
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=20240312112630.GU12921@unreal \
--to=leon@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.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;
as well as URLs for NNTP newsgroup(s).