Subject: Re: [RFC v2 06/12] qedr: Add support for QP verbs

From: Leon Romanovsky <[email-masked]>
Date: Tue, 20 Sep 2016 19:30:48 +0300

On Tue, Sep 20, 2016 at 01:35:58PM +0300, Ram Amrani wrote:
> From: Ram amrani <Ram.Amrani-YGCgFSpz5w/[email-masked]>
>
> Add support for Queue Pair verbs which adds, deletes,
> modifies and queries Queue Pairs.
>
> Signed-off-by: Rajesh Borundia <rajesh.borundia-YGCgFSpz5w/[email-masked]>
> Signed-off-by: Ram Amrani <Ram.Amrani-YGCgFSpz5w/[email-masked]>
> ---
>  drivers/infiniband/hw/qedr/main.c          |   15 +-
>  drivers/infiniband/hw/qedr/qedr.h          |  126 +++
>  drivers/infiniband/hw/qedr/qedr_cm.h       |   40 +
>  drivers/infiniband/hw/qedr/qedr_hsi_rdma.h |   11 +
>  drivers/infiniband/hw/qedr/verbs.c         | 1095 ++++++++++++++++++++++++-
>  drivers/infiniband/hw/qedr/verbs.h         |    7 +
>  drivers/net/ethernet/qlogic/qed/qed_cxt.h  |    1 +
>  drivers/net/ethernet/qlogic/qed/qed_roce.c | 1211 ++++++++++++++++++++++++++++
>  drivers/net/ethernet/qlogic/qed/qed_roce.h |   71 ++
>  include/linux/qed/qed_roce_if.h            |  144 ++++
>  include/uapi/rdma/providers/qedr-abi.h     |   35 +

Please be aware that the last version for ABI header files doesn't have
"provider" name in directory path (include/uapi/rdma/qedr-abi.h)

>  11 files changed, 2753 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/infiniband/hw/qedr/qedr_cm.h
>
> diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c
> index c99dd6a..10ad9ed 100644
> --- a/drivers/infiniband/hw/qedr/main.c
> +++ b/drivers/infiniband/hw/qedr/main.c
> @@ -52,7 +52,7 @@ uint debug;
>  module_param(debug, uint, 0);
>  MODULE_PARM_DESC(debug, "Default debug msglevel");
>
> -static LIST_HEAD(qedr_dev_list);

You are removing code which was added in previous patches, why do you do
it?

> +#define QEDR_WQ_MULTIPLIER_DFT	(3)
>
>  void qedr_ib_dispatch_event(struct qedr_dev *dev, u8 port_num,
>  			    enum ib_event_type type)
> @@ -99,7 +99,11 @@ static int qedr_register_device(struct qedr_dev *dev)
>  				     QEDR_UVERBS(CREATE_CQ) |
>  				     QEDR_UVERBS(RESIZE_CQ) |
>  				     QEDR_UVERBS(DESTROY_CQ) |
> -				     QEDR_UVERBS(REQ_NOTIFY_CQ);
> +				     QEDR_UVERBS(REQ_NOTIFY_CQ) |
> +				     QEDR_UVERBS(CREATE_QP) |
> +				     QEDR_UVERBS(MODIFY_QP) |
> +				     QEDR_UVERBS(QUERY_QP) |
> +				     QEDR_UVERBS(DESTROY_QP);
>
>  	dev->ibdev.phys_port_cnt = 1;
>  	dev->ibdev.num_comp_vectors = dev->num_cnq;
> @@ -124,6 +128,11 @@ static int qedr_register_device(struct qedr_dev *dev)
>  	dev->ibdev.resize_cq = qedr_resize_cq;
>  	dev->ibdev.req_notify_cq = qedr_arm_cq;
>
> +	dev->ibdev.create_qp = qedr_create_qp;
> +	dev->ibdev.modify_qp = qedr_modify_qp;
> +	dev->ibdev.query_qp = qedr_query_qp;
> +	dev->ibdev.destroy_qp = qedr_destroy_qp;
> +
>  	dev->ibdev.query_pkey = qedr_query_pkey;
>
>  	dev->ibdev.dma_device = &dev->pdev->dev;
> @@ -619,6 +628,8 @@ static struct qedr_dev *qedr_add(struct qed_dev *cdev, struct pci_dev *pdev,
>  		goto init_err;
>  	}
>
> +	dev->wq_multiplier = QEDR_WQ_MULTIPLIER_DFT;
> +
>  	qedr_pci_set_atomic(dev, pdev);
>
>  	rc = qedr_alloc_resources(dev);
> diff --git a/drivers/infiniband/hw/qedr/qedr.h b/drivers/infiniband/hw/qedr/qedr.h
> index dd974d5..05017be 100644
> --- a/drivers/infiniband/hw/qedr/qedr.h
> +++ b/drivers/infiniband/hw/qedr/qedr.h
> @@ -49,6 +49,9 @@
>  enum DP_QEDR_MODULE {
>  	QEDR_MSG_INIT = 0x10000,

We prefer shift notation (1 << 16) instead of 0x10000.

>  	QEDR_MSG_CQ = 0x20000,
> +	QEDR_MSG_RQ = 0x40000,
> +	QEDR_MSG_SQ = 0x80000,
> +	QEDR_MSG_QP = (QEDR_MSG_SQ | QEDR_MSG_RQ),
>  	QEDR_MSG_MR = 0x100000,
>  	QEDR_MSG_MISC = 0x400000,
>  };