Skip to contentSkip to conversation

i40iw: Set 128B as the only supported RQ WQE size

PATCH Superseded Henry Orosco 4 participants 15 messages Dec 19, 2016 – Dec 21, 2016 12 messages not in the archive InfiniBand

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i40iw: Set 128B as the only supported RQ WQE size

From: Chien Tin Tung <[email protected]>

RQ WQE size other than 128B is not supported. Correct RQ size calculation to use 128B only.

Since this breaks AIB, add additional code to provide compatibility with v4 user provider, libi40iw.

---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c     | 25 ++++++++++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_puda.c     |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_type.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_ucontext.h |  4 ++--
 drivers/infiniband/hw/i40iw/i40iw_uk.c       | 17 ++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_user.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 21 +++++++++++----------
 drivers/infiniband/hw/i40iw/i40iw_verbs.h    |  1 +
 8 files changed, 53 insertions(+), 25 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +20 -5
index 392f783..98923a8 100644
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 
@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 					      offset);
 
 	info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
+	info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
 	ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
 	if (ret_code)
 		return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 						    false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
 		    __func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
-	ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
-					       &wqe_size);
-	if (ret_code)
-		return ret_code;
+
+	switch (qp->pd->abi_ver) {
+	case 4:
+		ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
+						       &wqe_size);
+		if (ret_code)
+			return ret_code;
+		break;
+	case 5: /* fallthrough until next ABI version */
+	default:
+		if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
+			return I40IW_ERR_INVALID_FRAG_COUNT;
+		wqe_size = I40IW_MAX_WQE_SIZE_RQ;
+		break;
+	}
 	qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
 				(wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE,
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -1
index 3b286cd..a368b7d 100644
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
 	INIT_LIST_HEAD(&rsrc->txpend);
 
 	rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
-	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
+	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
 	rsrc->qp_id = info->qp_id;
 	rsrc->cq_id = info->cq_id;
 	rsrc->sq_size = info->sq_size;
drivers/infiniband/hw/i40iw/i40iw_type.h +3 -1
index 68502ba..d7a629a 100644
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
 	u32 size;
 	struct i40iw_sc_dev *dev;
 	u16 pd_id;
+	int abi_ver;
 };
 
 struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
 	u64 host_ctx_pa;
 	u64 q2_pa;
 	u64 shadow_area_pa;
+	int abi_ver;
 	u8 sq_tph_val;
 	u8 rq_tph_val;
 	u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
 };
 
 struct i40iw_pd_ops {
-	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
+	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
 };
 
 struct i40iw_priv_qp_ops {
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+
 struct i40iw_alloc_ucontext_req {
 	__u32 reserved32;
 	__u8 userspace_ver;
drivers/infiniband/hw/i40iw/i40iw_uk.c +12 -5
index a614ad2..2c6c442 100644
@@ -967,10 +967,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (ret_code)
 		return ret_code;
 
-	ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
-	if (ret_code)
-		return ret_code;
-
 	qp->sq_base = info->sq;
 	qp->rq_base = info->rq;
 	qp->shadow_area = info->shadow_area;
@@ -999,8 +995,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (!qp->use_srq) {
 		qp->rq_size = info->rq_size;
 		qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
-		qp->rq_wqe_size = rqshift;
 		I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
+		switch (info->abi_ver) {
+		case 4:
+			ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
+			if (ret_code)
+				return ret_code;
+			break;
+		case 5: /* fallthrough until next ABI version */
+		default:
+			rqshift = I40IW_MAX_RQ_WQE_SHIFT;
+			break;
+		}
+		qp->rq_wqe_size = rqshift;
 		qp->rq_wqe_size_multiplier = 4 << rqshift;
 	}
 	qp->ops = iw_qp_uk_ops;
drivers/infiniband/hw/i40iw/i40iw_user.h +3 -1
index 66263fc..ab2f7c1 100644
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
 	I40IW_MAX_ORD_SIZE =			127,
 	I40IW_MAX_WQ_ENTRIES =			2048,
 	I40IW_Q2_BUFFER_SIZE =			(248 + 100),
+	I40IW_MAX_WQE_SIZE_RQ =			128,
 	I40IW_QP_CTX_SIZE =			248,
 	I40IW_MAX_PDS = 			32768
 };
@@ -103,6 +104,7 @@ enum i40iw_device_capabilities_const {
 #define I40IW_STAG_INDEX_FROM_STAG(stag)    (((stag) && 0xFFFFFF00) >> 8)
 
 #define	I40IW_MAX_MR_SIZE	0x10000000000L
+#define	I40IW_MAX_RQ_WQE_SHIFT	2
 
 struct i40iw_qp_uk;
 struct i40iw_cq_uk;
@@ -411,7 +413,7 @@ struct i40iw_qp_uk_init_info {
 	u32 max_sq_frag_cnt;
 	u32 max_rq_frag_cnt;
 	u32 max_inline_data;
-
+	int abi_ver;
 };
 
 struct i40iw_cq_uk_init_info {
drivers/infiniband/hw/i40iw/i40iw_verbs.c +11 -10
index 855e499..7d1ebf0 100644
@@ -145,9 +145,8 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	if (ib_copy_from_udata(&req, udata, sizeof(req)))
 		return ERR_PTR(-EINVAL);
 
-	if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
-		i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
-			     req.userspace_ver, I40IW_ABI_USERSPACE_VER);
+	if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
+		i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -155,13 +154,14 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	uresp.max_qps = iwdev->max_qp;
 	uresp.max_pds = iwdev->max_pd;
 	uresp.wq_size = iwdev->max_qp_wr * 2;
-	uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
+	uresp.kernel_ver = req.userspace_ver;
 
 	ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
 	if (!ucontext)
 		return ERR_PTR(-ENOMEM);
 
 	ucontext->iwdev = iwdev;
+	ucontext->abi_ver = req.userspace_ver;
 
 	if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 		kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
 	struct i40iw_alloc_pd_resp uresp;
 	struct i40iw_sc_pd *sc_pd;
+	struct i40iw_ucontext *ucontext;
 	u32 pd_id = 0;
 	int err;
 
@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	}
 
 	sc_pd = &iwpd->sc_pd;
-	dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
 
 	if (context) {
+		ucontext = to_ucontext(context);
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
 		memset(&uresp, 0, sizeof(uresp));
 		uresp.pd_id = pd_id;
 		if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 			err = -EFAULT;
 			goto error;
 		}
+	} else {
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
 	}
 
 	i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
 	u32 sqdepth, rqdepth;
 	u32 sq_size, rq_size;
