[openib-general] [PATCH] userspace/management changes to support send side RMPP

Hal Rosenstock
Mon May 23 09:30:11 PDT 2005


userspace/management changes to support send side RMPP
(needs change to linux-kernel/infiniband/core/user_mad.c)
ABI_VERSION is now 3
RMPP is enabled in build
SA GetTable is now supported properly (within current RMPP limitations)

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Modified: gen2/trunk/src/userspace/management/diags/ibping/src/ibping.c
===================================================================
--- gen2/trunk/src/userspace/management/diags/ibping/src/ibping.c       2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/diags/ibping/src/ibping.c       2005-05-23 16:33:46 UTC (rev 2456)
@@ -295,7 +295,7 @@
        madrpc_init(ca, ca_port, mgmt_classes, 3);
 
        if (server) {
-               if (mad_register_server(ping_class, 0, oui) < 0)
+               if (mad_register_server(ping_class, 0, 0, oui) < 0)
                        PANIC("can't serve class %d", ping_class);
 
                get_host_and_domain(host_and_domain, sizeof host_and_domain);
@@ -305,7 +305,7 @@
                exit(0);
        }
 
-       if (mad_register_client(ping_class) < 0)
+       if (mad_register_client(ping_class, 0) < 0)
                PANIC("can't register to ping class %d", ping_class);
                
        if (ib_resolve_portid_str(&portid, argv[0], dest_type, sm_id) < 0)

Modified: gen2/trunk/src/userspace/management/diags/ibsysstat/src/ibsysstat.c
===================================================================
--- gen2/trunk/src/userspace/management/diags/ibsysstat/src/ibsysstat.c 2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/diags/ibsysstat/src/ibsysstat.c 2005-05-23 16:33:46 UTC (rev 2456)
@@ -269,7 +269,7 @@
 main(int argc, char **argv)
 {
        int mgmt_classes[3] = {IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS};
-       int ping_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
+       int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
        ib_portid_t portid = {0};
        ib_portid_t *sm_id = 0, sm_portid = {0};
        int timeout = 0, udebug = 0, server = 0;
@@ -336,8 +336,8 @@
        madrpc_init(ca, ca_port, mgmt_classes, 3);
 
        if (server) {
-               if (mad_register_server(ping_class, 0, oui) < 0)
-                       PANIC("can't serve class %d", ping_class);
+               if (mad_register_server(sysstat_class, 0, 0, oui) < 0)
+                       PANIC("can't serve class %d", sysstat_class);
 
                host_ncpu = build_cpuinfo();
 
@@ -346,8 +346,8 @@
                exit(0);
        }
 
-       if (mad_register_client(ping_class) < 0)
-               PANIC("can't register to ping class %d", ping_class);
+       if (mad_register_client(sysstat_class, 0) < 0)
+               PANIC("can't register to ping class %d", sysstat_class);
                
        if (ib_resolve_portid_str(&portid, argv[0], dest_type, sm_id) < 0)
                PANIC("can't resolve destination port %s", argv[0]);

Modified: gen2/trunk/src/userspace/management/diags/smpdump/src/smpdump.c
===================================================================
--- gen2/trunk/src/userspace/management/diags/smpdump/src/smpdump.c     2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/diags/smpdump/src/smpdump.c     2005-05-23 16:33:46 UTC (rev 2456)
@@ -282,7 +282,7 @@
        if ((portid = umad_open_port(dev_name, dev_port)) < 0)
                PANIC("can't open UMAD port (%s:%d)", dev_name, dev_port);
 
-       if ((mad_agent = umad_register(portid, mgmt_class, 1, 0)) < 0)
+       if ((mad_agent = umad_register(portid, mgmt_class, 1, 0, 0)) < 0)
                PANIC("Couldn't register agent for SMPs");
 
        if (!(umad = umad_alloc(1)))
@@ -298,7 +298,7 @@
        if (debug > 1)
                xdump(stderr, "before send:\n", smp, 256);
 
-       if (umad_send(portid, mad_agent, umad, timeout_ms) < 0)
+       if (umad_send(portid, mad_agent, umad, IB_MAD_SIZE, timeout_ms) < 0)
                PANIC("send failed");
 
        if (umad_recv(portid, umad, -1) != mad_agent)

Modified: gen2/trunk/src/userspace/management/libibmad/include/infiniband/mad.h
===================================================================
--- gen2/trunk/src/userspace/management/libibmad/include/infiniband/mad.h       2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibmad/include/infiniband/mad.h       2005-05-23 16:33:46 UTC (rev 2456)
@@ -630,9 +630,9 @@
 int    mad_build_pkt(void *umad, ib_rpc_t *rpc, ib_portid_t *dport, ib_rmpp_hdr_t *rmpp, void *data);
 
 /* register.c */
-int    mad_register_client(int mgmt);
-int    mad_register_server(int mgmt, uint32_t method_mask[4],
-                           uint32_t class_oui);
+int    mad_register_client(int mgmt, uint8_t rmpp_version);
+int    mad_register_server(int mgmt, uint8_t rmpp_version,
+                           uint32_t method_mask[4], uint32_t class_oui);
 int    mad_class_agent(int mgmt);
 int    mad_agent_class(int agent);
 

Modified: gen2/trunk/src/userspace/management/libibmad/src/mad.c
===================================================================
--- gen2/trunk/src/userspace/management/libibmad/src/mad.c      2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibmad/src/mad.c      2005-05-23 16:33:46 UTC (rev 2456)
@@ -147,7 +147,7 @@
                mad_set_field(buf, 0, IB_DRSMP_DRDLID_F, drpath->drdlid ? drpath->drdlid : 0xffff);
                mad_set_field(buf, 0, IB_DRSMP_DRSLID_F, drpath->drslid ? drpath->drslid : 0xffff);
 
-               /* bytes 128 - 256 - by default should be zero due memset*/
+               /* bytes 128 - 256 - by default should be zero due to memset*/
                if (is_resp)
                        mad_set_array(buf, 0, IB_DRSMP_RPATH_F, drpath->p);
                else

Modified: gen2/trunk/src/userspace/management/libibmad/src/register.c
===================================================================
--- gen2/trunk/src/userspace/management/libibmad/src/register.c 2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibmad/src/register.c 2005-05-23 16:33:46 UTC (rev 2456)
@@ -116,7 +116,7 @@
 }
 
 int
