i40e: fix VSI allocation for VMDq
authorHelin Zhang <helin.zhang@intel.com>
Thu, 12 Nov 2015 07:09:03 +0000 (15:09 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Thu, 12 Nov 2015 11:39:08 +0000 (12:39 +0100)
It fixes the issue of trying to allocate more VSIs for VMDq than
hardware remaining. It adds a check of the hardware remaining
before allocating VSIs for VMDq.

Fixes: c80707a0fd9c ("i40e: fix VMDq pool limit")

Signed-off-by: Helin Zhang <helin.zhang@intel.com>
drivers/net/i40e/i40e_ethdev.c

index e4684d3..323b1ff 100644 (file)
@@ -3118,13 +3118,16 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
        pf->vmdq_nb_qps = 0;
        pf->max_nb_vmdq_vsi = 0;
        if (hw->func_caps.vmdq) {
-               if (qp_count < hw->func_caps.num_tx_qp) {
+               if (qp_count < hw->func_caps.num_tx_qp &&
+                       vsi_count < hw->func_caps.num_vsis) {
                        pf->max_nb_vmdq_vsi = (hw->func_caps.num_tx_qp -
                                qp_count) / pf->vmdq_nb_qp_max;
 
                        /* Limit the maximum number of VMDq vsi to the maximum
                         * ethdev can support
                         */
+                       pf->max_nb_vmdq_vsi = RTE_MIN(pf->max_nb_vmdq_vsi,
+                               hw->func_caps.num_vsis - vsi_count);
                        pf->max_nb_vmdq_vsi = RTE_MIN(pf->max_nb_vmdq_vsi,
                                ETH_64_POOLS);
                        if (pf->max_nb_vmdq_vsi) {
@@ -3140,7 +3143,7 @@ i40e_pf_parameter_init(struct rte_eth_dev *dev)
                                            "VMDq");
                        }
                } else {
-                       PMD_DRV_LOG(INFO, "No queue left for VMDq");
+                       PMD_DRV_LOG(INFO, "No queue or VSI left for VMDq");
                }
        }
        qp_count += pf->vmdq_nb_qps * pf->max_nb_vmdq_vsi;