Re: [PATCH 1/1] Staging: rdma: hfi1: rc.c: Fixed coding style issues

2016-05-25 Thread Dennis Dalessandro

On Mon, May 23, 2016 at 12:06:01PM +0530, Shyam Saini wrote:

Fixed following checkpatch.pl warnings:
 Prefer 'unsigned int' to bare use of 'unsigned'
 Prefer READ_ONCE() over ACCESS_ONCE()


In general please don't fix two types of issues in the same patch. Also, as 
to the unsinged -> unsigned int, the linux-rdma maintainer has already said 
we don't really want all of the code churn for this [1].


I suggest to respin this patch with just the ACCESS_ONCE->READ_ONCE change 
so that can be reviewed on it's own.


[1] http://marc.info/?l=linux-rdma=146308474205407=2

-Denny

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: rdma: hfi1: sdma.c: Fixed coding style issues

2016-05-23 Thread Dennis Dalessandro

On Mon, May 23, 2016 at 12:06:02PM +0530, Shyam Saini wrote:

Fixed following checkpatch.pl warnings:
   Prefer 'unsigned int' to bare use of 'unsigned'
   Prefer READ_ONCE() over ACCESS_ONCE()


Same response [1] as to your previous patch. If you do spin the READ_ONCE 
bit please squash the two.


[1] http://marc.info/?l=linux-rdma=146400717024632=2

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: rdma: hfi1: verbs_mcast: fixed a brace coding style issue

2016-02-24 Thread Dennis Dalessandro

On Sun, Feb 21, 2016 at 04:30:39PM +0100, Jannik Becher wrote:

Fixed a coding style issue.

Signed-off-by: Jannik Becher 
---
drivers/staging/rdma/hfi1/verbs_mcast.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/verbs_mcast.c 
b/drivers/staging/rdma/hfi1/verbs_mcast.c
index afc6b4c..c45d4b1 100644
--- a/drivers/staging/rdma/hfi1/verbs_mcast.c
+++ b/drivers/staging/rdma/hfi1/verbs_mcast.c
@@ -140,11 +140,11 @@ struct hfi1_mcast *hfi1_mcast_find(struct hfi1_ibport 
*ibp, union ib_gid *mgid)

ret = memcmp(mgid->raw, mcast->mgid.raw,
 sizeof(union ib_gid));
-   if (ret < 0)
+   if (ret < 0) {
n = n->rb_left;
-   else if (ret > 0)
+   } else if (ret > 0) {
n = n->rb_right;
-   else {
+   } else {
atomic_inc(>refcount);
spin_unlock_irqrestore(>lock, flags);
goto bail;
--


Doug,

This has been taken care already when I moved the code to rdmavt. Patch is 
submitted in the midst of my other stuff for 4.6. See:

http://www.spinics.net/lists/linux-rdma/msg32802.html

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 02/15] IB/hfi1: Add basic rdmavt capability flags for hfi1

2015-12-14 Thread Dennis Dalessandro
Most functionality is still being done in the driver, set flags so that
rdmavt will let hfi1 continue to handle mr, qp, and cq init.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/verbs.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index 4292d52..c457e82 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -2075,6 +2075,9 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
 */
dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files;
dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds;
+   dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |
+  RVT_FLAG_QP_INIT_DRIVER |
+  RVT_FLAG_CQ_INIT_DRIVER);
 
ret = rvt_register_device(>verbs_dev.rdi);
if (ret)

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 11/15] IB/hfi1: Remove hfi1 MR and hfi1 specific qp type

2015-12-14 Thread Dennis Dalessandro
This patch does the actual removal of the queue pair from the hfi1 driver
along with a number of dependent data structures. These were moved to rvt.

It also removes the MR functions to use those in rdmavt.

These two pieces can not reasonably be split apart becuase they depend on
each other.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
Signed-off-by: Jubin John <jubin.j...@intel.com>
---
 drivers/staging/rdma/hfi1/Makefile  |2 
 drivers/staging/rdma/hfi1/cq.c  |2 
 drivers/staging/rdma/hfi1/diag.c|8 
 drivers/staging/rdma/hfi1/driver.c  |   10 -
 drivers/staging/rdma/hfi1/hfi.h |   16 -
 drivers/staging/rdma/hfi1/keys.c|  356 -
 drivers/staging/rdma/hfi1/mmap.c|   24 +
 drivers/staging/rdma/hfi1/mr.c  |  522 ---
 drivers/staging/rdma/hfi1/pio.c |4 
 drivers/staging/rdma/hfi1/qp.c  |   88 +++--
 drivers/staging/rdma/hfi1/qp.h  |   41 +-
 drivers/staging/rdma/hfi1/rc.c  |  116 +++
 drivers/staging/rdma/hfi1/ruc.c |   89 +++--
 drivers/staging/rdma/hfi1/sdma.h|6 
 drivers/staging/rdma/hfi1/srq.c |   28 +-
 drivers/staging/rdma/hfi1/trace.h   |   22 +
 drivers/staging/rdma/hfi1/uc.c  |   10 -
 drivers/staging/rdma/hfi1/ud.c  |   18 +
 drivers/staging/rdma/hfi1/verbs.c   |  143 +++-
 drivers/staging/rdma/hfi1/verbs.h   |  372 +++---
 drivers/staging/rdma/hfi1/verbs_mcast.c |8 
 21 files changed, 349 insertions(+), 1536 deletions(-)
 delete mode 100644 drivers/staging/rdma/hfi1/keys.c
 delete mode 100644 drivers/staging/rdma/hfi1/mr.c

diff --git a/drivers/staging/rdma/hfi1/Makefile 
b/drivers/staging/rdma/hfi1/Makefile
index 2126b8b..3ba64fe 100644
--- a/drivers/staging/rdma/hfi1/Makefile
+++ b/drivers/staging/rdma/hfi1/Makefile
@@ -8,7 +8,7 @@
 obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o
 
 hfi1-y := chip.o cq.o device.o diag.o driver.o eprom.o file_ops.o firmware.o \
-   init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \
+   init.o intr.o mad.o mmap.o pcie.o pio.o pio_copy.o \
qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \
uc.o ud.o user_pages.o user_sdma.o verbs_mcast.o verbs.o
 hfi1-$(CONFIG_DEBUG_FS) += debugfs.o
diff --git a/drivers/staging/rdma/hfi1/cq.c b/drivers/staging/rdma/hfi1/cq.c
index 4f046ff..ffd0e7a 100644
--- a/drivers/staging/rdma/hfi1/cq.c
+++ b/drivers/staging/rdma/hfi1/cq.c
@@ -479,7 +479,7 @@ int hfi1_resize_cq(struct ib_cq *ibcq, int cqe, struct 
ib_udata *udata)
 
