netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Steffen Klassert <steffen.klassert@secunet.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH ipsec] xfrm: Provide private skb extensions for segmented and hw offloaded ESP packets
Date: Tue, 23 Mar 2021 13:02:35 +0100	[thread overview]
Message-ID: <20210323120235.GI22603@breakpoint.cc> (raw)
In-Reply-To: <20210323082559.GO62598@gauss3.secunet.de>

Steffen Klassert <steffen.klassert@secunet.com> wrote:
> Commit 94579ac3f6d0 ("xfrm: Fix double ESP trailer insertion in IPsec
> crypto offload.") added a XFRM_XMIT flag to avoid duplicate ESP trailer
> insertion on HW offload. This flag is set on the secpath that is shared
> amongst segments. This lead to a situation where some segments are
> not transformed correctly when segmentation happens at layer 3.
> 
> Fix this by using private skb extensions for segmented and hw offloaded
> ESP packets.
> 
> Fixes: 94579ac3f6d0 ("xfrm: Fix double ESP trailer insertion in IPsec crypto offload.")
> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
> ---
>  include/linux/skbuff.h  |  1 +
>  net/core/skbuff.c       | 23 ++++++++++++++++++-----
>  net/ipv4/esp4_offload.c | 16 +++++++++++++++-
>  net/ipv6/esp6_offload.c | 16 +++++++++++++++-
>  net/xfrm/xfrm_device.c  |  2 --
>  5 files changed, 49 insertions(+), 9 deletions(-)
> 
> -	if (hw_offload)
> +	if (hw_offload) {
> +		ext = skb_ext_cow(skb->extensions, skb->active_extensions);

It should be possible to do

	if (hw_offload) {
		if (!skb_ext_add(skb, SKB_EXT_SECPATH);
			return -ENOMEM;

		xo = xfrm_offload(skb);
		....

without need for a new 'cow' function.
skb_ext_add() will auto-COW if the extension area has a refcount > 1.

  reply	other threads:[~2021-03-23 12:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23  8:25 [PATCH ipsec] xfrm: Provide private skb extensions for segmented and hw offloaded ESP packets Steffen Klassert
2021-03-23 12:02 ` Florian Westphal [this message]
2021-03-25  8:46   ` 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=20210323120235.GI22603@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=netdev@vger.kernel.org \
    --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).