[openib-general] Re: ipoib: question
Roland Dreier
rdreier at cisco.com
Wed Dec 14 12:16:45 PST 2005
> where exactly does the following math come from?
>
> static inline struct ipoib_neigh **to_ipoib_neigh(struct neighbour *neigh)
> {
> return (struct ipoib_neigh **) (neigh->ha + 24 -
> (offsetof(struct neighbour, ha) & 4));
> }
>
> 1. What does & 4 do here?
> 2. Why are we subsrctucting a function of ha offset?
No #3 again ;)
> 4. What is 24? Is it related to INFINIBAND_ALEN?
Yes, 24 is INFINIBAND_ALEN + 4. Maybe it would be clearer to write it
that way.
The idea is that we want to get something aligned to 8 bytes. I'd
have to check again to be sure but I think that on some architectures,
the beginning ha member of struct neighbour is only aligned to 4
bytes, so we should offset by 20 bytes to get to an alignment of 8 and
still leave room for the real hardware address.
- R.
More information about the general
mailing list