From patchwork Thu Jul 2 03:14:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hyong Youb Kim (hyonkim)" X-Patchwork-Id: 72698 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A5852A0523; Thu, 2 Jul 2020 05:17:01 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85B361C2AA; Thu, 2 Jul 2020 05:17:01 +0200 (CEST) Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) by dpdk.org (Postfix) with ESMTP id C351E1C1BF for ; Thu, 2 Jul 2020 05:16:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3910; q=dns/txt; s=iport; t=1593659819; x=1594869419; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=huV9GI1ikp+c2cIomwrF8QuDBhrDkE07tKvoHLged8w=; b=ITxLg9+LkDl/k4TIlBoMitOviXxkt3B6EYiykFRU8CRIu2P0DksVRRpX 3AhXSzXVD8kJCtHh2xXsgAddNTeLJYal8lhK+u+Gd4U88opGalfjkJuVK VnyW8cIWwllTWVSfeFcXP7MHZv/UcQ5OFMZ95/aCoajvhVAmdbPlbAYic 4=; X-IronPort-AV: E=Sophos;i="5.75,302,1589241600"; d="scan'208";a="778703792" Received: from alln-core-12.cisco.com ([173.36.13.134]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 02 Jul 2020 03:16:58 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-12.cisco.com (8.15.2/8.15.2) with ESMTP id 0623GwP1001330; Thu, 2 Jul 2020 03:16:58 GMT Received: by cisco.com (Postfix, from userid 508933) id 3227A20F2008; Wed, 1 Jul 2020 20:16:57 -0700 (PDT) From: Hyong Youb Kim To: Ferruh Yigit Cc: dev@dpdk.org, Hyong Youb Kim , John Daley Date: Wed, 1 Jul 2020 20:14:51 -0700 Message-Id: <20200702031451.25287-1-hyonkim@cisco.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Outbound-SMTP-Client: 10.193.184.48, savbu-usnic-a.cisco.com X-Outbound-Node: alln-core-12.cisco.com Subject: [dpdk-dev] [PATCH] net/enic: support burst mode info 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 Rx/Tx burst mode getter handlers. Signed-off-by: Hyong Youb Kim Reviewed-by: John Daley --- doc/guides/nics/features/enic.ini | 1 + drivers/net/enic/enic.h | 1 + drivers/net/enic/enic_ethdev.c | 45 +++++++++++++++++++++++++++ drivers/net/enic/enic_rxtx_vec_avx2.c | 1 + 4 files changed, 48 insertions(+) diff --git a/doc/guides/nics/features/enic.ini b/doc/guides/nics/features/enic.ini index 1a065a84fe..8ad938df3d 100644 --- a/doc/guides/nics/features/enic.ini +++ b/doc/guides/nics/features/enic.ini @@ -39,3 +39,4 @@ Linux VFIO = Y x86-32 = Y x86-64 = Y Usage doc = Y +Burst mode info = Y diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index a95e51eea8..a9545c0156 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -148,6 +148,7 @@ struct enic { uint8_t ig_vlan_rewrite_mode; /* devargs ig-vlan-rewrite */ uint16_t vxlan_port; /* current vxlan port pushed to NIC */ int use_simple_tx_handler; + int use_noscatter_vec_rx_handler; unsigned int flags; unsigned int priv_flags; diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 32d5397f85..4039dd79e3 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -976,6 +976,49 @@ static void enicpmd_dev_txq_info_get(struct rte_eth_dev *dev, /* tx_thresh, and all the other fields are not applicable for enic */ } +static int enicpmd_dev_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; + struct enic *enic = pmd_priv(dev); + const char *info_str = NULL; + int ret = -EINVAL; + + ENICPMD_FUNC_TRACE(); + if (enic->use_noscatter_vec_rx_handler) + info_str = "Vector AVX2 No Scatter"; + else if (pkt_burst == enic_noscatter_recv_pkts) + info_str = "Scalar No Scatter"; + else if (pkt_burst == enic_recv_pkts) + info_str = "Scalar"; + if (info_str) { + strlcpy(mode->info, info_str, sizeof(mode->info)); + ret = 0; + } + return ret; +} + +static int enicpmd_dev_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; + const char *info_str = NULL; + int ret = -EINVAL; + + ENICPMD_FUNC_TRACE(); + if (pkt_burst == enic_simple_xmit_pkts) + info_str = "Scalar Simplified"; + else if (pkt_burst == enic_xmit_pkts) + info_str = "Scalar"; + if (info_str) { + strlcpy(mode->info, info_str, sizeof(mode->info)); + ret = 0; + } + return ret; +} + static int enicpmd_dev_rx_queue_intr_enable(struct rte_eth_dev *eth_dev, uint16_t rx_queue_id) { @@ -1125,6 +1168,8 @@ static const struct eth_dev_ops enicpmd_eth_dev_ops = { .rx_queue_intr_disable = enicpmd_dev_rx_queue_intr_disable, .rxq_info_get = enicpmd_dev_rxq_info_get, .txq_info_get = enicpmd_dev_txq_info_get, + .rx_burst_mode_get = enicpmd_dev_rx_burst_mode_get, + .tx_burst_mode_get = enicpmd_dev_tx_burst_mode_get, .dev_led_on = NULL, .dev_led_off = NULL, .flow_ctrl_get = NULL, diff --git a/drivers/net/enic/enic_rxtx_vec_avx2.c b/drivers/net/enic/enic_rxtx_vec_avx2.c index 36d4d0deab..676b9f5fdb 100644 --- a/drivers/net/enic/enic_rxtx_vec_avx2.c +++ b/drivers/net/enic/enic_rxtx_vec_avx2.c @@ -824,6 +824,7 @@ enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev) if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_AVX2)) { ENICPMD_LOG(DEBUG, " use the non-scatter avx2 Rx handler"); eth_dev->rx_pkt_burst = &enic_noscatter_vec_recv_pkts; + enic->use_noscatter_vec_rx_handler = 1; return true; } return false;