On Sat, May 04, 2013 at 08:12:22PM +0800, Marek Lindner wrote:
On Wednesday, April 24, 2013 04:04:34 Antonio Quartulli wrote:
On Wed, Apr 24, 2013 at 03:58:56AM +0800, Marek Lindner wrote:
On Tuesday, April 23, 2013 22:34:30 Antonio Quartulli wrote:
@@ -1535,7 +1535,9 @@ static uint32_t batadv_tt_global_crc(struct batadv_priv *bat_priv, orig_node)) continue;
crc ^= crc32c(0, tt_common->addr, ETH_ALEN);
crc_tmp = crc32c(0, &tt_common->vid,
sizeof(tt_common->vid));
crc ^= crc32c(crc_tmp, tt_common->addr,
ETH_ALEN);
} rcu_read_unlock();
Is it necessary to define another variable ?
yes
Why not:
crc = crc32c(0, &tt_common->vid, sizeof(tt_common->vid)); crc ^= crc32c(crc, tt_common->addr, ETH_ALEN);
because crc_tmp is the result of the CRC operation on the VID and the MAC address (so one per client), while crc is the container of all the crc_tmp xor'ed together..
As we discussed on IRC please add a big comment here explaining why we do things this way and not differently.
Yeah, as I told you on IRC the comment is ready :-) Will add it in the next version
Cheers,