From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A59BA0471 for ; Tue, 13 Aug 2019 05:11:33 +0200 (CEST) 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_ */ -- 2.7.4