-	u8 sqshift, rqshift;
+	u8 sqshift;
 	u32 size;
 	enum i40iw_status_code status;
 	struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
 
 	status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
-	if (!status)
-		status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
-
 	if (status)
 		return -ENOMEM;
 
 	sqdepth = sq_size << sqshift;
-	rqdepth = rq_size << rqshift;
+	rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
 
 	size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
 	iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
drivers/infiniband/hw/i40iw/i40iw_verbs.h +1 -0
index 6549c93..07c3fec 100644
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
 	spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
 	struct list_head qp_reg_mem_list;
 	spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
+	int abi_ver;
 };
 
 struct i40iw_pd {
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161219203227.86392-1-henry.orosco-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

#2 lore raw
Quoted 6 lines · Henry Orosco

From: Chien Tin Tung <[email protected]>

RQ WQE size other than 128B is not supported. Correct RQ size calculation to use 128B only.

Since this breaks AIB, add additional code to

s/AIB/ABI

Quoted 20 lines

provide compatibility with v4 user provider, libi40iw.

---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c     | 25 ++++++++++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_puda.c     |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_type.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_ucontext.h |  4 ++--
 drivers/infiniband/hw/i40iw/i40iw_uk.c       | 17 ++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_user.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 21 +++++++++++----------
 drivers/infiniband/hw/i40iw/i40iw_verbs.h    |  1 +
 8 files changed, 53 insertions(+), 25 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +0 -0
index 392f783..98923a8 100644

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 366

Quoted 10 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +3 -1
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)

No need for new line here

Quoted 267 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +17 -4
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 
@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 					      offset);
 
 	info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
+	info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
 	ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
 	if (ret_code)
 		return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 						    false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
 		    __func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
-	ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
-					       &wqe_size);
-	if (ret_code)
-		return ret_code;
+
+	switch (qp->pd->abi_ver) {
+	case 4:
+		ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
+						       &wqe_size);
+		if (ret_code)
+			return ret_code;
+		break;
+	case 5: /* fallthrough until next ABI version */
+	default:
+		if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
+			return I40IW_ERR_INVALID_FRAG_COUNT;
+		wqe_size = I40IW_MAX_WQE_SIZE_RQ;
+		break;
+	}
 	qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
 				(wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE,
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -1
index 3b286cd..a368b7d 100644
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
 	INIT_LIST_HEAD(&rsrc->txpend);
 
 	rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
-	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
+	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
 	rsrc->qp_id = info->qp_id;
 	rsrc->cq_id = info->cq_id;
 	rsrc->sq_size = info->sq_size;
drivers/infiniband/hw/i40iw/i40iw_type.h +3 -1
index 68502ba..d7a629a 100644
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
 	u32 size;
 	struct i40iw_sc_dev *dev;
 	u16 pd_id;
+	int abi_ver;
 };
 
 struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
 	u64 host_ctx_pa;
 	u64 q2_pa;
 	u64 shadow_area_pa;
+	int abi_ver;
 	u8 sq_tph_val;
 	u8 rq_tph_val;
 	u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
 };
 
 struct i40iw_pd_ops {
-	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
+	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
 };
 
 struct i40iw_priv_qp_ops {
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+
 struct i40iw_alloc_ucontext_req {
 	__u32 reserved32;
 	__u8 userspace_ver;
drivers/infiniband/hw/i40iw/i40iw_uk.c +12 -5
index a614ad2..2c6c442 100644
@@ -967,10 +967,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (ret_code)
 		return ret_code;
 
-	ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
-	if (ret_code)
-		return ret_code;
-
 	qp->sq_base = info->sq;
 	qp->rq_base = info->rq;
 	qp->shadow_area = info->shadow_area;
@@ -999,8 +995,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (!qp->use_srq) {
 		qp->rq_size = info->rq_size;
 		qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
-		qp->rq_wqe_size = rqshift;
 		I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
+		switch (info->abi_ver) {
+		case 4:
+			ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
+			if (ret_code)
+				return ret_code;
+			break;
+		case 5: /* fallthrough until next ABI version */
+		default:
+			rqshift = I40IW_MAX_RQ_WQE_SHIFT;
+			break;
+		}
+		qp->rq_wqe_size = rqshift;
 		qp->rq_wqe_size_multiplier = 4 << rqshift;
 	}
 	qp->ops = iw_qp_uk_ops;
drivers/infiniband/hw/i40iw/i40iw_user.h +3 -1
index 66263fc..ab2f7c1 100644
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
 	I40IW_MAX_ORD_SIZE =			127,
 	I40IW_MAX_WQ_ENTRIES =			2048,
 	I40IW_Q2_BUFFER_SIZE =			(248 + 100),
+	I40IW_MAX_WQE_SIZE_RQ =			128,
 	I40IW_QP_CTX_SIZE =			248,
 	I40IW_MAX_PDS = 			32768
 };
@@ -103,6 +104,7 @@ enum i40iw_device_capabilities_const {
 #define I40IW_STAG_INDEX_FROM_STAG(stag)    (((stag) && 0xFFFFFF00) >> 8)
 
 #define	I40IW_MAX_MR_SIZE	0x10000000000L
+#define	I40IW_MAX_RQ_WQE_SHIFT	2
 
 struct i40iw_qp_uk;
 struct i40iw_cq_uk;
@@ -411,7 +413,7 @@ struct i40iw_qp_uk_init_info {
 	u32 max_sq_frag_cnt;
 	u32 max_rq_frag_cnt;
 	u32 max_inline_data;
-
+	int abi_ver;
 };
 
 struct i40iw_cq_uk_init_info {
drivers/infiniband/hw/i40iw/i40iw_verbs.c +11 -10
index 855e499..7d1ebf0 100644
@@ -145,9 +145,8 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	if (ib_copy_from_udata(&req, udata, sizeof(req)))
 		return ERR_PTR(-EINVAL);
 
-	if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
-		i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
-			     req.userspace_ver, I40IW_ABI_USERSPACE_VER);
+	if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
+		i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -155,13 +154,14 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	uresp.max_qps = iwdev->max_qp;
 	uresp.max_pds = iwdev->max_pd;
 	uresp.wq_size = iwdev->max_qp_wr * 2;
-	uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
+	uresp.kernel_ver = req.userspace_ver;
 
 	ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
 	if (!ucontext)
 		return ERR_PTR(-ENOMEM);
 
 	ucontext->iwdev = iwdev;
+	ucontext->abi_ver = req.userspace_ver;
 
 	if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 		kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
 	struct i40iw_alloc_pd_resp uresp;
 	struct i40iw_sc_pd *sc_pd;
+	struct i40iw_ucontext *ucontext;
 	u32 pd_id = 0;
 	int err;
 
@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	}
 
 	sc_pd = &iwpd->sc_pd;
-	dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
 
 	if (context) {
+		ucontext = to_ucontext(context);
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
 		memset(&uresp, 0, sizeof(uresp));
 		uresp.pd_id = pd_id;
 		if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 			err = -EFAULT;
 			goto error;
 		}
+	} else {
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
 	}
 
 	i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
 	u32 sqdepth, rqdepth;
 	u32 sq_size, rq_size;
