From: Harish Patil Date: Wed, 19 Oct 2016 04:11:42 +0000 (-0700) Subject: net/qede: fix status block index for VF queues X-Git-Tag: spdx-start~5438 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f1e4b6c0aceed27c280c47a5f4aa323d5000df60;p=dpdk.git net/qede: fix status block index for VF queues 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 --- diff --git a/drivers/net/qede/base/ecore_vf.c b/drivers/net/qede/base/ecore_vf.c index 634e2bb98f..be8b1ec4e2 100644 --- a/drivers/net/qede/base/ecore_vf.c +++ b/drivers/net/qede/base/ecore_vf.c @@ -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; diff --git a/drivers/net/qede/base/ecore_vf_api.h b/drivers/net/qede/base/ecore_vf_api.h index c73244f22b..571fd3741a 100644 --- a/drivers/net/qede/base/ecore_vf_api.h +++ b/drivers/net/qede/base/ecore_vf_api.h @@ -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 * diff --git a/drivers/net/qede/qede_ethdev.h b/drivers/net/qede/qede_ethdev.h index c3b87e883b..7b235b1543 100644 --- a/drivers/net/qede/qede_ethdev.h +++ b/drivers/net/qede/qede_ethdev.h @@ -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" diff --git a/drivers/net/qede/qede_main.c b/drivers/net/qede/qede_main.c index 04831163a1..4f1e3b0285 100644 --- a/drivers/net/qede/qede_main.c +++ b/drivers/net/qede/qede_main.c @@ -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); diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c index 8f83497565..bfcb16c580 100644 --- a/drivers/net/qede/qede_rxtx.c +++ b/drivers/net/qede/qede_rxtx.c @@ -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; }