[PATCH 4/6] InfiniBand-ocrdma: Return a value from a function call in _ocrdma_modify_qp() directly

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 18:40:43 +0100

Return the value from a call of the ocrdma_mbx_modify_qp() function
without using an extra assignment for the local variable "status".

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index aba1b5a..2de39d3 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1491,9 +1491,7 @@ int _ocrdma_modify_qp(struct ib_qp *ibqp, struct 
ib_qp_attr *attr,
 */
if (status < 0)
return status;
-   status = ocrdma_mbx_modify_qp(dev, qp, attr, attr_mask);
-
-   return status;
+   return ocrdma_mbx_modify_qp(dev, qp, attr, attr_mask);
 }
 
 int ocrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
-- 
2.6.3

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


Re: [PATCH rdma-next V2 00/32] Soft-RoCE driver

2015-12-26 Thread Doug Ledford
On 12/24/2015 09:20 AM, Christoph Hellwig wrote:
> On Thu, Dec 24, 2015 at 02:58:10PM +0200, Or Gerlitz wrote:
>> On Thu, Dec 24, 2015 at 12:02 PM, Christoph Hellwig  
>> wrote:
>>> On Thu, Dec 24, 2015 at 11:17:46AM +0200, Kamal Heib wrote:
 We've located the driver in the staging subtree. This follows a requirement
 to implement an IB transport library - Soft RoCE is in the same boat like 
 the hfi1
 driver. We need to define and implement a lib to prevent those code
 duplications.
>>>
>>> Given the trainwreck that the staging process is it might seems more
>>> sensible to get it into a stage and then merge it directly.  You'll
>>> probably save yourself a lot of work that way.
>>
>> I am not sure what you mean by "get it into a stage and then merge it
>> directly" --i
>> is that not go through staging at all?
> 
> Sorry, I should have not finished that email in a hurry before leaving
> the house.  Let me rephrase:
> 
> Given the trainwreck that the staging process is it, might be more
> sensible to get it into shape and then merge it directly.  You'll
> probably save yourself a lot of work that way.
> 

Greg and I have an agreement (again) on staging/rdma.  This shouldn't be
an issue.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


[PATCH 1/6] InfiniBand-ocrdma: One variable and jump label less in ocrdma_alloc_ucontext_pd()

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 17:16:00 +0100

This issue was detected by using the Coccinelle software.

* Let us return directly if a call of the _ocrdma_alloc_pd()
  function failed.

* Delete the jump label "err" and the local variable "status" then.

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 583001b..374c839 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -483,19 +483,15 @@ static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev 
*dev,
struct ocrdma_ucontext *uctx,
struct ib_udata *udata)
 {
-   int status = 0;
-
uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata);
if (IS_ERR(uctx->cntxt_pd)) {
-   status = PTR_ERR(uctx->cntxt_pd);
uctx->cntxt_pd = NULL;
-   goto err;
+   return PTR_ERR(uctx->cntxt_pd);
}
 
uctx->cntxt_pd->uctx = uctx;
uctx->cntxt_pd->ibpd.device = >ibdev;
-err:
-   return status;
+   return 0;
 }
 
 static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx)
-- 
2.6.3

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


[PATCH 5/6] InfiniBand-ocrdma: Returning only value constants in ocrdma_resize_cq()

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 18:54:47 +0100

Return constant integer values without storing them in the local
variable "status".

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 2de39d3..7bedf44 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1120,15 +1120,12 @@ ctx_err:
 int ocrdma_resize_cq(struct ib_cq *ibcq, int new_cnt,
 struct ib_udata *udata)
 {
-   int status = 0;
struct ocrdma_cq *cq = get_ocrdma_cq(ibcq);
 
-   if (new_cnt < 1 || new_cnt > cq->max_hw_cqe) {
-   status = -EINVAL;
-   return status;
-   }
+   if (new_cnt < 1 || new_cnt > cq->max_hw_cqe)
+   return -EINVAL;
ibcq->cqe = new_cnt;
-   return status;
+   return 0;
 }
 
 static void ocrdma_flush_cq(struct ocrdma_cq *cq)
-- 
2.6.3

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


[PATCH 6/6] InfiniBand-ocrdma: Delete an unnecessary variable in ocrdma_dealloc_pd()

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 19:09:23 +0100

1. Return zero in one case directly.

2. Return the value from a call of the _ocrdma_dealloc_pd() function
   without using an extra assignment for the local variable.

3. Remove the variable "status" in this function then.

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 7bedf44..0f79a01 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -750,7 +750,6 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd)
struct ocrdma_pd *pd = get_ocrdma_pd(ibpd);
struct ocrdma_dev *dev = get_ocrdma_dev(ibpd->device);
struct ocrdma_ucontext *uctx = NULL;
-   int status = 0;
u64 usr_db;
 
