net/bntx: use new API to get iova address XXX
[dpdk.git] / drivers / net / bnxt / bnxt_rxq.c
index 8459fcc..c4da474 100644 (file)
@@ -60,13 +60,14 @@ void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq)
 int bnxt_mq_rx_configure(struct bnxt *bp)
 {
        struct rte_eth_conf *dev_conf = &bp->eth_dev->data->dev_conf;
+       const struct rte_eth_vmdq_rx_conf *conf =
+                   &dev_conf->rx_adv_conf.vmdq_rx_conf;
        unsigned int i, j, nb_q_per_grp = 1, ring_idx = 0;
        int start_grp_id, end_grp_id = 1, rc = 0;
        struct bnxt_vnic_info *vnic;
        struct bnxt_filter_info *filter;
        enum rte_eth_nb_pools pools = bp->rx_cp_nr_rings, max_pools = 0;
        struct bnxt_rx_queue *rxq;
-       bool rss_dflt_cr = false;
 
        bp->nr_vnics = 0;
 
@@ -102,9 +103,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
        /* Multi-queue mode */
        if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_VMDQ_DCB_RSS) {
                /* VMDq ONLY, VMDq+RSS, VMDq+DCB, VMDq+DCB+RSS */
-               const struct rte_eth_vmdq_rx_conf *conf =
-                   &dev_conf->rx_adv_conf.vmdq_rx_conf;
-
 
                switch (dev_conf->rxmode.mq_mode) {
                case ETH_MQ_RX_VMDQ_RSS:
@@ -120,7 +118,7 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
                                pools = max_pools;
                        break;
                case ETH_MQ_RX_RSS:
-                       pools = 1;
+                       pools = bp->rx_cp_nr_rings;
                        break;
                default:
                        RTE_LOG(ERR, PMD, "Unsupported mq_mod %d\n",
@@ -129,13 +127,6 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
                        goto err_out;
                }
        }
-       /*
-        * If MQ RX w/o RSS no need for per VNIC filter.
-        */
-       if ((dev_conf->rxmode.mq_mode & ETH_MQ_RX_VMDQ_DCB) ||
-           (bp->rx_cp_nr_rings &&
-            !(dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS)))
-               rss_dflt_cr = true;
 
        nb_q_per_grp = bp->rx_cp_nr_rings / pools;
        start_grp_id = 0;
@@ -152,18 +143,25 @@ int bnxt_mq_rx_configure(struct bnxt *bp)
                STAILQ_INSERT_TAIL(&bp->ff_pool[i], vnic, next);
                bp->nr_vnics++;
 
-               for (j = 0, ring_idx = 0; j < nb_q_per_grp; j++, ring_idx++) {
+               for (j = 0; j < nb_q_per_grp; j++, ring_idx++) {
                        rxq = bp->eth_dev->data->rx_queues[ring_idx];
                        rxq->vnic = vnic;
                }
-               if (i == 0)
+               if (i == 0) {
+                       if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_VMDQ_DCB) {
+                               bp->eth_dev->data->promiscuous = 1;
+                               vnic->flags |= BNXT_VNIC_INFO_PROMISC;
+                       }
                        vnic->func_default = true;
+               }
                vnic->ff_pool_idx = i;
                vnic->start_grp_id = start_grp_id;
                vnic->end_grp_id = end_grp_id;
 
-               if (rss_dflt_cr && i) {
-                       vnic->rss_dflt_cr = true;
+               if (i) {
+                       if (dev_conf->rxmode.mq_mode & ETH_MQ_RX_VMDQ_DCB ||
+                           !(dev_conf->rxmode.mq_mode & ETH_MQ_RX_RSS))
+                               vnic->rss_dflt_cr = true;
                        goto skip_filter_allocation;
                }
                filter = bnxt_alloc_filter(bp);
@@ -188,6 +186,11 @@ out:
                struct rte_eth_rss_conf *rss = &dev_conf->rx_adv_conf.rss_conf;
                uint16_t hash_type = 0;
 
+               if (bp->flags & BNXT_FLAG_UPDATE_HASH) {
+                       rss = &bp->rss_conf;
+                       bp->flags &= ~BNXT_FLAG_UPDATE_HASH;
+               }
+
                if (rss->rss_hf & ETH_RSS_IPV4)
                        hash_type |= HWRM_VNIC_RSS_CFG_INPUT_HASH_TYPE_IPV4;
                if (rss->rss_hf & ETH_RSS_NONFRAG_IPV4_TCP)
@@ -203,7 +206,7 @@ out:
 
                for (i = 0; i < bp->nr_vnics; i++) {
                        STAILQ_FOREACH(vnic, &bp->ff_pool[i], next) {
-                       vnic->hash_type |= hash_type;
+                       vnic->hash_type = hash_type;
 
                        /*
                         * Use the supplied key if the key length is
@@ -357,3 +360,41 @@ int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
 out:
        return rc;
 }
+
+int
+bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
+{
+       struct bnxt_rx_queue *rxq;
+       struct bnxt_cp_ring_info *cpr;
+       int rc = 0;
+
+       if (eth_dev->data->rx_queues) {
+               rxq = eth_dev->data->rx_queues[queue_id];
+               if (!rxq) {
+                       rc = -EINVAL;
+                       return rc;
+               }
+               cpr = rxq->cp_ring;
+               B_CP_DB_ARM(cpr);
+       }
+       return rc;
+}
+
+int
+bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev, uint16_t queue_id)
+{
+       struct bnxt_rx_queue *rxq;
+       struct bnxt_cp_ring_info *cpr;
+       int rc = 0;
+
+       if (eth_dev->data->rx_queues) {
+               rxq = eth_dev->data->rx_queues[queue_id];
+               if (!rxq) {
+                       rc = -EINVAL;
+                       return rc;
+               }
+               cpr = rxq->cp_ring;
+               B_CP_DB_DISARM(cpr);
+       }
+       return rc;
+}