-	u8 sqshift, rqshift;
+	u8 sqshift;
 	u32 size;
 	enum i40iw_status_code status;
 	struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
 
 	status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
-	if (!status)
-		status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
-
 	if (status)
 		return -ENOMEM;
 
 	sqdepth = sq_size << sqshift;
-	rqdepth = rq_size << rqshift;
+	rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
 
 	size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
 	iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
drivers/infiniband/hw/i40iw/i40iw_verbs.h +1 -0
index 6549c93..07c3fec 100644
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
 	spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
 	struct list_head qp_reg_mem_list;
 	spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
+	int abi_ver;
 };
 
 struct i40iw_pd {
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161220104720.GD7351-Hxa29pjIrETlQW142y8m19+IiqhCXseY@public.gmane.org

#4 lore raw
Quoted 9 lines · Yuval Shaia
Quoted 6 lines · Henry Orosco

From: Chien Tin Tung <[email protected]>

RQ WQE size other than 128B is not supported. Correct RQ size calculation to use 128B only.

Since this breaks AIB, add additional code to

s/AIB/ABI

I will make this change.

Quoted 25 lines
Quoted 25 lines

provide compatibility with v4 user provider, libi40iw.

---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c     | 25 ++++++++++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_puda.c     |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_type.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_ucontext.h |  4 ++--
 drivers/infiniband/hw/i40iw/i40iw_uk.c       | 17 ++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_user.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 21 +++++++++++----------
 drivers/infiniband/hw/i40iw/i40iw_verbs.h    |  1 +
 8 files changed, 53 insertions(+), 25 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 -0
index 392f783..98923a8 100644
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
Quoted 9 lines

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 366

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +2 -1
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)

No need for new line here

Not sure what you mean here.

Quoted 259 lines
Quoted 259 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +17 -4
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 
@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 					      offset);
 
 	info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
+	info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
 	ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
 	if (ret_code)
 		return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 						    false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
 		    __func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
-	ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
-					       &wqe_size);
-	if (ret_code)
-		return ret_code;
+
+	switch (qp->pd->abi_ver) {
+	case 4:
+		ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
+						       &wqe_size);
+		if (ret_code)
+			return ret_code;
+		break;
+	case 5: /* fallthrough until next ABI version */
+	default:
+		if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
+			return I40IW_ERR_INVALID_FRAG_COUNT;
+		wqe_size = I40IW_MAX_WQE_SIZE_RQ;
+		break;
+	}
 	qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
 				(wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE,
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -1
index 3b286cd..a368b7d 100644
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
 	INIT_LIST_HEAD(&rsrc->txpend);
 
 	rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
-	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
+	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
 	rsrc->qp_id = info->qp_id;
 	rsrc->cq_id = info->cq_id;
 	rsrc->sq_size = info->sq_size;
drivers/infiniband/hw/i40iw/i40iw_type.h +3 -1
index 68502ba..d7a629a 100644
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
 	u32 size;
 	struct i40iw_sc_dev *dev;
 	u16 pd_id;
+	int abi_ver;
 };
 
 struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
 	u64 host_ctx_pa;
 	u64 q2_pa;
 	u64 shadow_area_pa;
