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 756ECA0547; Fri, 2 Sep 2022 13:23:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 61DD1427ED; Fri, 2 Sep 2022 13:23:22 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 22032427ED for ; Fri, 2 Sep 2022 13:23:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662117801; x=1693653801; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2QYN3uTK/n9Y3hWyBEZQ+ZcNwF4/+tNxyuhidK6djh4=; b=gyVLh/jUctLnYYe2ve3yqNNioC+S0pf1hQAQGQA9VyOYF4fduJlUWf0v WxeVYTq6r3c+LqXfgf9G+RbzuR5f4alqbFXMjh2VKVgEy6LCeFqDEHVS7 UIw/L/HvPngJnWnvvCFP2V2/wW9vT6Z61id/V3NpLMx8R5Fu6awEkI6pc RaNgGsRXLPXRqVr979jbQKzhH6GuQNxyXanqLkp26akRZoFxxQy+jaq1B OcvKEhhGRCTGM0nB/2FNc0fHwjF+xQTFV5hW7XQchNzMGxOPD9RnPjv1C SefZnePWhlsXBRnXbuko89UarP2DDW5rvl/9LAWz2TQ6SVAzrYnzOgRFq w==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="276361411" X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="276361411" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 04:23:20 -0700 X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="674320919" Received: from unknown (HELO localhost.localdomain) ([10.239.252.55]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 04:23:16 -0700 From: Yuan Wang To: dev@dpdk.org, Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Ray Kinsella Cc: xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com, qi.z.zhang@intel.com, qiming.yang@intel.com, jerinjacobk@gmail.com, viacheslavo@nvidia.com, stephen@networkplumber.org, xuan.ding@intel.com, hpothula@marvell.com, yaqi.tang@intel.com, Yuan Wang , Wenxuan Wu Subject: [PATCH v3 1/4] ethdev: introduce protocol header API Date: Sat, 3 Sep 2022 03:10:24 +0800 Message-Id: <20220902191027.666923-2-yuanx.wang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220902191027.666923-1-yuanx.wang@intel.com> References: <20220812181552.2908067-1-yuanx.wang@intel.com> <20220902191027.666923-1-yuanx.wang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Add a new ethdev API to retrieve supported protocol headers of a PMD, which helps to configure protocol header based buffer split. Signed-off-by: Yuan Wang Signed-off-by: Xuan Ding Signed-off-by: Wenxuan Wu --- doc/guides/rel_notes/release_22_11.rst | 5 ++++ lib/ethdev/ethdev_driver.h | 15 ++++++++++++ lib/ethdev/rte_ethdev.c | 33 ++++++++++++++++++++++++++ lib/ethdev/rte_ethdev.h | 24 +++++++++++++++++++ lib/ethdev/version.map | 3 +++ 5 files changed, 80 insertions(+) diff --git a/doc/guides/rel_notes/release_22_11.rst b/doc/guides/rel_notes/release_22_11.rst index 8c021cf050..4d90514a9a 100644 --- a/doc/guides/rel_notes/release_22_11.rst +++ b/doc/guides/rel_notes/release_22_11.rst @@ -55,6 +55,11 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Added new ethdev API for PMD to get buffer split supported protocol types.** + + Added ``rte_eth_buffer_split_get_supported_hdr_ptypes()``, to get supported + header protocols of a PMD to split. + Removed Items ------------- diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h index 5101868ea7..f64ceb9907 100644 --- a/lib/ethdev/ethdev_driver.h +++ b/lib/ethdev/ethdev_driver.h @@ -1054,6 +1054,18 @@ typedef int (*eth_ip_reassembly_conf_get_t)(struct rte_eth_dev *dev, typedef int (*eth_ip_reassembly_conf_set_t)(struct rte_eth_dev *dev, const struct rte_eth_ip_reassembly_params *conf); +/** + * @internal + * Get supported header protocols of a PMD to split. + * + * @param dev + * Ethdev handle of port. + * + * @return + * An array pointer to store supported protocol headers. + */ +typedef const uint32_t *(*eth_buffer_split_supported_hdr_ptypes_get_t)(struct rte_eth_dev *dev); + /** * @internal * Dump private info from device to a file. @@ -1301,6 +1313,9 @@ struct eth_dev_ops { /** Set IP reassembly configuration */ eth_ip_reassembly_conf_set_t ip_reassembly_conf_set; + /** Get supported header ptypes to split */ + eth_buffer_split_supported_hdr_ptypes_get_t buffer_split_supported_hdr_ptypes_get; + /** Dump private info from device */ eth_dev_priv_dump_t eth_dev_priv_dump; diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index 1979dc0850..093c577add 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -5917,6 +5917,39 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file) return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); } +int +rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint32_t *ptypes, int num) +{ + int i, j; + struct rte_eth_dev *dev; + const uint32_t *all_types; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + + if (ptypes == NULL && num > 0) { + RTE_ETHDEV_LOG(ERR, + "Cannot get ethdev port %u supported header protocol types to NULL " + "when array size is non zero\n", + port_id); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->buffer_split_supported_hdr_ptypes_get, -ENOTSUP); + all_types = (*dev->dev_ops->buffer_split_supported_hdr_ptypes_get)(dev); + + if (!all_types) + return 0; + + for (i = 0, j = 0; all_types[i] != RTE_PTYPE_UNKNOWN; ++i) { + if (j < num) + ptypes[j] = all_types[i]; + j++; + } + + return j; +} + 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 de9e970d4d..c58c908c3a 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -6206,6 +6206,30 @@ rte_eth_tx_buffer(uint16_t port_id, uint16_t queue_id, return rte_eth_tx_buffer_flush(port_id, queue_id, buffer); } +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Get supported header protocols to split on Rx. + * + * @param port_id + * The port identifier of the device. + * @param[out] ptypes + * An array pointer to store supported protocol headers, allocated by caller. + * These ptypes are composed with RTE_PTYPE_*. + * @param num + * Size of the array pointed by param ptypes. + * @return + * - (>=0) Number of supported ptypes. If the number of types exceeds num, + * only num entries will be filled into the ptypes array, but the full + * count of supported ptypes will be returned. + * - (-ENOTSUP) if header protocol is not supported by device. + * - (-ENODEV) if *port_id* invalid. + * - (-EINVAL) if bad parameter. + */ +__rte_experimental +int rte_eth_buffer_split_get_supported_hdr_ptypes(uint16_t port_id, uint32_t *ptypes, int num); + #ifdef __cplusplus } #endif diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map index 03f52fee91..e496c8d938 100644 --- a/lib/ethdev/version.map +++ b/lib/ethdev/version.map @@ -285,6 +285,9 @@ EXPERIMENTAL { rte_mtr_color_in_protocol_priority_get; rte_mtr_color_in_protocol_set; rte_mtr_meter_vlan_table_update; + + # added in 22.11 + rte_eth_buffer_split_get_supported_hdr_ptypes; }; INTERNAL { -- 2.25.1