Re: [PATCH 17/23 v3] mlx4_core: Randomize Mac addresses for slaves

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Ben Hutchings
Date: Tuesday, February 9, 2010 - 10:22 am

On Thu, 2010-02-04 at 17:56 +0200, Yevgeny Petrilin wrote:
[...]

Do you really want the last byte to be 0 always?

Assuming you don't, you can avoid the inner loop by writing:

	union {
		u8 bytes[ETH_ALEN];
		__le64 qword;
	} rand_mac = {
		.qword = 0
	};
	...
		random_ether_addr(rand_mac.bytes);
		caps->def_mac[i] = le64_to_cpup(&rand_mac.qword);

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 17/23 v3] mlx4_core: Randomize Mac addresses fo ..., Ben Hutchings, (Tue Feb 9, 10:22 am)