-mad_register_client(int mgmt)
+mad_register_client(int mgmt, uint8_t rmpp_version)
 {
        int vers, agent;
 
@@ -124,7 +124,7 @@
                DEBUG("Unknown class %d mgmt_class", mgmt);
                return -1;
        }
-       if ((agent = umad_register(madrpc_portid(), mgmt, vers, 0)) < 0) {
+       if ((agent = umad_register(madrpc_portid(), mgmt, vers, rmpp_version, 0)) < 0) {
                DEBUG("Can't register agent for class %d", mgmt);
                return -1;
        }
@@ -141,9 +141,11 @@
 }
 
 int
-mad_register_server(int mgmt, uint32_t method_mask[4], uint32_t class_oui)
+mad_register_server(int mgmt, uint8_t rmpp_version,
+                   uint32_t method_mask[4], uint32_t class_oui)
 {
-       uint32_t class_method_mask[4] = {0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff};
+       uint32_t class_method_mask[4] = {0xffffffff, 0xffffffff,
+                                        0xffffffff, 0xffffffff};
        uint8_t oui[3];
        int agent, vers, mad_portid;
 
@@ -165,11 +167,11 @@
                oui[0] = (class_oui >> 16) & 0xff;
                oui[1] = (class_oui >> 8) & 0xff;
                oui[2] = class_oui & 0xff;
-               if ((agent = umad_register_oui(mad_portid, mgmt, oui, class_method_mask)) < 0) {
+               if ((agent = umad_register_oui(mad_portid, mgmt, rmpp_version, oui, class_method_mask)) < 0) {
                        DEBUG("Can't register agent for class %d", mgmt);
                        return -1;
                }
-       } else if ((agent = umad_register(mad_portid, mgmt, vers, class_method_mask)) < 0) {
+       } else if ((agent = umad_register(mad_portid, mgmt, vers, rmpp_version, class_method_mask)) < 0) {
                DEBUG("Can't register agent for class %d", mgmt);
                return -1;
        }

Modified: gen2/trunk/src/userspace/management/libibmad/src/rpc.c
===================================================================
--- gen2/trunk/src/userspace/management/libibmad/src/rpc.c      2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibmad/src/rpc.c      2005-05-23 16:33:46 UTC (rev 2456)
@@ -112,8 +112,8 @@
                timeout = def_madrpc_timeout;
 
        if (ibdebug > 1) {
-               WARN(">>> sending: len %d pktsz %d", len, umad_size());
-               xdump(stderr, "send buf\n", umad, umad_size());
+               WARN(">>> sending: len %d pktsz %d", len, umad_size() + IB_MAD_SIZE);
+               xdump(stderr, "send buf\n", umad, umad_size() + IB_MAD_SIZE);
        }
 
        if (save_mad) {
@@ -126,7 +126,7 @@
                if (retries)
                        ERRS("retry %d (timeout %d ms)", retries+1, timeout);
 
-               if (umad_send(mad_portid, agentid, umad, timeout) < 0) {
+               if (umad_send(mad_portid, agentid, umad, IB_MAD_SIZE, timeout) < 0) {
                        WARN("send failed; %m");
                        return -1;
                }
@@ -157,7 +157,7 @@
        uint8_t pktbuf[1024], *mad;
        void *umad = pktbuf;
 
-       memset(pktbuf, 0, umad_size());
+       memset(pktbuf, 0, umad_size() + IB_MAD_SIZE);
 
        if ((len = mad_build_pkt(umad, rpc, dport, 0, payload)) < 0)
                return 0;
@@ -192,7 +192,7 @@
        uint8_t pktbuf[1024], *mad;
        void *umad = pktbuf;
 
-       memset(pktbuf, 0, umad_size());
+       memset(pktbuf, 0, umad_size() + IB_MAD_SIZE);
 
        DEBUG("rmpp %p data %p", rmpp, data);
 
@@ -263,7 +263,7 @@
        while (num_classes--) {
                int mgmt = *mgmt_classes++;
 
-               if (mad_register_client(mgmt) < 0)
+               if (mad_register_client(mgmt, 0) < 0)
                        PANIC("client_register for mgmt %d failed", mgmt);
        }
 }

Modified: gen2/trunk/src/userspace/management/libibmad/src/serv.c
===================================================================
--- gen2/trunk/src/userspace/management/libibmad/src/serv.c     2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibmad/src/serv.c     2005-05-23 16:33:46 UTC (rev 2456)
@@ -71,7 +71,7 @@
        }
 
        if (umad_send(madrpc_portid(), mad_class_agent(rpc->mgtclass),
-                     umad, rpc->timeout) < 0) {
+                     umad, IB_MAD_SIZE, rpc->timeout) < 0) {
                WARN("send failed; %m");
                return -1;
        }
