From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 71EE3A034F; Mon, 7 Feb 2022 14:54:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 029CA410F3; Mon, 7 Feb 2022 14:54:08 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 61CE2410EA for ; Mon, 7 Feb 2022 14:54:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644242046; x=1675778046; h=message-id:date:to:cc:references:from:subject: in-reply-to:content-transfer-encoding:mime-version; bh=SOVCY/jnbw8E72z3PLQlMP7rY7Pm895LWvVOWL8AW5g=; b=KoqRm5gUpC4GKcIuKjwMdfsxAhveEDpHHOyg8+hCuwv0KXx75SlMqSaV /Tw8rQvl7vSUapCvJoTDuaAJLelTnflH1FQCyqvELhoG/iVJCq0fs/K8f lwPmzqjNCe3b3FV8HPTCS/zW4RCVHVpE6z5ZklHDZo4woZD61Nv86fDOP 21YfuRDzhy3h/TWl6ACZE0Fw+VOKaaVA23LVTUs2XqSsAqRvsJ8H1INfr JXq3t7NbiFz/JNPPoBufVG8O0xk0c/J1kSJCqCGI/kGk0ewe1mD+wP2xk Y0Sb39/qOKHJ/GJ1QvqHMsN1217oS1aWDK6lAno9serB5y1hc0J1dokOO w==; X-IronPort-AV: E=McAfee;i="6200,9189,10250"; a="248482339" X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="248482339" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2022 05:54:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,349,1635231600"; d="scan'208";a="567483054" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga001.jf.intel.com with ESMTP; 07 Feb 2022 05:54:02 -0800 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 7 Feb 2022 05:54:01 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Mon, 7 Feb 2022 05:54:01 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Mon, 7 Feb 2022 05:54:01 -0800 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.20; Mon, 7 Feb 2022 05:54:01 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QtWgUzLmrqEwj8D6PHFovN257Z/QS73sSyOez+JMrgKS25eLKylFIVM3otH8HdRfNSt69y6O9lCxEBImok+Pb/TbMIldJYPviEVoSHpthZbyrIrtxgnVzCZWKcIKX4fadiFeTXdMUjqdSXXxiOR2z3MUl4rRzULesIuoKBljXdvSU7uzSJ0woGYeh30N0TOo56VyNgjJefDOnNpvZR0lIOmuh/pVCxmtFWXORuaYh/jD6sSJy+x78627DWIfILjcLRpEFlOqcn69CUni0PYR84kuisQy//DB1SsIrMydY/MuqTum12/SgZPxHzIiFniLKbEm3P8za4d3pYaKnAwBog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l9fGbAJ6XoDm9PgUZXhc0+Hw3f0UY2YTibYTXZbUoyI=; b=hNEbVWs+KJqXi/FROLSUQBjRwS/hEepMzuAtp8nY9JRJDSODZyVRi2MZj6RCXXTkjGHjn1oHwj+lKhY2QAqSjk6vHa7R5ys9BOj9g7WJIfOvyxPreZEUXnO6QcFL3n7MlwCXdYl0lnGCVkbB9bN/HMEEhGgy60qevTTfppGr8TAOQLvqaE7WTFMrsaT/9a+3/QrB4eizZYwXyUibiNJX6WUqvYH9AUWIeNGdRp6PjiZQBMMFEKx77GmmiNbSZ61+pxYg5TDddSWbxJkd+7um2+jKX+ZU90eWVE7nsz6+eejXKtI5myeq6v4BiHV0qAvlQUpf5/TdP1WgKVuY42an3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) by DM6PR11MB3370.namprd11.prod.outlook.com (2603:10b6:5:56::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.18; Mon, 7 Feb 2022 13:53:45 +0000 Received: from PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e]) by PH0PR11MB5000.namprd11.prod.outlook.com ([fe80::5046:8550:928d:850e%7]) with mapi id 15.20.4951.019; Mon, 7 Feb 2022 13:53:45 +0000 Message-ID: Date: Mon, 7 Feb 2022 13:53:38 +0000 Content-Language: en-US To: Akhil Goyal , CC: , , , , , , , , , , , References: <20220130175935.1947730-1-gakhil@marvell.com> <20220204221334.3551574-1-gakhil@marvell.com> <20220204221334.3551574-2-gakhil@marvell.com> From: Ferruh Yigit Subject: Re: [PATCH v4 1/3] ethdev: introduce IP reassembly offload X-User: ferruhy In-Reply-To: <20220204221334.3551574-2-gakhil@marvell.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P123CA0075.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:190::8) To PH0PR11MB5000.namprd11.prod.outlook.com (2603:10b6:510:41::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6b7ab38d-8b7b-47f4-8722-08d9ea414224 X-MS-TrafficTypeDiagnostic: DM6PR11MB3370:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WM+crshTeVezeqtveSJPox132Oj2SBIqjlAzzTGAE6OARPgHkfFXQx+s7g2uwBbFgqveT/IMpqpOvLrlbnGTQPtWeaW9rpQYnGfAiHiqUUMsJDHtj+d+3k2OggXzuR2Cyhw3DAmO7SqDWPCZk+du3rANKrQw7fWDaIkn+9qB0Abn2N+SuIHwUtqozezwwu7/g0VxS5SoF8kPyQmbwPHuNvg70Dc7vCQsQxa2ZQV3iEJKakr5kFoAWOVhCApPUV9LmlrwOKAGnJNTa+j+1r2CghIenkaWy7cjSR+HgJ25txPF3WwoSFwqKEQF05OMvww/Jmt1kPgZxn4k5nUkDDyqKFweIQ5rJG9pByMHtohhnYAFzuPL2r04xqvbPAvPYhMLpTSJ5lbH8T9XGPatuKD+vsNwXOlRigr8SooGu52lStpFyBF5RmUJslqKkakCoh/gbiXC6AWDPGbZ6iBm0406xKH1X5f/GTSR0jQthWcXl8wwcDexFQVu+KoeEV3AG++4RyhOnV+PsMf6y9FDVM1bg8+BY5Dk52EtjvF04fcuO4qOghHtWWp9zoMm/IE64AFaAXhcs4LypwQAo3p9ZSdcCV86TTq3ElZdHYksQr0jVfEmQCQeGIfaGNMKOXUBsdpe0Cw9z+oMjKpr60RUweCDdZYdbz2x7UeH8PCL5AhAj4riMlgWGJXpZrBMOCeby5X63f7SpdqdRwCMe0iY4JK4ViDewW8WbDo9FGZP3yygQVA= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5000.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(366004)(38100700002)(7416002)(83380400001)(6506007)(31696002)(316002)(30864003)(82960400001)(44832011)(86362001)(6512007)(6666004)(31686004)(53546011)(26005)(186003)(508600001)(55236004)(5660300002)(6486002)(2616005)(2906002)(8936002)(66946007)(36756003)(8676002)(66476007)(66556008)(4326008)(21314003)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Qmp0QmMxRjR6Rm5pVi9zZnUwQ3Y1cXJaNzdSdHNNb21KM29ock05R2szY0JO?= =?utf-8?B?UTFwelJvRnI0OHc1V1UrVVpYMmoxV3ZxYjZuNjYvb0pGdk9oVGVoZjhwUlNU?= =?utf-8?B?WlluMUdUK1FEQjQ4cHZmTmlIbUlTUlg5ZWplcWduYlNKSlNSalVSRFh3UnVi?= =?utf-8?B?QWJkbmlJS1BXNjVtbFRIMmZNOUs3NnFRL0s5UytraTIzWkExUHZHWXRKQnlt?= =?utf-8?B?QUNEUkowbFVpeXdRaVE5cGpvZE4ranFVQlI5Y1NWOE1yckxYTTRUdnQ3V0lr?= =?utf-8?B?dU1yQlN3cVdCZDdidjFDWWdERnZGa2w2SmEyRVo3OXBJSy9YR21YRm5CQW1N?= =?utf-8?B?dkh0VVh3Tk9zTkFIc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=?utf-8?Q?xkKpkrtodHMtH+EZpBc/eIs=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6b7ab38d-8b7b-47f4-8722-08d9ea414224 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5000.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Feb 2022 13:53:45.6380 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v1fKpCmxmufY6dAosAOjdUI/3u7EmykwCwJL1SQ5ACZCQwuUDWGWAHJa4bRhGV1loZiuEQhpINpFm7KBnoNfGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3370 X-OriginatorOrg: intel.com 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 On 2/4/2022 10:13 PM, Akhil Goyal wrote: > 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 feature is exposed in eth_dev ops for devices which can > attempt IP reassembly of packets in hardware. > - rte_eth_ip_reassembly_capability_get() - to get the maximum values > of reassembly configuration which can be set. > - rte_eth_ip_reassembly_conf_set() - to set IP reassembly configuration > and to enable the feature in the PMD (to be called before rte_eth_dev_start()). > - rte_eth_ip_reassembly_conf_get() - to get the current configuration > set in PMD. > > Now when the offload is enabled using rte_eth_ip_reassembly_conf_set(), > the resulting reassembled IP packet would be a typical segmented mbuf in > case of success. > > And if reassembly of IP fragments is failed or is incomplete (if fragments do > not come before the reass_timeout, overlap, etc), the mbuf dynamic flags can be > updated by the PMD. This is updated in a subsequent patch. > > Signed-off-by: Akhil Goyal > Change-Id: Ic20bb3af1ed599e8f2f3665d2d6c47b2e420e509 > --- > doc/guides/nics/features.rst | 13 +++++ > lib/ethdev/ethdev_driver.h | 55 +++++++++++++++++++++ > lib/ethdev/rte_ethdev.c | 93 ++++++++++++++++++++++++++++++++++++ > lib/ethdev/rte_ethdev.h | 91 +++++++++++++++++++++++++++++++++++ > lib/ethdev/version.map | 5 ++ > 5 files changed, 257 insertions(+) > > diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst > index 27be2d2576..e6e0bbe9d8 100644 > --- a/doc/guides/nics/features.rst > +++ b/doc/guides/nics/features.rst > @@ -602,6 +602,19 @@ 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. > + > +* **[provides] eth_dev_ops**: ``ip_reassemly_capability_get``, > + ``ip_reassembly_conf_get``, ``ip_reassembly_conf_set``. > +* **[related] API**: ``rte_eth_ip_reassembly_capability_get()``, > + ``rte_eth_ip_reassembly_conf_get()``, ``rte_eth_ip_reassembly_conf_set()``. > + > + Need to update 'default.ini' to have this new feature. > .. _nic_features_shared_rx_queue: > > Shared Rx queue > diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h > index d95605a355..8fe77f283f 100644 > --- a/lib/ethdev/ethdev_driver.h > +++ b/lib/ethdev/ethdev_driver.h > @@ -990,6 +990,54 @@ 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 capability of a PMD. > + * > + * @param dev > + * Port (ethdev) handle > + * > + * @param[out] conf > + * IP reassembly capability supported by the PMD > + * > + * @return > + * Negative errno value on error, zero otherwise > + */ > +typedef int (*eth_ip_reassembly_capability_get_t)(struct rte_eth_dev *dev, > + struct rte_eth_ip_reass_params *capa); > + > +/** > + * @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, > + const struct rte_eth_ip_reass_params *conf); > + > /** > * @internal A structure containing the functions exported by an Ethernet driver. > */ > @@ -1186,6 +1234,13 @@ struct eth_dev_ops { > * kinds of metadata to the PMD > */ > eth_rx_metadata_negotiate_t rx_metadata_negotiate; > + > + /** Get IP reassembly capability */ > + eth_ip_reassembly_capability_get_t ip_reassembly_capability_get; > + /** 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 29e21ad580..88ca4ce867 100644 > --- a/lib/ethdev/rte_ethdev.c > +++ b/lib/ethdev/rte_ethdev.c > @@ -6474,6 +6474,99 @@ 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_capability_get(uint16_t port_id, > + struct rte_eth_ip_reass_params *reass_capa) syntax, dpdk coding converntion doesn't align the next line, mostly it has two tabs in next line. Same comment valid for many instances below. > +{ > + 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", - while printing port_id, can use %u, 'PRIu16' has no benefit as far as I can see, and I see both are used in existing code, I prefer %u but no strong option there - The log doesn't mention from ip reassembly capability at all, assume you see this log, will it give enough context to understand problem is related to ip reassembly? - Andrew has a comment before that each log message should be unique, to be able to detect location easily, exact same log message is used a few other locations. > + port_id); > + return -EINVAL; > + } > + > + if (reass_capa == NULL) { I still think all 'reass' usage should be 'reassembly', but again that is me. > + RTE_ETHDEV_LOG(ERR, "Cannot get reassembly capability to NULL"); > + return -EINVAL; > + } > + > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->ip_reassembly_capability_get, > + -ENOTSUP); > + memset(reass_capa, 0, sizeof(struct rte_eth_ip_reass_params)); > + > + return eth_err(port_id, (*dev->dev_ops->ip_reassembly_capability_get) > + (dev, reass_capa)); > +} > + > +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 (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)); If user didn't call 'rte_eth_ip_reassembly_conf_set()' prior to this call, what user will get here? All zeros, or can PMD fill with some defaults? Or should this API set some kind of error in that case to highlight there is no configuration? > + 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, > + const 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 (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 147cc1ced3..ecc5cd50b9 100644 > --- a/lib/ethdev/rte_ethdev.h > +++ b/lib/ethdev/rte_ethdev.h > @@ -1794,6 +1794,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/capability. > + * > + * If rte_eth_ip_reassembly_capability_get() returns 0, IP reassembly can be > + * enabled using rte_eth_ip_reassembly_conf_set() and params values lower than > + * capability can be set in the PMD. Can you please clarify "params values lower than capability"? Is it refering to 'max_frags'? > + */ > +struct rte_eth_ip_reass_params { > + /** Maximum time in ms which PMD can wait for other fragments. */ > + uint32_t reass_timeout_ms; Other variables in the struct is missing 'reass_' prefix, like it is 'max_frags' instead of 'reass_max_frags', should we do the same for this variable? > + /** 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 > @@ -5202,6 +5225,74 @@ 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 capabilities supported by the PMD, > + * > + * @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. > + * - (-ENODEV) if *port_id* invalid. > + * - (-EIO) if device is removed. > + * - (0) on success. > + */ > +__rte_experimental > +int rte_eth_ip_reassembly_capability_get(uint16_t port_id, > + struct rte_eth_ip_reass_params *conf); > + > +/** > + * @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 This flag is no more. Needs to updated the sentences. > + * enabled and the PMD supports IP reassembly offload. > + * Device needs to be configured to call this API, should it be documented here? > + * @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 the PMD supports IP reassembly > + * offload. User should first call rte_eth_ip_reassembly_capability_get() to > + * check the maximum values supported by the PMD before setting the > + * configuration. The use of this API is mandatory to enable this feature and > + * should be called before rte_eth_dev_start(). > + * Not sure if above cause confusion, what above mean is this API should be called when device is stopped. When you call it should be called before 'te_eth_dev_start()' can it be taken as it should be called from first ever start() API? If you think above is clear enough we can continue as it is. > + * @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. > + * - (-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, > + const struct rte_eth_ip_reass_params *conf); > + > + > #include > > /** > diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map > index c2fb0669a4..e22c102818 100644 > --- a/lib/ethdev/version.map > +++ b/lib/ethdev/version.map > @@ -256,6 +256,11 @@ EXPERIMENTAL { > rte_flow_flex_item_create; > rte_flow_flex_item_release; > rte_flow_pick_transfer_proxy; > + > + # added in 22.03 > + rte_eth_ip_reassembly_capability_get; > + rte_eth_ip_reassembly_conf_get; > + rte_eth_ip_reassembly_conf_set; > }; > > INTERNAL {