[openib-general] [PATCH 1/2] libibmad: Add support for DrSLID
Hal Rosenstock
halr at voltaire.com
Mon Oct 16 05:50:25 PDT 2006
libibmad: Add support for DrSLID
Signed-off-by: Hal Rosenstock <halr at voltaire.com>
---
Index: ../libibmad/include/infiniband/mad.h
===================================================================
--- ../libibmad/include/infiniband/mad.h (revision 9746)
+++ ../libibmad/include/infiniband/mad.h (working copy)
@@ -577,6 +577,7 @@ enum {
IB_DEST_LID,
IB_DEST_DRPATH,
IB_DEST_GUID,
+ IB_DEST_DRSLID,
};
enum {
Index: ../libibmad/src/resolve.c
===================================================================
--- ../libibmad/src/resolve.c (revision 9746)
+++ ../libibmad/src/resolve.c (working copy)
@@ -93,6 +93,9 @@ ib_resolve_portid_str(ib_portid_t *porti
{
uint64_t guid;
int lid;
+ char *routepath;
+ ib_portid_t selfportid = {0};
+ int selfport = 0;
switch (dest_type) {
case IB_DEST_LID:
@@ -113,6 +116,20 @@ ib_resolve_portid_str(ib_portid_t *porti
/* keep guid in portid? */
return ib_resolve_guid(portid, &guid, sm_id, 0);
+ case IB_DEST_DRSLID:
+ lid = strtol(addr_str, &routepath, 0);
+ routepath++;
+ if (!IB_LID_VALID(lid))
+ return -1;
+ ib_portid_set(portid, lid, 0, 0);
+
+ /* handle DR parsing and set DrSLID to local lid */
+ if (ib_resolve_self(&selfportid, &selfport, 0) < 0)
+ return -1;
+ if (str2drpath(&portid->drpath, routepath, selfportid.lid, 0) < 0)
+ return -1;
+ return 0;
+
default:
IBWARN("bad dest_type %d", dest_type);
}
Index: ../libibmad/src/smp.c
===================================================================
--- ../libibmad/src/smp.c (revision 9746)
+++ ../libibmad/src/smp.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004,2005 Voltaire Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire Inc. 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
@@ -55,7 +55,9 @@ smp_set(void *data, ib_portid_t *portid,
ib_rpc_t rpc = {0};
DEBUG("attr %d mod %d route %s", attrid, mod, portid2str(portid));
- if (portid->lid <= 0)
+ if ((portid->lid <= 0) ||
+ (portid->drpath.drslid == 0xffff) ||
+ (portid->drpath.drdlid == 0xffff))
rpc.mgtclass = IB_SMI_DIRECT_CLASS; /* direct SMI */
else
rpc.mgtclass = IB_SMI_CLASS; /* Lid routed SMI */
@@ -87,7 +89,9 @@ smp_query(void *rcvbuf, ib_portid_t *por
rpc.datasz = IB_SMP_DATA_SIZE;
rpc.dataoffs = IB_SMP_DATA_OFFS;
- if (portid->lid <= 0)
+ if ((portid->lid <= 0) ||
+ (portid->drpath.drslid == 0xffff) ||
+ (portid->drpath.drdlid == 0xffff))
rpc.mgtclass = IB_SMI_DIRECT_CLASS; /* direct SMI */
else
rpc.mgtclass = IB_SMI_CLASS; /* Lid routed SMI */
Index: ../libibmad/src/mad.c
===================================================================
--- ../libibmad/src/mad.c (revision 9746)
+++ ../libibmad/src/mad.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004,2005 Voltaire Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire Inc. 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
@@ -182,7 +182,10 @@ mad_build_pkt(void *umad, ib_rpc_t *rpc,
else if (lid_routed)
umad_set_addr(umad, dport->lid, dport->qp, 0, 0);
else
- umad_set_addr(umad, 0xffff, 0, 0, 0); /* direct routed smi */
+ if ((dport->drpath.drslid != 0xffff) && (dport->lid > 0))
+ umad_set_addr(umad, dport->lid, 0, 0, 0);
+ else
+ umad_set_addr(umad, 0xffff, 0, 0, 0);
umad_set_grh(umad, (dport->grh && !is_smi) ? 0/*grh*/ : 0); /* FIXME: GRH support */
umad_set_pkey(umad, is_smi ? 0 : dport->pkey_idx);
Index: ../libibmad/src/portid.c
===================================================================
--- ../libibmad/src/portid.c (revision 9746)
+++ ../libibmad/src/portid.c (working copy)
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004,2005 Voltaire Inc. All rights reserved.
+ * Copyright (c) 2004-2006 Voltaire Inc. 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
@@ -79,7 +79,10 @@ portid2str(ib_portid_t *portid)
*(uint64_t *)portid->gid,
*(uint64_t *)(portid->gid+8));
}
- return buf;
+ if (portid->drpath.cnt)
+ s += sprintf(s, " ");
+ else
+ return buf;
}
s += sprintf(s, "DR path ");
for (i = 0; i < portid->drpath.cnt+1; i++)
More information about the general
mailing list