[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-rdma
Subject:    [PATCH] opensm/osm_slvl_map_rcv.c: fix port parsing on BE machine
From:       Sasha Khapyorsky <sashak () voltaire ! com>
Date:       2009-12-29 15:05:28
Message-ID: 20091229150528.GV26940 () me
[Download RAW message or body]


Ports (input and output) number parsing from attribute modifier value of
SLtoVLMappingTable response was endianess dependent and actually was
broken on a big endian machines. Fix it by doing this endianess
independently.

Signed-off-by: Sasha Khapyorsky <sashak@voltaire.com>
---

On 14:41 Tue 01 Dec     , Hal Rosenstock wrote:
> 
> Optimized SLtoVLMappingTable programming reduces the number of MADs
> needed from O(n**2) to O(n). See IBA 1.2.1 vol 1 p. 843 14.2.5.8
> SLtoVLMappingTable.
> 
> Signed-off-by: Hal Rosenstock <hal.rosenstock@gmail.com>

When reviewing this patch I found couple of bugs in this code unrelated
to the proposed change. Posting the fixes in this thread.

 opensm/opensm/osm_slvl_map_rcv.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/opensm/opensm/osm_slvl_map_rcv.c b/opensm/opensm/osm_slvl_map_rcv.c
index 4f75690..3b24a8e 100644
--- a/opensm/opensm/osm_slvl_map_rcv.c
+++ b/opensm/opensm/osm_slvl_map_rcv.c
@@ -105,10 +105,8 @@ void osm_slvl_rcv_process(IN void *context, IN void *p_data)
 
 	/* in case of a non switch node the attr modifier should be ignored */
 	if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) {
-		out_port_num =
-		    (uint8_t) cl_ntoh32(p_smp->attr_mod & 0xFF000000);
-		in_port_num =
-		    (uint8_t) cl_ntoh32((p_smp->attr_mod & 0x00FF0000) << 8);
+		out_port_num = cl_ntoh32(p_smp->attr_mod) & 0xff;
+		in_port_num = (cl_ntoh32(p_smp->attr_mod) >> 8) & 0xff;
 		p_physp = osm_node_get_physp_ptr(p_node, out_port_num);
 	} else {
 		p_physp = p_port->p_physp;
-- 
1.6.6.rc4

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

Configure | About | News | Add a list | Sponsored by KoreLogic