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

Hal Rosenstock halr at voltaire.com
Wed Oct 6 11:01:24 PDT 2004


On Wed, 2004-10-06 at 12:04, Fab Tillier wrote:
> > From: Hal Rosenstock [mailto:halr at voltaire.com]
> > Sent: Wednesday, October 06, 2004 7:36 AM
> > 
> > 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 TID on the wire is opaque to any recipient.

True but by conforming to network endian it makes it easier to
understand what is going on (which internal client should receive it).
This is a minor cost.

> A response to a MAD should have exactly the same TID.  
> The recipient of the response (original client)
> will then correctly decode the hi_tid and user_tid since the transaction ID
> is received exactly how it was sent.  You only need byte swapping if the
> value needs to be interpreted by some other node with unknown endianness.
> If the recipient just blindly echoes the value back, the TID is effectively
> just a 64-bit data blob that it cares not about - byte ordering doesn't
> matter one bit.  The endianness of the TID does not change for the client -
> it is sent in host order, and is received in host order.  The only time this
> could cause problems is if your client's CPU changes endianness between the
> time the request is sent and the response received.  I don't think we should
> bother coding for that possibility.

Agreed.

-- Hal




More information about the general mailing list