[openib-general] Gen2 OpenSM

shaharf shaharf at voltaire.com
Thu Dec 23 14:27:15 PST 2004


Thanks. You are probably right about the trap. I wonder why it has different scheme in the spec.
 
Did this work for anybody else then me?
Shahar

________________________________

From: Roland Dreier [mailto:roland at topspin.com]
Sent: Fri 12/24/2004 12:22 AM
To: shaharf
Cc: Michael S. Tsirkin; openib-general at openib.org
Subject: Re: [openib-general] Gen2 OpenSM



    shaharf> Ok, I will send the relevant function from user_mad
    shaharf> file. Please forgive me not to send you a proper patch. I
    shaharf> am already at home and I don't want to mess up my Wife's
    shaharf> computer ;-) Aha - BTW, what I really meant is that
    shaharf> OpenSM can bring up IPoIB (small mistake for me, big
    shaharf> progress for the openib...;-).

Here's the patch that I committed, I think I got the idea.

By the way, I had the umad module set the TID when sending traps,
since we do expect to get a response in the form of a trap repress.

 - Roland

Index: infiniband/core/user_mad.c
===================================================================
--- infiniband/core/user_mad.c  (revision 1375)
+++ infiniband/core/user_mad.c  (working copy)
@@ -236,6 +236,8 @@
                .num_sge     = 1,
                .send_flags  = IB_SEND_SIGNALED,
        };
+       u8 method;
+       u64 *tid;
        int ret;

        if (count < sizeof (struct ib_user_mad))
@@ -263,11 +265,22 @@
                goto err_up;
        }

-       ((struct ib_mad_hdr *) packet->mad.data)->tid =
-               cpu_to_be64(((u64) agent->hi_tid) << 32 |
-                           (be64_to_cpu(((struct ib_mad_hdr *) packet->mad.data)->tid) &
-                            0xffffffff));
+       /*
+        * If userspace is generating a request that will generate a
+        * response, we need to make sure the high-order part of the
+        * transaction ID matches the agent being used to send the
+        * MAD.
+        */
+       method = ((struct ib_mad_hdr *) packet->mad.data)->method;

+       if (!(method & IB_MGMT_METHOD_RESP)       &&
+           method != IB_MGMT_METHOD_TRAP_REPRESS &&
+           method != IB_MGMT_METHOD_SEND) {
+               tid = &((struct ib_mad_hdr *) packet->mad.data)->tid;
+               *tid = cpu_to_be64(((u64) agent->hi_tid) << 32 |
+                                  (be64_to_cpup(tid) & 0xffffffff));
+       }
+
        memset(&ah_attr, 0, sizeof ah_attr);
        ah_attr.dlid          = be16_to_cpu(packet->mad.lid);
        ah_attr.sl            = packet->mad.sl;





More information about the general mailing list