From: Rasesh Mody Date: Wed, 29 Mar 2017 20:36:16 +0000 (-0700) Subject: net/qede/base: read card personality via MFW commands X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=bdf4267ddee2366463fa541d6e7e5c897b969019;p=dpdk.git net/qede/base: read card personality via MFW commands Add support to read NIC personality via management FW for non-L2 protocols. Signed-off-by: Rasesh Mody --- diff --git a/drivers/net/qede/base/ecore.h b/drivers/net/qede/base/ecore.h index 25c96f83ef..842a3b5ad9 100644 --- a/drivers/net/qede/base/ecore.h +++ b/drivers/net/qede/base/ecore.h @@ -243,7 +243,8 @@ enum ecore_pci_personality { ECORE_PCI_FCOE, ECORE_PCI_ISCSI, ECORE_PCI_ETH_ROCE, - ECORE_PCI_IWARP, + ECORE_PCI_ETH_IWARP, + ECORE_PCI_ETH_RDMA, ECORE_PCI_DEFAULT /* default in shmem */ }; @@ -328,6 +329,19 @@ enum ecore_hw_err_type { struct ecore_hw_info { /* PCI personality */ enum ecore_pci_personality personality; +#define ECORE_IS_RDMA_PERSONALITY(dev) \ + ((dev)->hw_info.personality == ECORE_PCI_ETH_ROCE || \ + (dev)->hw_info.personality == ECORE_PCI_ETH_IWARP || \ + (dev)->hw_info.personality == ECORE_PCI_ETH_RDMA) +#define ECORE_IS_ROCE_PERSONALITY(dev) \ + ((dev)->hw_info.personality == ECORE_PCI_ETH_ROCE || \ + (dev)->hw_info.personality == ECORE_PCI_ETH_RDMA) +#define ECORE_IS_IWARP_PERSONALITY(dev) \ + ((dev)->hw_info.personality == ECORE_PCI_ETH_IWARP || \ + (dev)->hw_info.personality == ECORE_PCI_ETH_RDMA) +#define ECORE_IS_L2_PERSONALITY(dev) \ + ((dev)->hw_info.personality == ECORE_PCI_ETH || \ + ECORE_IS_RDMA_PERSONALITY(dev)) /* Resource Allocation scheme results */ u32 resc_start[ECORE_MAX_RESC]; diff --git a/drivers/net/qede/base/ecore_dev.c b/drivers/net/qede/base/ecore_dev.c index 7494f93553..1b033b7897 100644 --- a/drivers/net/qede/base/ecore_dev.c +++ b/drivers/net/qede/base/ecore_dev.c @@ -219,9 +219,7 @@ static enum _ecore_status_t ecore_init_qm_info(struct ecore_hwfn *p_hwfn, * don't have a good recycle flow. Non ethernet PFs require only a * single physical queue. */ - if (p_hwfn->hw_info.personality == ECORE_PCI_ETH_ROCE || - p_hwfn->hw_info.personality == ECORE_PCI_IWARP || - p_hwfn->hw_info.personality == ECORE_PCI_ETH) + if (ECORE_IS_L2_PERSONALITY(p_hwfn)) protocol_pqs = p_hwfn->hw_info.num_hw_tc; else protocol_pqs = 1; @@ -229,7 +227,7 @@ static enum _ecore_status_t ecore_init_qm_info(struct ecore_hwfn *p_hwfn, num_pqs = protocol_pqs + num_vfs + 1; /* The '1' is for pure-LB */ num_vports = (u8)RESC_NUM(p_hwfn, ECORE_VPORT); - if (p_hwfn->hw_info.personality == ECORE_PCI_ETH_ROCE) { + if (ECORE_IS_ROCE_PERSONALITY(p_hwfn)) { num_pqs++; /* for RoCE queue */ init_rdma_offload_pq = true; if (p_hwfn->pf_params.rdma_pf_params.enable_dcqcn) { @@ -259,7 +257,7 @@ static enum _ecore_status_t ecore_init_qm_info(struct ecore_hwfn *p_hwfn, qm_info->num_pf_rls = (u8)num_pf_rls; } - if (p_hwfn->hw_info.personality == ECORE_PCI_IWARP) { + if (ECORE_IS_IWARP_PERSONALITY(p_hwfn)) { num_pqs += 3; /* for iwarp queue / pure-ack / ooo */ init_rdma_offload_pq = true; init_pure_ack_pq = true; @@ -335,9 +333,7 @@ static enum _ecore_status_t ecore_init_qm_info(struct ecore_hwfn *p_hwfn, struct init_qm_pq_params *params = &qm_info->qm_pq_params[curr_queue++]; - if (p_hwfn->hw_info.personality == ECORE_PCI_ETH_ROCE || - p_hwfn->hw_info.personality == ECORE_PCI_IWARP || - p_hwfn->hw_info.personality == ECORE_PCI_ETH) { + if (ECORE_IS_L2_PERSONALITY(p_hwfn)) { params->vport_id = vport_id; params->tc_id = i; /* Note: this assumes that if we had a configuration @@ -612,8 +608,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev) /* EQ */ n_eqes = ecore_chain_get_capacity(&p_hwfn->p_spq->chain); - if ((p_hwfn->hw_info.personality == ECORE_PCI_ETH_ROCE) || - (p_hwfn->hw_info.personality == ECORE_PCI_IWARP)) { + if (ECORE_IS_RDMA_PERSONALITY(p_hwfn)) { /* Calculate the EQ size * --------------------- * Each ICID may generate up to one event at a time i.e. @@ -636,7 +631,7 @@ enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev) * smaller than RoCE's so we avoid exact * calculation. */ - if (p_hwfn->hw_info.personality == ECORE_PCI_ETH_ROCE) { + if (ECORE_IS_ROCE_PERSONALITY(p_hwfn)) { num_cons = ecore_cxt_get_proto_cid_count( p_hwfn, diff --git a/drivers/net/qede/base/ecore_mcp.c b/drivers/net/qede/base/ecore_mcp.c index 0338576328..9f897b5185 100644 --- a/drivers/net/qede/base/ecore_mcp.c +++ b/drivers/net/qede/base/ecore_mcp.c @@ -1373,16 +1373,47 @@ enum _ecore_status_t ecore_mcp_get_media_type(struct ecore_dev *p_dev, return ECORE_SUCCESS; } +/* @DPDK */ +/* Old MFW has a global configuration for all PFs regarding RDMA support */ +static void +ecore_mcp_get_shmem_proto_legacy(struct ecore_hwfn *p_hwfn, + enum ecore_pci_personality *p_proto) +{ + *p_proto = ECORE_PCI_ETH; + + DP_VERBOSE(p_hwfn, ECORE_MSG_IFUP, + "According to Legacy capabilities, L2 personality is %08x\n", + (u32)*p_proto); +} + +/* @DPDK */ +static enum _ecore_status_t +ecore_mcp_get_shmem_proto_mfw(struct ecore_hwfn *p_hwfn, + struct ecore_ptt *p_ptt, + enum ecore_pci_personality *p_proto) +{ + u32 resp = 0, param = 0; + enum _ecore_status_t rc; + + DP_VERBOSE(p_hwfn, ECORE_MSG_IFUP, + "According to capabilities, L2 personality is %08x [resp %08x param %08x]\n", + (u32)*p_proto, resp, param); + return ECORE_SUCCESS; +} + static enum _ecore_status_t ecore_mcp_get_shmem_proto(struct ecore_hwfn *p_hwfn, struct public_func *p_info, + struct ecore_ptt *p_ptt, enum ecore_pci_personality *p_proto) { enum _ecore_status_t rc = ECORE_SUCCESS; switch (p_info->config & FUNC_MF_CFG_PROTOCOL_MASK) { case FUNC_MF_CFG_PROTOCOL_ETHERNET: - *p_proto = ECORE_PCI_ETH; + if (ecore_mcp_get_shmem_proto_mfw(p_hwfn, p_ptt, p_proto) != + ECORE_SUCCESS) + ecore_mcp_get_shmem_proto_legacy(p_hwfn, p_proto); break; default: rc = ECORE_INVAL; @@ -1403,7 +1434,8 @@ enum _ecore_status_t ecore_mcp_fill_shmem_func_info(struct ecore_hwfn *p_hwfn, info->pause_on_host = (shmem_info.config & FUNC_MF_CFG_PAUSE_ON_HOST_RING) ? 1 : 0; - if (ecore_mcp_get_shmem_proto(p_hwfn, &shmem_info, &info->protocol)) { + if (ecore_mcp_get_shmem_proto(p_hwfn, &shmem_info, p_ptt, + &info->protocol)) { DP_ERR(p_hwfn, "Unknown personality %08x\n", (u32)(shmem_info.config & FUNC_MF_CFG_PROTOCOL_MASK)); return ECORE_INVAL; @@ -1559,8 +1591,9 @@ int ecore_mcp_get_personality_cnt(struct ecore_hwfn *p_hwfn, if (shmem_info.config & FUNC_MF_CFG_FUNC_HIDE) continue; - if (ecore_mcp_get_shmem_proto(p_hwfn, &shmem_info, - &protocol) != ECORE_SUCCESS) + if (ecore_mcp_get_shmem_proto(p_hwfn, &shmem_info, p_ptt, + &protocol) != + ECORE_SUCCESS) continue; if ((1 << ((u32)protocol)) & personalities) diff --git a/drivers/net/qede/base/ecore_sriov.c b/drivers/net/qede/base/ecore_sriov.c index 6e86966f35..578899c66d 100644 --- a/drivers/net/qede/base/ecore_sriov.c +++ b/drivers/net/qede/base/ecore_sriov.c @@ -86,6 +86,7 @@ static enum _ecore_status_t ecore_sp_vf_start(struct ecore_hwfn *p_hwfn, p_ramrod->personality = PERSONALITY_ETH; break; case ECORE_PCI_ETH_ROCE: + case ECORE_PCI_ETH_IWARP: p_ramrod->personality = PERSONALITY_RDMA_AND_ETH; break; default: