[PATCH] drivers/infiniband: Add a check for strict_strtoul()

2011-04-01 Thread Liu Yuan
From: Liu Yuan tailai...@taobao.com

It should check if strict_strtoul() succeeds before using
'wqm_quanta_value'.

Signed-off-by: Liu Yuan tailai...@taobao.com
---
 drivers/infiniband/hw/nes/nes.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 13de119..119d60d 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -1138,7 +1138,9 @@ static ssize_t nes_store_wqm_quanta(struct device_driver 
*ddp,
u32 i = 0;
struct nes_device *nesdev;
 
-   strict_strtoul(buf, 0, wqm_quanta_value);
+   if (strict_strtoul(buf, 0, wqm_quanta_value)  0)
+   return -EINVAL;
+
list_for_each_entry(nesdev, nes_dev_list, list) {
if (i == ee_flsh_adapter) {
nesdev-nesadapter-wqm_quanta = wqm_quanta_value;
-- 
1.7.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


HA mode bonding for IB over SDP

2011-04-01 Thread Bhavin
Hi,

I am a student pursuing masters. I have chosen to work on infiniband for my
final year project. As part of my project I am trying to implement infiniband
over SDP. I have also setup two systems for this purpose having Mallanox IB
cards. I found that OFED doesn’t have support for HA mode failover for IB over
SDP when searching for limitations of this configuration. So I have decided to
work on this issue.

Right now I am going through the OFED source code to understand how different
functionalities are implemented. I also found there is something called
APM(Automatic Path Migration) is present in OFED.

Is it possible to use APM for failover with IB over SDP? If yes, please guide me
on how can I use APM for IB over SDP.

Please Help.

Thanks


--
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] opensm/perfmgr: fix overflow processing

2011-04-01 Thread Alex Netes
On 18:11 Thu 24 Mar , Ira Weiny wrote:
 
 From: Ira Weiny wei...@llnl.gov
 Date: Wed, 9 Mar 2011 16:28:23 -0800
 Subject: [PATCH] opensm/perfmgr: fix overflow processing
 
The stored error counters need to be cleared when the clear is issued 
 because of overflow.
 
 Signed-off-by: Ira Weiny wei...@llnl.gov
 ---

Applied, thanks.
--
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] opensm: Allow comma in plugin names parsing

2011-04-01 Thread Alex Netes
On 10:46 Tue 29 Mar , Eli Dorfman wrote:
 Subject: [PATCH] Allow comma in plugin names parsing
 
 Signed-off-by: Eli Dorfman el...@mellanox.com
 ---

Apllied, thanks.
--
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] opensm: [RFC] Add PortCountersExtended support to the PerfMgr

2011-04-01 Thread Alex Netes
Hi Ira,

On 18:20 Thu 24 Mar , Ira Weiny wrote:
 I have briefly tested the following 4 patches to implement 
 PortCountersExtended
 collection in the performance manager of opensm.  They work well for my 
 limited
 testing.
 

Can you please provide more info regarding the tests you've run.

Thanks, Alex.
--
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] opensm: [RFC] Add PortCountersExtended support to the PerfMgr

2011-04-01 Thread Alex Netes
Hi Ira,

On 18:20 Thu 24 Mar , Ira Weiny wrote:
 I have briefly tested the following 4 patches to implement 
 PortCountersExtended
 collection in the performance manager of opensm.  They work well for my 
 limited
 testing.
 

Can you provide more info regarding the tested you've done?

Thanks, Alex.

--
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] librdmacm/doc: document the limitations on the user provided private data length

2011-04-01 Thread Yann Droneaud
Le lundi 28 mars 2011 à 10:49 +0200, Or Gerlitz a écrit :
 Document the limitations on the user provided private data length
 over Infiniband networks. These limitations are calculated by
 subtracting the rdma-cm header size (see IBA Annex A11 RDMA CM IP
 Service) from IB's private data len for the REQ (rdma_connect) and
 REP (rdma_accept) messages