+	int abi_ver;
 	u8 sq_tph_val;
 	u8 rq_tph_val;
 	u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
 };
 
 struct i40iw_pd_ops {
-	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
+	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
 };
 
 struct i40iw_priv_qp_ops {
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+
 struct i40iw_alloc_ucontext_req {
 	__u32 reserved32;
 	__u8 userspace_ver;
drivers/infiniband/hw/i40iw/i40iw_uk.c +12 -5
index a614ad2..2c6c442 100644
@@ -967,10 +967,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (ret_code)
 		return ret_code;
 
-	ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
-	if (ret_code)
-		return ret_code;
-
 	qp->sq_base = info->sq;
 	qp->rq_base = info->rq;
 	qp->shadow_area = info->shadow_area;
@@ -999,8 +995,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (!qp->use_srq) {
 		qp->rq_size = info->rq_size;
 		qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
-		qp->rq_wqe_size = rqshift;
 		I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
+		switch (info->abi_ver) {
+		case 4:
+			ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
+			if (ret_code)
+				return ret_code;
+			break;
+		case 5: /* fallthrough until next ABI version */
+		default:
+			rqshift = I40IW_MAX_RQ_WQE_SHIFT;
+			break;
+		}
+		qp->rq_wqe_size = rqshift;
 		qp->rq_wqe_size_multiplier = 4 << rqshift;
 	}
 	qp->ops = iw_qp_uk_ops;
drivers/infiniband/hw/i40iw/i40iw_user.h +3 -1
index 66263fc..ab2f7c1 100644
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
 	I40IW_MAX_ORD_SIZE =			127,
 	I40IW_MAX_WQ_ENTRIES =			2048,
 	I40IW_Q2_BUFFER_SIZE =			(248 + 100),
+	I40IW_MAX_WQE_SIZE_RQ =			128,
 	I40IW_QP_CTX_SIZE =			248,
 	I40IW_MAX_PDS = 			32768
 };
@@ -103,6 +104,7 @@ enum i40iw_device_capabilities_const {
 #define I40IW_STAG_INDEX_FROM_STAG(stag)    (((stag) && 0xFFFFFF00) >> 8)
 
 #define	I40IW_MAX_MR_SIZE	0x10000000000L
+#define	I40IW_MAX_RQ_WQE_SHIFT	2
 
 struct i40iw_qp_uk;
 struct i40iw_cq_uk;
@@ -411,7 +413,7 @@ struct i40iw_qp_uk_init_info {
 	u32 max_sq_frag_cnt;
 	u32 max_rq_frag_cnt;
 	u32 max_inline_data;
-
+	int abi_ver;
 };
 
 struct i40iw_cq_uk_init_info {
drivers/infiniband/hw/i40iw/i40iw_verbs.c +11 -10
index 855e499..7d1ebf0 100644
@@ -145,9 +145,8 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	if (ib_copy_from_udata(&req, udata, sizeof(req)))
 		return ERR_PTR(-EINVAL);
 
-	if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
-		i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
-			     req.userspace_ver, I40IW_ABI_USERSPACE_VER);
+	if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
+		i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -155,13 +154,14 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	uresp.max_qps = iwdev->max_qp;
 	uresp.max_pds = iwdev->max_pd;
 	uresp.wq_size = iwdev->max_qp_wr * 2;
-	uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
+	uresp.kernel_ver = req.userspace_ver;
 
 	ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
 	if (!ucontext)
 		return ERR_PTR(-ENOMEM);
 
 	ucontext->iwdev = iwdev;
+	ucontext->abi_ver = req.userspace_ver;
 
 	if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 		kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
 	struct i40iw_alloc_pd_resp uresp;
 	struct i40iw_sc_pd *sc_pd;
+	struct i40iw_ucontext *ucontext;
 	u32 pd_id = 0;
 	int err;
 
@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	}
 
 	sc_pd = &iwpd->sc_pd;
-	dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
 
 	if (context) {
+		ucontext = to_ucontext(context);
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
 		memset(&uresp, 0, sizeof(uresp));
 		uresp.pd_id = pd_id;
 		if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 			err = -EFAULT;
 			goto error;
 		}
+	} else {
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
 	}
 
 	i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
 	u32 sqdepth, rqdepth;
 	u32 sq_size, rq_size;
-	u8 sqshift, rqshift;
+	u8 sqshift;
 	u32 size;
 	enum i40iw_status_code status;
 	struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
 
 	status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
-	if (!status)
-		status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
-
 	if (status)
 		return -ENOMEM;
 
 	sqdepth = sq_size << sqshift;
-	rqdepth = rq_size << rqshift;
+	rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
 
 	size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
 	iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
drivers/infiniband/hw/i40iw/i40iw_verbs.h +1 -0
index 6549c93..07c3fec 100644
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
 	spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
 	struct list_head qp_reg_mem_list;
 	spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
+	int abi_ver;
 };
 
Quoted 8 lines
Quoted 8 lines
drivers/infiniband/hw/i40iw/i40iw_verbs.h +0 -0
 struct i40iw_pd {
Signature · 6 lines
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161220164118.GA91636-ZmvEvTIhtuUfyugFOqMDN/ooFf0ArEBIu+b9c/[email protected]

#6 lore raw
Quoted 25 lines · Henry Orosco
Quoted 10 lines
Quoted 10 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 -0
index 392f783..98923a8 100644
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
Quoted 9 lines

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 366

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +2 -1
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)

No need for new line here

Not sure what you mean here.

From code-style perspective "u16 pd_id," and "int abi_ver" can be on one line.

Quoted 7 lines
Quoted 7 lines

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 373

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 -0
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#7 lore raw
Quoted 21 lines · Yuval Shaia
Quoted 20 lines · Henry Orosco
Quoted 19 lines
Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +0 -0
index 392f783..98923a8 100644

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 366

Quoted 10 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +3 -1
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)

No need for new line here

Quoted 3 lines
Quoted 1 line

Not sure what you mean here.

From code-style perspective "u16 pd_id," and "int abi_ver" can be on one line.

We will opt to keep it as originally sent (one parameter per line) as this is consistent with the rest of the file.

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

drivers/infiniband/hw/i40iw/i40iw_ctrl.c void i40iw_qp_add_qos(struct i40iw_sc_qp *qp) · line 373

Quoted 9 lines
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +1 -0
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
In reply to a message not in the archive
Quoted 124 lines · Henry Orosco

From: Chien Tin Tung <[email protected]>

RQ WQE size other than 128B is not supported. Correct RQ size calculation to use 128B only.

Since this breaks AIB, add additional code to provide compatibility with v4 user provider, libi40iw.

