--- linux-2.4.23/drivers/net/bonding/bond_main.c Fri Jan 9 14:26:33 2004 +++ linux-2.4.23mapx/drivers/net/bonding/bond_main.c Fri Jan 9 14:48:09 2004 @@ -511,6 +511,7 @@ static int updelay = 0; static int downdelay = 0; static int use_carrier = 1; static char *mode = NULL; +static char use_mpxor = 0; static char *primary = NULL; static char *lacp_rate = NULL; static int arp_interval = BOND_LINK_ARP_INTERV; @@ -581,6 +582,7 @@ static struct bond_parm_tbl bond_mode_tb { "802.3ad", BOND_MODE_8023AD}, { "balance-tlb", BOND_MODE_TLB}, { "balance-alb", BOND_MODE_ALB}, +{ "balance-mpxor", BOND_MODE_MPXOR}, { NULL, -1}, }; @@ -603,6 +605,8 @@ static const char *bond_mode_name(void) return "transmit load balancing"; case BOND_MODE_ALB: return "adaptive load balancing"; + case BOND_MODE_MPXOR : + return "load balancing (mpxor)"; default: return "unknown"; } @@ -3603,6 +3607,7 @@ static int bond_xmit_xor(struct sk_buff struct ethhdr *data = (struct ethhdr *)skb->data; struct slave *slave, *start_at; int slave_no; + int ports_xor = 0; int i; read_lock(&bond->lock); @@ -3611,7 +3616,11 @@ static int bond_xmit_xor(struct sk_buff goto free_out; } - slave_no = (data->h_dest[5]^bond_dev->dev_addr[5]) % bond->slave_cnt; + /* don't use the port if you can't get it, i.e. packet is a fragment */ + use_mpxor = use_mpxor && ( skb->h.th > 0 ); + /* get the port numbers from the sk_buff and shift out of net order */ + use_mpxor && (ports_xor=((skb->h.th->source)>>8)^((skb->h.th->dest)>>8)); + slave_no = ((data->h_dest[5]^bond_dev->dev_addr[5])^ports_xor)% bond->slave_cnt; bond_for_each_slave(bond, slave, i) { slave_no--; @@ -3769,6 +3778,10 @@ static int __init bond_init(struct net_d bond_dev->hard_start_xmit = bond_alb_xmit; /* extern */ bond_dev->set_mac_address = bond_alb_set_mac_address; /* extern */ break; + case BOND_MODE_MPXOR: + use_mpxor = 1; + bond_dev->hard_start_xmit = bond_xmit_xor; + break; default: printk(KERN_ERR DRV_NAME ": Error: Unknown bonding mode %d\n", --- linux-2.4.23/Documentation/networking/bonding.txt Fri Jan 9 14:26:33 2004 +++ linux-2.4.23mapx/Documentation/networking/bonding.txt Fri Jan 9 14:39:47 2004 @@ -368,6 +368,17 @@ mode fails it's hw address is swapped with the new curr_active_slave that was chosen. + balance-mpxor or 7 + + A less deterministic version of the balance-xor policy. + Balance-mpxor bases its slave choice on [(( source MAC address + XOR'd with destination MAC address) XOR'd with (source port + XOR'd with destination port)) modula slave count]. The + resulting behavior is connectionb-based slave choosing + process. This would be useful in a sitaution where static + source and destination addresses are shuttling large amounts + of data between themselves over multiple TCP connections. + primary A string (eth0, eth2, etc) to equate to a primary device. If this --- linux-2.4.23/include/linux/if_bonding.h Fri Jan 9 14:26:33 2004 +++ linux-2.4.23mapx/include/linux/if_bonding.h Fri Jan 9 14:43:48 2004 @@ -64,6 +64,8 @@ #define BOND_MODE_8023AD 4 #define BOND_MODE_TLB 5 #define BOND_MODE_ALB 6 /* TLB + RLB (receive load balancing) */ +#define BOND_MODE_MPXOR 7 /* XOR based on (MAC^MAC)^(port^port) */ + /* each slave's link has 4 states */ #define BOND_LINK_UP 0 /* link is up and running */