In Annex A11 RMDA CM IP Service of Infiniband Architecture Release
1.2.1 (November 2007), there's nothing about the REP messages. Only REQ
(table 532) messages are specified in this section.

For general REP messages, one have to look to table 103 : REP Message
Contents in section 12.6.8 REP - Reply to Request For Communication.

Am I correct ?

Regards.

-- 
Yann Droneaud
OPTEYA


--
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] librdmacm/doc: document the limitations on the user provided private data length

2011-04-01 Thread Hefty, Sean
 For general REP messages, one have to look to table 103 : REP Message
 Contents in section 12.6.8 REP - Reply to Request For Communication.
 
 Am I correct ?

I believe so.  The rdma_accept size should be 196 for RDMA_PS_TCP.
 



[PATCH 1/ 11] opensm/osm_pkey_mgr.c: Fix commentary typo

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c
index 612130c..a81fa78 100644
--- a/opensm/osm_pkey_mgr.c
+++ b/opensm/osm_pkey_mgr.c
@@ -36,7 +36,7 @@

 /*
  * Abstract:
- * Implementation of the P_Key Manager (Partititon Manager).
+ * Implementation of the P_Key Manager (Partition Manager).
  * This is part of the OpenSM.
  */

--
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/11] opensm/osm_pkey_mgr.c: Move clearing of empty_block after any early returns

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_pkey_mgr.c b/opensm/osm_pkey_mgr.c
index 612130c..ce50f27 100644
--- a/opensm/osm_pkey_mgr.c
+++ b/opensm/osm_pkey_mgr.c
@@ -263,12 +263,12 @@ static int pkey_mgr_update_port(osm_log_t * p_log,
osm_sm_t * sm,
ib_pkey_table_t empty_block;
int ret = 0;

-   memset(empty_block, 0, sizeof(ib_pkey_table_t));
-
p_physp = p_port-p_physp;
if (!p_physp)
return FALSE;

+   memset(empty_block, 0, sizeof(ib_pkey_table_t));
+
p_node = osm_physp_get_node_ptr(p_physp);
p_pkey_tbl = p_physp-pkeys;
num_of_blocks = osm_pkey_tbl_get_num_blocks(p_pkey_tbl);
@@ -392,8 +392,6 @@ static int pkey_mgr_update_peer_port(osm_log_t *
p_log, osm_sm_t * sm,
ib_pkey_table_t empty_block;
int ret = 0;

-   memset(empty_block, 0, sizeof(ib_pkey_table_t));
-
p_physp = p_port-p_physp;
if (!p_physp)
return -1;
@@ -426,6 +424,8 @@ static int pkey_mgr_update_peer_port(osm_log_t *
p_log, osm_sm_t * sm,
if (enforce == FALSE)
return ret;

+   memset(empty_block, 0, sizeof(ib_pkey_table_t));
+
p_peer_pkey_tbl-used_blocks = p_pkey_tbl-used_blocks;
for (block_index = 0; block_index  p_pkey_tbl-used_blocks;
 block_index++) {
--
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/11] opensm/include/opensm/osm_mcm_port.h: Cosmetic formatting changes

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock hal.rosenst...@gmail.com
---
diff --git a/include/opensm/osm_mcm_port.h b/include/opensm/osm_mcm_port.h
index ad25b4f..ca126cd 100644
--- a/include/opensm/osm_mcm_port.h
+++ b/include/opensm/osm_mcm_port.h
@@ -62,14 +62,14 @@ struct osm_mgrp;

 /s* OpenSM: MCM Port Object/osm_mcm_port_t
 * NAME
-*   osm_mcm_port_t
+*  osm_mcm_port_t
 *
 * DESCRIPTION
-*   This object represents a particularport as a member of a
+*  This object represents a particular port as a member of a
 *  multicast group.
 *
-*   This object should be treated as opaque and should
-*   be manipulated only through the provided functions.
+*  This object should be treated as opaque and should
+*  be manipulated only through the provided functions.
 *
 * SYNOPSIS
 */
--
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/11] opensm/osm_sa_mcmember_record.c: Changed status in a couple of SA responses

2011-04-01 Thread Hal Rosenstock

For SubnAdmSet and SubnAdmDelete, return insufficient components rather
than invalid request when component mask doesn't have at least the
required components for a join

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_sa_mcmember_record.c
b/opensm/osm_sa_mcmember_record.c
index b2318ec..c8c6b5d 100644
--- a/opensm/osm_sa_mcmember_record.c
+++ b/opensm/osm_sa_mcmember_record.c
@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
- * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
+ * Copyright (c) 2002-2011 Mellanox Technologies LTD. All rights reserved.
  * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
  * Copyright (c) 2008 Xsigo Systems Inc.  All rights reserved.
  *
@@ -1462,7 +1462,7 @@ void osm_mcmr_rcv_process(IN void *context, IN
void *data)
  p_recvd_mcmember_rec-port_gid.raw,
  gid_str2, sizeof gid_str2));
