public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH/ibsim] SMPs traveling through links in INIT should be forwarded
@ 2011-09-15 17:57 Jason Gunthorpe
       [not found] ` <20110915175701.GA6020-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2011-09-15 17:57 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Alex Netes

See 7.2.2 and other places in the IBA.

Pass if the current routing is for a SMP through to link_valid
---
 ibsim/sim_mad.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

This applies on top of Rolf's patch to fix combind DR/LID routed SMPs

diff --git a/ibsim/sim_mad.c b/ibsim/sim_mad.c
index 27670a8..83d4e3b 100644
--- a/ibsim/sim_mad.c
+++ b/ibsim/sim_mad.c
@@ -911,7 +911,7 @@ static int is_port_lid(Port * port, int lid)
 	return 1;
 }
 
-static int link_valid(Port * port)
+static int link_valid(Port * port,int is_smp)
 {
 	Node *node = port->node;
 
@@ -921,7 +921,7 @@ static int link_valid(Port * port)
 		      node->nodeid, node->numports);
 		return 0;
 	}
-	if (port->state != 4) {	// Active ?
+	if (!is_smp && port->state != 4) {	// Active ?
 		DEBUG("port 0x%" PRIx64
 		      " %d in not Active (%d)(node %s ports %d)",
 		      port->portguid, port->portnum, port->state, node->nodeid,
@@ -932,7 +932,7 @@ static int link_valid(Port * port)
 	return 1;
 }
 
-static Port *lid_route_MAD(Port * port, int lid)
+static Port *lid_route_MAD(Port * port, int lid, int is_smp)
 {
 	int hop, portnum;
 	Node *node = port->node;
@@ -978,7 +978,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 		DEBUG("outport 0x%" PRIx64 " (%d)", port->portguid,
 		      port->portnum);
 
-		if (!link_valid(port)) {
+		if (!link_valid(port, is_smp)) {
 			pc_add_error_xmitdiscards(port);
 			return 0;
 		}
@@ -997,7 +997,7 @@ static Port *lid_route_MAD(Port * port, int lid)
 		if (!node || !port)	// double check ?...
 			IBPANIC("bad node %p or port %p", node, port);
 
-		if (!link_valid(port)) {
+		if (!link_valid(port, is_smp)) {
 			pc_add_error_xmitdiscards(tport);
 			return 0;
 		}
@@ -1108,10 +1108,11 @@ static Port *direct_route_out_MAD(Port * port, ib_dr_path_t * path)
 	return port;
 }
 
-static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path)
+static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path,
+		       int is_smp)
 {
 	if (lid >= 0 && lid < 0xffff) {
-		port = lid_route_MAD(port, lid);
+		port = lid_route_MAD(port, lid, is_smp);
 		if (!port)
 			return NULL;
 		if (!path)
@@ -1128,7 +1129,7 @@ static Port *route_MAD(Port * port, int response, int lid, ib_dr_path_t * path)
 	}
 
 	if (port && lid >= 0 && lid < 0xffff)
-		port = lid_route_MAD(port, lid);
+		port = lid_route_MAD(port, lid, is_smp);
 
 	return port;
 }
@@ -1190,7 +1191,8 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl)
 	}
 
 	port = route_MAD(cl->port, response, ntohs(r->dlid),
-			 rpc.mgtclass == 0x81 ? &path : NULL);
+			 rpc.mgtclass == 0x81 ? &path : NULL,
+			 rpc.mgtclass == 0x1 || rpc.mgtclass == 0x81);
 	if (!port) {
 		IBWARN("routing failed: no route to dest lid %u path %s",
 		       ntohs(r->dlid), pathstr(0, &path));
@@ -1236,7 +1238,8 @@ int process_packet(Client * cl, void *p, int size, Client ** dcl)
 	r->status = 0;
 
 	port = route_MAD(port, 1, ntohs(r->dlid),
-			 rpc.mgtclass == 0x81 ? &path : NULL);
+			 rpc.mgtclass == 0x81 ? &path : NULL,
+			 rpc.mgtclass == 0x1 || rpc.mgtclass == 0x81);
 	if (!port || cl->port->node != port->node) {
 		VERB("PKT roll back did not succeed");
 		goto _dropped;
@@ -1324,7 +1327,7 @@ int send_trap(Port * port, unsigned trapnum)
 	if (encode_trapfn(port, data) < 0)
 		return -1;
 
-	if (!(destport = lid_route_MAD(port, port->smlid))) {
+	if (!(destport = lid_route_MAD(port, port->smlid, 1))) {
 		IBWARN("routing failed: no route to dest lid %u", port->smlid);
 		return -1;
 	}
-- 
1.7.1

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-16 13:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-15 17:57 [PATCH/ibsim] SMPs traveling through links in INIT should be forwarded Jason Gunthorpe
     [not found] ` <20110915175701.GA6020-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2011-09-16 13:15   ` Hal Rosenstock

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox