DPDK patches and discussions
 help / color / mirror / Atom feed
From: John Daley <johndale@cisco.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, Hyong Youb Kim <hyonkim@cisco.com>
Subject: [dpdk-dev] [PATCH 05/14] net/enic: report ring limits and preferred default values
Date: Wed, 27 Jun 2018 20:19:31 -0700	[thread overview]
Message-ID: <20180628031940.17397-5-johndale@cisco.com> (raw)
In-Reply-To: <20180628031940.17397-1-johndale@cisco.com>

From: Hyong Youb Kim <hyonkim@cisco.com>

Report min/max ring sizes, alignments, and so on, and rely on the
common checks implemented in the rte_ethdev layer.

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 drivers/net/enic/enic_ethdev.c | 24 ++++++++++++++++++++++++
 drivers/net/enic/enic_main.c   | 24 ++++++++----------------
 drivers/net/enic/enic_res.h    | 12 ++++++++++++
 3 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 6ebad8d96..697dd6508 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -482,6 +482,30 @@ static void enicpmd_dev_info_get(struct rte_eth_dev *eth_dev,
 	device_info->reta_size = enic->reta_size;
 	device_info->hash_key_size = enic->hash_key_size;
 	device_info->flow_type_rss_offloads = enic->flow_type_rss_offloads;
+	device_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = enic->config.rq_desc_count,
+		.nb_min = ENIC_MIN_RQ_DESCS,
+		.nb_align = ENIC_ALIGN_DESCS,
+	};
+	device_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+		.nb_max = enic->config.wq_desc_count,
+		.nb_min = ENIC_MIN_WQ_DESCS,
+		.nb_align = ENIC_ALIGN_DESCS,
+		.nb_seg_max = ENIC_TX_XMIT_MAX,
+		.nb_mtu_seg_max = ENIC_NON_TSO_MAX_DESC,
+	};
+	device_info->default_rxportconf = (struct rte_eth_dev_portconf) {
+		.burst_size = ENIC_DEFAULT_RX_BURST,
+		.ring_size = RTE_MIN(device_info->rx_desc_lim.nb_max,
+			ENIC_DEFAULT_RX_RING_SIZE),
+		.nb_queues = ENIC_DEFAULT_RX_RINGS,
+	};
+	device_info->default_txportconf = (struct rte_eth_dev_portconf) {
+		.burst_size = ENIC_DEFAULT_TX_BURST,
+		.ring_size = RTE_MIN(device_info->tx_desc_lim.nb_max,
+			ENIC_DEFAULT_TX_RING_SIZE),
+		.nb_queues = ENIC_DEFAULT_TX_RINGS,
+	};
 }
 
 static const uint32_t *enicpmd_dev_supported_ptypes_get(struct rte_eth_dev *dev)
diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 863d2463c..2cd85168d 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -743,8 +743,8 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
 	}
 
 	/* number of descriptors have to be a multiple of 32 */
-	nb_sop_desc = (nb_desc / mbufs_per_pkt) & ~0x1F;
-	nb_data_desc = (nb_desc - nb_sop_desc) & ~0x1F;
+	nb_sop_desc = (nb_desc / mbufs_per_pkt) & ENIC_ALIGN_DESCS_MASK;
+	nb_data_desc = (nb_desc - nb_sop_desc) & ENIC_ALIGN_DESCS_MASK;
 
 	rq_sop->max_mbufs_per_pkt = mbufs_per_pkt;
 	rq_data->max_mbufs_per_pkt = mbufs_per_pkt;
@@ -752,7 +752,7 @@ int enic_alloc_rq(struct enic *enic, uint16_t queue_idx,
 	if (mbufs_per_pkt > 1) {
 		min_sop = 64;
 		max_sop = ((enic->config.rq_desc_count /
-			    (mbufs_per_pkt - 1)) & ~0x1F);
+			    (mbufs_per_pkt - 1)) & ENIC_ALIGN_DESCS_MASK);
 		min_data = min_sop * (mbufs_per_pkt - 1);
 		max_data = enic->config.rq_desc_count;
 	} else {
@@ -870,19 +870,11 @@ int enic_alloc_wq(struct enic *enic, uint16_t queue_idx,
 	static int instance;
 
 	wq->socket_id = socket_id;
-	if (nb_desc > enic->config.wq_desc_count) {
-		dev_warning(enic,
-			    "WQ %d - number of tx desc in cmd line (%d) "
-			    "is greater than that in the UCSM/CIMC adapter "
-			    "policy.  Applying the value in the adapter "
-			    "policy (%d)\n",
-			    queue_idx, nb_desc, enic->config.wq_desc_count);
-		nb_desc = enic->config.wq_desc_count;
-	} else if (nb_desc != enic->config.wq_desc_count) {
-		dev_info(enic,
-			 "TX Queues - effective number of descs:%d\n",
-			 nb_desc);
-	}
+	/*
+	 * rte_eth_tx_queue_setup() checks min, max, and alignment. So just
+	 * print an info message for diagnostics.
+	 */
+	dev_info(enic, "TX Queues - effective number of descs:%d\n", nb_desc);
 
 	/* Allocate queue resources */
 	err = vnic_wq_alloc(enic->vdev, &enic->wq[queue_idx], queue_idx,
diff --git a/drivers/net/enic/enic_res.h b/drivers/net/enic/enic_res.h
index e68f1307b..6a3a0c5cc 100644
--- a/drivers/net/enic/enic_res.h
+++ b/drivers/net/enic/enic_res.h
@@ -16,6 +16,10 @@
 #define ENIC_MIN_RQ_DESCS		64
 #define ENIC_MAX_RQ_DESCS		4096
 
+/* A descriptor ring has a multiple of 32 descriptors */
+#define ENIC_ALIGN_DESCS		32
+#define ENIC_ALIGN_DESCS_MASK		~(ENIC_ALIGN_DESCS - 1)
+
 #define ENIC_MIN_MTU			68
 
 /* Does not include (possible) inserted VLAN tag and FCS */
@@ -31,6 +35,14 @@
 #define ENIC_DEFAULT_RX_FREE_THRESH	32
 #define ENIC_TX_XMIT_MAX		64
 
+/* Defaults for dev_info.default_{rx,tx}portconf */
+#define ENIC_DEFAULT_RX_BURST		32
+#define ENIC_DEFAULT_RX_RINGS		1
+#define ENIC_DEFAULT_RX_RING_SIZE	512
+#define ENIC_DEFAULT_TX_BURST		32
+#define ENIC_DEFAULT_TX_RINGS		1
+#define ENIC_DEFAULT_TX_RING_SIZE	512
+
 #define ENIC_RSS_DEFAULT_CPU    0
 #define ENIC_RSS_BASE_CPU       0
 #define ENIC_RSS_HASH_BITS      7
-- 
2.16.2

  parent reply	other threads:[~2018-06-28  3:21 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  3:19 [dpdk-dev] [PATCH 01/14] net/enic: fix receive packet types John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 02/14] net/enic: update the UDP RSS detection mechanism John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 03/14] net/enic: do not overwrite admin Tx queue limit John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 04/14] net/enic: initialize RQ fetch index before enabling RQ John Daley
2018-06-28  3:19 ` John Daley [this message]
2018-06-28  3:19 ` [dpdk-dev] [PATCH 06/14] net/enic: add devarg to specify ingress VLAN rewrite mode John Daley
2018-06-28 16:04   ` Ferruh Yigit
2018-06-28  3:19 ` [dpdk-dev] [PATCH 07/14] net/enic: add handlers to add/delete vxlan port number John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 08/14] net/enic: use mbuf pointer array for inflight Tx packets John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 09/14] net/enic: support mbuf fast free offload John Daley
2018-06-28 16:05   ` Ferruh Yigit
2018-06-28  3:19 ` [dpdk-dev] [PATCH 10/14] net/enic: reduce Tx completion updates John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 11/14] net/enic: add the simple version of Tx handler John Daley
2018-06-28 16:05   ` Ferruh Yigit
2018-06-28  3:19 ` [dpdk-dev] [PATCH 12/14] net/enic: check maximum packet size in Tx prepare handler John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 13/14] net/enic: add simple Rx handler John Daley
2018-06-28  3:19 ` [dpdk-dev] [PATCH 14/14] net/enic: cap Rx packet processing to end of desc ring John Daley
2018-06-28 16:08 ` [dpdk-dev] [PATCH 01/14] net/enic: fix receive packet types Ferruh Yigit
2018-06-29  9:29 ` [dpdk-dev] [PATCH v2 00/15] enic PMD fixes and performance improvements John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 01/15] net/enic: fix receive packet types John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 02/15] net/enic: update the UDP RSS detection mechanism John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 03/15] net/enic: do not overwrite admin Tx queue limit John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 04/15] net/enic: initialize RQ fetch index before enabling RQ John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 05/15] net/enic: report ring limits and preferred default values John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 06/15] net/enic: add devarg to specify ingress VLAN rewrite mode John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 07/15] net/enic: add handlers to add/delete vxlan port number John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 08/15] net/enic: use mbuf pointer array for inflight Tx packets John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 09/15] net/enic: support mbuf fast free offload John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 10/15] net/enic: reduce Tx completion updates John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 11/15] net/enic: add the simple version of Tx handler John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 12/15] net/enic: check maximum packet size in Tx prepare handler John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 13/15] net/enic: add simple Rx handler John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 14/15] net/enic: cap Rx packet processing to end of desc ring John Daley
2018-06-29  9:29   ` [dpdk-dev] [PATCH v2 15/15] doc: update release notes with new enic features John Daley
2018-07-02 23:10   ` [dpdk-dev] [PATCH v2 00/15] enic PMD fixes and performance improvements Ferruh Yigit
2018-07-25 18:37   ` Kevin Traynor
2018-07-25 19:46     ` John Daley (johndale)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180628031940.17397-5-johndale@cisco.com \
    --to=johndale@cisco.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hyonkim@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).