osm_sa_send_error(sa, p_madw,
- IB_SA_MAD_STATUS_REQ_INVALID);
+ IB_SA_MAD_STATUS_INSUF_COMPS);
goto Exit;
}

@@ -1479,7 +1479,7 @@ void osm_mcmr_rcv_process(IN void *context, IN
void *data)
cl_ntoh64(p_sa_mad-comp_mask),
CL_NTOH64(JOIN_MC_COMP_MASK));
osm_sa_send_error(sa, p_madw,
- IB_SA_MAD_STATUS_REQ_INVALID);
+ IB_SA_MAD_STATUS_INSUF_COMPS);
goto Exit;
}

--
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/11] opensm/osm_sa_mcmember_record.c: Fix handling of invalid PKey

2011-04-01 Thread Hal Rosenstock

In mcmr_rcv_join_mgrp, when pkey is supplied, this needs to be checked
as to whether it is invalid or not as subsequent PKey checks are too
lenient

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_sa_mcmember_record.c
b/opensm/osm_sa_mcmember_record.c
index b2318ec..0f79e69 100644
--- a/opensm/osm_sa_mcmember_record.c
+++ b/opensm/osm_sa_mcmember_record.c
@@ -1019,6 +1019,15 @@ static void mcmr_rcv_join_mgrp(IN osm_sa_t * sa,
IN osm_madw_t * p_madw)
goto Exit;
}

+   if (p_sa_mad-comp_mask  IB_MCR_COMPMASK_PKEY 
+   ib_pkey_is_invalid(p_recvd_mcmember_rec-pkey)) {
+   CL_PLOCK_RELEASE(sa-p_lock);
+   OSM_LOG(sa-p_log, OSM_LOG_VERBOSE,
+   Invalid PKey supplied in request\n);
+   osm_sa_send_error(sa, p_madw, IB_SA_MAD_STATUS_REQ_INVALID);
+   goto Exit;
+   }
+
ib_member_get_scope_state(p_recvd_mcmember_rec-scope_state, NULL,
  join_state);