if (cq->ip) {
struct hfi1_ibdev *dev = to_idev(ibcq->device);
-   struct hfi1_mmap_info *ip = cq->ip;
+   struct rvt_mmap_info *ip = cq->ip;
 
hfi1_update_mmap_info(dev, ip, sz, wc);
 
diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c
index e172f2a..49822c1 100644
--- a/drivers/staging/rdma/hfi1/diag.c
+++ b/drivers/staging/rdma/hfi1/diag.c
@@ -1618,7 +1618,7 @@ int snoop_recv_handler(struct hfi1_packet *packet)
 /*
  * Handle snooping and capturing packets when sdma is being used.
  */
-int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,
+int snoop_send_dma_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
   u64 pbc)
 {
pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n");
@@ -1631,13 +1631,13 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct 
hfi1_pkt_state *ps,
  * bypass packets. The only way to send a bypass packet currently is to use the
  * diagpkt interface. When that interface is enable snoop/capture is not.
  */
-int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,
+int snoop_send_pio_handler(struct rvt_qp *qp, struct hfi1_pkt_state *ps,
   u64 pbc)
 {
struct hfi1_qp_priv *priv = qp->priv;
struct ahg_ib_header *ahdr = priv->s_hdr;
u32 hdrwords = qp->s_hdrwords;
-   struct hfi1_sge_state *ss = qp->s_cur_sge;
+   struct rvt_sge_state *ss = qp->s_cur_sge;
u32 len = qp->s_cur_size;
u32 dwords = (len + 3) >> 2;
u32 plen = hdrwords + dwords + 2; /* includes pbc */
@@ -1645,7 +1645,7 @@ int snoop_send_pio_handler(struct hfi1_qp *qp, struct 
hfi1_pkt_state *ps,
struct snoop_packet *s_packet = NULL;
u32 *hdr = (u32 *)>ibh;
u32 length = 0;
-   struct hfi1_sge_state temp_ss;
+   struct rvt_sge_state temp_ss;
void *data = NULL;
void *data_start = NULL;
int ret;
diff --git a/drivers/staging/rdma/hfi1/driver.c 
b/drivers/staging/rdma/hfi1/driver.c
index fb52d07..182e05f 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -318,7

[RFC PATCH 10/15] IB/hfi1: Implement hfi1 support for AH notification

2015-12-14 Thread Dennis Dalessandro
For OPA devices additional work is required to create an AH.
This patch adds support to set the VL correctly.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/verbs.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index e007c52..6d69491 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -1629,6 +1629,29 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct 
ib_ah_attr *ah_attr)
return 0;
 }
 
+static void hfi1_notify_new_ah(struct ib_device *ibdev,
+  struct ib_ah_attr *ah_attr,
+  struct rvt_ah *ah)
+{
+   struct hfi1_ibport *ibp;
+   struct hfi1_pportdata *ppd;
+   struct hfi1_devdata *dd;
+   u8 sc5;
+
+   /*
+* Do not trust reading anything from rvt_ah at this point as it is not
+* done being setup. We can however modify things which we need to set.
+*/
+
+   ibp = to_iport(ibdev, ah_attr->port_num);
+   ppd = ppd_from_ibp(ibp);
+   sc5 = ibp->sl_to_sc[ah->attr.sl];
+   dd = dd_from_ppd(ppd);
+   ah->vl = sc_to_vlt(dd, sc5);
+   if (ah->vl < num_vls || ah->vl == 15)
+   ah->log_pmtu = ilog2(dd->vld[ah->vl].mtu);
+}
+
 struct ib_ah *hfi1_create_qp0_ah(struct hfi1_ibport *ibp, u16 dlid)
 {
struct ib_ah_attr attr;
@@ -1919,6 +1942,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
dd->verbs_dev.rdi.driver_f.get_card_name = get_card_name;
dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev;
dd->verbs_dev.rdi.driver_f.check_ah = hfi1_check_ah;
+   dd->verbs_dev.rdi.driver_f.notify_new_ah = hfi1_notify_new_ah;
dd->verbs_dev.rdi.dparms.props.max_ah = hfi1_max_ahs;
dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds;
dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 15/15] IB/hfi1: Use rdmavt pkey verbs function

2015-12-14 Thread Dennis Dalessandro
No need to keep providing the query pkey function. This is now being
done in rdmavt. Remove support from hfi1. The allocation and
maintenance of the list still resides in the driver.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/verbs.c |   20 +---
 1 files changed, 1 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index d208717..e1f249a 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -1678,24 +1678,6 @@ unsigned hfi1_get_npkeys(struct hfi1_devdata *dd)
return ARRAY_SIZE(dd->pport[0].pkeys);
 }
 
-static int query_pkey(struct ib_device *ibdev, u8 port, u16 index,
- u16 *pkey)
-{
-   struct hfi1_devdata *dd = dd_from_ibdev(ibdev);
-   int ret;
-
-   if (index >= hfi1_get_npkeys(dd)) {
-   ret = -EINVAL;
-   goto bail;
-   }
-
-   *pkey = hfi1_get_pkey(to_iport(ibdev, port), index);
-   ret = 0;
-
-bail:
-   return ret;
-}
-
 /**
  * alloc_ucontext - allocate a ucontest
  * @ibdev: the infiniband device
@@ -1863,7 +1845,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
ibdev->modify_device = modify_device;
ibdev->query_port = query_port;
ibdev->modify_port = modify_port;
-   ibdev->query_pkey = query_pkey;
+   ibdev->query_pkey = NULL;
ibdev->query_gid = query_gid;
ibdev->alloc_ucontext = alloc_ucontext;
ibdev->dealloc_ucontext = dealloc_ucontext;

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 06/15] IB/hfi1: Remove driver specific members from hfi1 qp type

2015-12-14 Thread Dennis Dalessandro
In preparation for moving the queue pair data structure to rdmavt the
members of the driver specific queue pairs which are not common need to be
pushed off to a private driver structure. This structure will be available
in the queue pair once moved to rdmavt as a void pointer. This patch while
not adding a lot of value in and of itself is a prerequisite to move the
queue pair out of the drivers and into rdmavt.

The driver specific, private queue pair data structure should condense as
more of the send side code moves to rdmavt.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
Signed-off-by: Jubin John <jubin.j...@intel.com>
---
 drivers/staging/rdma/hfi1/diag.c  |3 +
 drivers/staging/rdma/hfi1/pio.c   |6 ++-
 drivers/staging/rdma/hfi1/qp.c|   76 -
 drivers/staging/rdma/hfi1/qp.h|9 +++-
 drivers/staging/rdma/hfi1/rc.c|7 ++-
 drivers/staging/rdma/hfi1/ruc.c   |   46 --
 drivers/staging/rdma/hfi1/uc.c|7 ++-
 drivers/staging/rdma/hfi1/ud.c|   37 +-
 drivers/staging/rdma/hfi1/verbs.c |   54 --
 drivers/staging/rdma/hfi1/verbs.h |   26 ++---
 10 files changed, 166 insertions(+), 105 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/diag.c b/drivers/staging/rdma/hfi1/diag.c
index 0cf324d..e172f2a 100644
--- a/drivers/staging/rdma/hfi1/diag.c
+++ b/drivers/staging/rdma/hfi1/diag.c
@@ -1634,7 +1634,8 @@ int snoop_send_dma_handler(struct hfi1_qp *qp, struct 
hfi1_pkt_state *ps,
 int snoop_send_pio_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,
   u64 pbc)
 {
-   struct ahg_ib_header *ahdr = qp->s_hdr;
+   struct hfi1_qp_priv *priv = qp->priv;
+   struct ahg_ib_header *ahdr = priv->s_hdr;
u32 hdrwords = qp->s_hdrwords;
struct hfi1_sge_state *ss = qp->s_cur_sge;
u32 len = qp->s_cur_size;
diff --git a/drivers/staging/rdma/hfi1/pio.c b/drivers/staging/rdma/hfi1/pio.c
index eab58c1..b5bce5e 100644
--- a/drivers/staging/rdma/hfi1/pio.c
+++ b/drivers/staging/rdma/hfi1/pio.c
@@ -1498,6 +1498,7 @@ static void sc_piobufavail(struct send_context *sc)
struct list_head *list;
struct hfi1_qp *qps[PIO_WAIT_BATCH_SIZE];
struct hfi1_qp *qp;
+   struct hfi1_qp_priv *priv;
unsigned long flags;
unsigned i, n = 0;
 
@@ -1517,8 +1518,9 @@ static void sc_piobufavail(struct send_context *sc)
if (n == ARRAY_SIZE(qps))
goto full;
wait = list_first_entry(list, struct iowait, list);
-   qp = container_of(wait, struct hfi1_qp, s_iowait);
-   list_del_init(>s_iowait.list);
+   qp = iowait_to_qp(wait);
+   priv = qp->priv;
+   list_del_init(>s_iowait.list);
/* refcount held until actual wake up */
qps[n++] = qp;
}
diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index bb447b5..d49b1e9 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -349,11 +349,12 @@ bail:
  */
 static void reset_qp(struct hfi1_qp *qp, enum ib_qp_type type)
 {
+   struct hfi1_qp_priv *priv = qp->priv;
qp->remote_qpn = 0;
qp->qkey = 0;
qp->qp_access_flags = 0;
iowait_init(
-   >s_iowait,
+   >s_iowait,
1,
hfi1_do_send,
iowait_sleep,
@@ -460,6 +461,7 @@ static void clear_mr_refs(struct hfi1_qp *qp, int clr_sends)
 int hfi1_error_qp(struct hfi1_qp *qp, enum ib_wc_status err)
 {
struct hfi1_ibdev *dev = to_idev(qp->ibqp.device);
+   struct hfi1_qp_priv *priv = qp->priv;
struct ib_wc wc;
int ret = 0;
 
@@ -477,9 +479,9 @@ int hfi1_error_qp(struct hfi1_qp *qp, enum ib_wc_status err)
qp->s_flags &= ~HFI1_S_ANY_WAIT_SEND;
 
write_seqlock(>iowait_lock);
-   if (!list_empty(>s_iowait.list) && !(qp->s_flags & HFI1_S_BUSY)) {
+   if (!list_empty(>s_iowait.list) && !(qp->s_flags & HFI1_S_BUSY)) {
qp->s_flags &= ~HFI1_S_ANY_WAIT_IO;
-   list_del_init(>s_iowait.list);
+   list_del_init(>s_iowait.list);
if (atomic_dec_and_test(>refcount))
wake_up(>wait);
}
@@ -544,11 +546,13 @@ bail:
 
 static void flush_tx_list(struct hfi1_qp *qp)
 {
-   while (!list_empty(>s_iowait.tx_head)) {
+   struct hfi1_qp_priv *priv = qp->priv;
+
+   while (!list_empty(>s_iowait.tx_head)) {
struct sdma_txreq *tx;
 
tx = list_first_entry(
-   >s_iowait.tx_head,
+   >s_iowait.tx_head,
  

[RFC PATCH 12/15] IB/hfi1: Remove srq from hfi1

2015-12-14 Thread Dennis Dalessandro
SRQ data structure has been moved to rdmavt. Make use of it.

Reviewed-by: Harish Chegondi <harish.chego...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/qp.c|2 +-
 drivers/staging/rdma/hfi1/ruc.c   |4 ++--
 drivers/staging/rdma/hfi1/srq.c   |   10 +-
 drivers/staging/rdma/hfi1/verbs.h |   13 -
 4 files changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index b82855f..045ee74 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -1092,7 +1092,7 @@ struct ib_qp *hfi1_create_qp(struct ib_pd *ibpd,
sz = sizeof(*qp);
sg_list_sz = 0;
if (init_attr->srq) {
-   struct hfi1_srq *srq = to_isrq(init_attr->srq);
+   struct rvt_srq *srq = ibsrq_to_rvtsrq(init_attr->srq);
 
if (srq->rq.max_sge > 1)
sg_list_sz = sizeof(*qp->r_sg_list) *
diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c
index 558dadb..9841e89 100644
--- a/drivers/staging/rdma/hfi1/ruc.c
+++ b/drivers/staging/rdma/hfi1/ruc.c
@@ -159,14 +159,14 @@ int hfi1_get_rwqe(struct rvt_qp *qp, int wr_id_only)
unsigned long flags;
struct rvt_rq *rq;
struct rvt_rwq *wq;
-   struct hfi1_srq *srq;
+   struct rvt_srq *srq;
struct rvt_rwqe *wqe;
void (*handler)(struct ib_event *, void *);
u32 tail;
int ret;
 
if (qp->ibqp.srq) {
-   srq = to_isrq(qp->ibqp.srq);
+   srq = ibsrq_to_rvtsrq(qp->ibqp.srq);
handler = srq->ibsrq.event_handler;
rq = >rq;
} else {
diff --git a/drivers/staging/rdma/hfi1/srq.c b/drivers/staging/rdma/hfi1/srq.c
index 932bd96..78f190a 100644
--- a/drivers/staging/rdma/hfi1/srq.c
+++ b/drivers/staging/rdma/hfi1/srq.c
@@ -65,7 +65,7 @@
 int hfi1_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
  struct ib_recv_wr **bad_wr)
 {
-   struct hfi1_srq *srq = to_isrq(ibsrq);
+   struct rvt_srq *srq = ibsrq_to_rvtsrq(ibsrq);
struct rvt_rwq *wq;
unsigned long flags;
int ret;
@@ -120,7 +120,7 @@ struct ib_srq *hfi1_create_srq(struct ib_pd *ibpd,
   struct ib_udata *udata)
 {
struct hfi1_ibdev *dev = to_idev(ibpd->device);
-   struct hfi1_srq *srq;
+   struct rvt_srq *srq;
u32 sz;
struct ib_srq *ret;
 
@@ -229,7 +229,7 @@ int hfi1_modify_srq(struct ib_srq *ibsrq, struct 
ib_srq_attr *attr,
enum ib_srq_attr_mask attr_mask,
struct ib_udata *udata)
 {
-   struct hfi1_srq *srq = to_isrq(ibsrq);
+   struct rvt_srq *srq = ibsrq_to_rvtsrq(ibsrq);
struct rvt_rwq *wq;
int ret = 0;
 
@@ -367,7 +367,7 @@ bail:
 
 int hfi1_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr)
 {
-   struct hfi1_srq *srq = to_isrq(ibsrq);
+   struct rvt_srq *srq = ibsrq_to_rvtsrq(ibsrq);
 
attr->max_wr = srq->rq.size - 1;
attr->max_sge = srq->rq.max_sge;
@@ -381,7 +381,7 @@ int hfi1_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr 
*attr)
  */
 int hfi1_destroy_srq(struct ib_srq *ibsrq)
 {
-   struct hfi1_srq *srq = to_isrq(ibsrq);
+   struct rvt_srq *srq = ibsrq_to_rvtsrq(ibsrq);
struct hfi1_ibdev *dev = to_idev(ibsrq->device);
 
spin_lock(>n_srqs_lock);
diff --git a/drivers/staging/rdma/hfi1/verbs.h 
b/drivers/staging/rdma/hfi1/verbs.h
index fec5e7b..f4ec83c 100644
--- a/drivers/staging/rdma/hfi1/verbs.h
+++ b/drivers/staging/rdma/hfi1/verbs.h
@@ -263,14 +263,6 @@ struct hfi1_cq {
struct rvt_mmap_info *ip;
 };
 
-struct hfi1_srq {
-   struct ib_srq ibsrq;
-   struct rvt_rq rq;
-   struct rvt_mmap_info *ip;
-   /* send signal when number of RWQEs < limit */
-   u32 limit;
-};
-
 /*
  * hfi1 specific data structures that will be hidden from rvt after the queue
  * pair is made common
@@ -537,11 +529,6 @@ static inline struct hfi1_cq *to_icq(struct ib_cq *ibcq)
return container_of(ibcq, struct hfi1_cq, ibcq);
 }
 
-static inline struct hfi1_srq *to_isrq(struct ib_srq *ibsrq)
-{
-   return container_of(ibsrq, struct hfi1_srq, ibsrq);
-}
-
 static inline struct rvt_qp *to_iqp(struct ib_qp *ibqp)
 {
return container_of(ibqp, struct rvt_qp, ibqp);

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 09/15] IB/hfi1: Use address handle in rdmavt and remove from hfi1

2015-12-14 Thread Dennis Dalessandro
Original patch from Kamal Heib <kam...@mellanox.com>, split
apart from original and modified to accomodate recent changes
in rdmavt.

Remove AH from hfi1 and use rdmavt version.

Signed-off-by: Kamal Heib <kam...@mellanox.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
Signed-off-by: Jubin John <jubin.j...@intel.com>
---
 drivers/staging/rdma/hfi1/common.h |2 -
 drivers/staging/rdma/hfi1/mad.c|2 -
 drivers/staging/rdma/hfi1/qp.c |6 +-
 drivers/staging/rdma/hfi1/ruc.c|2 -
 drivers/staging/rdma/hfi1/ud.c |4 +
 drivers/staging/rdma/hfi1/verbs.c  |  131 ++--
 drivers/staging/rdma/hfi1/verbs.h  |   20 +
 7 files changed, 18 insertions(+), 149 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/common.h 
b/drivers/staging/rdma/hfi1/common.h
index 5dd9272..b0c415a 100644
--- a/drivers/staging/rdma/hfi1/common.h
+++ b/drivers/staging/rdma/hfi1/common.h
@@ -341,7 +341,6 @@ struct hfi1_message_header {
 #define FULL_MGMT_P_KEY  0x
 
 #define DEFAULT_P_KEY LIM_MGMT_P_KEY
-#define HFI1_PERMISSIVE_LID 0x
 #define HFI1_AETH_CREDIT_SHIFT 24
 #define HFI1_AETH_CREDIT_MASK 0x1F
 #define HFI1_AETH_CREDIT_INVAL 0x1F
@@ -353,7 +352,6 @@ struct hfi1_message_header {
 #define HFI1_BECN_SHIFT 30
 #define HFI1_BECN_MASK 1
 #define HFI1_BECN_SMASK (1 << HFI1_BECN_SHIFT)
-#define HFI1_MULTICAST_LID_BASE 0xC000
 
 static inline __u64 rhf_to_cpu(const __le32 *rbuf)
 {
diff --git a/drivers/staging/rdma/hfi1/mad.c b/drivers/staging/rdma/hfi1/mad.c
index 0a3f291..8e9d1e7 100644
--- a/drivers/staging/rdma/hfi1/mad.c
+++ b/drivers/staging/rdma/hfi1/mad.c
@@ -137,7 +137,7 @@ static void send_trap(struct hfi1_ibport *ibp, void *data, 
unsigned len)
ret = PTR_ERR(ah);
else {
send_buf->ah = ah;
-   ibp->sm_ah = to_iah(ah);
+   ibp->sm_ah = ibah_to_rvtah(ah);
ret = 0;
}
} else
diff --git a/drivers/staging/rdma/hfi1/qp.c b/drivers/staging/rdma/hfi1/qp.c
index 7c356e4..bbe6b4d 100644
--- a/drivers/staging/rdma/hfi1/qp.c
+++ b/drivers/staging/rdma/hfi1/qp.c
@@ -424,7 +424,7 @@ static void clear_mr_refs(struct hfi1_qp *qp, int clr_sends)
if (qp->ibqp.qp_type == IB_QPT_UD ||
qp->ibqp.qp_type == IB_QPT_SMI ||
qp->ibqp.qp_type == IB_QPT_GSI)
-   atomic_dec(_iah(wqe->ud_wr.ah)->refcount);
+   
atomic_dec(_to_rvtah(wqe->ud_wr.ah)->refcount);
if (++qp->s_last >= qp->s_size)
qp->s_last = 0;
}
@@ -642,7 +642,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr 
*attr,
 
if (attr->ah_attr.dlid >= be16_to_cpu(IB_MULTICAST_LID_BASE))
goto inval;
-   if (hfi1_check_ah(qp->ibqp.device, >ah_attr))
+   if (rvt_check_ah(qp->ibqp.device, >ah_attr))
goto inval;
sc = ah_to_sc(ibqp->device, >ah_attr);
if (!qp_to_sdma_engine(qp, sc) &&
@@ -656,7 +656,7 @@ int hfi1_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr 
*attr,
if (attr->alt_ah_attr.dlid >=
be16_to_cpu(IB_MULTICAST_LID_BASE))
goto inval;
-   if (hfi1_check_ah(qp->ibqp.device, >alt_ah_attr))
+   if (rvt_check_ah(qp->ibqp.device, >alt_ah_attr))
goto inval;
if (attr->alt_pkey_index >= hfi1_get_npkeys(dd))
goto inval;
diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c
index 736b44d..4108c6a 100644
--- a/drivers/staging/rdma/hfi1/ruc.c
+++ b/drivers/staging/rdma/hfi1/ruc.c
@@ -891,7 +891,7 @@ void hfi1_send_complete(struct hfi1_qp *qp, struct 
hfi1_swqe *wqe,
if (qp->ibqp.qp_type == IB_QPT_UD ||
qp->ibqp.qp_type == IB_QPT_SMI ||
qp->ibqp.qp_type == IB_QPT_GSI)
-   atomic_dec(_iah(wqe->ud_wr.ah)->refcount);
+   atomic_dec(_to_rvtah(wqe->ud_wr.ah)->refcount);
 
/* See ch. 11.2.4.1 and 10.7.3.1 */
if (!(qp->s_flags & HFI1_S_SIGNAL_REQ_WR) ||
diff --git a/drivers/staging/rdma/hfi1/ud.c b/drivers/staging/rdma/hfi1/ud.c
index aad4e49..24b6077 100644
--- a/drivers/staging/rdma/hfi1/ud.c
+++ b/drivers/staging/rdma/hfi1/ud.c
@@ -98,7 +98,7 @@ static void ud_loopback(struct hfi1_qp *sqp, struct hfi1_swqe 
*swqe)
goto drop;
}
 
-   ah_attr = _iah(swqe->ud_wr.ah)->attr;
+   ah_attr = _to_rvtah(swqe->ud_wr.ah)->attr;
ppd = ppd_fro

[RFC PATCH 04/15] IB/hfi1: Use rdmavt protection domain

2015-12-14 Thread Dennis Dalessandro
Remove protection domain from hfi1 and use rdmavt's version.

Reviewed-by: Ira Weiny <ira.we...@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/keys.c  |4 +-
 drivers/staging/rdma/hfi1/mr.c|2 +
 drivers/staging/rdma/hfi1/ruc.c   |4 +-
 drivers/staging/rdma/hfi1/verbs.c |   67 +++--
 drivers/staging/rdma/hfi1/verbs.h |   15 +---
 5 files changed, 12 insertions(+), 80 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/keys.c b/drivers/staging/rdma/hfi1/keys.c
index cb4e608..57a266f 100644
--- a/drivers/staging/rdma/hfi1/keys.c
+++ b/drivers/staging/rdma/hfi1/keys.c
@@ -176,7 +176,7 @@ out:
  * Check the IB SGE for validity and initialize our internal version
  * of it.
  */
-int hfi1_lkey_ok(struct hfi1_lkey_table *rkt, struct hfi1_pd *pd,
+int hfi1_lkey_ok(struct hfi1_lkey_table *rkt, struct rvt_pd *pd,
 struct hfi1_sge *isge, struct ib_sge *sge, int acc)
 {
struct hfi1_mregion *mr;
@@ -285,7 +285,7 @@ int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge,
 */
rcu_read_lock();
if (rkey == 0) {
-   struct hfi1_pd *pd = to_ipd(qp->ibqp.pd);
+   struct rvt_pd *pd = ibpd_to_rvtpd(qp->ibqp.pd);
struct hfi1_ibdev *dev = to_idev(pd->ibpd.device);
 
if (pd->user)
diff --git a/drivers/staging/rdma/hfi1/mr.c b/drivers/staging/rdma/hfi1/mr.c
index 568f185..02589b2 100644
--- a/drivers/staging/rdma/hfi1/mr.c
+++ b/drivers/staging/rdma/hfi1/mr.c
@@ -116,7 +116,7 @@ struct ib_mr *hfi1_get_dma_mr(struct ib_pd *pd, int acc)
struct ib_mr *ret;
int rval;
 
-   if (to_ipd(pd)->user) {
+   if (ibpd_to_rvtpd(pd)->user) {
ret = ERR_PTR(-EPERM);
goto bail;
}
diff --git a/drivers/staging/rdma/hfi1/ruc.c b/drivers/staging/rdma/hfi1/ruc.c
index 317bf6f..eb7aea9 100644
--- a/drivers/staging/rdma/hfi1/ruc.c
+++ b/drivers/staging/rdma/hfi1/ruc.c
@@ -102,11 +102,11 @@ static int init_sge(struct hfi1_qp *qp, struct hfi1_rwqe 
*wqe)
int i, j, ret;
struct ib_wc wc;
struct hfi1_lkey_table *rkt;
-   struct hfi1_pd *pd;
+   struct rvt_pd *pd;
struct hfi1_sge_state *ss;
 
rkt = _idev(qp->ibqp.device)->lk_table;
-   pd = to_ipd(qp->ibqp.srq ? qp->ibqp.srq->pd : qp->ibqp.pd);
+   pd = ibpd_to_rvtpd(qp->ibqp.srq ? qp->ibqp.srq->pd : qp->ibqp.pd);
ss = >r_sge;
ss->sg_list = qp->r_sg_list;
qp->r_len = 0;
diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index 22e2742..1390755 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -368,7 +368,7 @@ static int post_one_send(struct hfi1_qp *qp, struct 
ib_send_wr *wr)
int j;
int acc;
struct hfi1_lkey_table *rkt;
-   struct hfi1_pd *pd;
+   struct rvt_pd *pd;
struct hfi1_devdata *dd = dd_from_ibdev(qp->ibqp.device);
struct hfi1_pportdata *ppd;
struct hfi1_ibport *ibp;
@@ -413,7 +413,7 @@ static int post_one_send(struct hfi1_qp *qp, struct 
ib_send_wr *wr)
return -ENOMEM;
 
rkt = _idev(qp->ibqp.device)->lk_table;
-   pd = to_ipd(qp->ibqp.pd);
+   pd = ibpd_to_rvtpd(qp->ibqp.pd);
wqe = get_swqe_ptr(qp, qp->s_head);
 
 
@@ -1394,7 +1394,7 @@ static int query_device(struct ib_device *ibdev,
props->max_mr = dev->lk_table.max;
props->max_fmr = dev->lk_table.max;
props->max_map_per_fmr = 32767;
-   props->max_pd = hfi1_max_pds;
+   props->max_pd = dev->rdi.dparms.props.max_pd;
props->max_qp_rd_atom = HFI1_MAX_RDMA_ATOMIC;
props->max_qp_init_rd_atom = 255;
/* props->max_res_rd_atom */
@@ -1592,61 +1592,6 @@ static int query_gid(struct ib_device *ibdev, u8 port,
return ret;
 }
 
-static struct ib_pd *alloc_pd(struct ib_device *ibdev,
- struct ib_ucontext *context,
- struct ib_udata *udata)
-{
-   struct hfi1_ibdev *dev = to_idev(ibdev);
-   struct hfi1_pd *pd;
-   struct ib_pd *ret;
-
-   /*
-* This is actually totally arbitrary.  Some correctness tests
-* assume there's a maximum number of PDs that can be allocated.
-* We don't actually have this limit, but we fail the test if
-* we allow allocations of more than we report for this value.
-*/
-
-   pd = kmalloc(sizeof(*pd), GFP_KERNEL);
-   if (!pd) {
-   ret = ERR_PTR(-ENOMEM);
-   goto bail;
-   }
-
-   spin_lock(>n_pds_lock);
-   if (dev->n_pds_allocated == hfi1_max_pds) {
-   spin_unlock(>n_pds_loc

[RFC PATCH 03/15] IB/hfi1: Consolidate dma ops for hfi1

2015-12-14 Thread Dennis Dalessandro
Remove the dma.c file from hfi1 in favor of using that which is
present in rdmavt.

Reviewed-by: Ira Weiny <ira.we...@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/Makefile |2 +-
 drivers/staging/rdma/hfi1/verbs.c  |2 +-
 drivers/staging/rdma/hfi1/verbs.h  |2 --
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/Makefile 
b/drivers/staging/rdma/hfi1/Makefile
index 2e5daa6..2126b8b 100644
--- a/drivers/staging/rdma/hfi1/Makefile
+++ b/drivers/staging/rdma/hfi1/Makefile
@@ -7,7 +7,7 @@
 #
 obj-$(CONFIG_INFINIBAND_HFI1) += hfi1.o
 
-hfi1-y := chip.o cq.o device.o diag.o dma.o driver.o eprom.o file_ops.o 
firmware.o \
+hfi1-y := chip.o cq.o device.o diag.o driver.o eprom.o file_ops.o firmware.o \
init.o intr.o keys.o mad.o mmap.o mr.o pcie.o pio.o pio_copy.o \
qp.o qsfp.o rc.o ruc.o sdma.o srq.o sysfs.o trace.o twsi.o \
uc.o ud.o user_pages.o user_sdma.o verbs_mcast.o verbs.o
diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index c457e82..22e2742 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -2064,7 +2064,7 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
ibdev->detach_mcast = hfi1_multicast_detach;
ibdev->process_mad = hfi1_process_mad;
ibdev->mmap = hfi1_mmap;
-   ibdev->dma_ops = _dma_mapping_ops;
+   ibdev->dma_ops = NULL;
ibdev->get_port_immutable = port_immutable;
 
strncpy(ibdev->node_desc, init_utsname()->nodename,
diff --git a/drivers/staging/rdma/hfi1/verbs.h 
b/drivers/staging/rdma/hfi1/verbs.h
index a290ed3..4f23e00 100644
--- a/drivers/staging/rdma/hfi1/verbs.h
+++ b/drivers/staging/rdma/hfi1/verbs.h
@@ -1155,6 +1155,4 @@ extern unsigned int hfi1_max_srq_wrs;
 
 extern const u32 ib_hfi1_rnr_table[];
 
-extern struct ib_dma_mapping_ops hfi1_dma_mapping_ops;
-
 #endif  /* HFI1_VERBS_H */

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 00/15] staging/rdma/hfi1: Initial patches to add rdmavt support in HFI1

2015-12-14 Thread Dennis Dalessandro
This patch series is being submitted as a Request For Comment only. It depends
on code submitted to the rdma subsystem [1].

This work is the first submission aimed to satisfy the TODO item for removing
duplicated code in hfi1. At the time of submission hfi1 and qib contained alot
of duplicated verbs processing code. The qib driver is having similar changes
made to use rdmavt. This will result in a common code base that both drivers and
future drivers such as soft-roce can use.

Note that due to the ongoing submission of hfi1 improvement patches, there will
likely be a number of conflicts which will still need to be resolved.

We also are still faced with the issue of separate trees for this work as was
discussed previously [2]. The result of that conversation was to keep the
drivers in separate trees until the 4.5 merge window. We are hoping that after
this merge window a single maintainer can take control of hfi1, qib, and rdmavt
so that these patches can move forward and be applied.

For now though we would like to get feedback on these patches with more to
follow.

[1] https://www.mail-archive.com/linux-rdma@vger.kernel.org/msg30074.html
[2] https://www.mail-archive.com/linux-rdma%40vger.kernel.org/msg29360.html

---

Dennis Dalessandro (15):
  IB/hfi1: Begin to use rdmavt for verbs
  IB/hfi1: Add basic rdmavt capability flags for hfi1
  IB/hfi1: Consolidate dma ops for hfi1
  IB/hfi1: Use rdmavt protection domain
  IB/hfi1: Remove MR data structures from hfi1
  IB/hfi1: Remove driver specific members from hfi1 qp type
  IB/hfi1: Add device specific info prints
  IB/hfi1: Use correct rdmavt header files after move.
  IB/hfi1: Use address handle in rdmavt and remove from hfi1
  IB/hfi1: Implement hfi1 support for AH notification
  IB/hfi1: Remove hfi1 MR and hfi1 specific qp type
  IB/hfi1: Remove srq from hfi1
  IB/hfi1: Remove ibport and use rdmavt version
  IB/hfi1: Remove mmap from hfi1
  IB/hfi1: Use rdmavt pkey verbs function


 drivers/staging/rdma/hfi1/Kconfig   |2 
 drivers/staging/rdma/hfi1/Makefile  |4 
 drivers/staging/rdma/hfi1/chip.c|   36 +-
 drivers/staging/rdma/hfi1/common.h  |2 
 drivers/staging/rdma/hfi1/cq.c  |   20 +
 drivers/staging/rdma/hfi1/diag.c|   13 -
 drivers/staging/rdma/hfi1/driver.c  |   31 +-
 drivers/staging/rdma/hfi1/hfi.h |   27 +-
 drivers/staging/rdma/hfi1/init.c|5 
 drivers/staging/rdma/hfi1/intr.c|2 
 drivers/staging/rdma/hfi1/keys.c|  356 -
 drivers/staging/rdma/hfi1/mad.c |  163 +-
 drivers/staging/rdma/hfi1/mmap.c|  192 ---
 drivers/staging/rdma/hfi1/mr.c  |  522 --
 drivers/staging/rdma/hfi1/pio.c |   10 -
 drivers/staging/rdma/hfi1/qp.c  |  214 +++-
 drivers/staging/rdma/hfi1/qp.h  |   44 +--
 drivers/staging/rdma/hfi1/rc.c  |  155 +
 drivers/staging/rdma/hfi1/ruc.c |  161 +
 drivers/staging/rdma/hfi1/sdma.h|8 
 drivers/staging/rdma/hfi1/srq.c |   58 ++-
 drivers/staging/rdma/hfi1/sysfs.c   |   18 +
 drivers/staging/rdma/hfi1/trace.h   |   22 +
 drivers/staging/rdma/hfi1/uc.c  |   19 +
 drivers/staging/rdma/hfi1/ud.c  |   91 +++--
 drivers/staging/rdma/hfi1/verbs.c   |  526 +++
 drivers/staging/rdma/hfi1/verbs.h   |  531 ---
 drivers/staging/rdma/hfi1/verbs_mcast.c |   36 +-
 28 files changed, 843 insertions(+), 2425 deletions(-)
 delete mode 100644 drivers/staging/rdma/hfi1/keys.c
 delete mode 100644 drivers/staging/rdma/hfi1/mmap.c
 delete mode 100644 drivers/staging/rdma/hfi1/mr.c

--
-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 05/15] IB/hfi1: Remove MR data structures from hfi1

2015-12-14 Thread Dennis Dalessandro
Remove MR data structures from hfi1 and use the version in rdmavt

Reviewed-by: Dean Luick <dean.lu...@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
---
 drivers/staging/rdma/hfi1/keys.c  |   30 +-
 drivers/staging/rdma/hfi1/mr.c|   22 ++---
 drivers/staging/rdma/hfi1/ruc.c   |4 +-
 drivers/staging/rdma/hfi1/sdma.h  |2 +
 drivers/staging/rdma/hfi1/ud.c|2 +
 drivers/staging/rdma/hfi1/verbs.c |   16 +
 drivers/staging/rdma/hfi1/verbs.h |   63 ++---
 7 files changed, 48 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/keys.c b/drivers/staging/rdma/hfi1/keys.c
index 57a266f..ffaaa6f 100644
--- a/drivers/staging/rdma/hfi1/keys.c
+++ b/drivers/staging/rdma/hfi1/keys.c
@@ -63,21 +63,21 @@
  *
  */
 
-int hfi1_alloc_lkey(struct hfi1_mregion *mr, int dma_region)
+int hfi1_alloc_lkey(struct rvt_mregion *mr, int dma_region)
 {
unsigned long flags;
u32 r;
u32 n;
int ret = 0;
struct hfi1_ibdev *dev = to_idev(mr->pd->device);
-   struct hfi1_lkey_table *rkt = >lk_table;
+   struct rvt_lkey_table *rkt = >lk_table;
 
hfi1_get_mr(mr);
spin_lock_irqsave(>lock, flags);
 
/* special case for dma_mr lkey == 0 */
if (dma_region) {
-   struct hfi1_mregion *tmr;
+   struct rvt_mregion *tmr;
 
tmr = rcu_access_pointer(dev->dma_mr);
if (!tmr) {
@@ -133,13 +133,13 @@ bail:
  * hfi1_free_lkey - free an lkey
  * @mr: mr to free from tables
  */
-void hfi1_free_lkey(struct hfi1_mregion *mr)
+void hfi1_free_lkey(struct rvt_mregion *mr)
 {
unsigned long flags;
u32 lkey = mr->lkey;
u32 r;
struct hfi1_ibdev *dev = to_idev(mr->pd->device);
-   struct hfi1_lkey_table *rkt = >lk_table;
+   struct rvt_lkey_table *rkt = >lk_table;
int freed = 0;
 
spin_lock_irqsave(>lock, flags);
@@ -176,10 +176,10 @@ out:
  * Check the IB SGE for validity and initialize our internal version
  * of it.
  */
-int hfi1_lkey_ok(struct hfi1_lkey_table *rkt, struct rvt_pd *pd,
+int hfi1_lkey_ok(struct rvt_lkey_table *rkt, struct rvt_pd *pd,
 struct hfi1_sge *isge, struct ib_sge *sge, int acc)
 {
-   struct hfi1_mregion *mr;
+   struct rvt_mregion *mr;
unsigned n, m;
size_t off;
 
@@ -231,15 +231,15 @@ int hfi1_lkey_ok(struct hfi1_lkey_table *rkt, struct 
rvt_pd *pd,
 
entries_spanned_by_off = off >> mr->page_shift;
off -= (entries_spanned_by_off << mr->page_shift);
-   m = entries_spanned_by_off / HFI1_SEGSZ;
-   n = entries_spanned_by_off % HFI1_SEGSZ;
+   m = entries_spanned_by_off / RVT_SEGSZ;
+   n = entries_spanned_by_off % RVT_SEGSZ;
} else {
m = 0;
n = 0;
while (off >= mr->map[m]->segs[n].length) {
off -= mr->map[m]->segs[n].length;
n++;
-   if (n >= HFI1_SEGSZ) {
+   if (n >= RVT_SEGSZ) {
m++;
n = 0;
}
@@ -274,8 +274,8 @@ bail:
 int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge,
 u32 len, u64 vaddr, u32 rkey, int acc)
 {
-   struct hfi1_lkey_table *rkt = _idev(qp->ibqp.device)->lk_table;
-   struct hfi1_mregion *mr;
+   struct rvt_lkey_table *rkt = _idev(qp->ibqp.device)->lk_table;
+   struct rvt_mregion *mr;
unsigned n, m;
size_t off;
 
@@ -328,15 +328,15 @@ int hfi1_rkey_ok(struct hfi1_qp *qp, struct hfi1_sge *sge,
 
entries_spanned_by_off = off >> mr->page_shift;
off -= (entries_spanned_by_off << mr->page_shift);
-   m = entries_spanned_by_off / HFI1_SEGSZ;
-   n = entries_spanned_by_off % HFI1_SEGSZ;
+   m = entries_spanned_by_off / RVT_SEGSZ;
+   n = entries_spanned_by_off % RVT_SEGSZ;
} else {
m = 0;
n = 0;
while (off >= mr->map[m]->segs[n].length) {
off -= mr->map[m]->segs[n].length;
n++;
-   if (n >= HFI1_SEGSZ) {
+   if (n >= RVT_SEGSZ) {
m++;
n = 0;
}
diff --git a/drivers/staging/rdma/hfi1/mr.c b/drivers/staging/rdma/hfi1/mr.c
index 02589b2..27f8081 100644
--- a/drivers/staging/rdma/hfi1/mr.c
+++ b/drivers/staging/rdma/hfi1/mr.c
@@ -56,7 +56,7 @@
 /* Fast memory region */
 struct hfi1_fmr {
struct ib_fmr ibfmr

[RFC PATCH 07/15] IB/hfi1: Add device specific info prints

2015-12-14 Thread Dennis Dalessandro
Implement get_card_name and get_pci_dev helper functions for rdmavt
for hfi1.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Reviewed-by: Ira Weiny <ira.we...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessa...@intel.com>
---
 drivers/staging/rdma/hfi1/driver.c |   16 
 drivers/staging/rdma/hfi1/hfi.h|2 ++
 drivers/staging/rdma/hfi1/verbs.c  |2 ++
 3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/driver.c 
b/drivers/staging/rdma/hfi1/driver.c
index 4c52e78..4f0103b 100644
--- a/drivers/staging/rdma/hfi1/driver.c
+++ b/drivers/staging/rdma/hfi1/driver.c
@@ -162,6 +162,22 @@ const char *get_unit_name(int unit)
return iname;
 }
 
+const char *get_card_name(struct rvt_dev_info *rdi)
+{
+   struct hfi1_ibdev *ibdev = container_of(rdi, struct hfi1_ibdev, rdi);
+   struct hfi1_devdata *dd = container_of(ibdev,
+  struct hfi1_devdata, verbs_dev);
+   return get_unit_name(dd->unit);
+}
+
+struct pci_dev *get_pci_dev(struct rvt_dev_info *rdi)
+{
+   struct hfi1_ibdev *ibdev = container_of(rdi, struct hfi1_ibdev, rdi);
+   struct hfi1_devdata *dd = container_of(ibdev,
+  struct hfi1_devdata, verbs_dev);
+   return dd->pcidev;
+}
+
 /*
  * Return count of units with at least one port ACTIVE.
  */
diff --git a/drivers/staging/rdma/hfi1/hfi.h b/drivers/staging/rdma/hfi1/hfi.h
index c4991be..5925deb 100644
--- a/drivers/staging/rdma/hfi1/hfi.h
+++ b/drivers/staging/rdma/hfi1/hfi.h
@@ -1604,6 +1604,8 @@ int get_platform_config_field(struct hfi1_devdata *dd,
 dma_addr_t hfi1_map_page(struct pci_dev *, struct page *, unsigned long,
 size_t, int);
 const char *get_unit_name(int unit);
+const char *get_card_name(struct rvt_dev_info *rdi);
+struct pci_dev *get_pci_dev(struct rvt_dev_info *rdi);
 
 /*
  * Flush write combining store buffers (if present) and perform a write
diff --git a/drivers/staging/rdma/hfi1/verbs.c 
b/drivers/staging/rdma/hfi1/verbs.c
index b810142..1477d00 100644
--- a/drivers/staging/rdma/hfi1/verbs.c
+++ b/drivers/staging/rdma/hfi1/verbs.c
@@ -2031,6 +2031,8 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd)
 * Fill in rvt info object.
 */
dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files;
+   dd->verbs_dev.rdi.driver_f.get_card_name = get_card_name;
+   dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev;
dd->verbs_dev.rdi.dparms.props.max_pd = hfi1_max_pds;
dd->verbs_dev.rdi.flags = (RVT_FLAG_MR_INIT_DRIVER |
   RVT_FLAG_QP_INIT_DRIVER |

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RFC PATCH 13/15] IB/hfi1: Remove ibport and use rdmavt version

2015-12-14 Thread Dennis Dalessandro
Remove most of the ibport members from hfi1 and use the rdmavt version.
Also register the port with rdmavt.

Reviewed-by: Mike Marciniszyn <mike.marcinis...@intel.com>
Reviewed-by: Harish Chegondi <harish.chego...@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
Signed-off-by: Jubin John <jubin.j...@intel.com>
---
 drivers/staging/rdma/hfi1/chip.c|   34 +++
 drivers/staging/rdma/hfi1/driver.c  |2 
 drivers/staging/rdma/hfi1/hfi.h |8 +-
 drivers/staging/rdma/hfi1/mad.c |  152 ---
 drivers/staging/rdma/hfi1/qp.c  |   23 ++---
 drivers/staging/rdma/hfi1/qp.h  |2 
 drivers/staging/rdma/hfi1/rc.c  |   32 +++
 drivers/staging/rdma/hfi1/ruc.c |   14 ++-
 drivers/staging/rdma/hfi1/uc.c  |2 
 drivers/staging/rdma/hfi1/ud.c  |   16 ++-
 drivers/staging/rdma/hfi1/verbs.c   |   61 +++-
 drivers/staging/rdma/hfi1/verbs.h   |   51 +-
 drivers/staging/rdma/hfi1/verbs_mcast.c |   28 +++---
 13 files changed, 198 insertions(+), 227 deletions(-)

diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c
index f799b86..6d916d0 100644
--- a/drivers/staging/rdma/hfi1/chip.c
+++ b/drivers/staging/rdma/hfi1/chip.c
@@ -1543,8 +1543,8 @@ static u64 access_sw_cpu_##cntr(const struct cntr_entry 
*entry, \
  void *context, int vl, int mode, u64 data)  \
 {\
struct hfi1_pportdata *ppd = (struct hfi1_pportdata *)context;\
-   return read_write_cpu(ppd->dd, >ibport_data.z_ ##cntr,   \
- ppd->ibport_data.cntr, vl,  \
+   return read_write_cpu(ppd->dd, >ibport_data.rvp.z_ ##cntr,   \
+ ppd->ibport_data.rvp.cntr, vl,  \
  mode, data);\
 }
 
@@ -1561,7 +1561,7 @@ static u64 access_ibp_##cntr(const struct cntr_entry 
*entry,\
if (vl != CNTR_INVALID_VL)\
return 0; \
  \
-   return read_write_sw(ppd->dd, >ibport_data.n_ ##cntr,\
+   return read_write_sw(ppd->dd, >ibport_data.rvp.n_ ##cntr,\
 mode, data); \
 }
 
@@ -5947,14 +5947,14 @@ static inline int init_cpu_counters(struct hfi1_devdata 
*dd)
 
ppd = (struct hfi1_pportdata *)(dd + 1);
for (i = 0; i < dd->num_pports; i++, ppd++) {
-   ppd->ibport_data.rc_acks = NULL;
-   ppd->ibport_data.rc_qacks = NULL;
-   ppd->ibport_data.rc_acks = alloc_percpu(u64);
-   ppd->ibport_data.rc_qacks = alloc_percpu(u64);
-   ppd->ibport_data.rc_delayed_comp = alloc_percpu(u64);
-   if ((ppd->ibport_data.rc_acks == NULL) ||
-   (ppd->ibport_data.rc_delayed_comp == NULL) ||
-   (ppd->ibport_data.rc_qacks == NULL))
+   ppd->ibport_data.rvp.rc_acks = NULL;
+   ppd->ibport_data.rvp.rc_qacks = NULL;
+   ppd->ibport_data.rvp.rc_acks = alloc_percpu(u64);
+   ppd->ibport_data.rvp.rc_qacks = alloc_percpu(u64);
+   ppd->ibport_data.rvp.rc_delayed_comp = alloc_percpu(u64);
+   if (!ppd->ibport_data.rvp.rc_acks ||
+   !ppd->ibport_data.rvp.rc_delayed_comp ||
+   !ppd->ibport_data.rvp.rc_qacks)
return -ENOMEM;
}
 
@@ -8010,14 +8010,14 @@ static void free_cntrs(struct hfi1_devdata *dd)
for (i = 0; i < dd->num_pports; i++, ppd++) {
kfree(ppd->cntrs);
kfree(ppd->scntrs);
-   free_percpu(ppd->ibport_data.rc_acks);
-   free_percpu(ppd->ibport_data.rc_qacks);
-   free_percpu(ppd->ibport_data.rc_delayed_comp);
+   free_percpu(ppd->ibport_data.rvp.rc_acks);
+   free_percpu(ppd->ibport_data.rvp.rc_qacks);
+   free_percpu(ppd->ibport_data.rvp.rc_delayed_comp);
ppd->cntrs = NULL;
ppd->scntrs = NULL;
-   ppd->ibport_data.rc_acks = NULL;
-   ppd->ibport_data.rc_qacks = NULL;
-   ppd->ibport_data.rc_delayed_comp = NULL;
+   ppd->ibport_data.rvp.rc_acks = NULL;
+   ppd->ibport_data.rvp.rc_qacks = NULL;
+   ppd->ibport_data.rvp.rc_delayed_comp = NULL;
}
kfree(dd->portcntrnames);
  

Re: HFI1 code duplication todo

2015-11-19 Thread Dennis Dalessandro

On Thu, Nov 12, 2015 at 04:13:18PM -0500, Dennis Dalessandro wrote:
The major todo for the hfi1 driver in staging is getting rid of the verbs 
code duplication between ipath, qib, and now hfi1. The ipath driver has 
been deprecated and is going to be deleted soon. So that leaves qib and 
hfi. To address this we have proposed rdmavt which will be a common kmod 
that provides software RDMA verbs support. qib and hfi1 will both use this 
as well as other forthcoming drivers such as soft-roce. See this thread for 
some details: http://www.spinics.net/lists/linux-rdma/msg29922.html.


Since that initial RFC we have been accumulating patches in a GitHub repo 
for an early look at the development. At some point soon we want to 
actually start posting the patches to the mailing list. This is where it 
gets tricky.  The code basically not only adds a new driver but it modifies 
two existing ones, heavily. To make it more murky one driver is in staging 
the other is in the usual drivers/infiniband tree.


The question is, how do we go about this logistically due to the 2 drivers 
being in separate sub-trees?


Greg, Doug,
As the maintainers of the two trees involved we'd kind of like to get your 
thoughts on this.


Hi Greg and Doug,

Just wanted to ping you guys again in case my mail last week slipped through 
the cracks. We are at the point now where we have some patches we can start 
posting. Looking for some logistical guidance.


Thanks

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


HFI1 code duplication todo

2015-11-12 Thread Dennis Dalessandro
The major todo for the hfi1 driver in staging is getting rid of the verbs 
code duplication between ipath, qib, and now hfi1. The ipath driver has been 
deprecated and is going to be deleted soon. So that leaves qib and hfi. To 
address this we have proposed rdmavt which will be a common kmod that 
provides software RDMA verbs support. qib and hfi1 will both use this as 
well as other forthcoming drivers such as soft-roce. See this thread for 
some details: http://www.spinics.net/lists/linux-rdma/msg29922.html.


Since that initial RFC we have been accumulating patches in a GitHub repo 
for an early look at the development. At some point soon we want to actually 
start posting the patches to the mailing list. This is where it gets tricky.  
The code basically not only adds a new driver but it modifies two existing 
ones, heavily. To make it more murky one driver is in staging the other is 
in the usual drivers/infiniband tree.


The question is, how do we go about this logistically due to the 2 drivers 
being in separate sub-trees?


Greg, Doug,
As the maintainers of the two trees involved we'd kind of like to get your 
thoughts on this.


Thanks

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/rdma/hfi1: Reduce number of parameters passed to send handlers

2015-11-12 Thread Dennis Dalessandro

On Thu, Nov 12, 2015 at 08:04:01AM +0200, Or Gerlitz wrote:

On Wed, Nov 11, 2015 at 3:39 PM, Dennis Dalessandro
<dennis.dalessan...@intel.com> wrote:

On Wed, Nov 11, 2015 at 08:25:35AM +0200, Leon Romanovsky wrote:

On Wed, Nov 11, 2015 at 12:34:37AM -0500, ira.we...@intel.com wrote:

From: Dennis Dalessandro <dennis.dalessan...@intel.com>
+int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,



-   pr_alert("Snooping/Capture of  Send DMA Packets Is Not
Supported!\n");
+   pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n");


Dennis, can we have less camelcase sort of speak in this upstream driver?
this is linux here not windowZ.


I plan to just remove this function.

See: http://www.spinics.net/lists/linux-rdma/msg30244.html

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/rdma/hfi1: Reduce number of parameters passed to send handlers

2015-11-11 Thread Dennis Dalessandro

On Wed, Nov 11, 2015 at 08:25:35AM +0200, Leon Romanovsky wrote:

On Wed, Nov 11, 2015 at 12:34:37AM -0500, ira.we...@intel.com wrote:

From: Dennis Dalessandro <dennis.dalessan...@intel.com>

+int snoop_send_dma_handler(struct hfi1_qp *qp, struct hfi1_pkt_state *ps,
+  u64 pbc)
 {
-   pr_alert("Snooping/Capture of  Send DMA Packets Is Not Supported!\n");
+   pr_alert("Snooping/Capture of Send DMA Packets Is Not Supported!\n");
snoop_dbg("Unsupported Operation");

Is it really necessary to do both print alert to message log (pr_alert) and to
trace buffer (snoop_dbg)?


Well yes, and no. They serve two different purposes. One for users of the
snoop feature the other for developers.

However, I don't think we really even need to keep this function around
anymore. How about we just remove it in a follow on patch, and let this one
stand as is?

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 4/8] staging/rdma/hfi1: remove unneeded goto done

2015-11-11 Thread Dennis Dalessandro

On Wed, Nov 11, 2015 at 12:03:36PM +0300, Dan Carpenter wrote:

On Wed, Nov 11, 2015 at 12:43:05AM -0500, ira.we...@intel.com wrote:

From: Ira Weiny <ira.we...@intel.com>

This goto done is followed by an if (ret) break in the outer switch clause.  It
is unnecessary.

Signed-off-by: Dennis Dalessandro <dennis.dalessan...@intel.com>
Signed-off-by: Ira Weiny <ira.we...@intel.com>


Also these sign offs don't really make sense.  Signed-off-by is
basically like signing a legal document saying the code in this patch
was not stolen from SCO UnixWare.  You only need to sign if you have
handled the patch.

Did Dennis write this patch or did he Ack it or Review it somehow?

regards,
dan carpenter


We both participated in creating the patch(s) in this series. I think the 
dual signed-off-by is appropriate here.


-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging/rdma/hfi1: Convert dd_dev_info() to hfi1_cdbg() in process startup

2015-11-05 Thread Dennis Dalessandro

On Thu, Nov 05, 2015 at 10:58:36AM +0300, Dan Carpenter wrote:

On Wed, Nov 04, 2015 at 11:14:57PM -0500, jubin.j...@intel.com wrote:

From: Sebastian Sanchez 

Replacing dd_dev_info() for hfi1_cdbg() to avoid generating syslog
output for every context that is open by PSM.



Just delete it...  People get scared about deleting debug code but you
can add it back if there is really a bug.

/me chants, "delete.  delete.  delete."


I would tend to agree with that, but in this case we want to keep a way to 
get this information without making code changes. We just don't want it to 
spew to the console/syslog all the time. Instead we are using the trace 
mechanism which lets the user selectively turn on the messages when needed.


Perhaps we should expand on the commit message to make this more clear?

-Denny
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel