[openib-general] [PATCH 1/5] ib_addr: retrieve MGID from device address
Michael S. Tsirkin
mst at mellanox.co.il
Sun Jun 11 03:52:10 PDT 2006
Quoting r. Sean Hefty <sean.hefty at intel.com>:
> Subject: [PATCH 1/5] ib_addr: retrieve MGID from device address
>
> Extract the MGID used by ipoib for broadcast traffic from the device
> address.
>
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> This will be used to get the MCMemberRecord for the ipoib broadcast group.
>
> --- svn3/gen2/trunk/src/linux-kernel/infiniband/include/rdma/ib_addr.h 2006-05-25 11:18:47.000000000 -0700
> +++ svn/gen2/trunk/src/linux-kernel/infiniband/include/rdma/ib_addr.h 2006-06-06 16:14:11.000000000 -0700
> @@ -89,6 +89,11 @@ static inline void ib_addr_set_pkey(stru
> dev_addr->broadcast[9] = (unsigned char) pkey;
> }
>
> +static inline union ib_gid *ib_addr_get_mgid(struct rdma_dev_addr *dev_addr)
> +{
> + return (union ib_gid *) (dev_addr->broadcast + 4);
> +}
> +
> static inline union ib_gid *ib_addr_get_sgid(struct rdma_dev_addr *dev_addr)
> {
> return (union ib_gid *) (dev_addr->src_dev_addr + 4);
>
dev_addr->broadcast + 4/dev_addr->src_dev_addr + 4 may not be naturally aligned,
so casting this pointer to structure type may cause compiler to generate
incorrect code.
In particular, there will generate misaligned access faults on ia64 when used,
as we have already seen in case of IPoIB. Please fix these to return gid as
char[16] instead, so that user uses memcpy properly and so that compiler knows
the address may not be aligned.
--
MST
More information about the general
mailing list