Skip to contentSkip to conversation

Question about the hash used in XOR mode

DISCUSSION Shmulik Hen 2 participants 2 messages Sep 21, 2003 – Sep 23, 2003

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

In bond_xmit_xor(), we have the following:

slave = bond->prev;
.
.
.
slave_no = (data->h_dest[5]^slave->dev->dev_addr[5]) % bond->slave_cnt;

Which should give us a number between 0 and slave_cnt-1 which is constant per destination address, hence acts as a hash function. But, the fact is slave->dev->dev_addr[5] is the same the whole time, and is actually the same as bond->device->dev_addr[5].

Is there a special meaning for XORing with a constant ? Wouldn't it be the same is we did just:

	slave_no = data->h_dest[5] % bond->slave_cnt;
Signature · 4 lines
| Shmulik Hen   Advanced Network Services  |
| Israel Design Center, Jerusalem          |
| LAN Access Division, Platform Networking |
| Intel Communications Group, Intel corp.  |
#1 lore raw
Quoted 2 lines

slave_no = (data->h_dest[5]^slave->dev->dev_addr[5]) % bond->slave_cnt;

[...]

Quoted 3 lines

Is there a special meaning for XORing with a constant ? Wouldn't it be the same is we did just:

	slave_no = data->h_dest[5] % bond->slave_cnt;

I asked Janice Girouard about this... The theory is to mimic
the way Cisco etherchannel load balancing modes operate (in particular I think the "src-dst-mac" mode).

The Cisco 6000 series switch (and maybe others) documentation
shows the algorithm (in an example; it doesn't go into detail).

	-J

---
-Jay Vosburgh, IBM Linux Technology Center, [email protected]