From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00,DKIM_ADSP_DISCARD, DKIM_INVALID,DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1258C4338F for ; Mon, 23 Aug 2021 10:18:47 +0000 (UTC) Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by mail.kernel.org (Postfix) with ESMTP id 3BFE06120A for ; Mon, 23 Aug 2021 10:18:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3BFE06120A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=oktetlabs.ru Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dpdk.org Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 607704014D; Mon, 23 Aug 2021 12:18:46 +0200 (CEST) Received: from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113]) by mails.dpdk.org (Postfix) with ESMTP id 4657340042 for ; Mon, 23 Aug 2021 12:18:45 +0200 (CEST) Received: from [192.168.38.17] (aros.oktetlabs.ru [192.168.38.17]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by shelob.oktetlabs.ru (Postfix) with ESMTPSA id AB2087F4FE; Mon, 23 Aug 2021 13:18:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru AB2087F4FE DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=oktetlabs.ru; s=default; t=1629713924; bh=jjWNlyI9kgo9SlEVNlyrtXDmX2iYcouBcHPNr/2bL74=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=owzZ3SDRkhbo5u7Bs80IBGcLjehkxvXWPdF69Y/e0AJ5BX9PQVSxEDqMSgM51gZeR nC2GjzOw1B0LTDf7bdfKGN6bTx7/mmSYvtgUN5OLf/J4usrJB616GnHCUy7whGOeHP KPbO9uLxD8Bf4KPd7n7n7kA2KBp54i4BHeRSGHXY= To: Akhil Goyal , dev@dpdk.org Cc: anoobj@marvell.com, radu.nicolau@intel.com, declan.doherty@intel.com, hemant.agrawal@nxp.com, matan@nvidia.com, konstantin.ananyev@intel.com, thomas@monjalon.net, adwivedi@marvell.com, ferruh.yigit@intel.com References: <20210823100259.1619886-1-gakhil@marvell.com> From: Andrew Rybchenko Organization: OKTET Labs Message-ID: <9ceeb864-f750-8b0b-624b-5f83c79a466e@oktetlabs.ru> Date: Mon, 23 Aug 2021 13:18:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <20210823100259.1619886-1-gakhil@marvell.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] RFC: ethdev: add reassembly offload X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 8/23/21 1:02 PM, Akhil Goyal wrote: > Reassembly is a costly operation if it is done in > software, however, if it is offloaded to HW, it can > considerably save application cycles. > The operation becomes even more costlier if IP fragmants > are encrypted. > > To resolve above two issues, a new offload > DEV_RX_OFFLOAD_REASSEMBLY is introduced in ethdev for > devices which can attempt reassembly of packets in hardware. > rte_eth_dev_info is added with the reassembly capabilities > which a device can support. > Now, if IP fragments are encrypted, reassembly can also be > attempted while doing inline IPsec processing. > This is controlled by a flag in rte_security_ipsec_sa_options > to enable reassembly of encrypted IP fragments in the inline > path. > > The resulting reassembled packet would be a typical > segmented mbuf in case of success. > > And if reassembly of fragments is failed or is incomplete (if > fragments do not come before the reass_timeout), the mbuf is > updated with an ol_flag PKT_RX_REASSEMBLY_INCOMPLETE and > mbuf is returned as is. Now application may decide the fate > of the packet to wait more for fragments to come or drop. > > Signed-off-by: Akhil Goyal Is it IPv4 only or IPv6 as well? I guess IPv4 only to start with. If so, I think offload name should say so. See below. I'd say that the feature should be added to doc/guides/nics/features.rst Do we really need RX_REASSEMBLY_INCOMPLETE if we provide buffered packets for incomplete reassembly anyway? I guess it is sufficient to cover simply reassembly case only in HW when there is no overlapping fragments etc. Everything else should be handled in SW anyway as without the offload support at all. > --- > lib/ethdev/rte_ethdev.c | 1 + > lib/ethdev/rte_ethdev.h | 18 +++++++++++++++++- > lib/mbuf/rte_mbuf_core.h | 3 ++- > lib/security/rte_security.h | 10 ++++++++++ > 4 files changed, 30 insertions(+), 2 deletions(-) > > diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c > index 9d95cd11e1..1ab3a093cf 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -119,6 +119,7 @@ static const struct { > RTE_RX_OFFLOAD_BIT2STR(VLAN_FILTER), > RTE_RX_OFFLOAD_BIT2STR(VLAN_EXTEND), > RTE_RX_OFFLOAD_BIT2STR(JUMBO_FRAME), > + RTE_RX_OFFLOAD_BIT2STR(REASSEMBLY), > RTE_RX_OFFLOAD_BIT2STR(SCATTER), > RTE_RX_OFFLOAD_BIT2STR(TIMESTAMP), > RTE_RX_OFFLOAD_BIT2STR(SECURITY), > diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h > index d2b27c351f..e89a4dc1eb 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -1360,6 +1360,7 @@ struct rte_eth_conf { > #define DEV_RX_OFFLOAD_VLAN_FILTER 0x00000200 > #define DEV_RX_OFFLOAD_VLAN_EXTEND 0x00000400 > #define DEV_RX_OFFLOAD_JUMBO_FRAME 0x00000800 > +#define DEV_RX_OFFLOAD_REASSEMBLY 0x00001000 I think it should be: RTE_ETH_RX_OFFLOAD_IPV4_REASSEMBLY i.e. have correct prefix similar to RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT and mention IPv4. If we'd like to cover IPv6 as well, it could be RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY and have IPv4/6 support bits in the offload capabilities below. > #define DEV_RX_OFFLOAD_SCATTER 0x00002000 > /** > * Timestamp is set by the driver in RTE_MBUF_DYNFIELD_TIMESTAMP_NAME > @@ -1477,6 +1478,20 @@ struct rte_eth_dev_portconf { > */ > #define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID (UINT16_MAX) > > +/** > + * Reassembly capabilities that a device can support. > + * The device which can support reassembly offload should set > + * DEV_RX_OFFLOAD_REASSEMBLY > + */ > +struct rte_eth_reass_capa { > + /** Maximum time in ns that a fragment can wait for further fragments */ > + uint64_t reass_timeout; > + /** Maximum number of fragments that device can reassemble */ > + uint16_t max_frags; > + /** Reserved for future capabilities */ > + uint16_t reserved[3]; > +}; > + > /** > * Ethernet device associated switch information > */ > @@ -1582,8 +1597,9 @@ struct rte_eth_dev_info { > * embedded managed interconnect/switch. > */ > struct rte_eth_switch_info switch_info; > + /* Reassembly capabilities of a device for reassembly offload */ > + struct rte_eth_reass_capa reass_capa; > > - uint64_t reserved_64s[2]; /**< Reserved for future fields */ > void *reserved_ptrs[2]; /**< Reserved for future fields */ > }; > > diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h > index bb38d7f581..cea25c87f7 100644 > --- a/lib/mbuf/rte_mbuf_core.h > +++ b/lib/mbuf/rte_mbuf_core.h > @@ -200,10 +200,11 @@ extern "C" { > #define PKT_RX_OUTER_L4_CKSUM_BAD (1ULL << 21) > #define PKT_RX_OUTER_L4_CKSUM_GOOD (1ULL << 22) > #define PKT_RX_OUTER_L4_CKSUM_INVALID ((1ULL << 21) | (1ULL << 22)) > +#define PKT_RX_REASSEMBLY_INCOMPLETE (1ULL << 23) In accordance with deprecation notice it should be RTE_MBUF_F_RX_REASSEMBLY_INCOMPLETE > > /* add new RX flags here, don't forget to update PKT_FIRST_FREE */ > > -#define PKT_FIRST_FREE (1ULL << 23) > +#define PKT_FIRST_FREE (1ULL << 24) > #define PKT_LAST_FREE (1ULL << 40) > > /* add new TX flags here, don't forget to update PKT_LAST_FREE */ > diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h > index 88d31de0a6..364eeb5cd4 100644 > --- a/lib/security/rte_security.h > +++ b/lib/security/rte_security.h > @@ -181,6 +181,16 @@ struct rte_security_ipsec_sa_options { > * * 0: Disable per session security statistics collection for this SA. > */ > uint32_t stats : 1; > + > + /** Enable reassembly on incoming packets. > + * > + * * 1: Enable driver to try reassembly of encrypted IP packets for > + * this SA, if supported by the driver. This feature will work > + * only if rx_offload DEV_RX_OFFLOAD_REASSEMBLY is set in > + * inline ethernet device. ethernet -> Ethernet > + * * 0: Disable reassembly of packets (default). > + */ > + uint32_t reass_en : 1; > }; > > /** IPSec security association direction */ >