[openib-general] [PATCH] ib_mad.c: Fix request/response matching

Hal Rosenstock
Wed Oct 6 08:25:15 PDT 2004


On Wed, 2004-10-06 at 10:36, Hal Rosenstock wrote: 
> On Tue, 2004-10-05 at 16:34, Sean Hefty wrote:
> > >   if (solicited) {
> > >           /* Routing is based on high 32 bits of transaction ID of MAD
> > >*/
> > >-          hi_tid = mad->mad_hdr.tid >> 32;
> > >+          hi_tid = be32_to_cpu(mad->mad_hdr.tid.tid_field.hi_tid);
> > 
> > This shouldn't be necessary:

It is still necessary as the TID is in network endian in the MAD header
and CPU endian in hi_tid.

> > 
> > Sender of request (system 1):
> > mad.tid = (mad_agent.hi_tid << 32) | user_tid;
> > send mad
> 
> The problem with this is that when this is done on a little endian
> machine it shows up byte swapped on the network and not in network
> endian.
> 
> So if hi_tid = 1 and user tid = 0x9abcdef0
> then the transaction ID in the MAD is 0xf0debc9a01000000
> I don't think that is what we want.

The client needs to do one more step:
Sender of request (system 1):
mad.tid = cpu_to_be64((mad_agent.hi_tid << 32) | user_tid);
send mad

If this seems right, I can post a patch and remove the TID union.

> > Receiver of response (system 1):
> > hi_tid = mad.tid >> 32

-- Hal



More information about the openib-general mailing list