From patchwork Mon Oct 14 15:35:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 61126 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 117421C1C0; Mon, 14 Oct 2019 17:41:55 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 97CC91C0B6 for ; Mon, 14 Oct 2019 17:41:50 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 08:41:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="225111990" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.153]) by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2019 08:41:48 -0700 From: Haiyue Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaolong.ye@intel.com Cc: ray.kinsella@intel.com, bernard.iremonger@intel.com, chenmin.sun@intel.com, Haiyue Wang Date: Mon, 14 Oct 2019 23:35:54 +0800 Message-Id: <20191014153557.88467-2-haiyue.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191014153557.88467-1-haiyue.wang@intel.com> References: <20191014153557.88467-1-haiyue.wang@intel.com> Subject: [dpdk-dev] [PATCH v3 1/4] ethdev: add the API for getting burst mode information X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Some PMDs have more than one RX/TX burst paths, add the ethdev API that allows an application to retrieve the mode information about Rx/Tx packet burst such as Scalar or Vector, and Vector technology like AVX2. Signed-off-by: Haiyue Wang Acked-by: Bernard Iremonger Reviewed-by: Xiaolong Ye --- doc/guides/nics/features.rst | 11 ++++ doc/guides/nics/features/default.ini | 1 + doc/guides/rel_notes/release_19_11.rst | 9 +++ lib/librte_ethdev/rte_ethdev.c | 71 ++++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 82 ++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_core.h | 5 ++ lib/librte_ethdev/rte_ethdev_version.map | 5 ++ 7 files changed, 184 insertions(+) diff --git a/doc/guides/nics/features.rst b/doc/guides/nics/features.rst index c4e128d2f..d96696801 100644 --- a/doc/guides/nics/features.rst +++ b/doc/guides/nics/features.rst @@ -871,6 +871,17 @@ Supports Tx queue setup after device started. * **[provides] rte_eth_dev_info**: ``dev_capa:RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP``. * **[related] API**: ``rte_eth_dev_info_get()``. +.. _nic_features_burst_mode_info: + +Burst mode info +--------------- + +Supports to get Rx/Tx packet burst mode information. + +* **[implements] eth_dev_ops**: ``rx_burst_mode_get``, ``tx_burst_mode_get``. +* **[related] API**: ``rte_eth_rx_burst_mode_get()``, ``rte_eth_tx_burst_mode_get()``, + ``rte_eth_burst_mode_option_name()``. + .. _nic_features_other: Other dev ops not represented by a Feature diff --git a/doc/guides/nics/features/default.ini b/doc/guides/nics/features/default.ini index dfbdf084e..91ec61901 100644 --- a/doc/guides/nics/features/default.ini +++ b/doc/guides/nics/features/default.ini @@ -19,6 +19,7 @@ Free Tx mbuf on demand = Queue start/stop = Runtime Rx queue setup = Runtime Tx queue setup = +Burst mode info = MTU update = Jumbo frame = Scattered Rx = diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst index a63c8af15..8634a7b81 100644 --- a/doc/guides/rel_notes/release_19_11.rst +++ b/doc/guides/rel_notes/release_19_11.rst @@ -83,6 +83,15 @@ New Features Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag. +* **Added RX/TX packet burst mode get API.** + + Added two new functions ``rte_eth_rx_burst_mode_get`` and + ``rte_eth_tx_burst_mode_get`` that allow an application + to retrieve the mode information about RX/TX packet burst + such as Scalar or Vector, and Vector technology like AVX2. + Another new function ``rte_eth_burst_mode_option_name`` is + provided for burst mode options stringification. + * **Updated the Intel ice driver.** Updated the Intel ice driver with new features and improvements, including: diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 7caaa0be3..921af3a9b 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4210,6 +4210,77 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, return 0; } +int +rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + if (mode == NULL) + return -EINVAL; + + dev = &rte_eth_devices[port_id]; + + if (queue_id >= dev->data->nb_rx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid RX queue_id=%u\n", queue_id); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rx_burst_mode_get, -ENOTSUP); + memset(mode, 0, sizeof(*mode)); + return eth_err(port_id, + dev->dev_ops->rx_burst_mode_get(dev, queue_id, mode)); +} + +int +rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + if (mode == NULL) + return -EINVAL; + + dev = &rte_eth_devices[port_id]; + + if (queue_id >= dev->data->nb_tx_queues) { + RTE_ETHDEV_LOG(ERR, "Invalid TX queue_id=%u\n", queue_id); + return -EINVAL; + } + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->tx_burst_mode_get, -ENOTSUP); + memset(mode, 0, sizeof(*mode)); + return eth_err(port_id, + dev->dev_ops->tx_burst_mode_get(dev, queue_id, mode)); +} + +const char * +rte_eth_burst_mode_option_name(uint64_t option) +{ + switch (option) { + case RTE_ETH_BURST_SCALAR: return "Scalar"; + case RTE_ETH_BURST_VECTOR: return "Vector"; + + case RTE_ETH_BURST_ALTIVEC: return "AltiVec"; + case RTE_ETH_BURST_NEON: return "Neon"; + case RTE_ETH_BURST_SSE: return "SSE"; + case RTE_ETH_BURST_AVX2: return "AVX2"; + case RTE_ETH_BURST_AVX512: return "AVX512"; + + case RTE_ETH_BURST_SCATTERED: return "Scattered"; + case RTE_ETH_BURST_BULK_ALLOC: return "Bulk Alloc"; + case RTE_ETH_BURST_SIMPLE: return "Simple"; + + case RTE_ETH_BURST_PER_QUEUE: return "Per Queue"; + } + + return ""; +} + int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct rte_ether_addr *mc_addr_set, diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index c26abe23a..83b08ee4d 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -1214,6 +1214,32 @@ struct rte_eth_txq_info { uint16_t nb_desc; /**< configured number of TXDs. */ } __rte_cache_min_aligned; +enum rte_eth_burst_mode_option { + RTE_ETH_BURST_SCALAR = (1 << 0), + RTE_ETH_BURST_VECTOR = (1 << 1), + + /**< bits[15:2] are reserved for each vector type */ + RTE_ETH_BURST_ALTIVEC = (1 << 2), + RTE_ETH_BURST_NEON = (1 << 3), + RTE_ETH_BURST_SSE = (1 << 4), + RTE_ETH_BURST_AVX2 = (1 << 5), + RTE_ETH_BURST_AVX512 = (1 << 6), + + RTE_ETH_BURST_SCATTERED = (1 << 16), /**< Support scattered packets */ + RTE_ETH_BURST_BULK_ALLOC = (1 << 17), /**< Support mbuf bulk alloc */ + RTE_ETH_BURST_SIMPLE = (1 << 18), + + RTE_ETH_BURST_PER_QUEUE = (1 << 19), /**< Support per queue burst */ +}; + +/** + * Ethernet device RX/TX queue packet burst mode information structure. + * Used to retrieve information about packet burst mode setting. + */ +struct rte_eth_burst_mode { + uint64_t options; +}; + /** Maximum name length for extended statistics counters */ #define RTE_ETH_XSTATS_NAME_SIZE 64 @@ -3602,6 +3628,62 @@ int rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id, int rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +/** + * Retrieve information about the Rx packet burst mode. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param queue_id + * The Rx queue on the Ethernet device for which information + * will be retrieved. + * @param mode + * A pointer to a structure of type *rte_eth_burst_mode* to be filled + * with the information of the packet burst mode. + * + * @return + * - 0: Success + * - -ENOTSUP: routine is not supported by the device PMD. + * - -EINVAL: The port_id or the queue_id is out of range. + */ +__rte_experimental +int rte_eth_rx_burst_mode_get(uint16_t port_id, uint16_t queue_id, + struct rte_eth_burst_mode *mode); + +/** + * Retrieve information about the Tx packet burst mode. + * + * @param port_id + * The port identifier of the Ethernet device. + * @param queue_id + * The Tx queue on the Ethernet device for which information + * will be retrieved. + * @param mode + * A pointer to a structure of type *rte_eth_burst_mode* to be filled + * with the information of the packet burst mode. + * + * @return + * - 0: Success + * - -ENOTSUP: routine is not supported by the device PMD. + * - -EINVAL: The port_id or the queue_id is out of range. + */ +__rte_experimental +int rte_eth_tx_burst_mode_get(uint16_t port_id, uint16_t queue_id, + struct rte_eth_burst_mode *mode); + +/** + * Retrieve name about burst mode option. + * + * @param mode + * The burst mode option of type *rte_eth_burst_mode_option*. + * + * @return + * - "": Not found + * - "xxx": name of the mode option. + */ +__rte_experimental +const char * +rte_eth_burst_mode_option_name(uint64_t option); + /** * Retrieve device registers and register attributes (number of registers and * register size) diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h index dcb5ae651..392aea8e6 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -294,6 +294,9 @@ typedef void (*eth_rxq_info_get_t)(struct rte_eth_dev *dev, typedef void (*eth_txq_info_get_t)(struct rte_eth_dev *dev, uint16_t tx_queue_id, struct rte_eth_txq_info *qinfo); +typedef int (*eth_burst_mode_get_t)(struct rte_eth_dev *dev, + uint16_t queue_id, struct rte_eth_burst_mode *mode); + typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu); /**< @internal Set MTU. */ @@ -542,6 +545,8 @@ struct eth_dev_ops { eth_dev_infos_get_t dev_infos_get; /**< Get device info. */ eth_rxq_info_get_t rxq_info_get; /**< retrieve RX queue information. */ eth_txq_info_get_t txq_info_get; /**< retrieve TX queue information. */ + eth_burst_mode_get_t rx_burst_mode_get; /**< Get RX burst mode */ + eth_burst_mode_get_t tx_burst_mode_get; /**< Get TX burst mode */ eth_fw_version_get_t fw_version_get; /**< Get firmware version. */ eth_dev_supported_ptypes_get_t dev_supported_ptypes_get; /**< Get packet types supported and identified by device. */ diff --git a/lib/librte_ethdev/rte_ethdev_version.map b/lib/librte_ethdev/rte_ethdev_version.map index 6df42a47b..e59d51648 100644 --- a/lib/librte_ethdev/rte_ethdev_version.map +++ b/lib/librte_ethdev/rte_ethdev_version.map @@ -283,4 +283,9 @@ EXPERIMENTAL { # added in 19.08 rte_eth_read_clock; + + # added in 19.11 + rte_eth_rx_burst_mode_get; + rte_eth_tx_burst_mode_get; + rte_eth_burst_mode_option_name; }; From patchwork Mon Oct 14 15:35:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 61127 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D6BB11C1DA; Mon, 14 Oct 2019 17:41:57 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 453E31C0C4 for ; Mon, 14 Oct 2019 17:41:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 08:41:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="225111996" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.153]) by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2019 08:41:50 -0700 From: Haiyue Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaolong.ye@intel.com Cc: ray.kinsella@intel.com, bernard.iremonger@intel.com, chenmin.sun@intel.com, Haiyue Wang Date: Mon, 14 Oct 2019 23:35:55 +0800 Message-Id: <20191014153557.88467-3-haiyue.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191014153557.88467-1-haiyue.wang@intel.com> References: <20191014153557.88467-1-haiyue.wang@intel.com> Subject: [dpdk-dev] [PATCH v3 2/4] net/i40e: add Rx/Tx burst mode get callbacks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Retrieve burst mode options according to the selected Rx/Tx burst function name. Signed-off-by: Haiyue Wang Acked-by: Bernard Iremonger Reviewed-by: Xiaolong Ye --- doc/guides/nics/features/i40e.ini | 1 + drivers/net/i40e/i40e_ethdev.c | 2 + drivers/net/i40e/i40e_ethdev.h | 4 ++ drivers/net/i40e/i40e_rxtx.c | 76 +++++++++++++++++++++++++++++++ 4 files changed, 83 insertions(+) diff --git a/doc/guides/nics/features/i40e.ini b/doc/guides/nics/features/i40e.ini index 980bcc5b2..e5ae6ded0 100644 --- a/doc/guides/nics/features/i40e.ini +++ b/doc/guides/nics/features/i40e.ini @@ -11,6 +11,7 @@ Rx interrupt = Y Queue start/stop = Y Runtime Rx queue setup = Y Runtime Tx queue setup = Y +Burst mode info = Y Jumbo frame = Y Scattered Rx = Y TSO = Y diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 2ca14da3b..77a46832c 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -502,6 +502,8 @@ static const struct eth_dev_ops i40e_eth_dev_ops = { .filter_ctrl = i40e_dev_filter_ctrl, .rxq_info_get = i40e_rxq_info_get, .txq_info_get = i40e_txq_info_get, + .rx_burst_mode_get = i40e_rx_burst_mode_get, + .tx_burst_mode_get = i40e_tx_burst_mode_get, .mirror_rule_set = i40e_mirror_rule_set, .mirror_rule_reset = i40e_mirror_rule_reset, .timesync_enable = i40e_timesync_enable, diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h index 261954b9a..2ddaffbeb 100644 --- a/drivers/net/i40e/i40e_ethdev.h +++ b/drivers/net/i40e/i40e_ethdev.h @@ -1209,6 +1209,10 @@ void i40e_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo); void i40e_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +int i40e_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_burst_mode *mode); +int i40e_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_burst_mode *mode); struct i40e_ethertype_filter * i40e_sw_ethertype_filter_lookup(struct i40e_ethertype_rule *ethertype_rule, const struct i40e_ethertype_filter_input *input); diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index bfe161f2c..09c01f67c 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -3022,6 +3022,51 @@ i40e_set_rx_function(struct rte_eth_dev *dev) } } +int +i40e_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; + uint64_t options; + + if (pkt_burst == i40e_recv_scattered_pkts) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == i40e_recv_pkts_bulk_alloc) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_BULK_ALLOC; + else if (pkt_burst == i40e_recv_pkts) + options = RTE_ETH_BURST_SCALAR; +#ifdef RTE_ARCH_X86 + else if (pkt_burst == i40e_recv_scattered_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2 | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == i40e_recv_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2; + else if (pkt_burst == i40e_recv_scattered_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == i40e_recv_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE; +#elif defined(RTE_ARCH_ARM64) + else if (pkt_burst == i40e_recv_scattered_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == i40e_recv_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON; +#elif defined(RTE_ARCH_PPC_64) + else if (pkt_burst == i40e_recv_scattered_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == i40e_recv_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC; +#endif + else + options = 0; + + mode->options = options; + + return options != 0 ? 0 : -EINVAL; +} + void __attribute__((cold)) i40e_set_tx_function_flag(struct rte_eth_dev *dev, struct i40e_tx_queue *txq) { @@ -3115,6 +3160,37 @@ i40e_set_tx_function(struct rte_eth_dev *dev) } } +int +i40e_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + uint64_t options; + + if (pkt_burst == i40e_xmit_pkts_simple) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SIMPLE; + else if (pkt_burst == i40e_xmit_pkts) + options = RTE_ETH_BURST_SCALAR; +#ifdef RTE_ARCH_X86 + else if (pkt_burst == i40e_xmit_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2; + else if (pkt_burst == i40e_xmit_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE; +#elif defined(RTE_ARCH_ARM64) + else if (pkt_burst == i40e_xmit_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_NEON; +#elif defined(RTE_ARCH_PPC_64) + else if (pkt_burst == i40e_xmit_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_ALTIVEC; +#endif + else + options = 0; + + mode->options = options; + + return options != 0 ? 0 : -EINVAL; +} + void __attribute__((cold)) i40e_set_default_ptype_table(struct rte_eth_dev *dev) { From patchwork Mon Oct 14 15:35:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 61128 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 745091C2E7; Mon, 14 Oct 2019 17:42:00 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id A42011C0C4 for ; Mon, 14 Oct 2019 17:41:53 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 08:41:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="225112001" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.153]) by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2019 08:41:51 -0700 From: Haiyue Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaolong.ye@intel.com Cc: ray.kinsella@intel.com, bernard.iremonger@intel.com, chenmin.sun@intel.com, Haiyue Wang Date: Mon, 14 Oct 2019 23:35:56 +0800 Message-Id: <20191014153557.88467-4-haiyue.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191014153557.88467-1-haiyue.wang@intel.com> References: <20191014153557.88467-1-haiyue.wang@intel.com> Subject: [dpdk-dev] [PATCH v3 3/4] net/ice: add Rx/Tx burst mode get callbacks X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Retrieve burst mode options according to the selected Rx/Tx burst function name. Signed-off-by: Haiyue Wang Acked-by: Bernard Iremonger Reviewed-by: Xiaolong Ye --- doc/guides/nics/features/ice.ini | 1 + drivers/net/ice/ice_ethdev.c | 2 ++ drivers/net/ice/ice_rxtx.c | 58 ++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 4 +++ 4 files changed, 65 insertions(+) diff --git a/doc/guides/nics/features/ice.ini b/doc/guides/nics/features/ice.ini index 5e6cb4b7e..65923f0bc 100644 --- a/doc/guides/nics/features/ice.ini +++ b/doc/guides/nics/features/ice.ini @@ -10,6 +10,7 @@ Link status event = Y Rx interrupt = Y Fast mbuf free = Y Queue start/stop = Y +Burst mode info = Y MTU update = Y Jumbo frame = Y Scattered Rx = Y diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 022b58c01..d848440a1 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -167,6 +167,8 @@ static const struct eth_dev_ops ice_eth_dev_ops = { .vlan_pvid_set = ice_vlan_pvid_set, .rxq_info_get = ice_rxq_info_get, .txq_info_get = ice_txq_info_get, + .rx_burst_mode_get = ice_rx_burst_mode_get, + .tx_burst_mode_get = ice_tx_burst_mode_get, .get_eeprom_length = ice_get_eeprom_length, .get_eeprom = ice_get_eeprom, .rx_queue_count = ice_rx_queue_count, diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 8785cf8a3..c07aa4b81 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -2435,6 +2435,39 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } +int +ice_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; + uint64_t options; + + if (pkt_burst == ice_recv_scattered_pkts) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == ice_recv_pkts_bulk_alloc) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_BULK_ALLOC; + else if (pkt_burst == ice_recv_pkts) + options = RTE_ETH_BURST_SCALAR; +#ifdef RTE_ARCH_X86 + else if (pkt_burst == ice_recv_scattered_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2 | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == ice_recv_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2; + else if (pkt_burst == ice_recv_scattered_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE | + RTE_ETH_BURST_SCATTERED; + else if (pkt_burst == ice_recv_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE; +#endif + else + options = 0; + + mode->options = options; + + return options != 0 ? 0 : -EINVAL; +} + void __attribute__((cold)) ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq) { @@ -2558,6 +2591,31 @@ ice_set_tx_function(struct rte_eth_dev *dev) } } +int +ice_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + struct rte_eth_burst_mode *mode) +{ + eth_tx_burst_t pkt_burst = dev->tx_pkt_burst; + uint64_t options; + + if (pkt_burst == ice_xmit_pkts_simple) + options = RTE_ETH_BURST_SCALAR | RTE_ETH_BURST_SIMPLE; + else if (pkt_burst == ice_xmit_pkts) + options = RTE_ETH_BURST_SCALAR; +#ifdef RTE_ARCH_X86 + else if (pkt_burst == ice_xmit_pkts_vec_avx2) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_AVX2; + else if (pkt_burst == ice_xmit_pkts_vec) + options = RTE_ETH_BURST_VECTOR | RTE_ETH_BURST_SSE; +#endif + else + options = 0; + + mode->options = options; + + return options != 0 ? 0 : -EINVAL; +} + /* For each value it means, datasheet of hardware can tell more details * * @note: fix ice_dev_supported_ptypes_get() if any change here. diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index 25b3822df..31c53d535 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -168,6 +168,10 @@ void ice_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_rxq_info *qinfo); void ice_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, struct rte_eth_txq_info *qinfo); +int ice_rx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_burst_mode *mode); +int ice_tx_burst_mode_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_burst_mode *mode); int ice_rx_descriptor_status(void *rx_queue, uint16_t offset); int ice_tx_descriptor_status(void *tx_queue, uint16_t offset); void ice_set_default_ptype_table(struct rte_eth_dev *dev); From patchwork Mon Oct 14 15:35:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 61129 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 866501C2B8; Mon, 14 Oct 2019 17:42:03 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 0B9301C122 for ; Mon, 14 Oct 2019 17:41:54 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Oct 2019 08:41:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,296,1566889200"; d="scan'208";a="225112004" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.153]) by fmsmga002.fm.intel.com with ESMTP; 14 Oct 2019 08:41:53 -0700 From: Haiyue Wang To: dev@dpdk.org, ferruh.yigit@intel.com, xiaolong.ye@intel.com Cc: ray.kinsella@intel.com, bernard.iremonger@intel.com, chenmin.sun@intel.com, Haiyue Wang Date: Mon, 14 Oct 2019 23:35:57 +0800 Message-Id: <20191014153557.88467-5-haiyue.wang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191014153557.88467-1-haiyue.wang@intel.com> References: <20191014153557.88467-1-haiyue.wang@intel.com> Subject: [dpdk-dev] [PATCH v3 4/4] app/testpmd: show the Rx/Tx burst mode description X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" Add the 'Burst mode' section into command 'show rxq|txq info ' to show the Rx/Tx burst mode description like: "Burst mode: Vector AVX2 Scattered" Signed-off-by: Haiyue Wang Acked-by: Bernard Iremonger Reviewed-by: Xiaolong Ye --- app/test-pmd/config.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 2356afee9..1844e4875 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -346,9 +346,25 @@ nic_stats_mapping_display(portid_t port_id) nic_stats_mapping_border, nic_stats_mapping_border); } +static void +burst_mode_options_display(uint64_t options) +{ + int offset; + + while (options != 0) { + offset = rte_bsf64(options); + + printf(" %s", + rte_eth_burst_mode_option_name(1ULL << offset)); + + options &= ~(1ULL << offset); + } +} + void rx_queue_infos_display(portid_t port_id, uint16_t queue_id) { + struct rte_eth_burst_mode mode; struct rte_eth_rxq_info qinfo; int32_t rc; static const char *info_border = "*********************"; @@ -376,12 +392,19 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id) printf("\nRX scattered packets: %s", (qinfo.scattered_rx != 0) ? "on" : "off"); printf("\nNumber of RXDs: %hu", qinfo.nb_desc); + + if (rte_eth_rx_burst_mode_get(port_id, queue_id, &mode) == 0) { + printf("\nBurst mode:"); + burst_mode_options_display(mode.options); + } + printf("\n"); } void tx_queue_infos_display(portid_t port_id, uint16_t queue_id) { + struct rte_eth_burst_mode mode; struct rte_eth_txq_info qinfo; int32_t rc; static const char *info_border = "*********************"; @@ -405,6 +428,12 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) printf("\nTX deferred start: %s", (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); printf("\nNumber of TXDs: %hu", qinfo.nb_desc); + + if (rte_eth_tx_burst_mode_get(port_id, queue_id, &mode) == 0) { + printf("\nBurst mode:"); + burst_mode_options_display(mode.options); + } + printf("\n"); }