---
 drivers/infiniband/hw/i40iw/i40iw_ctrl.c     | 25 ++++++++++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_puda.c     |  2 +-
 drivers/infiniband/hw/i40iw/i40iw_type.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_ucontext.h |  4 ++--
 drivers/infiniband/hw/i40iw/i40iw_uk.c       | 17 ++++++++++++-----
 drivers/infiniband/hw/i40iw/i40iw_user.h     |  4 +++-
 drivers/infiniband/hw/i40iw/i40iw_verbs.c    | 21 +++++++++++----------
 drivers/infiniband/hw/i40iw/i40iw_verbs.h    |  1 +
 8 files changed, 53 insertions(+), 25 deletions(-)
drivers/infiniband/hw/i40iw/i40iw_ctrl.c +20 -5
index 392f783..98923a8 100644
@@ -358,13 +358,16 @@ void i40iw_qp_add_qos(struct i40iw_sc_qp *qp)
  * @dev: sc device struct
  * @pd: sc pd ptr
  * @pd_id: pd_id for allocated pd
+ * @abi_ver: ABI version from user context, -1 if not valid
  */
 static void i40iw_sc_pd_init(struct i40iw_sc_dev *dev,
 			     struct i40iw_sc_pd *pd,
-			     u16 pd_id)
+			     u16 pd_id,
+			     int abi_ver)
 {
 	pd->size = sizeof(*pd);
 	pd->pd_id = pd_id;
+	pd->abi_ver = abi_ver;
 	pd->dev = dev;
 }
 
@@ -2252,6 +2255,7 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 					      offset);
 
 	info->qp_uk_init_info.wqe_alloc_reg = wqe_alloc_reg;
+	info->qp_uk_init_info.abi_ver = qp->pd->abi_ver;
 	ret_code = i40iw_qp_uk_init(&qp->qp_uk, &info->qp_uk_init_info);
 	if (ret_code)
 		return ret_code;
@@ -2270,10 +2274,21 @@ static enum i40iw_status_code i40iw_sc_qp_init(struct i40iw_sc_qp *qp,
 						    false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE, "%s: hw_sq_size[%04d] sq_ring.size[%04d]\n",
 		    __func__, qp->hw_sq_size, qp->qp_uk.sq_ring.size);