--
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 7/11] opensm/osm_pkey.c: Cosmetic formatting change

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_pkey.c b/opensm/osm_pkey.c
index 4c5a852..1032317 100644
--- a/opensm/osm_pkey.c
+++ b/opensm/osm_pkey.c
@@ -380,7 +380,6 @@ Exit:
 boolean_t osm_physp_has_pkey(IN osm_log_t * p_log, IN ib_net16_t pkey,
 IN const osm_physp_t * p_physp)
 {
-
ib_net16_t *p_pkey, pkey_base;
const osm_pkey_tbl_t *pkey_tbl;
boolean_t res = FALSE;
--
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 8/11] opensm/osm_prtn.c: Cosmetic formatting change

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/opensm/osm_prtn.c b/opensm/osm_prtn.c
index 6a23c76..3fd4fc0 100644
--- a/opensm/osm_prtn.c
+++ b/opensm/osm_prtn.c
@@ -253,7 +253,6 @@ osm_prtn_t *osm_prtn_make_new(osm_log_t * p_log,
osm_subn_t * p_subn,
osm_prtn_t *p = NULL, *p_check;

pkey = cl_hton16((uint16_t) ~ 0x8000);
-
if (!pkey) {
if (name  (p = osm_prtn_find_by_name(p_subn, name)))
return p;
--
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 9/11] osmtest/osmt_multicast.c: Fixed a couple of typos in OSM_LOG messages

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c
index b6dfdfc..4f0deb5 100644
--- a/osmtest/osmt_multicast.c
+++ b/osmtest/osmt_multicast.c
@@ -742,7 +742,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
((ib_net16_t) (sa_mad-status  IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 02EE: 
-   Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS 
got:%s/%s\n,
+   Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS 
got:%s/%s\n,
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) sa_mad));
status = IB_ERROR;
@@ -773,7 +773,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
((ib_net16_t) (sa_mad-status  IB_SMP_STATUS_MASK)) !=
IB_SA_MAD_STATUS_INSUF_COMPS) {
OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 02ED: 
-   Expectedd REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS 
got:%s/%s\n,
+   Expected REMOTE ERROR IB_SA_MAD_STATUS_INSUF_COMPS 
got:%s/%s\n,
ib_get_err_str(status),
ib_get_mad_status_str((ib_mad_t *) sa_mad));
status = IB_ERROR;
--
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 10/11] osmtest/osmt_multicast.c: Fixed some error codes in OSM_LOG messages

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c
index b6dfdfc..cfeb61b 100644
--- a/osmtest/osmt_multicast.c
+++ b/osmtest/osmt_multicast.c
@@ -677,7 +677,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
OSM_LOG(p_osmt-log, OSM_LOG_ERROR, EXPECTING_ERRORS_END \n);

if (status == IB_SUCCESS) {
-   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 2E0 
+   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 02E0: 
SubnAdmGet with invalid mlid 0x%x succeeded\n,
cl_ntoh16(mc_req_rec.mlid));
status = IB_ERROR;
@@ -706,7 +706,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
OSM_LOG(p_osmt-log, OSM_LOG_ERROR, EXPECTING_ERRORS_END \n);

if (status == IB_SUCCESS) {
-   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 2E4 
+   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 02E4: 
SubnAdmGet with invalid port guid succeeded\n);
status = IB_ERROR;
goto Exit;
@@ -2409,7 +2409,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
  cl_ntoh16(p_mc_res-mlid),
  p_mc_res);
} else if (cur_mlid  cl_ntoh16(max_mlid)) {
-   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 2E1 
+   OSM_LOG(p_osmt-log, OSM_LOG_ERROR, ERR 02E1: 

Successful Join with greater mlid than 
switches support
(MulticastFDBCap) 0x%04X\n,
cur_mlid);
status = IB_ERROR;
--
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 11/11] osmtest/osmt_multicast.c: Fix some typos

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/osmtest/osmt_multicast.c b/osmtest/osmt_multicast.c
index b6dfdfc..6d0ed73 100644
--- a/osmtest/osmt_multicast.c
+++ b/osmtest/osmt_multicast.c
@@ -729,7 +729,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)

comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
/* IB_MCR_COMPMASK_QKEY |  */
-   /* IB_MCR_COMPMASK_PKEY | intentionaly missed to raise the error */
+   /* IB_MCR_COMPMASK_PKEY | intentionally missed to raise the error */
IB_MCR_COMPMASK_SL | IB_MCR_COMPMASK_FLOW |
IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all above are
required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;

@@ -795,7 +795,7 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
comp_mask =
IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
IB_MCR_COMPMASK_QKEY | IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
-   /* IB_MCR_COMPMASK_FLOW | intentionaly missed to raise the error */
+   /* IB_MCR_COMPMASK_FLOW | intentionally missed to raise the error */
IB_MCR_COMPMASK_JOIN_STATE | IB_MCR_COMPMASK_TCLASS |   /* all 
above
are required */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;

