ixgbe: get queue info and descriptor limits
[dpdk.git] / drivers / net / ixgbe / ixgbe_rxtx.c
index 1158562..5d7924c 100644 (file)
@@ -1820,25 +1820,6 @@ ixgbe_recv_pkts_lro_bulk_alloc(void *rx_queue, struct rte_mbuf **rx_pkts,
  *
  **********************************************************************/
 
-/*
- * Rings setup and release.
- *
- * TDBA/RDBA should be aligned on 16 byte boundary. But TDLEN/RDLEN should be
- * multiple of 128 bytes. So we align TDBA/RDBA on 128 byte boundary. This will
- * also optimize cache line size effect. H/W supports up to cache line size 128.
- */
-#define IXGBE_ALIGN 128
-
-/*
- * Maximum number of Ring Descriptors.
- *
- * Since RDLEN/TDLEN should be multiple of 128 bytes, the number of ring
- * descriptors should meet the following condition:
- *      (num_ring_desc * sizeof(rx/tx descriptor)) % 128 == 0
- */
-#define IXGBE_MIN_RING_DESC 32
-#define IXGBE_MAX_RING_DESC 4096
-
 /*
  * Create memzone for HW rings. malloc can't be used as the physical address is
  * needed. If the memzone is already created, then this function returns a ptr
@@ -2007,9 +1988,9 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
         * It must not exceed hardware maximum, and must be multiple
         * of IXGBE_ALIGN.
         */
-       if (((nb_desc * sizeof(union ixgbe_adv_tx_desc)) % IXGBE_ALIGN) != 0 ||
-           (nb_desc > IXGBE_MAX_RING_DESC) ||
-           (nb_desc < IXGBE_MIN_RING_DESC)) {
+       if (nb_desc % IXGBE_TXD_ALIGN != 0 ||
+                       (nb_desc > IXGBE_MAX_RING_DESC) ||
+                       (nb_desc < IXGBE_MIN_RING_DESC)) {
                return -EINVAL;
        }
 
@@ -2374,9 +2355,9 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
         * It must not exceed hardware maximum, and must be multiple
         * of IXGBE_ALIGN.
         */
-       if (((nb_desc * sizeof(union ixgbe_adv_rx_desc)) % IXGBE_ALIGN) != 0 ||
-           (nb_desc > IXGBE_MAX_RING_DESC) ||
-           (nb_desc < IXGBE_MIN_RING_DESC)) {
+       if (nb_desc % IXGBE_RXD_ALIGN != 0 ||
+                       (nb_desc > IXGBE_MAX_RING_DESC) ||
+                       (nb_desc < IXGBE_MIN_RING_DESC)) {
                return (-EINVAL);
        }
 
@@ -2928,7 +2909,7 @@ ixgbe_vmdq_dcb_configure(struct rte_eth_dev *dev)
                 * mapping is done with 3 bits per priority,
                 * so shift by i*3 each time
                 */
-               queue_mapping |= ((cfg->dcb_queue[i] & 0x07) << (i * 3));
+               queue_mapping |= ((cfg->dcb_tc[i] & 0x07) << (i * 3));
 
        IXGBE_WRITE_REG(hw, IXGBE_RTRUP2TC, queue_mapping);
 
@@ -3063,7 +3044,7 @@ ixgbe_vmdq_dcb_rx_config(struct rte_eth_dev *dev,
        }
        /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-               j = vmdq_rx_conf->dcb_queue[i];
+               j = vmdq_rx_conf->dcb_tc[i];
                tc = &dcb_config->tc_config[j];
                tc->path[IXGBE_DCB_RX_CONFIG].up_to_tc_bitmap =
                                                (uint8_t)(1 << j);
@@ -3091,7 +3072,7 @@ ixgbe_dcb_vt_tx_config(struct rte_eth_dev *dev,
 
        /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-               j = vmdq_tx_conf->dcb_queue[i];
+               j = vmdq_tx_conf->dcb_tc[i];
                tc = &dcb_config->tc_config[j];
                tc->path[IXGBE_DCB_TX_CONFIG].up_to_tc_bitmap =
                                                (uint8_t)(1 << j);
@@ -3113,7 +3094,7 @@ ixgbe_dcb_rx_config(struct rte_eth_dev *dev,
 
        /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-               j = rx_conf->dcb_queue[i];
+               j = rx_conf->dcb_tc[i];
                tc = &dcb_config->tc_config[j];
                tc->path[IXGBE_DCB_RX_CONFIG].up_to_tc_bitmap =
                                                (uint8_t)(1 << j);
@@ -3134,7 +3115,7 @@ ixgbe_dcb_tx_config(struct rte_eth_dev *dev,
 
        /* User Priority to Traffic Class mapping */
        for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) {
-               j = tx_conf->dcb_queue[i];
+               j = tx_conf->dcb_tc[i];
                tc = &dcb_config->tc_config[j];
                tc->path[IXGBE_DCB_TX_CONFIG].up_to_tc_bitmap =
                                                (uint8_t)(1 << j);
@@ -3169,9 +3150,13 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
                                reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
                                        IXGBE_MRQC_VMDQRT4TCEN;
                        else {
+                               /* no matter the mode is DCB or DCB_RSS, just
+                                * set the MRQE to RSSXTCEN. RSS is controlled
+                                * by RSS_FIELD
+                                */
                                IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0);
                                reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
-                                       IXGBE_MRQC_RT4TCEN;
+                                       IXGBE_MRQC_RTRSS4TCEN;
                        }
                }
                if (dcb_config->num_tcs.pg_tcs == 8) {
@@ -3181,7 +3166,7 @@ ixgbe_dcb_rx_hw_config(struct ixgbe_hw *hw,
                        else {
                                IXGBE_WRITE_REG(hw, IXGBE_VT_CTL, 0);
                                reg = (reg & ~IXGBE_MRQC_MRQE_MASK) |
-                                       IXGBE_MRQC_RT8TCEN;
+                                       IXGBE_MRQC_RTRSS8TCEN;
                        }
                }
 
@@ -3286,16 +3271,17 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
                         *get dcb and VT rx configuration parameters
                         *from rte_eth_conf
                         */
-                       ixgbe_vmdq_dcb_rx_config(dev,dcb_config);
+                       ixgbe_vmdq_dcb_rx_config(dev, dcb_config);
                        /*Configure general VMDQ and DCB RX parameters*/
                        ixgbe_vmdq_dcb_configure(dev);
                }
                break;
        case ETH_MQ_RX_DCB:
+       case ETH_MQ_RX_DCB_RSS:
                dcb_config->vt_mode = false;
                config_dcb_rx = DCB_RX_CONFIG;
                /* Get dcb TX configuration parameters from rte_eth_conf */
-               ixgbe_dcb_rx_config(dev,dcb_config);
+               ixgbe_dcb_rx_config(dev, dcb_config);
                /*Configure general DCB RX parameters*/
                ixgbe_dcb_rx_hw_config(hw, dcb_config);
                break;
@@ -3317,7 +3303,7 @@ ixgbe_dcb_hw_configure(struct rte_eth_dev *dev,
                dcb_config->vt_mode = false;
                config_dcb_tx = DCB_TX_CONFIG;
                /*get DCB TX configuration parameters from rte_eth_conf*/
-               ixgbe_dcb_tx_config(dev,dcb_config);
+               ixgbe_dcb_tx_config(dev, dcb_config);
                /*Configure general DCB TX parameters*/
                ixgbe_dcb_tx_hw_config(hw, dcb_config);
                break;
@@ -3458,14 +3444,15 @@ void ixgbe_configure_dcb(struct rte_eth_dev *dev)
 
        /* check support mq_mode for DCB */
        if ((dev_conf->rxmode.mq_mode != ETH_MQ_RX_VMDQ_DCB) &&
-           (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB))
+           (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB) &&
+           (dev_conf->rxmode.mq_mode != ETH_MQ_RX_DCB_RSS))
                return;
 
        if (dev->data->nb_rx_queues != ETH_DCB_NUM_QUEUES)
                return;
 
        /** Configure DCB hardware **/
-       ixgbe_dcb_hw_configure(dev,dcb_cfg);
+       ixgbe_dcb_hw_configure(dev, dcb_cfg);
 
        return;
 }
@@ -3707,21 +3694,25 @@ ixgbe_dev_mq_rx_configure(struct rte_eth_dev *dev)
                 * any DCB/RSS w/o VMDq multi-queue setting
                 */
                switch (dev->data->dev_conf.rxmode.mq_mode) {
-                       case ETH_MQ_RX_RSS:
-                               ixgbe_rss_configure(dev);
-                               break;
+               case ETH_MQ_RX_RSS:
+               case ETH_MQ_RX_DCB_RSS:
+               case ETH_MQ_RX_VMDQ_RSS:
+                       ixgbe_rss_configure(dev);
+                       break;
 
-                       case ETH_MQ_RX_VMDQ_DCB:
-                               ixgbe_vmdq_dcb_configure(dev);
-                               break;
+               case ETH_MQ_RX_VMDQ_DCB:
+                       ixgbe_vmdq_dcb_configure(dev);
+                       break;
 
-                       case ETH_MQ_RX_VMDQ_ONLY:
-                               ixgbe_vmdq_rx_hw_configure(dev);
-                               break;
+               case ETH_MQ_RX_VMDQ_ONLY:
+                       ixgbe_vmdq_rx_hw_configure(dev);
+                       break;
 
-                       case ETH_MQ_RX_NONE:
-                               /* if mq_mode is none, disable rss mode.*/
-                       default: ixgbe_rss_disable(dev);
+               case ETH_MQ_RX_NONE:
+               default:
+                       /* if mq_mode is none, disable rss mode.*/
+                       ixgbe_rss_disable(dev);
+                       break;
                }
        } else {
                /*
@@ -4674,6 +4665,43 @@ ixgbe_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
        return 0;
 }
 
+void
+ixgbe_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+       struct rte_eth_rxq_info *qinfo)
+{
+       struct ixgbe_rx_queue *rxq;
+
+       rxq = dev->data->rx_queues[queue_id];
+
+       qinfo->mp = rxq->mb_pool;
+       qinfo->scattered_rx = dev->data->scattered_rx;
+       qinfo->nb_desc = rxq->nb_rx_desc;
+
+       qinfo->conf.rx_free_thresh = rxq->rx_free_thresh;
+       qinfo->conf.rx_drop_en = rxq->drop_en;
+       qinfo->conf.rx_deferred_start = rxq->rx_deferred_start;
+}
+
+void
+ixgbe_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id,
+       struct rte_eth_txq_info *qinfo)
+{
+       struct ixgbe_tx_queue *txq;
+
+       txq = dev->data->tx_queues[queue_id];
+
+       qinfo->nb_desc = txq->nb_tx_desc;
+
+       qinfo->conf.tx_thresh.pthresh = txq->pthresh;
+       qinfo->conf.tx_thresh.hthresh = txq->hthresh;
+       qinfo->conf.tx_thresh.wthresh = txq->wthresh;
+
+       qinfo->conf.tx_free_thresh = txq->tx_free_thresh;
+       qinfo->conf.tx_rs_thresh = txq->tx_rs_thresh;
+       qinfo->conf.txq_flags = txq->txq_flags;
+       qinfo->conf.tx_deferred_start = txq->tx_deferred_start;
+}
+
 /*
  * [VF] Initializes Receive Unit.
  */