[patch] IB/mthca: make type explicit in mthca_INIT_HCA()

2013-08-16 Thread Dan Carpenter
The type of the second argument to the MTHCA_PUT() macro determines how
many bytes will be written to inbox.  Judging from the context, the
current code is doing the right thing by writing an int of data.  But I
would feel more comfortable making it explicit that we are writing 32
bits.

This is just a cleanup.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c 
b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 9d3e5c1..2d2a401 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -1359,7 +1359,7 @@ int mthca_INIT_HCA(struct mthca_dev *dev,
memset(inbox, 0, INIT_HCA_IN_SIZE);
 
if (dev-mthca_flags  MTHCA_FLAG_SINAI_OPT)
-   MTHCA_PUT(inbox, 0x1, INIT_HCA_FLAGS1_OFFSET);
+   MTHCA_PUT(inbox, (u32)0x1, INIT_HCA_FLAGS1_OFFSET);
 
 #if defined(__LITTLE_ENDIAN)
*(inbox + INIT_HCA_FLAGS2_OFFSET / 4) = ~cpu_to_be32(1  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


Re: [PATCH] osm_port_info_rcv.c Issue a log message if we cannot read the MKey of a port

2013-08-16 Thread Hal Rosenstock
On 8/14/2013 6:26 AM, Line Holen wrote:
 Signed-off-by: Line Holen line.ho...@oracle.com
 
 ---
 
 diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
 index 7dcd15e..961b376 100644
 --- a/opensm/osm_port_info_rcv.c
 +++ b/opensm/osm_port_info_rcv.c
 @@ -85,7 +85,7 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN 
 osm_physp_t * p_physp,
   osm_madw_context_t context;
   ib_api_status_t status;
   ib_net64_t port_guid;
 - uint8_t rate, mtu;
 + uint8_t rate, mtu, mpb;
   unsigned data_vls;
   cl_qmap_t *p_sm_tbl;
   osm_remote_sm_t *p_sm;
 @@ -126,6 +126,14 @@ static void pi_rcv_process_endport(IN osm_sm_t * sm, IN 
 osm_physp_t * p_physp,
   }
   }
  
 + /* Check M_Key vs M_Key protect, can we control the port ? */
 + mpb = ib_port_info_get_mpb(p_pi);
 + if (mpb  0  p_pi-m_key == 0) {
 + OSM_LOG(sm-p_log, OSM_LOG_INFO,
 + Port 0x% PRIx64  has unknown M_Key, protection level 
 %u\n,
 + cl_ntoh64(port_guid), mpb);
 + }
 +

It looks to me like the only case here is when protect bits is 1 for
gets; all others fail. Is it more than that ?

Also, would this spam the OpenSM log ?

-- Hal

   if (port_guid != sm-p_subn-sm_port_guid) {
   p_sm_tbl = sm-p_subn-sm_guid_tbl;
   if (p_pi-capability_mask  IB_PORT_CAP_IS_SM) {
 

--
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 libibverbs] XRC - Sample application issues

2013-08-16 Thread Hefty, Sean
 @@ -884,6 +884,13 @@ int main(int argc, char *argv[])
   if (ctx.use_event)
   ibv_ack_cq_events(ctx.recv_cq, num_cq_events);
 
 + /* Process should wait before closing its resources to make sure
 +   * latest daemon's response sent via its target QP destined to an XSRQ
 +   * created by another client won't be lost.
 +   * Failure to do so will cause the client to wait for that sent message
 forever.
 +   * See comment on pp_post_send.
 + */
 + sleep(1);

I dislike adding sleep calls into code.  Isn't there a more robust way to 
handle this?
--
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 opensm] osm_lid_mgr.c: Don't configure MTU and LMC for base SP0

2013-08-16 Thread Hal Rosenstock
From: Alex Netes ale...@mellanox.com

For base switch port 0, these values aren't defined/used.

Signed-off-by: Alex Netes ale...@mellanox.com
Signed-off-by: Hal Rosenstock h...@mellanox.com
---
 opensm/osm_lid_mgr.c |   11 ++-
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/opensm/osm_lid_mgr.c b/opensm/osm_lid_mgr.c
index d881b5e..85fb44f 100644
--- a/opensm/osm_lid_mgr.c
+++ b/opensm/osm_lid_mgr.c
@@ -988,10 +988,11 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
ib_port_info_get_port_state(p_old_pi))
send_set = TRUE;
}
-   } else {
+   } else if (ib_switch_info_is_enhanced_port0(p_node-sw-switch_info)) {
/*
-  For Port 0, NeighborMTU is relevant only for Enh. SP0.
-  In this case, we'll set the MTU according to the mtu_cap
+* Configure Enh. SP0:
+* Set MTU according to the mtu_cap.
+* Set LMC if lmc_esp0 is defined.
 */
ib_port_info_set_neighbor_mtu(p_pi,
  ib_port_info_get_mtu_cap
@@ -1006,8 +1007,8 @@ static int lid_mgr_set_physp_pi(IN osm_lid_mgr_t * p_mgr,
cl_ntoh64(osm_physp_get_port_guid(p_physp)),
ib_port_info_get_neighbor_mtu(p_pi));
 
-   /* Determine if enhanced switch port 0 and if so set LMC */
-   if (osm_switch_sp0_is_lmc_capable(p_node-sw, p_mgr-p_subn)) {
+   /* Configure LMC on enhanced SP0 */
+   if (p_mgr-p_subn-opt.lmc_esp0) {
/* p_pi-mkey_lmc is initialized earlier */
ib_port_info_set_lmc(p_pi, p_mgr-p_subn-opt.lmc);
if (ib_port_info_get_lmc(p_pi) !=
-- 
1.7.8.2

--
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: [ceph-users] Help needed porting Ceph to RSockets

2013-08-16 Thread Hefty, Sean
 I am looking at a multithreaded application here, and I believe that
 the race is between thread A calling the rpoll() for POLLIN event and
 thread B calling the shutdown(SHUT_RDWR) for reading and writing of
 the (r)socket almost immediately afterwards.

I modified a test program, and I can reproduce the hang as you describe -- 
calling rpoll() then rshutdown() from another thread.

These calls end up calling rpoll-poll followed by rshutdown-read.  The read 
completes, which completes rshutdown, but the poll continues to wait for an 
event.  In the kernel, poll ends up in uverbs.c::ib_uverbs_event_poll, and read 
in uverbs.c::ib_uverbs_event_read().

The behavior of poll/read seems reasonable, so I don't think this is a kernel 
issue.  I'm still trying to figure out a simple solution to fixing this.

- Sean
--
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