[openib-general] [PATCH][RFC/v1][10/12] IPoIB IPv4 multicast

Grant Grundler iod00d at hp.com
Thu Nov 18 13:48:27 PST 2004


On Thu, Nov 18, 2004 at 10:58:50AM -0800, Roland Dreier wrote:
> Add ip_ib_mc_map() to convert IPv$ multicast addresses to IPoIB
> hardware addresses.
...
> +	addr    = ntohl(addr);
...
> +	buf[19] = addr & 0xff;
> +	addr  >>= 8;
> +	buf[18] = addr & 0xff;
> +	addr  >>= 8;
> +	buf[17] = addr & 0xff;
> +	addr  >>= 8;
> +	buf[16] = addr & 0x0f;

Can the same be done instead with the following?

	addr &= 0x0fffffff;
	((unsigned int *)buf)[4] = cpu_to_be32(addr);

Or are there possible alignment issues with buf?

Maybe the following is also correct:
	((unsigned int *)buf)[4] = addr & htonl(0x0fffffff);

anyway...just some micro-optimizations...probably really only matters
on BE machines.

thanks,
grant



More information about the general mailing list