From: Leon Romanovsky <leonro@nvidia.com>
To: Ilia Lin <quic_ilial@quicinc.com>
Cc: <steffen.klassert@secunet.com>, <herbert@gondor.apana.org.au>,
<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
<pabeni@redhat.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Ilia Lin <ilia.lin@kernel.org>
Subject: Re: [PATCH] xfrm: Allow ESP over UDP in packet offload mode
Date: Tue, 18 Jul 2023 12:52:42 +0300 [thread overview]
Message-ID: <20230718095242.GC8808@unreal> (raw)
In-Reply-To: <20230718092405.4124345-1-quic_ilial@quicinc.com>
On Tue, Jul 18, 2023 at 12:24:05PM +0300, Ilia Lin wrote:
> The ESP encapsulation is not supported only in crypto mode.
> In packet offload mode, the RX is bypassing the XFRM,
> so we can enable the encapsulation.
It is not accurate. RX is bypassed after XFRM validated packet to ensure
that it was really handled by HW.
However, this patch should come with relevant driver code which should
support ESP over UDP. You can see it here:
https://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git/log/?h=xfrm-next
xfrm: Support UDP encapsulation in packet offload mode
net/mlx5e: Support IPsec NAT-T functionality
net/mlx5e: Check for IPsec NAT-T support
net/mlx5: Add relevant capabilities bits to support NAT-T
Thanks
>
> Signed-off-by: Ilia Lin <ilia.lin@kernel.org>
> ---
> net/xfrm/xfrm_device.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/xfrm/xfrm_device.c b/net/xfrm/xfrm_device.c
> index 4aff76c6f12e0..3018468d97662 100644
> --- a/net/xfrm/xfrm_device.c
> +++ b/net/xfrm/xfrm_device.c
> @@ -246,8 +246,10 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
> return -EINVAL;
> }
>
> - /* We don't yet support UDP encapsulation and TFC padding. */
> - if (x->encap || x->tfcpad) {
> + is_packet_offload = xuo->flags & XFRM_OFFLOAD_PACKET;
> +
> + /* We don't yet support UDP encapsulation except full mode and TFC padding. */
> + if ((!is_packet_offload && x->encap) || x->tfcpad) {
> NL_SET_ERR_MSG(extack, "Encapsulation and TFC padding can't be offloaded");
> return -EINVAL;
> }
> @@ -258,7 +260,6 @@ int xfrm_dev_state_add(struct net *net, struct xfrm_state *x,
> return -EINVAL;
> }
>
> - is_packet_offload = xuo->flags & XFRM_OFFLOAD_PACKET;
> dev = dev_get_by_index(net, xuo->ifindex);
> if (!dev) {
> if (!(xuo->flags & XFRM_OFFLOAD_INBOUND)) {
> --
>
>
next prev parent reply other threads:[~2023-07-18 9:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 9:24 [PATCH] xfrm: Allow ESP over UDP in packet offload mode Ilia Lin
2023-07-18 9:52 ` Leon Romanovsky [this message]
2023-07-18 10:15 ` Ilia Lin
2023-07-18 10:54 ` Leon Romanovsky
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=20230718095242.GC8808@unreal \
--to=leonro@nvidia.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=ilia.lin@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=quic_ilial@quicinc.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).