@@ -857,10 +857,10 @@ ib_api_status_t osmt_run_mcast_flow(IN osmtest_t *
const p_osmt)
ib_member_set_join_state(mc_req_rec, IB_MC_REC_STATE_FULL_MEMBER);

comp_mask = IB_MCR_COMPMASK_MGID | IB_MCR_COMPMASK_PORT_GID |
-   /* IB_MCR_COMPMASK_QKEY | intentionaly missed to raise the error */
+   /* IB_MCR_COMPMASK_QKEY | intentionally missed to raise the error */
IB_MCR_COMPMASK_PKEY | IB_MCR_COMPMASK_SL |
IB_MCR_COMPMASK_FLOW | IB_MCR_COMPMASK_JOIN_STATE |
-   /* IB_MCR_COMPMASK_TCLASS |  intentionaly missed to raise the error 
*/
+   /* IB_MCR_COMPMASK_TCLASS |  intentionally missed to raise the
error */
IB_MCR_COMPMASK_RATE_SEL | IB_MCR_COMPMASK_RATE;

OSM_LOG(p_osmt-log, OSM_LOG_ERROR, EXPECTING_ERRORS_START \n);
--
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] infiniband-diags.spec.in: Remove duplication of ibdiscover.pl

2011-04-01 Thread Hal Rosenstock

Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/infiniband-diags.spec.in b/infiniband-diags.spec.in
index c50ce09..692ebd7 100644
--- a/infiniband-diags.spec.in
+++ b/infiniband-diags.spec.in
@@ -37,7 +37,6 @@ rm -rf $RPM_BUILD_ROOT

 %files
 %defattr(-,root,root)
-%{_sbindir}/ibdiscover.pl
 %{_sbindir}/ib*
 %{_sbindir}/perfquery
 %{_sbindir}/saquery
--
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 1/2] libibmad/smp.c: Fix to smp_query_via for attribute data

2011-04-01 Thread Hal Rosenstock

smp_query_via() does not allow setting the sent mad data.
Change the data to be both in and out arguments.

Signed-off-by: Oren Kladnitsky or...@dev.mellanox.co.il
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/src/smp.c b/src/smp.c
index 3ff58ce..2809ffe 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -102,7 +102,7 @@ uint8_t *smp_query_via(void *rcvbuf, ib_portid_t *
portid, unsigned attrid,
portid-sl = 0;
portid-qp = 0;

-   return mad_rpc(srcport, rpc, portid, 0, rcvbuf);
+   return mad_rpc(srcport, rpc, portid, rcvbuf, rcvbuf);
 }

 uint8_t *smp_query(void *rcvbuf, ib_portid_t * portid, unsigned attrid,

--
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/2] libibmad: Added smp_query/set _status_via functions

2011-04-01 Thread Hal Rosenstock

The smp_query/set functions do not return the MAD status.
The new extended API allows getting the SMP MAD status, and
to differentiate between timeout on MAD response and response
with bad status.

