RE: [RFC 01/19] qed: Introduce iWARP personality

2017-06-27 Thread Kalderon, Michal
From: Leon Romanovsky [mailto:l...@kernel.org]
Sent: Tuesday, June 27, 2017 8:37 AM
> 
> On Mon, Jun 26, 2017 at 09:06:51PM +0300, Michal Kalderon wrote:
> > 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: Michal Kalderon 
> > Signed-off-by: Yuval Mintz 
> > Signed-off-by: Ariel Elior 
> >
> > ---
> >  drivers/net/ethernet/qlogic/qed/qed.h  | 26 +++--
> -
> >  drivers/net/ethernet/qlogic/qed/qed_cxt.c  |  8 
> > drivers/net/ethernet/qlogic/qed/qed_dev.c  | 12 +---
> >  drivers/net/ethernet/qlogic/qed/qed_l2.c   |  3 +--
> >  drivers/net/ethernet/qlogic/qed/qed_ll2.c  |  2 +-
> > drivers/net/ethernet/qlogic/qed/qed_main.c | 17 -
> >  include/linux/qed/common_hsi.h |  2 +-
> >  7 files changed, 43 insertions(+), 27 deletions(-)
> 
> I see that these changes are in Ethernet part of your driver, but for RDMA 
> part,
> there are already available inline functions:
> rdma_protocol_iwarp, rdma_protocol_roce.
> 
> Please avoid introducing new IS_IWARP/IS_ROCE macros and the decision
> should be taken on port level and not on device, despite the fact that 
> probably
> your ib_device has only one port.
> 
> Thanks

We still need to differentiate between iWARP/RoCE before 
rdma_protocol_iwarp/rdma_protocol_roce will be valid
(allocating resources, registering ib device, initializing ib_device, and 
capabilities.
For the rest of the places, after the port capabilities are valid, we'll use 
the inline functions.



Re: [RFC 01/19] qed: Introduce iWARP personality

2017-06-26 Thread Leon Romanovsky
On Mon, Jun 26, 2017 at 09:06:51PM +0300, Michal Kalderon wrote:
> 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: Michal Kalderon 
> Signed-off-by: Yuval Mintz 
> Signed-off-by: Ariel Elior 
>
> ---
>  drivers/net/ethernet/qlogic/qed/qed.h  | 26 +++---
>  drivers/net/ethernet/qlogic/qed/qed_cxt.c  |  8 
>  drivers/net/ethernet/qlogic/qed/qed_dev.c  | 12 +---
>  drivers/net/ethernet/qlogic/qed/qed_l2.c   |  3 +--
>  drivers/net/ethernet/qlogic/qed/qed_ll2.c  |  2 +-
>  drivers/net/ethernet/qlogic/qed/qed_main.c | 17 -
>  include/linux/qed/common_hsi.h |  2 +-
>  7 files changed, 43 insertions(+), 27 deletions(-)

I see that these changes are in Ethernet part of your driver, but for
RDMA part, there are already available inline functions:
rdma_protocol_iwarp, rdma_protocol_roce.

Please avoid introducing new IS_IWARP/IS_ROCE macros and the decision
should be taken on port level and not on device, despite the fact that
probably your ib_device has only one port.

Thanks


signature.asc
Description: PGP signature


[RFC 01/19] qed: Introduce iWARP personality

2017-06-26 Thread Michal Kalderon
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: Michal Kalderon 
Signed-off-by: Yuval Mintz 
Signed-off-by: Ariel Elior 

---
 drivers/net/ethernet/qlogic/qed/qed.h  | 26 +++---
 drivers/net/ethernet/qlogic/qed/qed_cxt.c  |  8 
 drivers/net/ethernet/qlogic/qed/qed_dev.c  | 12 +---
 drivers/net/ethernet/qlogic/qed/qed_l2.c   |  3 +--
 drivers/net/ethernet/qlogic/qed/qed_ll2.c  |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_main.c | 17 -
 include/linux/qed/common_hsi.h |  2 +-
 7 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed.h 
b/drivers/net/ethernet/qlogic/qed/qed.h
index 14b08ee..22e1171 100644
--- a/drivers/net/ethernet/qlogic/qed/qed.h
+++ b/drivers/net/ethernet/qlogic/qed/qed.h
@@ -210,14 +210,16 @@ struct qed_tunn_update_params {
 
 /* The PCI personality is not quite synonymous to protocol ID:
  * 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 {
QED_PCI_ETH,
QED_PCI_FCOE,
QED_PCI_ISCSI,
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 */
@@ -277,6 +279,7 @@ enum qed_dev_cap {
QED_DEV_CAP_FCOE,
QED_DEV_CAP_ISCSI,
QED_DEV_CAP_ROCE,
+   QED_DEV_CAP_IWARP,
 };
 
 enum qed_wol_support {
@@ -286,7 +289,24 @@ enum qed_wol_support {
 
 struct qed_hw_info {
/* PCI personality */
-   enum qed_pci_personalitypersonality;
+   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 */
u32 resc_start[QED_MAX_RESC];
diff --git a/drivers/net/ethernet/qlogic/qed/qed_cxt.c 
b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
index e201214..38716f7 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_cxt.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_cxt.c
@@ -853,7 +853,7 @@ u32 qed_cxt_cfg_ilt_compute_excess(struct qed_hwfn *p_hwfn, 
u32 used_lines)
if (!excess_lines)
return 0;
 
-   if (p_hwfn->hw_info.personality != QED_PCI_ETH_ROCE)
+   if (!QED_IS_RDMA_PERSONALITY(p_hwfn))
return 0;
 
p_mngr = p_hwfn->p_cxt_mngr;
@@ -1033,7 +1033,7 @@ static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,
u32 lines, line, sz_left, lines_to_skip = 0;
 
/* 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))
return 0;
 
@@ -1833,7 +1833,7 @@ static void qed_tm_init_pf(struct qed_hwfn *p_hwfn)
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;
 
STORE_RT_REG(p_hwfn, TM_REG_PF_ENABLE_TASK_RT_OFFSET, active_seg_mask);
@@ -2344,7 +2344,7 @@ int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
   last_cid_allocated - 1);
 
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);
p_hwfn->b_rdma_enabled_in_prs = true;
}
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c 
b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index