uctx = pd->uctx;
@@ -764,11 +763,10 @@ int ocrdma_dealloc_pd(struct ib_pd *ibpd)
 
if (is_ucontext_pd(uctx, pd)) {
ocrdma_release_ucontext_pd(uctx);
-   return status;
+   return 0;
}
}
-   status = _ocrdma_dealloc_pd(dev, pd);
-   return status;
+   return _ocrdma_dealloc_pd(dev, pd);
 }
 
 static int ocrdma_alloc_lkey(struct ocrdma_dev *dev, struct ocrdma_mr *mr,
-- 
2.6.3

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


[PATCH 2/6] InfiniBand-ocrdma: Delete unnecessary variable initialisations in 11 functions

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 18:18:18 +0100

The variable "status" will be set to an appropriate value a bit later.
Thus let us omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_ah.c|  2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c|  4 ++--
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c |  4 ++--
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 12 ++--
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
index 9820074..98c0abd 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
@@ -59,7 +59,7 @@ static inline int set_av_attr(struct ocrdma_dev *dev, struct 
ocrdma_ah *ah,
struct ib_ah_attr *attr, union ib_gid *sgid,
int pdid, bool *isvlan, u16 vlan_tag)
 {
-   int status = 0;
+   int status;
struct ocrdma_eth_vlan eth;
struct ocrdma_grh grh;
int eth_sz;
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 30f67be..6647aa6 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -1089,7 +1089,7 @@ mbx_err:
 static int ocrdma_nonemb_mbx_cmd(struct ocrdma_dev *dev, struct ocrdma_mqe 
*mqe,
 void *payload_va)
 {
-   int status = 0;
+   int status;
struct ocrdma_mbx_rsp *rsp = payload_va;
 
if ((mqe->hdr.spcl_sge_cnt_emb & OCRDMA_MQE_HDR_EMB_MASK) >>
@@ -2842,7 +2842,7 @@ int ocrdma_mbx_destroy_srq(struct ocrdma_dev *dev, struct 
ocrdma_srq *srq)
 static int ocrdma_mbx_get_dcbx_config(struct ocrdma_dev *dev, u32 ptype,
  struct ocrdma_dcbx_cfg *dcbxcfg)
 {
-   int status = 0;
+   int status;
dma_addr_t pa;
struct ocrdma_mqe cmd;
 
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
index 86c303a..119baa3 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
@@ -608,7 +608,7 @@ static char *ocrdma_driver_dbg_stats(struct ocrdma_dev *dev)
 static void ocrdma_update_stats(struct ocrdma_dev *dev)
 {
ulong now = jiffies, secs;
-   int status = 0;
+   int status;
struct ocrdma_rdma_stats_resp *rdma_stats =
  (struct ocrdma_rdma_stats_resp *)dev->stats_mem.va;
struct ocrdma_rsrc_stats *rsrc_stats = _stats->act_rsrc_stats;
@@ -639,7 +639,7 @@ static ssize_t ocrdma_dbgfs_ops_write(struct file *filp,
 {
char tmp_str[32];
long reset;
-   int status = 0;
+   int status;
struct ocrdma_stats *pstats = filp->private_data;
struct ocrdma_dev *dev = pstats->dev;
 
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 374c839..aba1b5a 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -419,7 +419,7 @@ static struct ocrdma_pd *_ocrdma_alloc_pd(struct ocrdma_dev 
*dev,
  struct ib_udata *udata)
 {
struct ocrdma_pd *pd = NULL;
-   int status = 0;
+   int status;
 
pd = kzalloc(sizeof(*pd), GFP_KERNEL);
if (!pd)
@@ -468,7 +468,7 @@ static inline int is_ucontext_pd(struct ocrdma_ucontext 
*uctx,
 static int _ocrdma_dealloc_pd(struct ocrdma_dev *dev,
  struct ocrdma_pd *pd)
 {
-   int status = 0;
+   int status;
 
if (dev->pd_mgr->pd_prealloc_valid)
status = ocrdma_put_pd_num(dev, pd->id, pd->dpp_enabled);
@@ -592,7 +592,7 @@ map_err:
 
 int ocrdma_dealloc_ucontext(struct ib_ucontext *ibctx)
 {
-   int status = 0;
+   int status;
struct ocrdma_mm *mm, *tmp;
struct ocrdma_ucontext *uctx = get_ocrdma_ucontext(ibctx);
struct ocrdma_dev *dev = get_ocrdma_dev(ibctx->device);
@@ -619,7 +619,7 @@ int ocrdma_mmap(struct ib_ucontext *context, struct 
vm_area_struct *vma)
unsigned long vm_page = vma->vm_pgoff << PAGE_SHIFT;
u64 unmapped_db = (u64) dev->nic_info.unmapped_db;
unsigned long len = (vma->vm_end - vma->vm_start);
-   int status = 0;
+   int status;
bool found;
 
if (vma->vm_start & (PAGE_SIZE - 1))
@@ -1282,7 +1282,7 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp,
struct ib_udata *udata, int dpp_offset,
int dpp_credit_lmt, int srq)
 {
-   int status = 0;
+   int status;
u64 usr_db;
struct ocrdma_create_qp_uresp uresp;
struct ocrdma_pd *pd = qp->pd;
@@ -1946,7 +1946,7 @@ int ocrdma_modify_srq(struct ib_srq *ibsrq,

Re: [PATCH 1/6] InfiniBand-ocrdma: One variable and jump label less in ocrdma_alloc_ucontext_pd()

2015-12-26 Thread kbuild test robot
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]
Hi Markus,

[auto build test WARNING on v4.4-rc6]
[also build test WARNING on next-20151223]

url:
https://github.com/0day-ci/linux/commits/SF-Markus-Elfring/InfiniBand-ocrdma-Fine-tuning-for-some-function-implementations/20151227-025304


coccinelle warnings: (new ones prefixed by >>)

>> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:489:9-16: ERROR: PTR_ERR applied 
>> after initialization to constant on line 488

vim +489 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c

   482  static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev *dev,
   483  struct ocrdma_ucontext *uctx,
   484  struct ib_udata *udata)
   485  {
   486  uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata);
   487  if (IS_ERR(uctx->cntxt_pd)) {
 > 488  uctx->cntxt_pd = NULL;
 > 489  return PTR_ERR(uctx->cntxt_pd);
   490  }
   491  
   492  uctx->cntxt_pd->uctx = uctx;

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/4] ocrdma bug fix for linux-4.4-rc

2015-12-26 Thread Doug Ledford
On 12/24/2015 01:14 PM, Devesh Sharma wrote:
> This patch series fixes for critical bugs introduced due to recent
> changes in linux Infiniband stack.
> 
> Patch 0001 fixes a vlan-id assignment issues in presence of PFC.
> This bug was introduced recently got introduced and it fixes
> dbf727de7440 ('IB/core: Use GID table in AH creation and dmac resolution')
> 
> Patches 0002 to 0004 fixes a deadlock condition reported by Dough Ledford
> while testing linux-4.4-rc5. The deadlock happens when any be2net hook 
> (e.g. open/close) is called in parallel to insmod ocrdma.ko.
> 
> A. be2net is sending administrative open/close event to ocrdma holding
>device_list_mutex. It does this from ndo_open/ndo_stop hooks of be2net.
>So sequence of locks is rtnl_lock---> device_list lock
> 
> B.  When new ocrdma roce device gets registered, infiniband stack now
> takes rtnl_lock in ib_register_device() in GID initialization routines.
> So sequence of locks in this path is device_list lock ---> rtnl_lock.
> 
> This improper locking sequence causes deadlock.
> 
> Patch 0002 removes an unwanted code to force all active-QPs to error state
> using a management command. It is rather simple to let active-QPs to move
> to error on their own due to a completion error after the port error is
> reported.
> 
> Patch 0003 makes IB-dispatch-event mechanism independent of administrative
> open/close events injected from be2net driver. Instead of those events, now
> ocrdma relies on async-events generated from CNA. Thus, solving the problem
> of keeping device_list_mutex busy under rtnl-lock. Moving from administrative
> events to CNA async-events does not change the functionality of ocrdma driver
> in any way.
> 
> Patch 0004 Removes the dead code from be2net driver.
> 
> Devesh Sharma (4):
>   RDMA/ocrdma: Fix vlan-id assignment in qp parameters
>   RDMA/ocrdma: Dispatch only port event when port state changes
>   RDMA/ocrdma: Depend on async link events from CNA
>   RDMA/be2net: Remove open and close entry points
> 
>  drivers/infiniband/hw/ocrdma/ocrdma.h   | 10 +
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.c| 49 -
>  drivers/infiniband/hw/ocrdma/ocrdma_hw.h|  4 +-
>  drivers/infiniband/hw/ocrdma/ocrdma_main.c  | 57 
> +
>  drivers/infiniband/hw/ocrdma/ocrdma_sli.h   | 49 +++--
>  drivers/infiniband/hw/ocrdma/ocrdma_verbs.c |  2 +-
>  drivers/net/ethernet/emulex/benet/be.h  |  2 -
>  drivers/net/ethernet/emulex/benet/be_main.c |  4 --
>  drivers/net/ethernet/emulex/benet/be_roce.c | 36 --
>  drivers/net/ethernet/emulex/benet/be_roce.h |  4 +-
>  10 files changed, 124 insertions(+), 93 deletions(-)
> 

Thanks Devesh, I'll review and test this later today.

-- 
Doug Ledford 
  GPG KeyID: 0E572FDD




signature.asc
Description: OpenPGP digital signature


[PATCH 0/6] InfiniBand-ocrdma: Fine-tuning for some function implementations

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 19:30:54 +0100

Several update suggestions were taken into account
from static source code analysis.

Markus Elfring (6):
  One variable and jump label less in ocrdma_alloc_ucontext_pd()
  Delete unnecessary variable initialisations in 11 functions
  Returning only value constants in ocrdma_qp_state_change()
  Return a value from a function call in _ocrdma_modify_qp() directly
  Returning only value constants in ocrdma_resize_cq()
  Delete an unnecessary variable in ocrdma_dealloc_pd()

 drivers/infiniband/hw/ocrdma/ocrdma_ah.c|  2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c|  7 +++---
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c |  4 +--
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 39 +++--
 4 files changed, 20 insertions(+), 32 deletions(-)

-- 
2.6.3

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


[PATCH 3/6] InfiniBand-ocrdma: Returning only value constants in ocrdma_qp_state_change()

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 18:28:35 +0100

Return zero at the end without using the local variable "status".

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
index 6647aa6..9a2b153 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c
@@ -2110,7 +2110,6 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum 
ib_qp_state new_ib_state,
   enum ib_qp_state *old_ib_state)
 {
unsigned long flags;
-   int status = 0;
enum ocrdma_qp_state new_state;
new_state = get_ocrdma_qp_state(new_ib_state);
 
@@ -2135,7 +2134,7 @@ int ocrdma_qp_state_change(struct ocrdma_qp *qp, enum 
ib_qp_state new_ib_state,
qp->state = new_state;
 
spin_unlock_irqrestore(>q_lock, flags);
-   return status;
+   return 0;
 }
 
 static u32 ocrdma_set_create_qp_mbx_access_flags(struct ocrdma_qp *qp)
-- 
2.6.3

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


Re: [PATCH rdma-next V2 00/32] Soft-RoCE driver

2015-12-26 Thread Ming Lin
On Thu, 2015-12-24 at 11:17 +0200, Kamal Heib wrote:
> Doug and list Hi,
> 
> This patchset introduces Soft RoCE driver.

Thanks to submit this driver.
I have been looking for this kind of driver a while to setup a RDMA
environment with 2 virtual machines.

I did a quick test with 2 VMs.

root@vm1:~# rxe_cfg start
tee: /sys/kernel/config/rdma_cm/rxe0/default_roce_mode: Permission denied
IBOE V2
  Name  Link  Driver  Speed  NMTU  IPv4_addr  RDEV  RMTU  
  eth0  yes   8139cp 1500  192.168.122.3  rxe0  1024  (3)

ibv_rc_pingpong works!

root@vm1:~# ibv_rc_pingpong -d rxe0 -g 0
  local address:  LID 0x, QPN 0x11, PSN 0xfb6f08, GID 
fe80::5054:ff:fe12:3456
  remote address: LID 0x, QPN 0x11, PSN 0xcb2acb, GID 
fe80::5054:ff:fe5f:8a49
8192000 bytes in 0.66 seconds = 99.94 Mbit/sec
1000 iters in 0.66 seconds = 655.76 usec/iter

root@vm2:~# ibv_rc_pingpong -d rxe0 -g 0 192.168.122.89
  local address:  LID 0x, QPN 0x11, PSN 0xcb2acb, GID 
fe80::5054:ff:fe5f:8a49
  remote address: LID 0x, QPN 0x11, PSN 0xfb6f08, GID 
fe80::5054:ff:fe12:3456
8192000 bytes in 0.66 seconds = 99.70 Mbit/sec
1000 iters in 0.66 seconds = 657.32 usec/iter

rping seems works too!

root@vm1:~# rping -s -d
created cm_id 0x1683d20
rdma_bind_addr successful
rdma_listen
cma_event type RDMA_CM_EVENT_CONNECT_REQUEST cma_id 0x1684200 (child)
child cma 0x1684200
created pd 0x16844a0
created channel 0x16844c0
created cq 0x16844e0
created qp 0x1684590
rping_setup_buffers called on cb 0x1683010
allocated & registered buffers...
accepting client connection request
cq_thread started.
cma_event type RDMA_CM_EVENT_ESTABLISHED cma_id 0x1684200 (child)
ESTABLISHED
recv completion
Received rkey 118b addr 22899e0 len 64 from peer
server received sink adv
server posted rdma read req 
rdma read completion
server received read complete
server posted go ahead
send completion
recv completion
Received rkey 1045 addr 2289950 len 64 from peer
server received sink adv
rdma write from lkey d11 laddr 16846d0 len 64
rdma write completion
server rdma write complete 
server posted go ahead
send completion
cma_event type RDMA_CM_EVENT_DISCONNECTED cma_id 0x1684200 (child)
server DISCONNECT EVENT...
wait for RDMA_READ_ADV state 9
rping_free_buffers called on cb 0x1683010
destroy cm_id 0x1683d20

root@vm2:~# rping -c -d -a 192.168.122.89 -C 1
count 1
created cm_id 0x2289200
cma_event type RDMA_CM_EVENT_ADDR_RESOLVED cma_id 0x2289200 (parent)
cma_event type RDMA_CM_EVENT_ROUTE_RESOLVED cma_id 0x2289200 (parent)
rdma_resolve_addr - rdma_resolve_route successful
created pd 0x22896e0
created channel 0x2289700
created cq 0x2289720
created qp 0x22897d0
rping_setup_buffers called on cb 0x2288010
allocated & registered buffers...
cq_thread started.
cma_event type RDMA_CM_EVENT_ESTABLISHED cma_id 0x2289200 (parent)
ESTABLISHED
rmda_connect successful
RDMA addr 22899e0 rkey 118b len 64
send completion
recv completion
RDMA addr 2289950 rkey 1045 len 64
send completion
recv completion
rping_free_buffers called on cb 0x2288010
destroy cm_id 0x2289200



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


[PATCH v2 1/6] InfiniBand-ocrdma: One jump label less in ocrdma_alloc_ucontext_pd()

2015-12-26 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sat, 26 Dec 2015 22:18:38 +0100

This issue was detected by using the Coccinelle software.

* Let us return directly if a call of the _ocrdma_alloc_pd()
  function failed.

* Reduce the scope for the local variable "status" to one case
  of an if statement.

* Delete the jump label "err" then.

* Return zero as a constant at the end.

Signed-off-by: Markus Elfring 
---
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 9 +++--
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 583001b..7f10cc47 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -483,19 +483,16 @@ static int ocrdma_alloc_ucontext_pd(struct ocrdma_dev 
*dev,
struct ocrdma_ucontext *uctx,
struct ib_udata *udata)
 {
-   int status = 0;
-
uctx->cntxt_pd = _ocrdma_alloc_pd(dev, uctx, udata);
if (IS_ERR(uctx->cntxt_pd)) {
-   status = PTR_ERR(uctx->cntxt_pd);
+   int status = PTR_ERR(uctx->cntxt_pd);
uctx->cntxt_pd = NULL;
-   goto err;
+   return status;
}
 
uctx->cntxt_pd->uctx = uctx;
uctx->cntxt_pd->ibpd.device = >ibdev;
-err:
-   return status;
+   return 0;
 }
 
 static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx)
-- 
2.6.3

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


Re: [PATCH 1/6] IB/uapi: expose uverbs WR opcodes

2015-12-26 Thread Leon Romanovsky
On Thu, Dec 24, 2015 at 03:39:22PM +0100, Christoph Hellwig wrote:

>  #define MLX5_IB_SEND_UMR_UPDATE_MTT (IB_SEND_RESERVED_START << 2)
>  #define MLX5_IB_QPT_REG_UMR  IB_QPT_RESERVED1
> -#define MLX5_IB_WR_UMR   IB_WR_RESERVED1
> +#define MLX5_IB_WR_UMR   (IB_WR_END + 0)

>  
> - IB_WR_RESERVED10,
> +
> + /* drivers may use any value greater or equal to IB_WR_END internally */
> + IB_WR_END,
IB_WR_END --> IB_WR_KERNEL_LAST
>  };
>  

> + IB_UVERBS_WR_END= 9,
I think name IB_UVERBS_WR_LAST describes better than IB_UVERBS_WR_END.
> +};
> +
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] IB/uapi: expose uverbs WC opcodes

2015-12-26 Thread Leon Romanovsky
On Thu, Dec 24, 2015 at 03:39:24PM +0100, Christoph Hellwig wrote:
> This exposes the WC opcodes supported by uverbs as part of the uapi
> headers.  It follows the same scheme as the WR opcodes.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  include/rdma/ib_verbs.h  | 29 +
>  include/uapi/rdma/ib_verbs.h | 16 
>  2 files changed, 29 insertions(+), 16 deletions(-)
> 
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 5dccc6a..7dce204 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -819,22 +819,19 @@ enum ib_wc_status {
>  const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
>  
>  enum ib_wc_opcode {
> - IB_WC_SEND,
> - IB_WC_RDMA_WRITE,
> - IB_WC_RDMA_READ,
> - IB_WC_COMP_SWAP,
> - IB_WC_FETCH_ADD,
> - IB_WC_LSO,
> - IB_WC_LOCAL_INV,
> - IB_WC_REG_MR,
> - IB_WC_MASKED_COMP_SWAP,
> - IB_WC_MASKED_FETCH_ADD,
> -/*
> - * Set value of IB_WC_RECV so consumers can test if a completion is a
> - * receive by testing (opcode & IB_WC_RECV).
> - */
> - IB_WC_RECV  = 1 << 7,
> - IB_WC_RECV_RDMA_WITH_IMM
> + IB_WC_SEND  = IB_UVERBS_WC_SEND,
> + IB_WC_RDMA_WRITE= IB_UVERBS_WC_RDMA_WRITE,
> + IB_WC_RDMA_READ = IB_UVERBS_WC_RDMA_READ,
> + IB_WC_COMP_SWAP = IB_UVERBS_WC_COMP_SWAP,
> + IB_WC_FETCH_ADD = IB_UVERBS_WC_FETCH_ADD,
> + IB_WC_LSO   = IB_UVERBS_WC_SEND_END,
> + IB_WC_LOCAL_INV = IB_UVERBS_WC_SEND_END + 1,
> + IB_WC_REG_MR= IB_UVERBS_WC_SEND_END + 2,
> + IB_WC_MASKED_COMP_SWAP  = IB_UVERBS_WC_SEND_END + 3,
> + IB_WC_MASKED_FETCH_ADD  = IB_UVERBS_WC_SEND_END + 4,
As you did it in the first patch, just don't assign after IB_WC_LOCAL_INV.
Compiler will handle IB_UVERS_WC_SEND_END + X calculations by itself.
> +
> + IB_WC_RECV  = IB_UVERBS_WC_RECV,
> + IB_WC_RECV_RDMA_WITH_IMM = IB_UVERBS_WC_RECV_END,
>  };
>  
>  enum ib_wc_flags {
> diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h
> index 3be3152..fd7a393 100644
> --- a/include/uapi/rdma/ib_verbs.h
> +++ b/include/uapi/rdma/ib_verbs.h
> @@ -29,4 +29,20 @@ enum ib_uverbs_send_flags {
>   IB_UVERBS_SEND_END  = (1 << 5),
>  };
>  
> +enum ib_uverbs_wc_opcode {
> + IB_UVERBS_WC_SEND   = 0,
> + IB_UVERBS_WC_RDMA_WRITE = 1,
> + IB_UVERBS_WC_RDMA_READ  = 2,
> + IB_UVERBS_WC_COMP_SWAP  = 3,
> + IB_UVERBS_WC_FETCH_ADD  = 4,
> + IB_UVERBS_WC_SEND_END   = 5,
> +
> + /*
> +  * Set value of IB_WC_RECV so consumers can test if a completion is a
> +  * receive by testing (opcode & IB_WC_RECV).
> +  */
> + IB_UVERBS_WC_RECV   = 1 << 7,
> + IB_UVERBS_WC_RECV_END   = (1 << 7) + 1,
> +};
> +
>  #endif /* _UAPI_RDMA_IB_VERBS_H */
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] IB/uapi: expose uverbs WC flags

2015-12-26 Thread Leon Romanovsky
On Thu, Dec 24, 2015 at 03:39:25PM +0100, Christoph Hellwig wrote:
> This exposes the WC flags supported by uverbs as part of the uapi
> headers.  It follows the same scheme as the WR opcodes.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  include/rdma/ib_verbs.h  | 14 +++---
>  include/uapi/rdma/ib_verbs.h | 10 ++
>  2 files changed, 17 insertions(+), 7 deletions(-)
> 
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 7dce204..337db70 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -835,13 +835,13 @@ enum ib_wc_opcode {
>  };
>  
>  enum ib_wc_flags {
> - IB_WC_GRH   = 1,
> - IB_WC_WITH_IMM  = (1<<1),
> - IB_WC_WITH_INVALIDATE   = (1<<2),
> - IB_WC_IP_CSUM_OK= (1<<3),
> - IB_WC_WITH_SMAC = (1<<4),
> - IB_WC_WITH_VLAN = (1<<5),
> - IB_WC_WITH_NETWORK_HDR_TYPE = (1<<6),
> + IB_WC_GRH   = IB_UVERBS_WC_GRH,
> + IB_WC_WITH_IMM  = IB_UVERBS_WC_WITH_IMM,
> + IB_WC_WITH_INVALIDATE   = IB_UVERBS_WC_WITH_INVALIDATE,
> + IB_WC_IP_CSUM_OK= IB_UVERBS_WC_IP_CSUM_OK,
> + IB_WC_WITH_SMAC = IB_UVERBS_WC_WITH_SMAC,
> + IB_WC_WITH_VLAN = IB_UVERBS_WC_WITH_VLAN,
> + IB_WC_WITH_NETWORK_HDR_TYPE = IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE,
>  };
>  
>  struct ib_wc {
> diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h
> index fd7a393..c40c00b 100644
> --- a/include/uapi/rdma/ib_verbs.h
> +++ b/include/uapi/rdma/ib_verbs.h
> @@ -45,4 +45,14 @@ enum ib_uverbs_wc_opcode {
>   IB_UVERBS_WC_RECV_END   = (1 << 7) + 1,
>  };
>  
> +enum ib_uverbs_wc_flags {
> + IB_UVERBS_WC_GRH= (1 << 0),
> + IB_UVERBS_WC_WITH_IMM   = (1 << 1),
> + IB_UVERBS_WC_WITH_INVALIDATE= (1 << 2),
> + IB_UVERBS_WC_IP_CSUM_OK = (1 << 3),
> + IB_UVERBS_WC_WITH_SMAC  = (1 << 4),
> + IB_UVERBS_WC_WITH_VLAN  = (1 << 5),
> + IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE  = (1 << 6),
> +};
It will be great to add _FLAGS_ mark in the name and add _LAST too.
> +
>  #endif /* _UAPI_RDMA_IB_VERBS_H */
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/6] IB/uapi: expose uverbs WC status codes

2015-12-26 Thread Leon Romanovsky
On Thu, Dec 24, 2015 at 03:39:26PM +0100, Christoph Hellwig wrote:
> This exposes the WC status codes supported by uverbs as part of the uapi
> headers.  It follows the same scheme as the WR opcodes.
> 
> Signed-off-by: Christoph Hellwig 
> ---
>  include/rdma/ib_verbs.h  | 44 
> ++--
>  include/uapi/rdma/ib_verbs.h | 25 +
>  2 files changed, 47 insertions(+), 22 deletions(-)
> 
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 337db70..48bfcf5 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -792,28 +792,28 @@ struct ib_ah_attr {
>  };
>  
>  enum ib_wc_status {
> - IB_WC_SUCCESS,
> - IB_WC_LOC_LEN_ERR,
> - IB_WC_LOC_QP_OP_ERR,
> - IB_WC_LOC_EEC_OP_ERR,
> - IB_WC_LOC_PROT_ERR,
> - IB_WC_WR_FLUSH_ERR,
> - IB_WC_MW_BIND_ERR,
> - IB_WC_BAD_RESP_ERR,
> - IB_WC_LOC_ACCESS_ERR,
> - IB_WC_REM_INV_REQ_ERR,
> - IB_WC_REM_ACCESS_ERR,
> - IB_WC_REM_OP_ERR,
> - IB_WC_RETRY_EXC_ERR,
> - IB_WC_RNR_RETRY_EXC_ERR,
> - IB_WC_LOC_RDD_VIOL_ERR,
> - IB_WC_REM_INV_RD_REQ_ERR,
> - IB_WC_REM_ABORT_ERR,
> - IB_WC_INV_EECN_ERR,
> - IB_WC_INV_EEC_STATE_ERR,
> - IB_WC_FATAL_ERR,
> - IB_WC_RESP_TIMEOUT_ERR,
> - IB_WC_GENERAL_ERR
> + IB_WC_SUCCESS   = IB_UVERBS_WC_SUCCESS,
> + IB_WC_LOC_LEN_ERR   = IB_UVERBS_WC_LOC_LEN_ERR,
> + IB_WC_LOC_QP_OP_ERR = IB_UVERBS_WC_LOC_QP_OP_ERR,
> + IB_WC_LOC_EEC_OP_ERR= IB_UVERBS_WC_LOC_EEC_OP_ERR,
> + IB_WC_LOC_PROT_ERR  = IB_UVERBS_WC_LOC_PROT_ERR,
> + IB_WC_WR_FLUSH_ERR  = IB_UVERBS_WC_WR_FLUSH_ERR,
> + IB_WC_MW_BIND_ERR   = IB_UVERBS_WC_MW_BIND_ERR,
> + IB_WC_BAD_RESP_ERR  = IB_UVERBS_WC_BAD_RESP_ERR,
> + IB_WC_LOC_ACCESS_ERR= IB_UVERBS_WC_LOC_ACCESS_ERR,
> + IB_WC_REM_INV_REQ_ERR   = IB_UVERBS_WC_REM_INV_REQ_ERR,
> + IB_WC_REM_ACCESS_ERR= IB_UVERBS_WC_REM_ACCESS_ERR,
> + IB_WC_REM_OP_ERR= IB_UVERBS_WC_REM_OP_ERR,
> + IB_WC_RETRY_EXC_ERR = IB_UVERBS_WC_RETRY_EXC_ERR,
> + IB_WC_RNR_RETRY_EXC_ERR = IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
> + IB_WC_LOC_RDD_VIOL_ERR  = IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
> + IB_WC_REM_INV_RD_REQ_ERR= IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
> + IB_WC_REM_ABORT_ERR = IB_UVERBS_WC_REM_ABORT_ERR,
> + IB_WC_INV_EECN_ERR  = IB_UVERBS_WC_INV_EECN_ERR,
> + IB_WC_INV_EEC_STATE_ERR = IB_UVERBS_WC_INV_EEC_STATE_ERR,
> + IB_WC_FATAL_ERR = IB_UVERBS_WC_FATAL_ERR,
> + IB_WC_RESP_TIMEOUT_ERR  = IB_UVERBS_WC_RESP_TIMEOUT_ERR,
> + IB_WC_GENERAL_ERR   = IB_UVERBS_WC_GENERAL_ERR,
>  };
>  
>  const char *__attribute_const__ ib_wc_status_msg(enum ib_wc_status status);
> diff --git a/include/uapi/rdma/ib_verbs.h b/include/uapi/rdma/ib_verbs.h
> index c40c00b..fbadb29 100644
> --- a/include/uapi/rdma/ib_verbs.h
> +++ b/include/uapi/rdma/ib_verbs.h
> @@ -55,4 +55,29 @@ enum ib_uverbs_wc_flags {
>   IB_UVERBS_WC_WITH_NETWORK_HDR_TYPE  = (1 << 6),
>  };
>  
> +enum ib_uverbs_wc_status {
> + IB_UVERBS_WC_SUCCESS,
> + IB_UVERBS_WC_LOC_LEN_ERR,
> + IB_UVERBS_WC_LOC_QP_OP_ERR,
> + IB_UVERBS_WC_LOC_EEC_OP_ERR,
> + IB_UVERBS_WC_LOC_PROT_ERR,
> + IB_UVERBS_WC_WR_FLUSH_ERR,
> + IB_UVERBS_WC_MW_BIND_ERR,
> + IB_UVERBS_WC_BAD_RESP_ERR,
> + IB_UVERBS_WC_LOC_ACCESS_ERR,
> + IB_UVERBS_WC_REM_INV_REQ_ERR,
> + IB_UVERBS_WC_REM_ACCESS_ERR,
> + IB_UVERBS_WC_REM_OP_ERR,
> + IB_UVERBS_WC_RETRY_EXC_ERR,
> + IB_UVERBS_WC_RNR_RETRY_EXC_ERR,
> + IB_UVERBS_WC_LOC_RDD_VIOL_ERR,
> + IB_UVERBS_WC_REM_INV_RD_REQ_ERR,
> + IB_UVERBS_WC_REM_ABORT_ERR,
> + IB_UVERBS_WC_INV_EECN_ERR,
> + IB_UVERBS_WC_INV_EEC_STATE_ERR,
> + IB_UVERBS_WC_FATAL_ERR,
> + IB_UVERBS_WC_RESP_TIMEOUT_ERR,
> + IB_UVERBS_WC_GENERAL_ERR
> +};
The same as in previous mail, mark it as a _STATUS_ in the name.
> +
>  #endif /* _UAPI_RDMA_IB_VERBS_H */
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH rdma-next V2 01/32] IB/core: Macro for RoCEv2 UDP port

2015-12-26 Thread Leon Romanovsky
On Thu, Dec 24, 2015 at 11:17:47AM +0200, Kamal Heib wrote:
> From: Amir Vadai 
> 
> Adding a macro for RoCEv2 UDP destination port.
You are adding define and not macro.

> 
> Signed-off-by: Amir Vadai 
> Signed-off-by: Kamal Heib 
> ---
>  include/rdma/ib_verbs.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index 368fc22..9904394 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -79,6 +79,8 @@ enum ib_gid_type {
>   IB_GID_TYPE_SIZE
>  };
>  
> +#define ROCE_V2_UDP_DPORT  4791
> +
>  struct ib_gid_attr {
>   enum ib_gid_typegid_type;
>   struct net_device   *ndev;
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majord...@vger.kernel.org
> 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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html