Also, in mad_rpc, status should be based on management class

Signed-off-by: Hal Rosenstock <[email protected]>
---
diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c
index 210f0c2..c18b086 100644
--- a/libibmad/src/rpc.c
+++ b/libibmad/src/rpc.c
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004-2006 Voltaire Inc.  All rights reserved.
+ * Copyright (c) 2009 HNR Consulting.  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
@@ -168,7 +169,7 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * 
rpc, ib_portid_t * dport
              void *payload, void *rcvdata)
 {
        int status, len;
-       uint8_t sndbuf[1024], rcvbuf[1024], *mad;
+       uint8_t sndbuf[1024], rcvbuf[1024], *mad, mgmtclass;
 
        len = 0;
        memset(sndbuf, 0, umad_size() + IB_MAD_SIZE);
@@ -185,10 +186,28 @@ void *mad_rpc(const struct ibmad_port *port, ib_rpc_t * 
rpc, ib_portid_t * dport
 
        mad = umad_get_mad(rcvbuf);
 
-       if ((status = mad_get_field(mad, 0, IB_DRSMP_STATUS_F)) != 0) {
-               ERRS("MAD completed with error status 0x%x; dport (%s)",
-                    status, portid2str(dport));
-               return 0;
+       mgmtclass = mad_get_field(mad, 0, IB_MAD_MGMTCLASS_F);
+       if (mgmtclass == 1 || mgmtclass == 0x81) {
+               if (mgmtclass == 1)
+                       status = mad_get_field(mad, 0, IB_MAD_STATUS_F);
+               else
+                       status = mad_get_field(mad, 0, IB_DRSMP_STATUS_F);
+               if (status != 0) {
+                       ERRS("MAD completed with error status 0x%x; dport (%s)",
+                            status, portid2str(dport));
+                       return 0;
+               }
+       } else {
+               if ((status = mad_get_field(mad, 0, IB_MAD_STATUS_F)) != 0) {
+                       if (status & 2) { /* redirection */
+                               ERRS("MAD redirection not supported; dport 
(%s)",
+                                    portid2str(dport));
+                       } else {
+                               ERRS("MAD completed with error status 0x%x; 
dport (%s)",
+                                    status, portid2str(dport));
+                       }
+                       return 0;
+               }
        }
 
        if (ibdebug) {
@@ -225,8 +244,13 @@ void *mad_rpc_rmpp(const struct ibmad_port *port, ib_rpc_t 
* rpc, ib_portid_t *
        mad = umad_get_mad(rcvbuf);
 
        if ((status = mad_get_field(mad, 0, IB_MAD_STATUS_F)) != 0) {
-               ERRS("MAD completed with error status 0x%x; dport (%s)",
-                    status, portid2str(dport));
+               if (status & 2) { /* redirection */
+                       ERRS("MAD redirection not supported; dport (%s)",
+                            portid2str(dport));
+               } else {
+                       ERRS("MAD completed with error status 0x%x; dport (%s)",
+                            status, portid2str(dport));
+               }
                return 0;
        }
 
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to