@@ -145,7 +145,7 @@
                xdump(stderr, "mad respond pkt\n", mad, IB_MAD_SIZE);
 
        if (umad_send(madrpc_portid(), mad_class_agent(rpc.mgtclass), umad,
-                     rpc.timeout) < 0) {
+                     IB_MAD_SIZE, rpc.timeout) < 0) {
                DEBUG("send failed; %m");
                return -1;
        }
@@ -156,7 +156,7 @@
 void *
 mad_receive(void *umad, int timeout)
 {
-       void *mad = umad ? umad : umad_alloc(1);
+       void *mad = umad ? umad : umad_alloc(1, umad_size() + IB_MAD_SIZE);
        int agent;
 
        if ((agent = umad_recv(madrpc_portid(), mad, timeout)) < 0) {
@@ -172,7 +172,7 @@
 void *
 mad_alloc(void)
 {
-       return umad_alloc(1);
+       return umad_alloc(1, umad_size() + IB_MAD_SIZE);
 }
 
 void

Modified: gen2/trunk/src/userspace/management/libibumad/include/infiniband/umad.h
===================================================================
--- gen2/trunk/src/userspace/management/libibumad/include/infiniband/umad.h     2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibumad/include/infiniband/umad.h     2005-05-23 16:33:46 UTC (rev 2456)
@@ -63,7 +63,7 @@
        uint32_t flow_label;
 } ib_mad_addr_t;
 
-#define IB_UMAD_ABI_VERSION    2
+#define IB_UMAD_ABI_VERSION    3
 #define IB_UMAD_ABI_DIR                "/sys/class/infiniband_mad"
 #define IB_UMAD_ABI_FILE       "abi_version"
 
@@ -160,14 +160,15 @@
 int    umad_set_addr(void *umad, int dlid, int dqp, int sl, int qkey);
 int    umad_set_pkey(void *umad, int pkey);
 
-int    umad_send(int portid, int agentid, void *umad, int timeout_ms);
+int    umad_send(int portid, int agentid, void *umad, int length,
+                 int timeout_ms);
 int    umad_recv(int portid, void *umad, int timeout_ms);
 int    umad_poll(int portid, int timeout_ms);
 
 int    umad_register(int portid, int mgmt_class, int mgmt_version,
-                     uint32_t method_mask[4]);
-int    umad_register_oui(int portid, int mgmt_class, uint8_t oui[3],
-                         uint32_t method_mask[4]);
+                     uint8_t rmpp_version, uint32_t method_mask[4]);
+int    umad_register_oui(int portid, int mgmt_class, uint8_t rmpp_version, 
+                         uint8_t oui[3], uint32_t method_mask[4]);
 int    umad_unregister(int portid, int agentid);
 
 int    umad_debug(int level);
