From: Somnath Kotur Date: Thu, 2 Jul 2020 23:27:50 +0000 (-0700) Subject: net/bnxt: get IDs for port representor endpoint X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=f9e91b13575b76b64521885ce49d6c54df9e5b26;p=dpdk.git net/bnxt: get IDs for port representor endpoint Use 'first_vf_id' and the 'vf_id' that is input as part of adding a representor to obtain the PCI function ID(FID) of the VF(VFR endpoint). Use the FID as an input to FUNC_QCFG HWRM cmd to obtain the default vnic ID of the VF. Along with getting the default vNIC ID by supplying the FW FID of the VF-rep endpoint to HWRM_FUNC_QCFG, obtain and store it's function svif. Signed-off-by: Somnath Kotur Signed-off-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde --- diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 443d9fee46..7afbd5cab0 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -784,6 +784,9 @@ struct bnxt { struct bnxt_vf_representor { uint16_t switch_domain_id; uint16_t vf_id; + uint16_t fw_fid; + uint16_t dflt_vnic_id; + uint16_t svif; uint16_t tx_cfa_action; uint16_t rx_cfa_code; /* Private data store of associated PF/Trusted VF */ diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 945bc90185..ed42e58d43 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -3094,6 +3094,33 @@ int bnxt_hwrm_func_qcfg(struct bnxt *bp, uint16_t *mtu) return rc; } +int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id, uint16_t *svif) +{ + struct hwrm_func_qcfg_input req = {0}; + struct hwrm_func_qcfg_output *resp = bp->hwrm_cmd_resp_addr; + uint16_t svif_info; + int rc = 0; + + HWRM_PREP(&req, HWRM_FUNC_QCFG, BNXT_USE_CHIMP_MB); + req.fid = rte_cpu_to_le_16(fid); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT(); + + if (vnic_id) + *vnic_id = rte_le_to_cpu_16(resp->dflt_vnic_id); + + svif_info = rte_le_to_cpu_16(resp->svif_info); + if (svif && (svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_VALID)) + *svif = svif_info & HWRM_FUNC_QCFG_OUTPUT_SVIF_INFO_SVIF_MASK; + + HWRM_UNLOCK(); + + return rc; +} + int bnxt_hwrm_port_mac_qcfg(struct bnxt *bp) { struct hwrm_port_mac_qcfg_input req = {0}; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index 58b414d4ff..8d19998df1 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -270,4 +270,8 @@ int bnxt_hwrm_cfa_counter_qstats(struct bnxt *bp, enum bnxt_flow_dir dir, uint16_t cntr, uint16_t num_entries); +int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id); +int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, + uint16_t *vnic_id, uint16_t *svif); #endif diff --git a/drivers/net/bnxt/bnxt_reps.c b/drivers/net/bnxt/bnxt_reps.c index b318c5a061..bdbce6e8bb 100644 --- a/drivers/net/bnxt/bnxt_reps.c +++ b/drivers/net/bnxt/bnxt_reps.c @@ -150,6 +150,7 @@ int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params) (struct bnxt_vf_representor *)params; struct rte_eth_link *link; struct bnxt *parent_bp; + int rc = 0; vf_rep_bp->vf_id = rep_params->vf_id; vf_rep_bp->switch_domain_id = rep_params->switch_domain_id; @@ -179,6 +180,17 @@ int bnxt_vf_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_link.link_status = link->link_status; eth_dev->data->dev_link.link_autoneg = link->link_autoneg; + vf_rep_bp->fw_fid = rep_params->vf_id + parent_bp->first_vf_id; + PMD_DRV_LOG(INFO, "vf_rep->fw_fid = %d\n", vf_rep_bp->fw_fid); + rc = bnxt_hwrm_get_dflt_vnic_svif(parent_bp, vf_rep_bp->fw_fid, + &vf_rep_bp->dflt_vnic_id, + &vf_rep_bp->svif); + if (rc) + PMD_DRV_LOG(ERR, "Failed to get default vnic id of VF\n"); + else + PMD_DRV_LOG(INFO, "vf_rep->dflt_vnic_id = %d\n", + vf_rep_bp->dflt_vnic_id); + PMD_DRV_LOG(INFO, "calling bnxt_print_link_info\n"); bnxt_print_link_info(eth_dev);