Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6649092rwp; Tue, 18 Jul 2023 03:58:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlEQfq06AIL2sMmBq/3x0PIutycy+2ZYCNkZMHNhn0kfZIPdvzn4thXxmH6L2j//JaNDrfhh X-Received: by 2002:ac2:504d:0:b0:4fb:897e:21cd with SMTP id a13-20020ac2504d000000b004fb897e21cdmr9097608lfm.67.1689677936604; Tue, 18 Jul 2023 03:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689677936; cv=none; d=google.com; s=arc-20160816; b=zNKUsN0QSjJDJ6DNIAckNjmtwVJYhVa8oG+RtoKBqa0KUsD8PbuPnnW9OqXNUDUPE9 9ozAD1OHsnECvp4kpFREEx1nVHOsTAiZpltuADDkt5OtnIoZ+8EXY36V8OzZa8XEaUfJ J7uw1HMj+g5QxAVUNAZF5wT11EpgM8bZQDS/ir2Seq6JNtHfjV8/aTl09BaYxH9BdSjn ISfdyWK6NhWkNKeU5Sz5Zo5okaHMyNEGmCdCCNX4fHoqfovK4GxTGblsbttEMn3Cf2rY /YXbwcJsBYLQCKWeFc3bYngEUgPH5Zb8vwLngzLCQwufj8HncL+Xc/IOvb5nIvCI9H0p xRvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Nsphudp/CcIJPoHlRqWFFR7A5rixowGafFY/icj7bqQ=; fh=c507ORGTYEWPmO+LcHLDS3drq6fAx1lOAYJ38lWB7EE=; b=RPnVzFoJI/LJxzQSxLHILs8N+OCKeo+qSWWqJmmsh8P7oraN8+foTfIj1DFSfQbvXM bFAekcJn9ts2gSyPkVaJ9CRCGyk0lhz/2tBvqsiS+r1cV6hFpNT71NJC15QuuxvSy1H8 U3az42y3A/GkQdaPGjsQi/7DVbH77WJSO5QqjTuArJKWZyc3xphHw5U3U9114rbK0lT9 H60FeXI4eQ6W0ERa+ONPyot0z7haAhpvxeazIJtmP2XjIu4W53g7P64dRXBrV82Id0yk js0L6i6hwXUD8bOcVslRuJ9tdm/yN0HQnE6kxUjyQNsE6nIkWrs9IH3Hgn55I6kA8z75 Rsug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CtZB0+of; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id by5-20020a0564021b0500b00521029a8eeesi1060077edb.313.2023.07.18.03.58.33; Tue, 18 Jul 2023 03:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CtZB0+of; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231309AbjGRKyx (ORCPT + 99 others); Tue, 18 Jul 2023 06:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjGRKyw (ORCPT ); Tue, 18 Jul 2023 06:54:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C98E60 for ; Tue, 18 Jul 2023 03:54:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09650614F9 for ; Tue, 18 Jul 2023 10:54:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4846C433C8; Tue, 18 Jul 2023 10:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689677690; bh=VkiCUBmbXEThupNefKNKWnl4TsWI33/Zru4NwUp15sY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CtZB0+of8mIHWCMLv1juOhUqqkkafip9RBlX56sG9o8x83U9k4B8NL7jjbCc8f37A bclxrPhMiDUTGSA6PYHOz2JgJViQzykXsNi5fdS1BJFIQzKQoWUMGJDGcfHQY8JGQN WIsRrRo25w2av3YKQDrwbN2wCtK9dvr3DcLCSoCG/rLSGRWsTbcsoTjYa/QNsWADZA Im3kgKg5FtTdGwjLd5Yr/sS9LK5jJj646LRMmBCubkSvNp9keJf2kK8Z/63emxCiJE WwUqS69seNytGmyGtazPuODnQM0dzYF5X4IuwmSbRlDQbD1dVJrvfALmMPVvQxzrF6 DOKzH5hcVwZPA== Date: Tue, 18 Jul 2023 13:54:46 +0300 From: Leon Romanovsky To: Ilia Lin Cc: Ilia Lin , netdev@vger.kernel.org, open list Subject: Re: [PATCH] xfrm: Allow ESP over UDP in packet offload mode Message-ID: <20230718105446.GD8808@unreal> References: <20230718092405.4124345-1-quic_ilial@quicinc.com> <20230718095242.GC8808@unreal> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 18, 2023 at 01:15:12PM +0300, Ilia Lin wrote: > Hi Leon, Please don't top-post your replies. > > Indeed the policy check is checking the sec_path lags set after > decapsulation, but this has nothing to do with UDP encapsulation, the > driver will set them anyway. It doesn't make commit message correct. "In packet offload mode, the RX is bypassing the XFRM, so we can enable the encapsulation." > Regarding the driver support, each driver may restrict NAT-T support > in their state_add callback, so in common code it may stay allowed. We don't support out-of-tree drivers. Please submit it together with relevant driver changes which exercise your newly opened path. If you want, you can even take my series and submit it. Thanks > > Thanks, > Ilia > > BR, > Ilia Lin > > > > On Tue, Jul 18, 2023 at 12:53 PM Leon Romanovsky wrote: > > > > 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 > > > --- > > > 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)) { > > > -- > > > > > > >