From patchwork Tue Aug 13 03:06:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 57642 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 17FDC1BE89; Tue, 13 Aug 2019 05:11:12 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id CDAB7378B for ; Tue, 13 Aug 2019 05:11:09 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 20:11:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,379,1559545200"; d="scan'208";a="259997336" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.111.73]) by orsmga001.jf.intel.com with ESMTP; 12 Aug 2019 20:11:08 -0700 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang Date: Tue, 13 Aug 2019 11:06:10 +0800 Message-Id: <1565665572-65495-2-git-send-email-haiyue.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> References: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> Subject: [dpdk-dev] [RFC v2 1/3] ethdev: add the API for getting trace 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" Enhance the PMD to support retrieving trace information like Rx/Tx burst selection etc. Signed-off-by: Haiyue Wang --- lib/librte_ethdev/rte_ethdev.c | 18 ++++++++++++++++++ lib/librte_ethdev/rte_ethdev.h | 9 +++++++++ lib/librte_ethdev/rte_ethdev_core.h | 4 ++++ 3 files changed, 31 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 17d183e..6098fad 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -4083,6 +4083,24 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, } int +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id, + enum rte_eth_trace type, char *buf, int sz) +{ + struct rte_eth_dev *dev; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + + if (buf == NULL) + return -EINVAL; + + dev = &rte_eth_devices[port_id]; + + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->trace_info_get, -ENOTSUP); + + return dev->dev_ops->trace_info_get(dev, queue_id, type, buf, sz); +} + +int rte_eth_dev_set_mc_addr_list(uint16_t port_id, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index dc6596b..9405157 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -404,6 +404,11 @@ struct rte_eth_rxmode { uint64_t offloads; }; +enum rte_eth_trace { + ETH_TRACE_RX_BURST, + ETH_TRACE_TX_BURST, +}; + /** * VLAN types to indicate if it is for single VLAN, inner VLAN or outer VLAN. * Note that single VLAN is treated the same as inner VLAN. @@ -3556,6 +3561,10 @@ 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); +int +rte_eth_trace_info_get(uint16_t port_id, uint16_t queue_id, + enum rte_eth_trace type, char *buf, int sz); + /** * 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 2922d5b..366bf5b 100644 --- a/lib/librte_ethdev/rte_ethdev_core.h +++ b/lib/librte_ethdev/rte_ethdev_core.h @@ -170,6 +170,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_trace_info_get_t)(struct rte_eth_dev *dev, + uint16_t queue_id, enum rte_eth_trace type, char *buf, int sz); + typedef int (*mtu_set_t)(struct rte_eth_dev *dev, uint16_t mtu); /**< @internal Set MTU. */ @@ -418,6 +421,7 @@ 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_trace_info_get_t trace_info_get; /**< Get trace. */ 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. */ From patchwork Tue Aug 13 03:06:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 57645 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 67E681BE95; Tue, 13 Aug 2019 05:11:14 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id BBB2B1BE84 for ; Tue, 13 Aug 2019 05:11:11 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 20:11:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,379,1559545200"; d="scan'208";a="259997346" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.111.73]) by orsmga001.jf.intel.com with ESMTP; 12 Aug 2019 20:11:10 -0700 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang Date: Tue, 13 Aug 2019 11:06:11 +0800 Message-Id: <1565665572-65495-3-git-send-email-haiyue.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> References: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> Subject: [dpdk-dev] [RFC v2 2/3] testpmd: show the Rx/Tx burst 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 description' section into command 'show rxq|txq info ' to show the Rx/Tx burst description by new trace API. Signed-off-by: Haiyue Wang --- app/test-pmd/config.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 1a5a5c1..52814ba 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -330,6 +330,7 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id) struct rte_eth_rxq_info qinfo; int32_t rc; static const char *info_border = "*********************"; + char burst_info[128]; rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo); if (rc != 0) { @@ -354,6 +355,11 @@ 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_trace_info_get(port_id, queue_id, ETH_TRACE_RX_BURST, + burst_info, sizeof(burst_info)) > 0) + printf("\nBurst description: %s\n", burst_info); + printf("\n"); } @@ -363,6 +369,7 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) struct rte_eth_txq_info qinfo; int32_t rc; static const char *info_border = "*********************"; + char burst_info[128]; rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo); if (rc != 0) { @@ -383,6 +390,11 @@ 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_trace_info_get(port_id, queue_id, ETH_TRACE_TX_BURST, + burst_info, sizeof(burst_info)) > 0) + printf("\nBurst description: %s\n", burst_info); + printf("\n"); } From patchwork Tue Aug 13 03:06:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Haiyue" X-Patchwork-Id: 57644 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 D089B1BE97; Tue, 13 Aug 2019 05:11:16 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 2D8351BE92 for ; Tue, 13 Aug 2019 05:11:14 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Aug 2019 20:11:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,379,1559545200"; d="scan'208";a="259997355" Received: from npg-dpdk-haiyue-1.sh.intel.com ([10.67.111.73]) by orsmga001.jf.intel.com with ESMTP; 12 Aug 2019 20:11:12 -0700 From: Haiyue Wang To: dev@dpdk.org Cc: Haiyue Wang Date: Tue, 13 Aug 2019 11:06:12 +0800 Message-Id: <1565665572-65495-4-git-send-email-haiyue.wang@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> References: <1565665572-65495-1-git-send-email-haiyue.wang@intel.com> Subject: [dpdk-dev] [RFC v2 3/3] net/ice: support the Rx/Tx burst description trace 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" According to the Rx/Tx burst function that's selected currently, format the distinct burst description information for apps to query. Signed-off-by: Haiyue Wang --- drivers/net/ice/ice_ethdev.c | 26 ++++++++++++++++++++++ drivers/net/ice/ice_rxtx.c | 52 ++++++++++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_rxtx.h | 4 ++++ 3 files changed, 82 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 44a14cb..bad5c23 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -99,6 +99,8 @@ static int ice_dev_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); static int ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel); +static int ice_trace_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + enum rte_eth_trace type, char *buf, int sz); static const struct rte_pci_id pci_id_ice_map[] = { { RTE_PCI_DEVICE(ICE_INTEL_VENDOR_ID, ICE_DEV_ID_E810C_BACKPLANE) }, @@ -147,6 +149,7 @@ 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, + .trace_info_get = ice_trace_info_get, .get_eeprom_length = ice_get_eeprom_length, .get_eeprom = ice_get_eeprom, .rx_queue_count = ice_rx_queue_count, @@ -3765,6 +3768,29 @@ ice_dev_udp_tunnel_port_del(struct rte_eth_dev *dev, } static int +ice_trace_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + enum rte_eth_trace type, char *buf, int sz) +{ + int ret; + + switch (type) { + case ETH_TRACE_RX_BURST: + ret = ice_rx_burst_info_get(dev, queue_id, buf, sz); + break; + + case ETH_TRACE_TX_BURST: + ret = ice_tx_burst_info_get(dev, queue_id, buf, sz); + break; + + default: + ret = -ENOTSUP; + break; + } + + return ret; +} + +static int ice_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c index 0282b53..43d52c2 100644 --- a/drivers/net/ice/ice_rxtx.c +++ b/drivers/net/ice/ice_rxtx.c @@ -2385,6 +2385,35 @@ ice_set_rx_function(struct rte_eth_dev *dev) } } +int +ice_rx_burst_info_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + char *buf, int sz) +{ + int len = 0; + + if (dev->rx_pkt_burst == ice_recv_scattered_pkts) + len = snprintf(buf, sz, "Scattered Rx"); + else if (dev->rx_pkt_burst == ice_recv_pkts_bulk_alloc) + len = snprintf(buf, sz, "Bulk Rx"); + else if (dev->rx_pkt_burst == ice_recv_pkts) + len = snprintf(buf, sz, "Normal Rx"); +#ifdef RTE_ARCH_X86 + else if (dev->rx_pkt_burst == ice_recv_scattered_pkts_vec_avx2) + len = snprintf(buf, sz, "AVX2 Vector Scattered Rx"); + else if (dev->rx_pkt_burst == ice_recv_scattered_pkts_vec) + len = snprintf(buf, sz, "Vector Scattered Rx"); + else if (dev->rx_pkt_burst == ice_recv_pkts_vec_avx2) + len = snprintf(buf, sz, "AVX2 Vector Rx"); + else if (dev->rx_pkt_burst == ice_recv_pkts_vec) + len = snprintf(buf, sz, "Vector Rx"); +#endif + + if (len >= sz) + len = -ENOSPC; /* The output was truncated */ + + return len; +} + void __attribute__((cold)) ice_set_tx_function_flag(struct rte_eth_dev *dev, struct ice_tx_queue *txq) { @@ -2454,6 +2483,29 @@ ice_prep_pkts(__rte_unused void *tx_queue, struct rte_mbuf **tx_pkts, return i; } +int +ice_tx_burst_info_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, + char *buf, int sz) +{ + int len = 0; + + if (dev->tx_pkt_burst == ice_xmit_pkts_simple) + len = snprintf(buf, sz, "Simple Tx"); + else if (dev->tx_pkt_burst == ice_xmit_pkts) + len = snprintf(buf, sz, "Normal Tx"); +#ifdef RTE_ARCH_X86 + else if (dev->tx_pkt_burst == ice_xmit_pkts_vec_avx2) + len = snprintf(buf, sz, "AVX2 Vector Tx"); + else if (dev->tx_pkt_burst == ice_xmit_pkts_vec) + len = snprintf(buf, sz, "Vector Tx"); +#endif + + if (len >= sz) + len = -ENOSPC; /* The output was truncated */ + + return len; +} + void __attribute__((cold)) ice_set_tx_function(struct rte_eth_dev *dev) { diff --git a/drivers/net/ice/ice_rxtx.h b/drivers/net/ice/ice_rxtx.h index e921411..f951088 100644 --- a/drivers/net/ice/ice_rxtx.h +++ b/drivers/net/ice/ice_rxtx.h @@ -188,4 +188,8 @@ uint16_t ice_recv_scattered_pkts_vec_avx2(void *rx_queue, uint16_t nb_pkts); uint16_t ice_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts); +int ice_rx_burst_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + char *buf, int sz); +int ice_tx_burst_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + char *buf, int sz); #endif /* _ICE_RXTX_H_ */