@@ -177,9 +178,9 @@
 #include 
 
 static inline void *
-umad_alloc(int num)                    /* alloc array of umad buffers */
+umad_alloc(int num, int size)          /* alloc array of umad buffers */
 {
-       return calloc(num, umad_size());
+       return calloc(num, size); 
 }
 
 static inline void

Modified: gen2/trunk/src/userspace/management/libibumad/src/umad.c
===================================================================
--- gen2/trunk/src/userspace/management/libibumad/src/umad.c    2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/libibumad/src/umad.c    2005-05-23 16:33:46 UTC (rev 2456)
@@ -50,12 +50,14 @@
 
 #include "umad.h"
 
+#define IB_OPENIB_OUI                 (0x001405)
+
 typedef struct ib_user_mad {
-       uint8_t  data[256];
        uint32_t agent_id;
        uint32_t status;
        uint32_t timeout_ms;
        ib_mad_addr_t addr;
+       uint8_t  data[0];
 } ib_user_mad_t;
 
 typedef struct ib_user_mad_reg_req {
@@ -65,6 +67,7 @@
        uint8_t  mgmt_class;
        uint8_t  mgmt_class_version;
        uint8_t  oui[3];
+       uint8_t  rmpp_version;
 } ib_user_mad_reg_req_t;
 
 #define TRACE  if (umaddebug)  WARN
@@ -233,7 +236,7 @@
                return 1;
        }
 