-	ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
-					       &wqe_size);
-	if (ret_code)
-		return ret_code;
+
+	switch (qp->pd->abi_ver) {
+	case 4:
+		ret_code = i40iw_fragcnt_to_wqesize_rq(qp->qp_uk.max_rq_frag_cnt,
+						       &wqe_size);
+		if (ret_code)
+			return ret_code;
+		break;
+	case 5: /* fallthrough until next ABI version */
+	default:
+		if (qp->qp_uk.max_rq_frag_cnt > I40IW_MAX_WQ_FRAGMENT_COUNT)
+			return I40IW_ERR_INVALID_FRAG_COUNT;
+		wqe_size = I40IW_MAX_WQE_SIZE_RQ;
+		break;
+	}
 	qp->hw_rq_size = i40iw_get_encoded_wqe_size(qp->qp_uk.rq_size *
 				(wqe_size / I40IW_QP_WQE_MIN_SIZE), false);
 	i40iw_debug(qp->dev, I40IW_DEBUG_WQE,
drivers/infiniband/hw/i40iw/i40iw_puda.c +1 -1
index 3b286cd..a368b7d 100644
@@ -930,7 +930,7 @@ enum i40iw_status_code i40iw_puda_create_rsrc(struct i40iw_sc_vsi *vsi,
 	INIT_LIST_HEAD(&rsrc->txpend);
 
 	rsrc->tx_wqe_avail_cnt = info->sq_size - 1;
-	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id);
+	dev->iw_pd_ops->pd_init(dev, &rsrc->sc_pd, info->pd_id, -1);
 	rsrc->qp_id = info->qp_id;
 	rsrc->cq_id = info->cq_id;
 	rsrc->sq_size = info->sq_size;
drivers/infiniband/hw/i40iw/i40iw_type.h +3 -1
index 68502ba..d7a629a 100644
@@ -280,6 +280,7 @@ struct i40iw_sc_pd {
 	u32 size;
 	struct i40iw_sc_dev *dev;
 	u16 pd_id;
+	int abi_ver;
 };
 
 struct i40iw_cqp_quanta {
@@ -852,6 +853,7 @@ struct i40iw_qp_init_info {
 	u64 host_ctx_pa;
 	u64 q2_pa;
 	u64 shadow_area_pa;
+	int abi_ver;
 	u8 sq_tph_val;
 	u8 rq_tph_val;
 	u8 type;
@@ -1051,7 +1053,7 @@ struct i40iw_aeq_ops {
 };
 
 struct i40iw_pd_ops {
-	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16);
+	void (*pd_init)(struct i40iw_sc_dev *, struct i40iw_sc_pd *, u16, int);
 };
 
 struct i40iw_priv_qp_ops {
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5" instead?

Quoted 172 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
 struct i40iw_alloc_ucontext_req {
 	__u32 reserved32;
 	__u8 userspace_ver;
drivers/infiniband/hw/i40iw/i40iw_uk.c +12 -5
index a614ad2..2c6c442 100644
@@ -967,10 +967,6 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (ret_code)
 		return ret_code;
 
-	ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
-	if (ret_code)
-		return ret_code;
-
 	qp->sq_base = info->sq;
 	qp->rq_base = info->rq;
 	qp->shadow_area = info->shadow_area;
@@ -999,8 +995,19 @@ enum i40iw_status_code i40iw_qp_uk_init(struct i40iw_qp_uk *qp,
 	if (!qp->use_srq) {
 		qp->rq_size = info->rq_size;
 		qp->max_rq_frag_cnt = info->max_rq_frag_cnt;
-		qp->rq_wqe_size = rqshift;
 		I40IW_RING_INIT(qp->rq_ring, qp->rq_size);
+		switch (info->abi_ver) {
+		case 4:
+			ret_code = i40iw_get_wqe_shift(info->rq_size, info->max_rq_frag_cnt, 0, &rqshift);
+			if (ret_code)
+				return ret_code;
+			break;
+		case 5: /* fallthrough until next ABI version */
+		default:
+			rqshift = I40IW_MAX_RQ_WQE_SHIFT;
+			break;
+		}
+		qp->rq_wqe_size = rqshift;
 		qp->rq_wqe_size_multiplier = 4 << rqshift;
 	}
 	qp->ops = iw_qp_uk_ops;
drivers/infiniband/hw/i40iw/i40iw_user.h +3 -1
index 66263fc..ab2f7c1 100644
@@ -76,6 +76,7 @@ enum i40iw_device_capabilities_const {
 	I40IW_MAX_ORD_SIZE =			127,
 	I40IW_MAX_WQ_ENTRIES =			2048,
 	I40IW_Q2_BUFFER_SIZE =			(248 + 100),
+	I40IW_MAX_WQE_SIZE_RQ =			128,
 	I40IW_QP_CTX_SIZE =			248,
 	I40IW_MAX_PDS = 			32768
 };
@@ -103,6 +104,7 @@ enum i40iw_device_capabilities_const {
 #define I40IW_STAG_INDEX_FROM_STAG(stag)    (((stag) && 0xFFFFFF00) >> 8)
 
 #define	I40IW_MAX_MR_SIZE	0x10000000000L
+#define	I40IW_MAX_RQ_WQE_SHIFT	2
 
 struct i40iw_qp_uk;
 struct i40iw_cq_uk;
@@ -411,7 +413,7 @@ struct i40iw_qp_uk_init_info {
 	u32 max_sq_frag_cnt;
 	u32 max_rq_frag_cnt;
 	u32 max_inline_data;
-
+	int abi_ver;
 };
 
 struct i40iw_cq_uk_init_info {
drivers/infiniband/hw/i40iw/i40iw_verbs.c +11 -10
index 855e499..7d1ebf0 100644
@@ -145,9 +145,8 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	if (ib_copy_from_udata(&req, udata, sizeof(req)))
 		return ERR_PTR(-EINVAL);
 
-	if (req.userspace_ver != I40IW_ABI_USERSPACE_VER) {
-		i40iw_pr_err("Invalid userspace driver version detected. Detected version %d, should be %d\n",
-			     req.userspace_ver, I40IW_ABI_USERSPACE_VER);
+	if (req.userspace_ver < 4 || req.userspace_ver > I40IW_ABI_VER) {
+		i40iw_pr_err("Unsupported provider library version %u.\n", req.userspace_ver);
 		return ERR_PTR(-EINVAL);
 	}
 
@@ -155,13 +154,14 @@ static struct ib_ucontext *i40iw_alloc_ucontext(struct ib_device *ibdev,
 	uresp.max_qps = iwdev->max_qp;
 	uresp.max_pds = iwdev->max_pd;
 	uresp.wq_size = iwdev->max_qp_wr * 2;
-	uresp.kernel_ver = I40IW_ABI_KERNEL_VER;
+	uresp.kernel_ver = req.userspace_ver;
 
 	ucontext = kzalloc(sizeof(*ucontext), GFP_KERNEL);
 	if (!ucontext)
 		return ERR_PTR(-ENOMEM);
 
 	ucontext->iwdev = iwdev;
+	ucontext->abi_ver = req.userspace_ver;
 
 	if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 		kfree(ucontext);
@@ -333,6 +333,7 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	struct i40iw_sc_dev *dev = &iwdev->sc_dev;
 	struct i40iw_alloc_pd_resp uresp;
 	struct i40iw_sc_pd *sc_pd;
+	struct i40iw_ucontext *ucontext;
 	u32 pd_id = 0;
 	int err;
 
@@ -353,15 +354,18 @@ static struct ib_pd *i40iw_alloc_pd(struct ib_device *ibdev,
 	}
 
 	sc_pd = &iwpd->sc_pd;
-	dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id);
 
 	if (context) {
+		ucontext = to_ucontext(context);
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, ucontext->abi_ver);
 		memset(&uresp, 0, sizeof(uresp));
 		uresp.pd_id = pd_id;
 		if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
 			err = -EFAULT;
 			goto error;
 		}
+	} else {
+		dev->iw_pd_ops->pd_init(dev, sc_pd, pd_id, -1);
 	}
 
 	i40iw_add_pdusecount(iwpd);
@@ -518,7 +522,7 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	struct i40iw_dma_mem *mem = &iwqp->kqp.dma_mem;
 	u32 sqdepth, rqdepth;
 	u32 sq_size, rq_size;
-	u8 sqshift, rqshift;
+	u8 sqshift;
 	u32 size;
 	enum i40iw_status_code status;
 	struct i40iw_qp_uk_init_info *ukinfo = &info->qp_uk_init_info;
@@ -527,14 +531,11 @@ static int i40iw_setup_kmode_qp(struct i40iw_device *iwdev,
 	rq_size = i40iw_qp_roundup(ukinfo->rq_size + 1);
 
 	status = i40iw_get_wqe_shift(sq_size, ukinfo->max_sq_frag_cnt, ukinfo->max_inline_data, &sqshift);
-	if (!status)
-		status = i40iw_get_wqe_shift(rq_size, ukinfo->max_rq_frag_cnt, 0, &rqshift);
-
 	if (status)
 		return -ENOMEM;
 
 	sqdepth = sq_size << sqshift;
-	rqdepth = rq_size << rqshift;
+	rqdepth = rq_size << I40IW_MAX_RQ_WQE_SHIFT;
 
 	size = sqdepth * sizeof(struct i40iw_sq_uk_wr_trk_info) + (rqdepth << 3);
 	iwqp->kqp.wrid_mem = kzalloc(size, GFP_KERNEL);
drivers/infiniband/hw/i40iw/i40iw_verbs.h +1 -1
index 6549c93..07c3fec 100644
@@ -42,6 +42,7 @@ struct i40iw_ucontext {
 	spinlock_t cq_reg_mem_list_lock; /* memory list for cq's */
 	struct list_head qp_reg_mem_list;
 	spinlock_t qp_reg_mem_list_lock; /* memory list for qp's */
+	int abi_ver;
 };
 
 struct i40iw_pd {
--

1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161220112417.GV1074-U/[email protected]

#10 lore raw
Quoted 18 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5" instead?

[Chien Tin Tung] This is the ABI version change, did you read the commit message? Two defines were not necessary.

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 748B799B6A00724488C603FD7E5E7EB94CBAEEA0-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#12 lore raw
Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 9 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
 #include <linux/types.h>
 
Quoted 8 lines
Quoted 6 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 4 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5" instead?

[Chien Tin Tung] This is the ABI version change, did you read the commit message? Two defines were not necessary.

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

Or maybe they still needed and should be renamed?

Thanks

A message that is not in the archive (sent off-list or not yet received): 20161220134203.GW1074-U/[email protected]

#14 lore raw
Quoted 42 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

Quoted 8 lines

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Quoted 2 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Chien
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 748B799B6A00724488C603FD7E5E7EB94CBAFBBC-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#16 lore raw
Quoted 45 lines · Chien Tin
Quoted 45 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

message? Two defines were not necessary.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a define.

Quoted 9 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Chien

A message that is not in the archive (sent off-list or not yet received): 20161220200239.GA1074-U/[email protected]

#18 lore raw
Quoted 62 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 2:03 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 51 lines · Chien Tin
Quoted 51 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ
WQE size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

Quoted 8 lines
Quoted 2 lines

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a define.

You have yet to provide a good argument for changing the 4 and 5 to defines, so I don't know why you are telling me how to find them. Very puzzling. I already made my case on this. Enough said.

Chien

Quoted 1 line

[Chien]

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Chien

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 748B799B6A00724488C603FD7E5E7EB94CBB12AF-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#20 lore raw
Quoted 65 lines · Chien Tin
Quoted 65 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 2:03 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 53 lines · Chien Tin
Quoted 43 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ
WQE size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

Quoted 8 lines

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Quoted 8 lines
Quoted 5 lines

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a define.

You have yet to provide a good argument for changing the 4 and 5 to defines, so I don't know why you are telling me how to find them. Very puzzling.

I'm not telling to you, but asking from you to provide maintainable code which will be read more than once. Right now, you blindly copy-pasted hardcoded values in three different places (2 kernel and 1 rdma-core).

Feel free to ask your colleagues (Faisal L. and Shiraz S.) if they interested in maintainable driver code or they prefer your prone to errors copy-paste technique.

Quoted 19 lines

I already made my case on this. Enough said.

Chien

Quoted 1 line

[Chien]

Quoted 9 lines
Quoted 9 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Chien

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161221054805.GB1074-U/[email protected]

#22 lore raw
Quoted 84 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 11:48 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 63 lines · Chien Tin
Quoted 63 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 2:03 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 51 lines · Chien Tin
Quoted 51 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ
WQE size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported
RQ WQE size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a

define.

Quoted 1 line
Quoted 7 lines
Quoted 2 lines

You have yet to provide a good argument for changing the 4 and 5 to defines, so I don't know why you are telling me how to find them. Very

puzzling.

I'm not telling to you, but asking from you to provide maintainable code which will be read more than once. Right now, you blindly copy-pasted hardcoded values in three different places (2 kernel and 1 rdma-core).

Please make your case by coming up with a define that's better than 4 or 5, making the code more readable and understandable, then I will consider using it. Until you can do that, you have no case for your comment. Blindly using a define is something you tell junior programmers, sometimes, a number is just a number, nothing wrong with using it as is.

Quoted 4 lines

Feel free to ask your colleagues (Faisal L. and Shiraz S.) if they interested in maintainable driver code or they prefer your prone to errors copy-paste technique.

Why don't you go back and read the comment made against I40IW_SUCCESS? Maybe you will learn something from that?

Quoted 15 lines
Quoted 15 lines

I already made my case on this. Enough said.

Chien

Quoted 1 line

[Chien]

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Chien

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"
in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 748B799B6A00724488C603FD7E5E7EB94CBB1BA8-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org

#24 lore raw
Quoted 86 lines · Chien Tin
Quoted 86 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 11:48 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 63 lines · Chien Tin
Quoted 63 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 2:03 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 51 lines · Chien Tin
Quoted 51 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ
WQE size

Quoted 20 lines · Chien Tin
Quoted 20 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only supported
RQ WQE size

Quoted 7 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
index 12acd68..57d3f1d 100644
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and "5"

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case 5"?

Quoted 8 lines
Quoted 8 lines
Quoted 2 lines

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather than some define.

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a

define.

Quoted 3 lines

You have yet to provide a good argument for changing the 4 and 5 to defines, so I don't know why you are telling me how to find them. Very

Quoted 8 lines
Quoted 5 lines

puzzling.

I'm not telling to you, but asking from you to provide maintainable code which will be read more than once. Right now, you blindly copy-pasted hardcoded values in three different places (2 kernel and 1 rdma-core).

Please make your case by coming up with a define that's better than 4 or 5, making the code more readable and understandable, then I will consider using it.

First of all you are already have define for 5, but who cares, you are not junior and don't need to read the code which you wrote minute before.

Second, you need to come with new name for number 4 only. What about following?
#define I40IW_LEGACY_ABI 4

Quoted 11 lines

Until you can do that, you have no case for your comment. Blindly using a define is something you tell junior programmers, sometimes, a number is just a number, nothing wrong with using it as is.

Quoted 4 lines

Feel free to ask your colleagues (Faisal L. and Shiraz S.) if they interested in maintainable driver code or they prefer your prone to errors copy-paste technique.

Why don't you go back and read the comment made against I40IW_SUCCESS? Maybe you will learn something from that?

Your word is a lamp for my feet, a light on my path. Please enlighten me.

Happy Christmas.

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines

I already made my case on this. Enough said.

Chien

Quoted 1 line

[Chien]

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Chien

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"
in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 20161221151250.GA18935-U/[email protected]

#26 lore raw
Quoted 113 lines

-----Original Message-----
From: [email protected] [mailto:linux-rdma- [email protected]] On Behalf Of Leon Romanovsky
Sent: Wednesday, December 21, 2016 9:13 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE size

Quoted 60 lines · Chien Tin
Quoted 60 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 11:48 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ WQE
size

Quoted 48 lines · Chien Tin
Quoted 48 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 2:03 PM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected]; linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported RQ
WQE size

Quoted 36 lines · Chien Tin
Quoted 36 lines

-----Original Message-----
From: Leon Romanovsky [mailto:[email protected]]
Sent: Tuesday, December 20, 2016 7:42 AM
To: Tung, Chien Tin <[email protected]>
Cc: Orosco, Henry <[email protected]>; [email protected];
linux- [email protected]; [email protected]
Subject: Re: [PATCH] i40iw: Set 128B as the only supported
RQ WQE size

Quoted 22 lines · Chien Tin
Quoted 22 lines

-----Original Message-----
From: [email protected]
[mailto:linux-rdma- [email protected]] On Behalf Of
Leon Romanovsky
Sent: Tuesday, December 20, 2016 5:24 AM
To: Orosco, Henry <[email protected]>
Cc: [email protected]; [email protected]; e1000- [email protected]; Tung, Chien Tin <[email protected]>
Subject: Re: [PATCH] i40iw: Set 128B as the only
supported RQ WQE size

Quoted 8 lines

diff --git
a/drivers/infiniband/hw/i40iw/i40iw_ucontext.h
b/drivers/infiniband/hw/i40iw/i40iw_ucontext.h
index 12acd68..57d3f1d 100644

drivers/infiniband/hw/i40iw/i40iw_ucontext.h +0 -0
@@ -39,8 +39,8 @@
 
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

drivers/infiniband/hw/i40iw/i40iw_ucontext.h line 43

Quoted 6 lines
drivers/infiniband/hw/i40iw/i40iw_ucontext.h +2 -2
 #include <linux/types.h>
 
-#define I40IW_ABI_USERSPACE_VER 4
-#define I40IW_ABI_KERNEL_VER    4
+#define I40IW_ABI_VER 5
+

Why did you remove defines and move to use constants "4" and

"5"

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

instead?

Quoted 2 lines

[Chien Tin Tung] This is the ABI version change, did you read the commit

message? Two defines were not necessary.

Quoted 1 line

Thank you Chian Tin Tung for your informative answer and yes, I read commit message.

If you think that these defines are not needed, so can you please remove the code which uses hardcoded "case 4" and "case

5"?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

[Chien Tin Tung] Those are explicit checks against a particular ABI version and it is clearer to use the numbers rather

than some define.

Quoted 9 lines
Quoted 9 lines
Quoted 7 lines
Quoted 7 lines

Can you please stop to add [..] in front of your response? This Outlook style is annoying and not needed.

Regarding you response, you added the same check in two places and from grep/ctags/cscope/lxr perspective it is easier to spot them with a

define.

Quoted 1 line
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

You have yet to provide a good argument for changing the 4 and 5 to defines, so I don't know why you are telling me how to find them. Very

puzzling.

I'm not telling to you, but asking from you to provide maintainable code which will be read more than once. Right now, you blindly copy-pasted hardcoded values in three different places (2 kernel and 1

Quoted 8 lines

rdma-core).

Quoted 3 lines

Please make your case by coming up with a define that's better than 4 or 5, making the code more readable and understandable, then I will

consider using it.

First of all you are already have define for 5, but who cares, you are not junior and don't need to read the code which you wrote minute before.

You should think about the usage for that define. That is the current ABI version. That means the driver is at ABI version level 5. The value of that define will not stay as 5 with the next ABI version change.

Quoted 4 lines

Second, you need to come with new name for number 4 only. What about following?
#define I40IW_LEGACY_ABI 4

So what do you do with the next ABI version rev? What is LEGACY_ABI? You are very short sighted with this kind of suggestion.

Again, there is a specific fix for ABI version 4 and ABI version 5 and the next ABI version. This is the reason I'm checking against specific version number because it has meaning. Abstracting the actual number away from the value makes it much less readable.

Chien

Quoted 10 lines
Quoted 10 lines

Until you can do that, you have no case for your comment. Blindly using a define is something you tell junior programmers, sometimes, a number is just a number, nothing wrong with using it as is.

Quoted 4 lines

Feel free to ask your colleagues (Faisal L. and Shiraz S.) if they interested in maintainable driver code or they prefer your prone to errors copy-paste technique.

Quoted 5 lines
Quoted 1 line

Why don't you go back and read the comment made against

I40IW_SUCCESS?

Quoted 1 line

Maybe you will learn something from that?

Your word is a lamp for my feet, a light on my path. Please enlighten me.

I hope this clears up your misunderstand regarding my patch. I can't be any more clear than this.

Chien

Quoted 28 lines

Happy Christmas.

Quoted 25 lines
Quoted 16 lines
Quoted 16 lines

I already made my case on this. Enough said.

Chien

Quoted 1 line

[Chien]

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

Or maybe they still needed and should be renamed?

[Chien Tin Tung] They are not needed. Before we were checking against one version and one version only. Now we are making the provider library and driver backward compatible. All we need is one define to specify current ABI version.

Quoted 5 lines
Quoted 5 lines
Quoted 1 line
Quoted 1 line

Chien

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma"
in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html