From patchwork Sun Jan 30 17:59:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 106723 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 009F8A04A7; Sun, 30 Jan 2022 18:59:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6362541154; Sun, 30 Jan 2022 18:59:54 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id CDBE741152 for ; Sun, 30 Jan 2022 18:59:52 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20UCmYVZ000909; Sun, 30 Jan 2022 09:59:49 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=+QdtY/4gXR2VbgUC1rQMzRBs9E69Yt74Jve4Ij5R9wo=; b=AEPF/Jrp/lo0iuORrLM0+J4K30nGfYmvq5PKVjZ92MhbsjF/k1EI9RdXZH0zh/9yU0qt nc5239tGjFiiWIVoXjBpn8Zk3MSLfQ8/91bMGinbaYRI5C/6jHB/Aih3yev4sYMfrW1p aQctOUlwFjBjbANlPbg6vdU1OGU3u0Vyfa/+qekps+8a7/sJrIAeyMo0GZ0E3ERRQfOj P5FURP5AH/sT5gN3dVA7kxN+vy03gXi73MOpqU4UrlRYcYyKen8cR78z//dN7ko0/lYF fSHn/zaR/ZE1pXt0lMjwr5MtseOxzWq2G4cld4xbYf4lTXjfLQVuOLwMhlZuqnsKl+08 WQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3dw5yqjfw5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jan 2022 09:59:49 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 30 Jan 2022 09:59:47 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 30 Jan 2022 09:59:47 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id B482B3F70A7; Sun, 30 Jan 2022 09:59:43 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v3 1/4] ethdev: introduce IP reassembly offload Date: Sun, 30 Jan 2022 23:29:32 +0530 Message-ID: <20220130175935.1947730-2-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130175935.1947730-1-gakhil@marvell.com> References: <20220120162627.4155695-1-gakhil@marvell.com> <20220130175935.1947730-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: j8xDbGV9Fdthanr_MxyN-ALB03UTJ8eJ X-Proofpoint-GUID: j8xDbGV9Fdthanr_MxyN-ALB03UTJ8eJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-30_05,2022-01-28_01,2021-12-02_01 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 IP Reassembly is a costly operation if it is done in software. The operation becomes even more costlier if IP fragments are encrypted. However, if it is offloaded to HW, it can considerably save application cycles. Hence, a new offload RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY is introduced in ethdev for devices which can attempt reassembly of packets in hardware. rte_eth_dev_info is updated with the reassembly capabilities which a device can support. 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 ol_flags can be updated. This is updated in a subsequent patch. Signed-off-by: Akhil Goyal Acked-by: Konstantin Ananyev --- devtools/libabigail.abignore | 5 +++++ doc/guides/nics/features.rst | 11 +++++++++++ lib/ethdev/rte_ethdev.c | 1 + lib/ethdev/rte_ethdev.h | 28 +++++++++++++++++++++++++++- 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index 4b676f317d..90f449c43a 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -11,3 +11,8 @@ ; Ignore generated PMD information strings [suppress_variable] name_regexp = _pmd_info$ + +; Ignore fields inserted in place of reserved_64s of rte_eth_dev_info +[suppress_type] + name = rte_eth_dev_info + has_data_member_inserted_between = {offset_of(reserved_64s), end} diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index 27be2d2576..b45bce4a78 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -602,6 +602,17 @@ Supports inner packet L4 checksum. ``tx_offload_capa,tx_queue_offload_capa:RTE_ETH_TX_OFFLOAD_OUTER_UDP_CKSUM``. +.. _nic_features_ip_reassembly: + +IP reassembly +------------- + +Supports IP reassembly in hardware. + +* **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY``. +* **[provides] rte_eth_dev_info**: ``reass_capa``. + + .. _nic_features_shared_rx_queue: Shared Rx queue diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index a1d475a292..d9a03f12f9 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -126,6 +126,7 @@ static const struct { RTE_RX_OFFLOAD_BIT2STR(OUTER_UDP_CKSUM), RTE_RX_OFFLOAD_BIT2STR(RSS_HASH), RTE_RX_OFFLOAD_BIT2STR(BUFFER_SPLIT), + RTE_RX_OFFLOAD_BIT2STR(IP_REASSEMBLY), }; #undef RTE_RX_OFFLOAD_BIT2STR diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index fa299c8ad7..cfaf7a5afc 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -1586,6 +1586,7 @@ struct rte_eth_conf { #define RTE_ETH_RX_OFFLOAD_RSS_HASH RTE_BIT64(19) #define DEV_RX_OFFLOAD_RSS_HASH RTE_ETH_RX_OFFLOAD_RSS_HASH #define RTE_ETH_RX_OFFLOAD_BUFFER_SPLIT RTE_BIT64(20) +#define RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY RTE_BIT64(21) #define RTE_ETH_RX_OFFLOAD_CHECKSUM (RTE_ETH_RX_OFFLOAD_IPV4_CKSUM | \ RTE_ETH_RX_OFFLOAD_UDP_CKSUM | \ @@ -1781,6 +1782,29 @@ enum rte_eth_representor_type { RTE_ETH_REPRESENTOR_PF, /**< representor of Physical Function. */ }; +/* Flag to offload IP reassembly for IPv4 packets. */ +#define RTE_ETH_DEV_REASSEMBLY_F_IPV4 (RTE_BIT32(0)) +/* Flag to offload IP reassembly for IPv6 packets. */ +#define RTE_ETH_DEV_REASSEMBLY_F_IPV6 (RTE_BIT32(1)) +/** + * A structure used to get/set IP reassembly configuration. + * + * If RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY flag is set in offloads field, + * the PMD will attempt IP reassembly for the received packets as per + * properties defined in this structure. + */ +struct rte_eth_ip_reass_params { + /** Maximum time in ms which PMD can wait for other fragments. */ + uint32_t reass_timeout_ms; + /** Maximum number of fragments that can be reassembled. */ + uint16_t max_frags; + /** + * Flags to enable reassembly of packet types - + * RTE_ETH_DEV_REASSEMBLY_F_xxx. + */ + uint16_t flags; +}; + /** * A structure used to retrieve the contextual information of * an Ethernet device, such as the controlling driver of the @@ -1841,8 +1865,10 @@ struct rte_eth_dev_info { * embedded managed interconnect/switch. */ struct rte_eth_switch_info switch_info; + /** IP reassembly offload capabilities that a device can support. */ + struct rte_eth_ip_reass_params reass_capa; - uint64_t reserved_64s[2]; /**< Reserved for future fields */ + uint64_t reserved_64s[1]; /**< Reserved for future fields */ void *reserved_ptrs[2]; /**< Reserved for future fields */ }; From patchwork Sun Jan 30 17:59:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 106724 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3D18FA04A7; Sun, 30 Jan 2022 19:00:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ABD4941165; Sun, 30 Jan 2022 18:59:58 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 3D76D4115B for ; Sun, 30 Jan 2022 18:59:57 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20UHfKNG029524; Sun, 30 Jan 2022 09:59:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=a2q1VjaDmYBUb613dNBegAPQdbk1fZEeyz31uSJb/iA=; b=X/xPClx//01Z1q1L6QsADs4kIpKFnIkosE55nvbI7indBlUH1zzh/kG+V5mOGFGVjvPe /OemHlpoaUMvPqUs+kWEKWAAu3vyypJPOWASswt1k92cNsd63yQktb72XiqiUt5JerPL XTdbp4vQ0bC+nlCoD0n8NdlI8gwtteLm3IPQJtNwTHNcHFH06GElALqYtxBdMNOAYrpi vKmaiYCqVNJWOZ390wZyuWa0q+uSUznXYZNWT82V6/3yta/jmrIFATptaDX1/tjdhLoU pQE2mO6snJllyJAFNuzol/FVLl+yiWqcrklag3ttOD0INmxsqSyuUIPFsENYOL5exSL6 XA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3dw5yqjfwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jan 2022 09:59:53 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 30 Jan 2022 09:59:51 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 30 Jan 2022 09:59:51 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id 0C3113F70A8; Sun, 30 Jan 2022 09:59:47 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v3 2/4] ethdev: add dev op to set/get IP reassembly configuration Date: Sun, 30 Jan 2022 23:29:33 +0530 Message-ID: <20220130175935.1947730-3-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130175935.1947730-1-gakhil@marvell.com> References: <20220120162627.4155695-1-gakhil@marvell.com> <20220130175935.1947730-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: KQXEGoYne0qLAlOBhUjxIu4CN_KYN9rQ X-Proofpoint-GUID: KQXEGoYne0qLAlOBhUjxIu4CN_KYN9rQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-30_05,2022-01-28_01,2021-12-02_01 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 A new Ethernet device op is added to give application control over the IP reassembly configuration. This operation is an optional call from the application, default/max values are set by PMD and exposed via rte_eth_dev_info. Application should always first retrieve the capabilities from rte_eth_dev_info and then set the fields accordingly. The set API should be called before the starting the device. User can get the currently set values using the get API. Signed-off-by: Akhil Goyal --- doc/guides/nics/features.rst | 1 + lib/ethdev/ethdev_driver.h | 37 +++++++++++++++++ lib/ethdev/rte_ethdev.c | 80 ++++++++++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 51 +++++++++++++++++++++++ lib/ethdev/version.map | 4 ++ 5 files changed, 173 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index b45bce4a78..2a3cf09066 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -611,6 +611,7 @@ Supports IP reassembly in hardware. * **[uses] rte_eth_rxconf,rte_eth_rxmode**: ``offloads:RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY``. * **[provides] rte_eth_dev_info**: ``reass_capa``. +* **[provides] eth_dev_ops**: ``ip_reassembly_conf_get:ip_reassembly_conf_set``. .. _nic_features_shared_rx_queue: diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index d95605a355..a310001648 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -990,6 +990,38 @@ typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev, uint64_t *features); +/** + * @internal + * Get IP reassembly offload configuration parameters set in PMD. + * + * @param dev + * Port (ethdev) handle + * + * @param[out] conf + * Configuration parameters for IP reassembly. + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev, + struct rte_eth_ip_reass_params *conf); + +/** + * @internal + * Set configuration parameters for enabling IP reassembly offload in hardware. + * + * @param dev + * Port (ethdev) handle + * + * @param[in] conf + * Configuration parameters for IP reassembly. + * + * @return + * Negative errno value on error, zero otherwise + */ +typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev, + struct rte_eth_ip_reass_params *conf); + /** * @internal A structure containing the functions exported by an Ethernet driver. */ @@ -1186,6 +1218,11 @@ struct eth_dev_ops { * kinds of metadata to the PMD */ eth_rx_metadata_negotiate_t rx_metadata_negotiate; + + /** Get IP reassembly configuration */ + eth_ip_reassembly_conf_get_t ip_reassembly_conf_get; + /** Set IP reassembly configuration */ + eth_ip_reassembly_conf_set_t ip_reassembly_conf_set; }; /** diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index d9a03f12f9..6e9a8cf33b 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -6473,6 +6473,86 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features) (*dev->dev_ops->rx_metadata_negotiate)(dev, features)); } +int +rte_eth_ip_reassembly_conf_get(uint16_t port_id, + struct rte_eth_ip_reass_params *conf) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (dev->data->dev_configured == 0) { + RTE_ETHDEV_LOG(ERR, + "Device with port_id=%"PRIu16" is not configured.\n", + port_id); + return -EINVAL; + } + + if ((dev->data->dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY) == 0) { + RTE_ETHDEV_LOG(ERR, + "The port (ID=%"PRIu16") is not configured for IP reassembly\n", + port_id); + return -EINVAL; + } + + if (conf == NULL) { + RTE_ETHDEV_LOG(ERR, "Cannot get reassembly info to NULL"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_get, + -ENOTSUP); + memset(conf, 0, sizeof(struct rte_eth_ip_reass_params)); + return eth_err(port_id, + (*dev->dev_ops->ip_reassembly_conf_get)(dev, conf)); +} + +int +rte_eth_ip_reassembly_conf_set(uint16_t port_id, + struct rte_eth_ip_reass_params *conf) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (dev->data->dev_configured == 0) { + RTE_ETHDEV_LOG(ERR, + "Device with port_id=%"PRIu16" is not configured.\n", + port_id); + return -EINVAL; + } + + if (dev->data->dev_started != 0) { + RTE_ETHDEV_LOG(ERR, + "Device with port_id=%"PRIu16" started,\n" + "cannot configure IP reassembly params.\n", + port_id); + return -EINVAL; + } + + if ((dev->data->dev_conf.rxmode.offloads & + RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY) == 0) { + RTE_ETHDEV_LOG(ERR, + "The port (ID=%"PRIu16") is not configured for IP reassembly\n", + port_id); + return -EINVAL; + } + + if (conf == NULL) { + RTE_ETHDEV_LOG(ERR, + "Invalid IP reassembly configuration (NULL)\n"); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_conf_set, + -ENOTSUP); + return eth_err(port_id, + (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf)); +} + RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO); RTE_INIT(ethdev_init_telemetry) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index cfaf7a5afc..e3532591f4 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -5214,6 +5214,57 @@ int rte_eth_representor_info_get(uint16_t port_id, __rte_experimental int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Get IP reassembly configuration parameters currently set in PMD, + * if device Rx offload flag (RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY) is + * enabled and the PMD supports IP reassembly offload. + * + * @param port_id + * The port identifier of the device. + * @param conf + * A pointer to rte_eth_ip_reass_params structure. + * @return + * - (-ENOTSUP) if offload configuration is not supported by device. + * - (-EINVAL) if offload is not enabled in rte_eth_conf. + * - (-ENODEV) if *port_id* invalid. + * - (-EIO) if device is removed. + * - (0) on success. + */ +__rte_experimental +int rte_eth_ip_reassembly_conf_get(uint16_t port_id, + struct rte_eth_ip_reass_params *conf); + +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Set IP reassembly configuration parameters if device Rx offload + * flag (RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY) is enabled and the PMD + * supports IP reassembly offload. User should first check the + * reass_capa in rte_eth_dev_info before setting the configuration. + * The values of configuration parameters must not exceed the device + * capabilities. The use of this API is optional and if called, it + * should be called before rte_eth_dev_start(). + * + * @param port_id + * The port identifier of the device. + * @param conf + * A pointer to rte_eth_ip_reass_params structure. + * @return + * - (-ENOTSUP) if offload configuration is not supported by device. + * - (-EINVAL) if offload is not enabled in rte_eth_conf. + * - (-ENODEV) if *port_id* invalid. + * - (-EIO) if device is removed. + * - (0) on success. + */ +__rte_experimental +int rte_eth_ip_reassembly_conf_set(uint16_t port_id, + struct rte_eth_ip_reass_params *conf); + + #include /** diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index c2fb0669a4..ad829dd47e 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -256,6 +256,10 @@ EXPERIMENTAL { rte_flow_flex_item_create; rte_flow_flex_item_release; rte_flow_pick_transfer_proxy; + + #added in 22.03 + rte_eth_ip_reassembly_conf_get; + rte_eth_ip_reassembly_conf_set; }; INTERNAL { From patchwork Sun Jan 30 17:59:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 106725 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6960AA04A7; Sun, 30 Jan 2022 19:00:11 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A1C024115D; Sun, 30 Jan 2022 19:00:02 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0FFC24116D for ; Sun, 30 Jan 2022 19:00:00 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20UHkOlN007705; Sun, 30 Jan 2022 09:59:57 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=6+2AsYXw0taWuc38ya7WoRrFEI19+/XaT/3clpNJeSA=; b=kmxJaWGyrjvjUz4MQRAw/iiR9G+aBl8c2x2GyOUNKiiTnYKDHWcuPvfzF8jwwvp31NML dCsL5XYD5bcffOe4e2Z6odxzOtjKabH8ADp65YjikhFH3m1H41b0MLvl58Z1TZV1+P+s y6biM6j9RxeLZozh7dCXEIxtmyo+YcWsWVGIW1PwRa/v3dGglkwKQPxQiv8JFfKcHvJs 0DP1IN+oH3oFVepJ+oIFgSvvEMiIpF03vrjt7VyL7QS3c8MEm1SNcxqn2nNCzzCjciRs 3M8oYd6TzNXBCJsth8JoGmq7RzvLTGsAmnuCFHdRkG1nYY3N33vVA6lR/g/K4xuEwLTj Fw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dw3tt2v99-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jan 2022 09:59:57 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 30 Jan 2022 09:59:56 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sun, 30 Jan 2022 09:59:56 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id 57D1C3F70A7; Sun, 30 Jan 2022 09:59:52 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v3 3/4] ethdev: add mbuf dynfield for incomplete IP reassembly Date: Sun, 30 Jan 2022 23:29:34 +0530 Message-ID: <20220130175935.1947730-4-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130175935.1947730-1-gakhil@marvell.com> References: <20220120162627.4155695-1-gakhil@marvell.com> <20220130175935.1947730-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: cBUSJJkVzfQV-vaeup_wuzC4jo0UaiOA X-Proofpoint-ORIG-GUID: cBUSJJkVzfQV-vaeup_wuzC4jo0UaiOA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-30_05,2022-01-28_01,2021-12-02_01 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 Hardware IP reassembly may be incomplete for multiple reasons like reassembly timeout reached, duplicate fragments, etc. To save application cycles to process these packets again, a new mbuf dynflag is added to show that the mbuf received is not reassembled properly. Now if this dynflag is set, application can retrieve corresponding chain of mbufs using mbuf dynfield set by the PMD. Now, it will be up to application to either drop those fragments or wait for more time. Signed-off-by: Akhil Goyal --- lib/ethdev/ethdev_driver.h | 8 ++++++++ lib/ethdev/rte_ethdev.c | 28 ++++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++ lib/ethdev/version.map | 1 + 4 files changed, 58 insertions(+) diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index a310001648..7499a4fbf5 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1689,6 +1689,14 @@ int rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, uint32_t direction); +/** + * @internal + * Register mbuf dynamic field and flag for IP reassembly incomplete case. + */ +__rte_internal +int +rte_eth_ip_reass_dynfield_register(int *field_offset, int *flag); + /* * Legacy ethdev API used internally by drivers. diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 6e9a8cf33b..3c68a951c0 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -6553,6 +6553,34 @@ rte_eth_ip_reassembly_conf_set(uint16_t port_id, (*dev->dev_ops->ip_reassembly_conf_set)(dev, conf)); } +int +rte_eth_ip_reass_dynfield_register(int *field_offset, int *flag_offset) +{ + static const struct rte_mbuf_dynfield field_desc = { + .name = RTE_ETH_IP_REASS_DYNFIELD_NAME, + .size = sizeof(rte_eth_ip_reass_dynfield_t), + .align = __alignof__(rte_eth_ip_reass_dynfield_t), + }; + static const struct rte_mbuf_dynflag ip_reass_dynflag = { + .name = RTE_ETH_IP_REASS_INCOMPLETE_DYNFLAG_NAME, + }; + int offset; + + offset = rte_mbuf_dynfield_register(&field_desc); + if (offset < 0) + return -1; + if (field_offset != NULL) + *field_offset = offset; + + offset = rte_mbuf_dynflag_register(&ip_reass_dynflag); + if (offset < 0) + return -1; + if (flag_offset != NULL) + *flag_offset = offset; + + return 0; +} + RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO); RTE_INIT(ethdev_init_telemetry) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index e3532591f4..e3e6368a1d 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -5264,6 +5264,27 @@ __rte_experimental int rte_eth_ip_reassembly_conf_set(uint16_t port_id, struct rte_eth_ip_reass_params *conf); +#define RTE_ETH_IP_REASS_DYNFIELD_NAME "rte_eth_ip_reass_dynfield" +#define RTE_ETH_IP_REASS_INCOMPLETE_DYNFLAG_NAME "rte_eth_ip_reass_incomplete_dynflag" + +/** + * In case of IP reassembly offload failure, ol_flags in mbuf will be set + * with RTE_MBUF_F_RX_IPREASSEMBLY_INCOMPLETE and packets will be returned + * without alteration. The application can retrieve the attached fragments + * using mbuf dynamic field. + */ +typedef struct { + /** + * Next fragment packet. Application should fetch dynamic field of + * each fragment until a NULL is received and nb_frags is 0. + */ + struct rte_mbuf *next_frag; + /** Time spent(in ms) by HW in waiting for further fragments. */ + uint16_t time_spent_ms; + /** Number of more fragments attached in mbuf dynamic fields. */ + uint16_t nb_frags; +} rte_eth_ip_reass_dynfield_t; + #include diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index ad829dd47e..8b7578471a 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -283,6 +283,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_ip_reass_dynfield_register; rte_eth_representor_id_get; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; From patchwork Sun Jan 30 17:59:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 106726 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0791EA04A7; Sun, 30 Jan 2022 19:00:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2C0B41172; Sun, 30 Jan 2022 19:00:06 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 4E1F341172 for ; Sun, 30 Jan 2022 19:00:05 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 20UHkOlP007705; Sun, 30 Jan 2022 10:00:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=2y0q3ZnLcB4DkXcyBn60rJ2grNSK42EJ5oyutewJ2fk=; b=gAighUp4LfeM6td4/Q8cD3ak/4SjOQ9CkfBCMa/rfmr/dIJrAw3xigSwLetze5JYh0Ig myul4ID1DFIVJ0j1hXn5L8BCgzee1ceo2jsobTXT7GL/YMWojMw6d0NUw892WyifJ01+ xYNKU6fldoG96kiKu8gBp8eaHxav9bkocoUOVBcs9yPyp5hJoqUbZdLm0gf+rbbX0lRV 9879mf63bqj8WtX4vj8PwLPyGVnc4oz35n3qIXwThoXftwA5GEy0UYaTGhPIL5hd1CMf jF5t7nCyaZjYtPLPqtCxP5/yebRAVvKfCD71QSmvXcZMle7ioZKyR2i8NLY72dTyCSSi 5w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3dw3tt2v9m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 30 Jan 2022 10:00:01 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 30 Jan 2022 10:00:00 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Sun, 30 Jan 2022 10:00:00 -0800 Received: from localhost.localdomain (unknown [10.28.48.55]) by maili.marvell.com (Postfix) with ESMTP id A37593F70AA; Sun, 30 Jan 2022 09:59:56 -0800 (PST) From: Akhil Goyal To: CC: , , , , , , , , , , Akhil Goyal Subject: [PATCH v3 4/4] security: add IPsec option for IP reassembly Date: Sun, 30 Jan 2022 23:29:35 +0530 Message-ID: <20220130175935.1947730-5-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220130175935.1947730-1-gakhil@marvell.com> References: <20220120162627.4155695-1-gakhil@marvell.com> <20220130175935.1947730-1-gakhil@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: P2lUSNJEHnnGgst6N8vVTfjLSCBgtxej X-Proofpoint-ORIG-GUID: P2lUSNJEHnnGgst6N8vVTfjLSCBgtxej X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-01-30_05,2022-01-28_01,2021-12-02_01 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 A new option is added in IPsec to enable and attempt reassembly of inbound packets. Signed-off-by: Akhil Goyal --- devtools/libabigail.abignore | 14 ++++++++++++++ lib/security/rte_security.h | 12 +++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore index 90f449c43a..c6e304282f 100644 --- a/devtools/libabigail.abignore +++ b/devtools/libabigail.abignore @@ -16,3 +16,17 @@ [suppress_type] name = rte_eth_dev_info has_data_member_inserted_between = {offset_of(reserved_64s), end} + +; Ignore fields inserted in place of reserved_opts of rte_security_ipsec_sa_options +[suppress_type] + name = rte_ipsec_sa_prm + name = rte_security_ipsec_sa_options + has_data_member_inserted_between = {offset_of(reserved_opts), end} + +[suppress_type] + name = rte_security_capability + has_data_member_inserted_between = {offset_of(reserved_opts), (offset_of(reserved_opts) + 18)} + +[suppress_type] + name = rte_security_session_conf + has_data_member_inserted_between = {offset_of(reserved_opts), (offset_of(reserved_opts) + 18)} diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h index 1228b6c8b1..168b837a82 100644 --- a/lib/security/rte_security.h +++ b/lib/security/rte_security.h @@ -264,6 +264,16 @@ struct rte_security_ipsec_sa_options { */ uint32_t l4_csum_enable : 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 RTE_ETH_RX_OFFLOAD_IP_REASSEMBLY is set in + * inline Ethernet device. + * * 0: Disable reassembly of packets (default). + */ + uint32_t reass_en : 1; + /** Reserved bit fields for future extension * * User should ensure reserved_opts is cleared as it may change in @@ -271,7 +281,7 @@ struct rte_security_ipsec_sa_options { * * Note: Reduce number of bits in reserved_opts for every new option. */ - uint32_t reserved_opts : 18; + uint32_t reserved_opts : 17; }; /** IPSec security association direction */