-       if (*port > 0) {             /* user wants user gets */
+       if (*port > 0) {     /* user wants user gets */
                if (*port > ca.numports)
                        return -1;
                if (!ca.ports[*port])
@@ -300,7 +303,8 @@
                if (port_type > 0) {
                        if (best_port)
                                *best_port = port;
-                       DEBUG("found ca %s with active port %d", names[caidx], port);
+                       DEBUG("found ca %s with active port %d",
+                             names[caidx], port);
                        return (char *)(names + caidx);
                }
 
@@ -332,18 +336,22 @@
        int r, i, ret;
        int portnum;
 
-       strncpy(ca->ca_name, ca_name, sizeof(ca->ca_name));
+       strncpy(ca->ca_name, ca_name, sizeof ca->ca_name);
         
-       snprintf(dir_name, sizeof dir_name - 1, "%s/%s", SYS_INFINIBAND, ca->ca_name);
+       snprintf(dir_name, sizeof dir_name - 1, "%s/%s", SYS_INFINIBAND,
+                ca->ca_name);
        dir_name[sizeof dir_name - 1] = 0;
 
        if ((r = sys_read_uint(dir_name, SYS_NODE_TYPE, &ca->node_type)) < 0)
                return r;
-       if ((r = sys_read_string(dir_name, SYS_CA_FW_VERS, ca->fw_ver, sizeof ca->fw_ver)) < 0)
+       if ((r = sys_read_string(dir_name, SYS_CA_FW_VERS, ca->fw_ver,
+                                sizeof ca->fw_ver)) < 0)
                return r;
-       if ((r = sys_read_string(dir_name, SYS_CA_HW_VERS, ca->hw_ver, sizeof ca->hw_ver)) < 0)
+       if ((r = sys_read_string(dir_name, SYS_CA_HW_VERS, ca->hw_ver,
+                                sizeof ca->hw_ver)) < 0)
                return r;
-       if ((r = sys_read_string(dir_name, SYS_CA_TYPE, ca->ca_type, sizeof ca->ca_type)) < 0)
+       if ((r = sys_read_string(dir_name, SYS_CA_TYPE, ca->ca_type,
+                                sizeof ca->ca_type)) < 0)
                return r;
        if ((r = sys_read_guid(dir_name, SYS_CA_NODE_GUID, &ca->node_guid)) < 0)
                return r;
@@ -367,14 +375,16 @@
        memset(ca->ports, 0, sizeof ca->ports);
        for (i = 0; i < r; i++) {
                portnum = 0;
-               if (!strcmp(".", namelist[i]->d_name) || !strcmp("..", namelist[i]->d_name))
+               if (!strcmp(".", namelist[i]->d_name) ||
+                   !strcmp("..", namelist[i]->d_name))
                        continue;
                if (strcmp("0", namelist[i]->d_name) &&
-                   ((portnum = atoi(namelist[i]->d_name)) <= 0 || portnum >= UMAD_CA_MAX_PORTS)) {
+                   ((portnum = atoi(namelist[i]->d_name)) <= 0 ||
+                    portnum >= UMAD_CA_MAX_PORTS)) {
                        ret = -EIO;
                        goto clean;
                }
-               if (!(ca->ports[portnum] = calloc(1, sizeof (*ca->ports[portnum])))) {
+               if (!(ca->ports[portnum] = calloc(1, sizeof(*ca->ports[portnum])))) {
                        ret = -ENOMEM;
                        goto clean;
                }
@@ -489,7 +499,8 @@
                        if (!strcmp(namelist[i]->d_name, ".") || 
                            !strcmp(namelist[i]->d_name, "..")) {
                        } else 
-                               strncpy(cas[j++], namelist[i]->d_name, UMAD_CA_NAME_LEN);
+                               strncpy(cas[j++], namelist[i]->d_name,
+                                       UMAD_CA_NAME_LEN);
                        free(namelist[i]);
                }
                DEBUG("return %d cas", j);
@@ -679,7 +690,8 @@
 {
        struct ib_user_mad *mad = umad;
 
-       TRACE("umad %p dlid %d dqp %d sl %d, qkey %x", umad, dlid, dqp, sl, qkey);
+       TRACE("umad %p dlid %d dqp %d sl %d, qkey %x",
+             umad, dlid, dqp, sl, qkey);
        mad->addr.qpn = htonl(dqp);
        mad->addr.lid = htons(dlid);
        mad->addr.qkey = htonl(qkey);
@@ -704,7 +716,7 @@
 }
 
 int
-umad_send(int portid, int agentid, void *umad, int timeout_ms)
+umad_send(int portid, int agentid, void *umad, int length, int timeout_ms)
 {
        struct ib_user_mad *mad = umad;
        Port *port;
@@ -720,7 +732,7 @@
        if (umaddebug > 1)
                umad_dump(mad);
 
-       if (write(port->dev_fd, mad, sizeof (*mad)) == sizeof (*mad))
+       if (write(port->dev_fd, mad, length + sizeof *mad) == length + sizeof *mad)
                return 0;
 
        DEBUG("send error: %m");
@@ -758,7 +770,7 @@
        if (timeout_ms && (n = dev_poll(port->dev_fd, timeout_ms)) < 0)
                return n;
 
-       if ((n = read(port->dev_fd, umad, sizeof (*mad))) == sizeof (*mad)) {
+       if ((n = read(port->dev_fd, umad, sizeof *mad + 256)) == sizeof *mad + 256) {
                DEBUG("mad received by agent %d", mad->agent_id);
                return mad->agent_id;
        }
@@ -766,7 +778,7 @@
        if (n == -EWOULDBLOCK)
                return n;
 
-       DEBUG("read returned %d != sizeof umad %d (%m)", n, sizeof (*mad));
+       DEBUG("read returned %d != sizeof umad %d (%m)", n, sizeof *mad);
        return -EIO;
 }
 
@@ -783,14 +795,14 @@
 }
 
 int
-umad_register_oui(int portid, int mgmt_class, uint8_t oui[3],
-                 uint32_t method_mask[4])
+umad_register_oui(int portid, int mgmt_class, uint8_t rmpp_version,
+                 uint8_t oui[3], uint32_t method_mask[4])
 {
        struct ib_user_mad_reg_req req;
        Port *port;
 
-       TRACE("portid %d mgmt_class %u oui 0x%x%x%x method_mask %p",
-               portid, mgmt_class, (int)oui[0], (int)oui[1],
+       TRACE("portid %d mgmt_class %u rmpp_version %d oui 0x%x%x%x method_mask %p",
+               portid, mgmt_class, (int)rmpp_version, (int)oui[0], (int)oui[1],
                (int)oui[2], method_mask);
 
        if (!(port = port_get(portid)))
@@ -805,6 +817,7 @@
        req.mgmt_class = mgmt_class;
        req.mgmt_class_version = 1;
        memcpy(req.oui, oui, sizeof req.oui);
+       req.rmpp_version = rmpp_version;
 
        if ((void *)method_mask != 0)
                memcpy(req.method_mask, method_mask, sizeof req.method_mask);
@@ -817,21 +830,22 @@
                return req.id;          /* return agentid */
        }
        
-       DEBUG("portid %d registering qp %d class %s version %d out 0x%x failed: %m",
+       DEBUG("portid %d registering qp %d class %s version %d oui 0x%x failed: %m",
                portid, req.qpn, req.mgmt_class, req.mgmt_class_version, oui);
        return -EPERM;  
 }
 
 int
 umad_register(int portid, int mgmt_class, int mgmt_version,
-             uint32_t method_mask[4])
+             uint8_t rmpp_version, uint32_t method_mask[4])
 {
        struct ib_user_mad_reg_req req;
        Port *port;
+       uint32_t oui = htonl(IB_OPENIB_OUI);
        int qp;
 
-       TRACE("portid %d mgmt_class %u mgmt_version %u method_mask %p",
-               portid, mgmt_class, mgmt_version, method_mask);
+       TRACE("portid %d mgmt_class %u mgmt_version %u rmpp_version %d method_mask %p",
+               portid, mgmt_class, mgmt_version, rmpp_version, method_mask);
 
        if (!(port = port_get(portid)))
                return -EINVAL;
@@ -839,12 +853,15 @@
        req.qpn = qp = (mgmt_class == 0x1 || mgmt_class == 0x81) ? 0 : 1;
        req.mgmt_class = mgmt_class;
        req.mgmt_class_version = mgmt_version;
+       req.rmpp_version = rmpp_version;
 
        if ((void *)method_mask != 0)
                memcpy(req.method_mask, method_mask, sizeof req.method_mask);
        else
                memset(req.method_mask, 0, sizeof req.method_mask);
 
+       memcpy(&req.oui, (char *)&oui + 1, sizeof req.oui); 
+
        if (!ioctl(port->dev_fd, IB_USER_MAD_REGISTER_AGENT, (void *)&req)) {
                DEBUG("portid %d registered to use agent %d qp %d",
                      portid, req.id, qp);

Modified: gen2/trunk/src/userspace/management/osm/libvendor/Makefile.am
===================================================================
--- gen2/trunk/src/userspace/management/osm/libvendor/Makefile.am       2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/osm/libvendor/Makefile.am       2005-05-23 16:33:46 UTC (rev 2456)
@@ -9,7 +9,7 @@
 
 lib_LTLIBRARIES = libosmvendor.la
 
-libosmvendor_la_CFLAGS = -Wall -DOSM_VENDOR_INTF_OPENIB
+libosmvendor_la_CFLAGS = -Wall -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT
 
 if HAVE_LD_VERSION_SCRIPT
     libosmvendor_version_script = -Wl,--version-script=$(srcdir)/libosmvendor.map

Modified: gen2/trunk/src/userspace/management/osm/libvendor/osm_vendor_ibumad.c
===================================================================
--- gen2/trunk/src/userspace/management/osm/libvendor/osm_vendor_ibumad.c       2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/osm/libvendor/osm_vendor_ibumad.c       2005-05-23 16:33:46 UTC (rev 2456)
@@ -224,7 +224,8 @@
        pthread_sigmask(SIG_BLOCK, &sigs, NULL);
 
        for (;;) {
-               if (!umad && !(umad = umad_alloc(1))) {
+               if (!umad &&
+                   !(umad = umad_alloc(1, umad_size() + MAD_BLOCK_SIZE))) {
                        osm_log(p_ur->p_log, OSM_LOG_ERROR,
                                "umad_receiver: can't alloc umad\n");
                        break;
@@ -236,7 +237,8 @@
                        break;
                }
 
-               if (mad_agent >= UMAD_CA_MAX_AGENTS || !(p_bind = p_vend->agents[mad_agent])) {
+               if (mad_agent >= UMAD_CA_MAX_AGENTS ||
+                   !(p_bind = p_vend->agents[mad_agent])) {
                        osm_log(p_ur->p_log, OSM_LOG_ERROR,
                                "umad_receiver: bad mad agent %d - dropping\n", mad_agent);
                        continue;
@@ -249,7 +251,8 @@
                                 mad->mgmt_class == IB_MCLASS_SUBN_LID ||
                                 mad->mgmt_class == IB_MCLASS_SUBN_DIR);
 
-               if (!(madw_p = osm_mad_pool_get(p_bind->p_mad_pool, (osm_bind_handle_t)p_bind,
+               if (!(madw_p = osm_mad_pool_get(p_bind->p_mad_pool,
+                                               (osm_bind_handle_t)p_bind,
                                          MAD_BLOCK_SIZE, &osm_addr))) {
                        osm_log( p_vend->p_log, OSM_LOG_ERROR, "umad_receiver: "
                                "request for a new madw failed -- dropping packet\n" );
@@ -271,7 +274,8 @@
                        if (mad->mgmt_class != IB_MCLASS_SUBN_DIR) {
                                /* LID routed */
                                osm_log( p_vend->p_log, OSM_LOG_ERROR,
-                                       "umad_receiver: class 0x%x LID 0x%x\n", mad->mgmt_class, ib_addr->lid); 
+                                       "umad_receiver: class 0x%x LID 0x%x\n",
+                                       mad->mgmt_class, ib_addr->lid); 
                        } else {
                                /* Direct routed SMP */
                                ib_smp_t *smp = (ib_smp_t *)mad;
@@ -280,8 +284,10 @@
                                char line[BUF_SIZE];
 
                                osm_log( p_vend->p_log, OSM_LOG_ERROR,
-                                       "umad_receiver: DR SMP hop ptr %d hop count %d DR SLID 0x%x DR DLID 0x%x\n", smp->hop_ptr, smp->hop_count, smp->dr_slid, smp->dr_dlid);
-                               if( osm_log_is_active( p_vend->p_log, OSM_LOG_ERROR) )
+                                       "umad_receiver: DR SMP hop ptr %d hop count %d DR SLID 0x%x DR DLID 0x%x\n",
+                                       smp->hop_ptr, smp->hop_count, smp->dr_slid, smp->dr_dlid);
+                               if( osm_log_is_active( p_vend->p_log,
+                                                      OSM_LOG_ERROR) )
                                {
                                        sprintf( buf, "Initial path = ");
                                        for ( i = 0; i < smp->hop_count; i++ ) {
@@ -622,6 +628,7 @@
        osm_umad_bind_info_t *p_bind = 0;
        uint32_t method_mask[4];
        int umad_port_id;
+       uint8_t rmpp_version;
 
        OSM_LOG_ENTER( p_vend->p_log, osm_vendor_bind );
 
@@ -657,10 +664,20 @@
 
        memset(method_mask, 0xff, sizeof method_mask);  /* accept all methods */
 
+#ifndef VENDOR_RMPP_SUPPORT
+       rmpp_version = 0;
+#else
+       /* If SA class, set rmpp_version */
+       if (p_user_bind->mad_class == IB_MCLASS_SUBN_ADM)
+               rmpp_version = 1;
+       else
+               rmpp_version = 0;
+#endif
+
        if ((p_bind->agent_id = umad_register(p_vend->umad_port_id,
                                              p_user_bind->mad_class,
                                              p_user_bind->class_version,
-                                             method_mask)) < 0) {
+                                             rmpp_version, method_mask)) < 0) {
                osm_log( p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_bind: "
                        "Unable to register class %u version %u.\n",
                        p_user_bind->mad_class, p_user_bind->class_version);
@@ -681,10 +698,12 @@
 
        p_vend->agents[p_bind->agent_id] = p_bind;
 
-       if (p_user_bind->mad_class == 0x81) {
-               if ((p_bind->agent_id1 = umad_register(p_vend->umad_port_id, 1,
+       /* If Subn Directed Route class, register Subn LID routed class */
+       if (p_user_bind->mad_class == IB_MCLASS_SUBN_DIR) {
+               if ((p_bind->agent_id1 = umad_register(p_vend->umad_port_id,
+                                                      IB_MCLASS_SUBN_LID,
                                                       p_user_bind->class_version,
-                                                      method_mask)) < 0) {
+                                                      0, method_mask)) < 0) {
                        osm_log( p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_bind: "
                                "Unable to register class 1 version %u.\n",
                                p_user_bind->class_version);
@@ -724,13 +743,12 @@
 
        OSM_LOG_ENTER( p_vend->p_log, osm_vendor_get );
 
+osm_log( p_vend->p_log, OSM_LOG_DEBUG, "osm_vendor_get: "
+                "Acquiring UMAD for p_madw = %p, size = %u.\n", p_vw, mad_size );
        CL_ASSERT( p_vw );
-       CL_ASSERT( mad_size <= MAD_BLOCK_SIZE );
+       p_vw->size = mad_size;
+       p_vw->umad = umad_alloc(1, mad_size + umad_size());
 
-       /* IB_UMAD assumes it is 256 - we must follow */
-       p_vw->size = MAD_BLOCK_SIZE;
-       p_vw->umad = umad_alloc(1);
-
        /* track locally */
        p_vw->h_bind = h_bind;
 
@@ -786,7 +804,7 @@
        osm_vend_wrap_t* const p_vw = osm_madw_get_vend_ptr( p_madw );
        osm_mad_addr_t* const p_mad_addr = osm_madw_get_mad_addr_ptr( p_madw );
        ib_mad_t* const p_mad = osm_madw_get_mad_ptr( p_madw );
-       ib_sa_mad_t* const p_sa = (ib_sa_mad_t *)p_vw->umad;
+       ib_sa_mad_t* const p_sa = (ib_sa_mad_t *)p_mad;
        int ret = -1;
 #ifndef VENDOR_RMPP_SUPPORT
        uint32_t paylen = 0;
@@ -821,6 +839,7 @@
                        p_sa->rmpp_status = 0;
 #ifdef VENDOR_RMPP_SUPPORT
                }
+               osm_log( p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_send: RMPP %d length %d\n", ib_rmpp_is_flag_set((ib_rmpp_mad_t *)p_sa, IB_RMPP_FLAG_ACTIVE), p_madw->mad_size);
 #else
                } else { 
                        p_sa->rmpp_version = 1;
@@ -838,7 +857,7 @@
        if (resp_expected)
                put_madw(p_vend, p_madw, &p_mad->trans_id);
 
-       if ((ret = umad_send(p_bind->port_id, p_bind->agent_id, p_vw->umad, resp_expected ? p_vend->timeout : 0)) < 0) {
+       if ((ret = umad_send(p_bind->port_id, p_bind->agent_id, p_vw->umad, p_madw->mad_size, resp_expected ? p_vend->timeout : 0)) < 0) {
                osm_log( p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_send: Send failed %d (%m).\n", ret);
                (*p_bind->send_err_callback)(p_bind->client_context, p_madw);     /* cb frees madw */
                if (resp_expected)
@@ -850,7 +869,7 @@
                osm_mad_pool_put(p_bind->p_mad_pool, p_madw);
 
        osm_log(p_vend->p_log, OSM_LOG_DEBUG, "__osm_mtl_send_callback: "
-               "Completed Sending Request MADW:%p.\n", p_madw);
+               "Completed Sending Request MADW: %p.\n", p_madw);
 Exit:
        OSM_LOG_EXIT( p_vend->p_log );
        return( ret );

Modified: gen2/trunk/src/userspace/management/osm/opensm/Makefile.am
===================================================================
--- gen2/trunk/src/userspace/management/osm/opensm/Makefile.am  2005-05-23 16:12:49 UTC (rev 2455)
+++ gen2/trunk/src/userspace/management/osm/opensm/Makefile.am  2005-05-23 16:33:46 UTC (rev 2456)
@@ -47,7 +47,7 @@
                 osm_ucast_mgr.c osm_ucast_updn.c \
                 osm_vl15intf.c osm_vl_arb_rcv.c\
                 osm_vl_arb_rcv_ctrl.c
-opensm_CFLAGS = -Wall -DOSM_VENDOR_INTF_OPENIB
+opensm_CFLAGS = -Wall -DOSM_VENDOR_INTF_OPENIB -DVENDOR_RMPP_SUPPORT
 opensm_LDADD = $(libdir)/libibumad.la \
               $(libdir)/libibcommon.la \
               $(libdir)/libosmcomp.la \




More information about the openib-general mailing list