net/qede: fix status block index for VF queues
authorHarish Patil <harish.patil@qlogic.com>
Wed, 19 Oct 2016 04:11:42 +0000 (21:11 -0700)
committerBruce Richardson <bruce.richardson@intel.com>
Wed, 26 Oct 2016 17:42:22 +0000 (19:42 +0200)
o Fix the fastpath status block index such that each queue pair shares
the same index value.

o Add ecore_vf_get_num_sbs() API that returns the number of status
blocks assigned by PF. Use that to decide how many VF queues can be
advertised. Additionally, restrict maximum number of VF queues to 16
for 100G VF case.

Fixes: 2ea6f76aff40 ("qede: add core driver")

Signed-off-by: Harish Patil <harish.patil@qlogic.com>
drivers/net/qede/base/ecore_vf.c
drivers/net/qede/base/ecore_vf_api.h
drivers/net/qede/qede_ethdev.h
drivers/net/qede/qede_main.c
drivers/net/qede/qede_rxtx.c

index 634e2bb..be8b1ec 100644 (file)
@@ -336,7 +336,7 @@ static enum _ecore_status_t ecore_vf_pf_acquire(struct ecore_hwfn *p_hwfn)
        /* Learn of the possibility of CMT */
        if (IS_LEAD_HWFN(p_hwfn)) {
                if (resp->pfdev_info.capabilities & PFVF_ACQUIRE_CAP_100G) {
-                       DP_NOTICE(p_hwfn, false, "100g VF\n");
+                       DP_INFO(p_hwfn, "100g VF\n");
                        p_hwfn->p_dev->num_hwfns = 2;
                }
        }
@@ -1382,6 +1382,15 @@ void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
        *num_mac = p_vf->acquire_resp.resc.num_mac_filters;
 }
 
+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+                         u32 *num_sbs)
+{
+       struct ecore_vf_iov *p_vf;
+
+       p_vf = p_hwfn->vf_iov_info;
+       *num_sbs = (u32)p_vf->acquire_resp.resc.num_sbs;
+}
+
 bool ecore_vf_check_mac(struct ecore_hwfn *p_hwfn, u8 *mac)
 {
        struct ecore_bulletin_content *bulletin;
index c73244f..571fd37 100644 (file)
@@ -87,6 +87,9 @@ void ecore_vf_get_num_vlan_filters(struct ecore_hwfn *p_hwfn,
 void ecore_vf_get_num_mac_filters(struct ecore_hwfn *p_hwfn,
                                  u32 *num_mac_filters);
 
+void ecore_vf_get_num_sbs(struct ecore_hwfn *p_hwfn,
+                         u32 *num_sbs);
+
 /**
  * @brief Check if VF can set a MAC address
  *
index c3b87e8..7b235b1 100644 (file)
@@ -29,6 +29,7 @@
 #include "base/ecore_hsi_eth.h"
 #include "base/ecore_dev_api.h"
 #include "base/ecore_iov_api.h"
+#include "base/ecore_cxt.h"
 
 #include "qede_logs.h"
 #include "qede_if.h"
index 0483116..4f1e3b0 100644 (file)
@@ -384,6 +384,7 @@ int
 qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
 {
        struct qede_dev *qdev = (struct qede_dev *)edev;
+       uint8_t queues = 0;
        int i;
 
        memset(info, 0, sizeof(*info));
@@ -407,7 +408,17 @@ qed_fill_eth_dev_info(struct ecore_dev *edev, struct qed_dev_eth_info *info)
                rte_memcpy(&info->port_mac, &edev->hwfns[0].hw_info.hw_mac_addr,
                           ETHER_ADDR_LEN);
        } else {
-               ecore_vf_get_num_rxqs(&edev->hwfns[0], &info->num_queues);
+               ecore_vf_get_num_rxqs(ECORE_LEADING_HWFN(edev),
+                                     &info->num_queues);
+               if (edev->num_hwfns > 1) {
+                       ecore_vf_get_num_rxqs(&edev->hwfns[1], &queues);
+                       info->num_queues += queues;
+                       /* Restrict 100G VF to advertise 16 queues till the
+                        * required support is available to go beyond 16.
+                        */
+                       info->num_queues = RTE_MIN(info->num_queues,
+                                                  ECORE_MAX_VF_CHAINS_PER_PF);
+               }
 
                ecore_vf_get_num_vlan_filters(&edev->hwfns[0],
                                              (u8 *)&info->num_vlan_filters);
index 8f83497..bfcb16c 100644 (file)
@@ -435,9 +435,22 @@ qede_alloc_mem_sb(struct qede_dev *qdev, struct ecore_sb_info *sb_info,
 
 int qede_alloc_fp_resc(struct qede_dev *qdev)
 {
+       struct ecore_dev *edev = &qdev->edev;
        struct qede_fastpath *fp;
+       uint32_t num_sbs;
        int rc, i;
 
+       if (IS_VF(edev))
+               ecore_vf_get_num_sbs(ECORE_LEADING_HWFN(edev), &num_sbs);
+       else
+               num_sbs = (ecore_cxt_get_proto_cid_count
+                         (ECORE_LEADING_HWFN(edev), PROTOCOLID_ETH, NULL)) / 2;
+
+       if (num_sbs == 0) {
+               DP_ERR(edev, "No status blocks available\n");
+               return -EINVAL;
+       }
+
        if (qdev->fp_array)
                qede_free_fp_arrays(qdev);
 
@@ -449,7 +462,7 @@ int qede_alloc_fp_resc(struct qede_dev *qdev)
 
        for (i = 0; i < QEDE_QUEUE_CNT(qdev); i++) {
                fp = &qdev->fp_array[i];
-               if (qede_alloc_mem_sb(qdev, fp->sb_info, i)) {
+               if (qede_alloc_mem_sb(qdev, fp->sb_info, i % num_sbs)) {
                        qede_free_fp_arrays(qdev);
                        return -ENOMEM;
                }