Commit c851a9dc authored by Kalderon, Michal's avatar Kalderon, Michal Committed by David S. Miller

qed: Introduce iWARP personality

iWARP personality introduced the need for differentiating in several
places in the code whether we are RoCE, iWARP or either. This
leads to introducing new macros for querying the personality.
Signed-off-by: default avatarMichal Kalderon <Michal.Kalderon@cavium.com>
Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarAriel Elior <Ariel.Elior@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a5192c52
...@@ -210,14 +210,16 @@ struct qed_tunn_update_params { ...@@ -210,14 +210,16 @@ struct qed_tunn_update_params {
/* The PCI personality is not quite synonymous to protocol ID: /* The PCI personality is not quite synonymous to protocol ID:
* 1. All personalities need CORE connections * 1. All personalities need CORE connections
* 2. The Ethernet personality may support also the RoCE protocol * 2. The Ethernet personality may support also the RoCE/iWARP protocol
*/ */
enum qed_pci_personality { enum qed_pci_personality {
QED_PCI_ETH, QED_PCI_ETH,
QED_PCI_FCOE, QED_PCI_FCOE,
QED_PCI_ISCSI, QED_PCI_ISCSI,
QED_PCI_ETH_ROCE, QED_PCI_ETH_ROCE,
QED_PCI_DEFAULT /* default in shmem */ QED_PCI_ETH_IWARP,
QED_PCI_ETH_RDMA,
QED_PCI_DEFAULT, /* default in shmem */
}; };
/* All VFs are symmetric, all counters are PF + all VFs */ /* All VFs are symmetric, all counters are PF + all VFs */
...@@ -277,6 +279,7 @@ enum qed_dev_cap { ...@@ -277,6 +279,7 @@ enum qed_dev_cap {
QED_DEV_CAP_FCOE, QED_DEV_CAP_FCOE,
QED_DEV_CAP_ISCSI, QED_DEV_CAP_ISCSI,
QED_DEV_CAP_ROCE, QED_DEV_CAP_ROCE,
QED_DEV_CAP_IWARP,
}; };
enum qed_wol_support { enum qed_wol_support {
...@@ -286,7 +289,24 @@ enum qed_wol_support { ...@@ -286,7 +289,24 @@ enum qed_wol_support {
struct qed_hw_info { struct qed_hw_info {
/* PCI personality */ /* PCI personality */
enum qed_pci_personality personality; enum qed_pci_personality personality;
#define QED_IS_RDMA_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_ETH_ROCE || \
(dev)->hw_info.personality == QED_PCI_ETH_IWARP || \
(dev)->hw_info.personality == QED_PCI_ETH_RDMA)
#define QED_IS_ROCE_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_ETH_ROCE || \
(dev)->hw_info.personality == QED_PCI_ETH_RDMA)
#define QED_IS_IWARP_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_ETH_IWARP || \
(dev)->hw_info.personality == QED_PCI_ETH_RDMA)
#define QED_IS_L2_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_ETH || \
QED_IS_RDMA_PERSONALITY(dev))
#define QED_IS_FCOE_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_FCOE)
#define QED_IS_ISCSI_PERSONALITY(dev) \
((dev)->hw_info.personality == QED_PCI_ISCSI)
/* Resource Allocation scheme results */ /* Resource Allocation scheme results */
u32 resc_start[QED_MAX_RESC]; u32 resc_start[QED_MAX_RESC];
......
...@@ -853,7 +853,7 @@ u32 qed_cxt_cfg_ilt_compute_excess(struct qed_hwfn *p_hwfn, u32 used_lines) ...@@ -853,7 +853,7 @@ u32 qed_cxt_cfg_ilt_compute_excess(struct qed_hwfn *p_hwfn, u32 used_lines)
if (!excess_lines) if (!excess_lines)
return 0; return 0;
if (p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE) if (!QED_IS_RDMA_PERSONALITY(p_hwfn))
return 0; return 0;
p_mngr = p_hwfn->p_cxt_mngr; p_mngr = p_hwfn->p_cxt_mngr;
...@@ -1033,7 +1033,7 @@ static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn, ...@@ -1033,7 +1033,7 @@ static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,
u32 lines, line, sz_left, lines_to_skip = 0; u32 lines, line, sz_left, lines_to_skip = 0;
/* Special handling for RoCE that supports dynamic allocation */ /* Special handling for RoCE that supports dynamic allocation */
if ((p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) && if (QED_IS_RDMA_PERSONALITY(p_hwfn) &&
((ilt_client == ILT_CLI_CDUT) || ilt_client == ILT_CLI_TSDM)) ((ilt_client == ILT_CLI_CDUT) || ilt_client == ILT_CLI_TSDM))
return 0; return 0;
...@@ -1833,7 +1833,7 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn) ...@@ -1833,7 +1833,7 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn)
tm_offset += tm_iids.pf_tids[i]; tm_offset += tm_iids.pf_tids[i];
} }
if (p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) if (QED_IS_RDMA_PERSONALITY(p_hwfn))
active_seg_mask = 0; active_seg_mask = 0;
STORE_RT_REG(p_hwfn, TM_REG_PF_ENABLE_TASK_RT_OFFSET, active_seg_mask); STORE_RT_REG(p_hwfn, TM_REG_PF_ENABLE_TASK_RT_OFFSET, active_seg_mask);
...@@ -2344,7 +2344,7 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn, ...@@ -2344,7 +2344,7 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
last_cid_allocated - 1); last_cid_allocated - 1);
if (!p_hwfn->b_rdma_enabled_in_prs) { if (!p_hwfn->b_rdma_enabled_in_prs) {
/* Enable RoCE search */ /* Enable RDMA search */
qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 1); qed_wr(p_hwfn, p_ptt, p_hwfn->rdma_prs_search_reg, 1);
p_hwfn->b_rdma_enabled_in_prs = true; p_hwfn->b_rdma_enabled_in_prs = true;
} }
......
...@@ -936,7 +936,7 @@ int qed_resc_alloc(struct qed_dev *cdev) ...@@ -936,7 +936,7 @@ int qed_resc_alloc(struct qed_dev *cdev)
/* EQ */ /* EQ */
n_eqes = qed_chain_get_capacity(&p_hwfn->p_spq->chain); n_eqes = qed_chain_get_capacity(&p_hwfn->p_spq->chain);
if (p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) { if (QED_IS_RDMA_PERSONALITY(p_hwfn)) {
num_cons = qed_cxt_get_proto_cid_count(p_hwfn, num_cons = qed_cxt_get_proto_cid_count(p_hwfn,
PROTOCOLID_ROCE, PROTOCOLID_ROCE,
NULL) * 2; NULL) * 2;
...@@ -2057,7 +2057,7 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn) ...@@ -2057,7 +2057,7 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
qed_int_get_num_sbs(p_hwfn, &sb_cnt); qed_int_get_num_sbs(p_hwfn, &sb_cnt);
if (IS_ENABLED(CONFIG_QED_RDMA) && if (IS_ENABLED(CONFIG_QED_RDMA) &&
p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE) { QED_IS_RDMA_PERSONALITY(p_hwfn)) {
/* Roce CNQ each requires: 1 status block + 1 CNQ. We divide /* Roce CNQ each requires: 1 status block + 1 CNQ. We divide
* the status blocks equally between L2 / RoCE but with * the status blocks equally between L2 / RoCE but with
* consideration as to how many l2 queues / cnqs we have. * consideration as to how many l2 queues / cnqs we have.
...@@ -2068,9 +2068,7 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn) ...@@ -2068,9 +2068,7 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
non_l2_sbs = feat_num[QED_RDMA_CNQ]; non_l2_sbs = feat_num[QED_RDMA_CNQ];
} }
if (QED_IS_L2_PERSONALITY(p_hwfn)) {
if (p_hwfn->hw_info.personality == QED_PCI_ETH_ROCE ||
p_hwfn->hw_info.personality == QED_PCI_ETH) {
/* Start by allocating VF queues, then PF's */ /* Start by allocating VF queues, then PF's */
feat_num[QED_VF_L2_QUE] = min_t(u32, feat_num[QED_VF_L2_QUE] = min_t(u32,
RESC_NUM(p_hwfn, QED_L2_QUEUE), RESC_NUM(p_hwfn, QED_L2_QUEUE),
...@@ -2083,12 +2081,12 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn) ...@@ -2083,12 +2081,12 @@ static void qed_hw_set_feat(struct qed_hwfn *p_hwfn)
QED_VF_L2_QUE)); QED_VF_L2_QUE));
} }
if (p_hwfn->hw_info.personality == QED_PCI_FCOE) if (QED_IS_FCOE_PERSONALITY(p_hwfn))
feat_num[QED_FCOE_CQ] = min_t(u32, sb_cnt.cnt, feat_num[QED_FCOE_CQ] = min_t(u32, sb_cnt.cnt,
RESC_NUM(p_hwfn, RESC_NUM(p_hwfn,
QED_CMDQS_CQS)); QED_CMDQS_CQS));
if (p_hwfn->hw_info.personality == QED_PCI_ISCSI) if (QED_IS_ISCSI_PERSONALITY(p_hwfn))
feat_num[QED_ISCSI_CQ] = min_t(u32, sb_cnt.cnt, feat_num[QED_ISCSI_CQ] = min_t(u32, sb_cnt.cnt,
RESC_NUM(p_hwfn, RESC_NUM(p_hwfn,
QED_CMDQS_CQS)); QED_CMDQS_CQS));
......
...@@ -79,8 +79,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn) ...@@ -79,8 +79,7 @@ int qed_l2_alloc(struct qed_hwfn *p_hwfn)
unsigned long **pp_qids; unsigned long **pp_qids;
u32 i; u32 i;
if (p_hwfn->hw_info.personality != QED_PCI_ETH && if (!QED_IS_L2_PERSONALITY(p_hwfn))
p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE)
return 0; return 0;
p_l2_info = kzalloc(sizeof(*p_l2_info), GFP_KERNEL); p_l2_info = kzalloc(sizeof(*p_l2_info), GFP_KERNEL);
......
...@@ -1421,7 +1421,7 @@ int qed_ll2_establish_connection(void *cxt, u8 connection_handle) ...@@ -1421,7 +1421,7 @@ int qed_ll2_establish_connection(void *cxt, u8 connection_handle)
if (rc) if (rc)
goto out; goto out;
if (p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE) if (!QED_IS_RDMA_PERSONALITY(p_hwfn))
qed_wr(p_hwfn, p_ptt, PRS_REG_USE_LIGHT_L2, 1); qed_wr(p_hwfn, p_ptt, PRS_REG_USE_LIGHT_L2, 1);
qed_ll2_establish_connection_ooo(p_hwfn, p_ll2_conn); qed_ll2_establish_connection_ooo(p_hwfn, p_ll2_conn);
......
...@@ -237,6 +237,8 @@ static int qed_init_pci(struct qed_dev *cdev, struct pci_dev *pdev) ...@@ -237,6 +237,8 @@ static int qed_init_pci(struct qed_dev *cdev, struct pci_dev *pdev)
int qed_fill_dev_info(struct qed_dev *cdev, int qed_fill_dev_info(struct qed_dev *cdev,
struct qed_dev_info *dev_info) struct qed_dev_info *dev_info)
{ {
struct qed_hwfn *p_hwfn = QED_LEADING_HWFN(cdev);
struct qed_hw_info *hw_info = &p_hwfn->hw_info;
struct qed_tunnel_info *tun = &cdev->tunnel; struct qed_tunnel_info *tun = &cdev->tunnel;
struct qed_ptt *ptt; struct qed_ptt *ptt;
...@@ -260,11 +262,10 @@ int qed_fill_dev_info(struct qed_dev *cdev, ...@@ -260,11 +262,10 @@ int qed_fill_dev_info(struct qed_dev *cdev,
dev_info->pci_mem_start = cdev->pci_params.mem_start; dev_info->pci_mem_start = cdev->pci_params.mem_start;
dev_info->pci_mem_end = cdev->pci_params.mem_end; dev_info->pci_mem_end = cdev->pci_params.mem_end;
dev_info->pci_irq = cdev->pci_params.irq; dev_info->pci_irq = cdev->pci_params.irq;
dev_info->rdma_supported = (cdev->hwfns[0].hw_info.personality == dev_info->rdma_supported = QED_IS_RDMA_PERSONALITY(p_hwfn);
QED_PCI_ETH_ROCE);
dev_info->is_mf_default = IS_MF_DEFAULT(&cdev->hwfns[0]); dev_info->is_mf_default = IS_MF_DEFAULT(&cdev->hwfns[0]);
dev_info->dev_type = cdev->type; dev_info->dev_type = cdev->type;
ether_addr_copy(dev_info->hw_mac, cdev->hwfns[0].hw_info.hw_mac_addr); ether_addr_copy(dev_info->hw_mac, hw_info->hw_mac_addr);
if (IS_PF(cdev)) { if (IS_PF(cdev)) {
dev_info->fw_major = FW_MAJOR_VERSION; dev_info->fw_major = FW_MAJOR_VERSION;
...@@ -274,8 +275,7 @@ int qed_fill_dev_info(struct qed_dev *cdev, ...@@ -274,8 +275,7 @@ int qed_fill_dev_info(struct qed_dev *cdev,
dev_info->mf_mode = cdev->mf_mode; dev_info->mf_mode = cdev->mf_mode;
dev_info->tx_switching = true; dev_info->tx_switching = true;
if (QED_LEADING_HWFN(cdev)->hw_info.b_wol_support == if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)
QED_WOL_SUPPORT_PME)
dev_info->wol_support = true; dev_info->wol_support = true;
dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id; dev_info->abs_pf_id = QED_LEADING_HWFN(cdev)->abs_pf_id;
...@@ -304,7 +304,7 @@ int qed_fill_dev_info(struct qed_dev *cdev, ...@@ -304,7 +304,7 @@ int qed_fill_dev_info(struct qed_dev *cdev,
&dev_info->mfw_rev, NULL); &dev_info->mfw_rev, NULL);
} }
dev_info->mtu = QED_LEADING_HWFN(cdev)->hw_info.mtu; dev_info->mtu = hw_info->mtu;
return 0; return 0;
} }
...@@ -790,7 +790,7 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev, ...@@ -790,7 +790,7 @@ static int qed_slowpath_setup_int(struct qed_dev *cdev,
cdev->num_hwfns; cdev->num_hwfns;
if (!IS_ENABLED(CONFIG_QED_RDMA) || if (!IS_ENABLED(CONFIG_QED_RDMA) ||
QED_LEADING_HWFN(cdev)->hw_info.personality != QED_PCI_ETH_ROCE) !QED_IS_RDMA_PERSONALITY(QED_LEADING_HWFN(cdev)))
return 0; return 0;
for_each_hwfn(cdev, i) for_each_hwfn(cdev, i)
...@@ -931,8 +931,7 @@ static void qed_update_pf_params(struct qed_dev *cdev, ...@@ -931,8 +931,7 @@ static void qed_update_pf_params(struct qed_dev *cdev,
/* In case we might support RDMA, don't allow qede to be greedy /* In case we might support RDMA, don't allow qede to be greedy
* with the L2 contexts. Allow for 64 queues [rx, tx, xdp] per hwfn. * with the L2 contexts. Allow for 64 queues [rx, tx, xdp] per hwfn.
*/ */
if (QED_LEADING_HWFN(cdev)->hw_info.personality == if (QED_IS_RDMA_PERSONALITY(QED_LEADING_HWFN(cdev))) {
QED_PCI_ETH_ROCE) {
u16 *num_cons; u16 *num_cons;
num_cons = &params->eth_pf_params.num_cons; num_cons = &params->eth_pf_params.num_cons;
......
...@@ -778,7 +778,7 @@ enum protocol_type { ...@@ -778,7 +778,7 @@ enum protocol_type {
PROTOCOLID_ROCE, PROTOCOLID_ROCE,
PROTOCOLID_CORE, PROTOCOLID_CORE,
PROTOCOLID_ETH, PROTOCOLID_ETH,
PROTOCOLID_RESERVED4, PROTOCOLID_IWARP,
PROTOCOLID_RESERVED5, PROTOCOLID_RESERVED5,
PROTOCOLID_PREROCE, PROTOCOLID_PREROCE,
PROTOCOLID_COMMON, PROTOCOLID_COMMON,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment