net/enic: report ring limits and preferred default values
authorHyong Youb Kim <hyonkim@cisco.com>
Fri, 29 Jun 2018 09:29:34 +0000 (02:29 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 2 Jul 2018 23:54:12 +0000 (01:54 +0200)
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
drivers/net/enic/enic_main.c
drivers/net/enic/enic_res.h

index 6ebad8d..697dd65 100644 (file)
@@ -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)
index 863d246..2cd8516 100644 (file)
@@ -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,
index e68f130..6a3a0c5 100644 (file)
 #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 */
 #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