From 4e3f887bec4b9f1b1a5138b30457e33a520a93e6 Mon Sep 17 00:00:00 2001 From: Venkat Duvvuru Date: Thu, 2 Jul 2020 16:27:54 -0700 Subject: [PATCH] net/bnxt: support HWRM port PHY qcaps Issue HWRM_PORT_PHY_QCAPS to the firmware to get the physical port count of the device. Signed-off-by: Venkat Duvvuru Reviewed-by: Somnath Kotur Reviewed-by: Kalesh AP Reviewed-by: Kishore Padmanabha Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt.h | 1 + drivers/net/bnxt/bnxt_ethdev.c | 2 ++ drivers/net/bnxt/bnxt_hwrm.c | 22 ++++++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 1 + 4 files changed, 26 insertions(+) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 0bdf8f5ba8..65862abdc0 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -747,6 +747,7 @@ struct bnxt { uint32_t outer_tpid_bd; struct bnxt_pf_info *pf; struct bnxt_parent_info *parent; + uint8_t port_cnt; uint8_t vxlan_port_cnt; uint8_t geneve_port_cnt; uint16_t vxlan_port; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index 7edc9a70b8..3c76f21f8c 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -5286,6 +5286,8 @@ static int bnxt_init_fw(struct bnxt *bp) bnxt_hwrm_parent_pf_qcfg(bp); + bnxt_hwrm_port_phy_qcaps(bp); + rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp); if (rc) return rc; diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 347e1c71e0..e6a28d07ce 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -1330,6 +1330,28 @@ static int bnxt_hwrm_port_phy_qcfg(struct bnxt *bp, return rc; } +int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp) +{ + int rc = 0; + struct hwrm_port_phy_qcaps_input req = {0}; + struct hwrm_port_phy_qcaps_output *resp = bp->hwrm_cmd_resp_addr; + + if (BNXT_VF(bp) && !BNXT_VF_IS_TRUSTED(bp)) + return 0; + + HWRM_PREP(&req, HWRM_PORT_PHY_QCAPS, BNXT_USE_CHIMP_MB); + + rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB); + + HWRM_CHECK_RESULT(); + + bp->port_cnt = resp->port_cnt; + + HWRM_UNLOCK(); + + return 0; +} + static bool bnxt_find_lossy_profile(struct bnxt *bp) { int i = 0; diff --git a/drivers/net/bnxt/bnxt_hwrm.h b/drivers/net/bnxt/bnxt_hwrm.h index ef89975009..87cd40779c 100644 --- a/drivers/net/bnxt/bnxt_hwrm.h +++ b/drivers/net/bnxt/bnxt_hwrm.h @@ -275,4 +275,5 @@ int bnxt_hwrm_get_dflt_vnic_id(struct bnxt *bp, uint16_t fid, int bnxt_hwrm_get_dflt_vnic_svif(struct bnxt *bp, uint16_t fid, uint16_t *vnic_id, uint16_t *svif); int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp); +int bnxt_hwrm_port_phy_qcaps(struct bnxt *bp); #endif -- 2.20.1