Signed-off-by: Oren Kladnitsky or...@dev.mellanox.co.il
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
diff --git a/include/infiniband/mad.h b/include/infiniband/mad.h
index a0b368a..5d18ec3 100644
--- a/include/infiniband/mad.h
+++ b/include/infiniband/mad.h
@@ -1,7 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
- * Copyright (c) 2009-2010 Mellanox Technologies LTD.  All rights reserved.
+ * Copyright (c) 2009-2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -981,6 +981,14 @@ MAD_EXPORT uint8_t *smp_query_via(void *buf,
ib_portid_t * id, unsigned attrid,
 MAD_EXPORT uint8_t *smp_set_via(void *buf, ib_portid_t * id, unsigned
attrid,
unsigned mod, unsigned timeout,
const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_query_status_via(void *rcvbuf, ib_portid_t *
portid,
+unsigned attrid, unsigned mod,
+unsigned timeout, int *rstatus,
+const struct ibmad_port *srcport);
+MAD_EXPORT uint8_t *smp_set_status_via(void *data, ib_portid_t * portid,
+  unsigned attrid, unsigned mod,
+  unsigned timeout, int *rstatus,
+  const struct ibmad_port *srcport);

 /* sa.c */
 uint8_t *sa_call(void *rcvbuf, ib_portid_t * portid, ib_sa_call_t * sa,
diff --git a/src/libibmad.map b/src/libibmad.map
index 5778e3e..1e6a028 100644
--- a/src/libibmad.map
+++ b/src/libibmad.map
@@ -101,7 +101,9 @@ IBMAD_1.3 {
ib_vendor_call;
ib_vendor_call_via;
smp_query_via;
+   smp_query_status_via;
smp_set_via;
+   smp_set_status_via;
ib_path_query_via;
ib_resolve_smlid_via;
ib_resolve_guid_via;
diff --git a/src/rpc.c b/src/rpc.c
index c5246fe..a702046 100644
--- a/src/rpc.c
+++ b/src/rpc.c
@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
  * Copyright (c) 2009 HNR Consulting.  All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -243,6 +244,8 @@ void *mad_rpc(const struct ibmad_port *port,
ib_rpc_t * rpc,
redirect = 0;
}

+   rpc-rstatus = status;
+
if (status != 0) {
ERRS(MAD completed with error status 0x%x; dport (%s),
 status, portid2str(dport));
diff --git a/src/smp.c b/src/smp.c
index 3ff58ce..a337663 100644
--- a/src/smp.c
+++ b/src/smp.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004-2009 Voltaire Inc.  All rights reserved.
+ * Copyright (c) 2011 Mellanox Technologies LTD.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -45,11 +46,12 @@
 #undef DEBUG
 #define DEBUG  if (ibdebug)IBWARN

-uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
-unsigned mod, unsigned timeout,
-const struct ibmad_port *srcport)
+uint8_t *smp_set_status_via(void *data, ib_portid_t * portid, unsigned
attrid,
+   unsigned mod, unsigned timeout, int *rstatus,
+   const struct ibmad_port *srcport)
 {
ib_rpc_t rpc = { 0 };
+   uint8_t *res;

DEBUG(attr 0x%x mod 0x%x route %s, attrid, mod, portid2str(portid));
if ((portid-lid = 0) ||
@@ -69,7 +71,18 @@ uint8_t *smp_set_via(void *data, ib_portid_t *
portid, unsigned attrid,
portid-sl = 0;
portid-qp = 0;

-   return mad_rpc(srcport, rpc, portid, data, data);
+   res = mad_rpc(srcport, rpc, portid, data, data);
+   if (rstatus)
+   *rstatus = rpc.rstatus;
+   return res;
+}
+
+uint8_t *smp_set_via(void *data, ib_portid_t * portid, unsigned attrid,
+unsigned mod, unsigned timeout,
+const struct ibmad_port *srcport)
+{
+   return smp_set_status_via(data, portid, attrid, mod, timeout, NULL,
+ srcport);
 }

 uint8_t *smp_set(void *data, ib_portid_t * portid, unsigned attrid,
@@ -78,11 +91,12 @@ uint8_t *smp_set(void *data, ib_portid_t * portid,
unsigned attrid,
return smp_set_via(data, 

[PATCH 1/3] ibacm: Reduce overhead on multicast groups not used

2011-04-01 Thread Hefty, Sean
ACM may join several multicast groups when using the multicast
group protocol.  No data is ever sent on those groups.  They exist
simply to see if a port *could* send data across those groups, for
example, to validate the mtu or rate between two endpoints.  Since
we don't send data on them, there's no need to create an address
handle for them or attach the ACM UD QP to it.

Signed-off-by: Sean Hefty sean.he...@intel.com
---
 src/acm.c |   30 --
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/acm.c b/src/acm.c
index 15f2631..3df996b 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -724,22 +724,32 @@ static void acm_process_join_resp(struct acm_ep *ep, 
struct ib_user_mad *umad)
mc_rec = (struct ib_mc_member_rec *) mad-data;
lock_acquire(ep-lock);
index = acm_mc_index(ep, mc_rec-mgid);
-   if (index = 0) {
-   dest = ep-mc_dest[index];
-   dest-remote_qpn = IB_MC_QPN;
-   dest-mgid = mc_rec-mgid;
-   acm_record_mc_av(ep-port, mc_rec, dest);
+   if (index  0) {
+   acm_log(0, ERROR - MGID in join response not found\n);
+   goto out;
+   }
+
+   dest = ep-mc_dest[index];
+   dest-remote_qpn = IB_MC_QPN;
+   dest-mgid = mc_rec-mgid;
+   acm_record_mc_av(ep-port, mc_rec, dest);
+
+   if (index == 0) {
dest-ah = ibv_create_ah(ep-port-dev-pd, dest-av);
+   if (!dest-ah) {
+   acm_log(0, ERROR - unable to create ah\n);
+   goto out;
+   }
ret = ibv_attach_mcast(ep-qp, mc_rec-mgid, mc_rec-mlid);
if (ret) {
acm_log(0, ERROR - unable to attach QP to multicast 
group\n);
-   } else {
-   dest-state = ACM_READY;
-   acm_log(1, join successful\n);
+   goto out;
}
-   } else {
-   acm_log(0, ERROR - MGID in join response not found\n);
}
+
+   dest-state = ACM_READY;
+   acm_log(1, join successful\n);
+out:
lock_release(ep-lock);
 }
 


--
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/3] ibacm: Join only the base multicast group if using SA path resolution

2011-04-01 Thread Hefty, Sean
If the ACM service is configured to use the SA to resolve path
record data, then only join the base multicast group.  We only
need to join other groups if we're creating path records based
on multicast data, using the acm route protocol.

Signed-off-by: Sean Hefty sean.he...@intel.com
---
 src/acm.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/acm.c b/src/acm.c
index 3df996b..fe42498 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -1556,7 +1556,8 @@ static void acm_port_join(struct acm_port *port)
if ((ep-state = ep-mc_dest[0].state) != ACM_READY)
continue;
 
-   if (port-rate != min_rate || port-mtu != min_mtu)
+   if ((route_prot == ACM_ROUTE_PROT_ACM) 
+   (port-rate != min_rate || port-mtu != min_mtu))
acm_join_group(ep, port_gid, 0, 0, 0, port-rate, 
port-mtu);
}
acm_log(1, joins for device %s port %d complete\n, 
dev-verbs-device-name,


--
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/3] ibacm: Allocate address handles dynamically when needed

2011-04-01 Thread Hefty, Sean
ibacm allocates an address handle for every remote destination
that it tracks.  However, under normal operation, the handle
is used infrequently - typically only once by the target
service to send a response and not at all on the initiator
service.  Avoid the overhead of having 1 address handle per
destination by allocating them dynamically only when they are needed.

The exceptions to this are the address handles allocated to
communicate with the SA and the primary multicast group.

Signed-off-by: Sean Hefty sean.he...@intel.com
---
 src/acm.c |   55 +--
 1 files changed, 25 insertions(+), 30 deletions(-)

diff --git a/src/acm.c b/src/acm.c
index fe42498..53a8e7b 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -164,6 +164,7 @@ struct acm_send_msg
DLIST_ENTRY  entry;
struct acm_ep*ep;
struct acm_dest  *dest;
+   struct ibv_ah*ah;
void *context;
void (*resp_handler)(struct acm_send_msg *req,
 struct ibv_wc *wc, struct acm_mad 
*resp);
@@ -449,20 +450,30 @@ acm_alloc_send(struct acm_ep *ep, struct acm_dest *dest, 
size_t size)
msg-mr = ibv_reg_mr(ep-port-dev-pd, msg-data, size, 0);
if (!msg-mr) {
acm_log(0, ERROR - failed to register send buffer\n);
-   goto err;
+   goto err1;
+   }
+
+   if (!dest-ah) {
+   msg-ah = ibv_create_ah(ep-port-dev-pd, dest-av);
+   if (!msg-ah) {
+   acm_log(0, ERROR - unable to create ah\n);
+   goto err2;
+   }
+   msg-wr.wr.ud.ah = msg-ah;
+   } else {
+   msg-wr.wr.ud.ah = dest-ah;
}
 
+   acm_log(2, get dest %s\n, dest-name);
+   (void) atomic_inc(dest-refcnt);
+   msg-dest = dest;
+
msg-wr.next = NULL;
msg-wr.sg_list = msg-sge;
msg-wr.num_sge = 1;
msg-wr.opcode = IBV_WR_SEND;
msg-wr.send_flags = IBV_SEND_SIGNALED;
msg-wr.wr_id = (uintptr_t) msg;
-
-   acm_log(2, get dest %s\n, dest-name);
-   (void) atomic_inc(dest-refcnt);
-   msg-dest = dest;
-   msg-wr.wr.ud.ah = dest-ah;
msg-wr.wr.ud.remote_qpn = dest-remote_qpn;
msg-wr.wr.ud.remote_qkey = ACM_QKEY;
 
@@ -471,7 +482,10 @@ acm_alloc_send(struct acm_ep *ep, struct acm_dest *dest, 
size_t size)
msg-sge.addr = (uintptr_t) msg-data;
acm_log(2, %p\n, msg);
return msg;
-err:
+
+err2:
+   ibv_dereg_mr(msg-mr);
+err1:
free(msg);
return NULL;
 }
@@ -490,6 +504,8 @@ acm_init_send_req(struct acm_send_msg *msg, void *context,
 static void acm_free_send(struct acm_send_msg *msg)
 {
acm_log(2, %p\n, msg);
+   if (msg-ah)
+   ibv_destroy_ah(msg-ah);
ibv_dereg_mr(msg-mr);
acm_put_dest(msg-dest);
free(msg);
@@ -774,7 +790,6 @@ static uint8_t
 acm_record_acm_route(struct acm_ep *ep, struct acm_dest *dest)
 {
int i;
-   uint8_t status;
 
acm_log(2, \n);
for (i = 0; i  MAX_EP_MC; i++) {
@@ -789,18 +804,8 @@ acm_record_acm_route(struct acm_ep *ep, struct acm_dest 
*dest)
dest-path = ep-mc_dest[i].path;
dest-path.dgid = dest-av.grh.dgid;
dest-path.dlid = htons(dest-av.dlid);
-
-   dest-ah = ibv_create_ah(ep-port-dev-pd, dest-av);
-   if (!dest-ah) {
-   acm_log(0, ERROR - failed to create ah\n);
-   dest-state = ACM_INIT;
-   status = ACM_STATUS_ENOMEM;
-   } else {
-   dest-state = ACM_READY;
-   status = ACM_STATUS_SUCCESS;
-   }
-   
-   return status;
+   dest-state = ACM_READY;
+   return ACM_STATUS_SUCCESS;
 }
 
 static void acm_init_path_query(struct ib_sa_mad *mad)
@@ -1096,15 +1101,6 @@ acm_dest_sa_resp(struct acm_send_msg *msg, struct ibv_wc 
*wc, struct acm_mad *ma
if (!status) {
memcpy(dest-path, sa_mad-data, sizeof(dest-path));
acm_init_path_av(msg-ep-port, dest);
-   if (dest-remote_qpn) {
-   dest-ah = ibv_create_ah(msg-ep-port-dev-pd, 
dest-av);
-   if (!dest-ah) {
-   acm_log(0, ERROR - failed to create ah\n);
-   status = ACM_STATUS_ENOMEM;
-   }
-   }
-   }
-   if (!status) {
dest-state = ACM_READY;
} else {
dest-state = ACM_INIT;
@@ -1164,7 +1160,6 @@ acm_process_addr_req(struct acm_ep *ep, struct ibv_wc 
*wc, struct acm_mad *mad)
break;
 
acm_log(2, src service has new qp, resetting\n);
-   ibv_destroy_ah(dest-ah); // TODO: ah could be in use
/* fall through */
case ACM_INIT:
case ACM_QUERY_ADDR:


--
To unsubscribe from this