aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:26:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 12:26:46 -0400
commit15c54033964a943de7b0763efd3bd0ede7326395 (patch)
tree840b292612d1b5396d5bab5bde537a9013db3ceb /drivers/net/bonding
parentad5da3cf39a5b11a198929be1f2644e17ecd767e (diff)
parent912a41a4ab935ce8c4308428ec13fc7f8b1f18f4 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (448 commits) [IPV4] nl_fib_lookup: Initialise res.r before fib_res_put(&res) [IPV6]: Fix thinko in ipv6_rthdr_rcv() changes. [IPV4]: Add multipath cached to feature-removal-schedule.txt [WIRELESS] cfg80211: Clarify locking comment. [WIRELESS] cfg80211: Fix locking in wiphy_new. [WEXT] net_device: Don't include wext bits if not required. [WEXT]: Misc code cleanups. [WEXT]: Reduce inline abuse. [WEXT]: Move EXPORT_SYMBOL statements where they belong. [WEXT]: Cleanup early ioctl call path. [WEXT]: Remove options. [WEXT]: Remove dead debug code. [WEXT]: Clean up how wext is called. [WEXT]: Move to net/wireless [AFS]: Eliminate cmpxchg() usage in vlocation code. [RXRPC]: Fix pointers passed to bitops. [RXRPC]: Remove bogus atomic_* overrides. [AFS]: Fix u64 printing in debug logging. [AFS]: Add "directory write" support. [AFS]: Implement the CB.InitCallBackState3 operation. ...
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r--drivers/net/bonding/bond_3ad.c8
-rw-r--r--drivers/net/bonding/bond_alb.c36
-rw-r--r--drivers/net/bonding/bond_main.c9
3 files changed, 30 insertions, 23 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
index 3fb354d9c515..7e03f41ae2c2 100644
--- a/drivers/net/bonding/bond_3ad.c
+++ b/drivers/net/bonding/bond_3ad.c
@@ -884,8 +884,8 @@ static int ad_lacpdu_send(struct port *port)
884 } 884 }
885 885
886 skb->dev = slave->dev; 886 skb->dev = slave->dev;
887 skb->mac.raw = skb->data; 887 skb_reset_mac_header(skb);
888 skb->nh.raw = skb->data + ETH_HLEN; 888 skb->network_header = skb->mac_header + ETH_HLEN;
889 skb->protocol = PKT_TYPE_LACPDU; 889 skb->protocol = PKT_TYPE_LACPDU;
890 skb->priority = TC_PRIO_CONTROL; 890 skb->priority = TC_PRIO_CONTROL;
891 891
@@ -928,8 +928,8 @@ static int ad_marker_send(struct port *port, struct marker *marker)
928 skb_reserve(skb, 16); 928 skb_reserve(skb, 16);
929 929
930 skb->dev = slave->dev; 930 skb->dev = slave->dev;
931 skb->mac.raw = skb->data; 931 skb_reset_mac_header(skb);
932 skb->nh.raw = skb->data + ETH_HLEN; 932 skb->network_header = skb->mac_header + ETH_HLEN;
933 skb->protocol = PKT_TYPE_LACPDU; 933 skb->protocol = PKT_TYPE_LACPDU;
934 934
935 marker_header = (struct marker_header *)skb_put(skb, length); 935 marker_header = (struct marker_header *)skb_put(skb, length);
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 217a2eedee0a..92c3b6f6a8e7 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -104,10 +104,15 @@ struct arp_pkt {
104}; 104};
105#pragma pack() 105#pragma pack()
106 106
107static inline struct arp_pkt *arp_pkt(const struct sk_buff *skb)
108{
109 return (struct arp_pkt *)skb_network_header(skb);
110}
111
107/* Forward declaration */ 112/* Forward declaration */
108static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); 113static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]);
109 114
110static inline u8 _simple_hash(u8 *hash_start, int hash_size) 115static inline u8 _simple_hash(const u8 *hash_start, int hash_size)
111{ 116{
112 int i; 117 int i;
113 u8 hash = 0; 118 u8 hash = 0;
@@ -613,7 +618,7 @@ static void rlb_req_update_subnet_clients(struct bonding *bond, u32 src_ip)
613static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) 618static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond)
614{ 619{
615 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); 620 struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
616 struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw; 621 struct arp_pkt *arp = arp_pkt(skb);
617 struct slave *assigned_slave; 622 struct slave *assigned_slave;
618 struct rlb_client_info *client_info; 623 struct rlb_client_info *client_info;
619 u32 hash_index = 0; 624 u32 hash_index = 0;
@@ -701,7 +706,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
701 */ 706 */
702static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) 707static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond)
703{ 708{
704 struct arp_pkt *arp = (struct arp_pkt *)skb->nh.raw; 709 struct arp_pkt *arp = arp_pkt(skb);
705 struct slave *tx_slave = NULL; 710 struct slave *tx_slave = NULL;
706 711
707 if (arp->op_code == __constant_htons(ARPOP_REPLY)) { 712 if (arp->op_code == __constant_htons(ARPOP_REPLY)) {
@@ -890,8 +895,8 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
890 data = skb_put(skb, size); 895 data = skb_put(skb, size);
891 memcpy(data, &pkt, size); 896 memcpy(data, &pkt, size);
892 897
893 skb->mac.raw = data; 898 skb_reset_mac_header(skb);
894 skb->nh.raw = data + ETH_HLEN; 899 skb->network_header = skb->mac_header + ETH_HLEN;
895 skb->protocol = pkt.type; 900 skb->protocol = pkt.type;
896 skb->priority = TC_PRIO_CONTROL; 901 skb->priority = TC_PRIO_CONTROL;
897 skb->dev = slave->dev; 902 skb->dev = slave->dev;
@@ -1263,10 +1268,10 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1263 int hash_size = 0; 1268 int hash_size = 0;
1264 int do_tx_balance = 1; 1269 int do_tx_balance = 1;
1265 u32 hash_index = 0; 1270 u32 hash_index = 0;
1266 u8 *hash_start = NULL; 1271 const u8 *hash_start = NULL;
1267 int res = 1; 1272 int res = 1;
1268 1273
1269 skb->mac.raw = (unsigned char *)skb->data; 1274 skb_reset_mac_header(skb);
1270 eth_data = eth_hdr(skb); 1275 eth_data = eth_hdr(skb);
1271 1276
1272 /* make sure that the curr_active_slave and the slaves list do 1277 /* make sure that the curr_active_slave and the slaves list do
@@ -1280,15 +1285,18 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1280 } 1285 }
1281 1286
1282 switch (ntohs(skb->protocol)) { 1287 switch (ntohs(skb->protocol)) {
1283 case ETH_P_IP: 1288 case ETH_P_IP: {
1289 const struct iphdr *iph = ip_hdr(skb);
1290
1284 if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) || 1291 if ((memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) ||
1285 (skb->nh.iph->daddr == ip_bcast) || 1292 (iph->daddr == ip_bcast) ||
1286 (skb->nh.iph->protocol == IPPROTO_IGMP)) { 1293 (iph->protocol == IPPROTO_IGMP)) {
1287 do_tx_balance = 0; 1294 do_tx_balance = 0;
1288 break; 1295 break;
1289 } 1296 }
1290 hash_start = (char*)&(skb->nh.iph->daddr); 1297 hash_start = (char *)&(iph->daddr);
1291 hash_size = sizeof(skb->nh.iph->daddr); 1298 hash_size = sizeof(iph->daddr);
1299 }
1292 break; 1300 break;
1293 case ETH_P_IPV6: 1301 case ETH_P_IPV6:
1294 if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) { 1302 if (memcmp(eth_data->h_dest, mac_bcast, ETH_ALEN) == 0) {
@@ -1296,8 +1304,8 @@ int bond_alb_xmit(struct sk_buff *skb, struct net_device *bond_dev)
1296 break; 1304 break;
1297 } 1305 }
1298 1306
1299 hash_start = (char*)&(skb->nh.ipv6h->daddr); 1307 hash_start = (char *)&(ipv6_hdr(skb)->daddr);
1300 hash_size = sizeof(skb->nh.ipv6h->daddr); 1308 hash_size = sizeof(ipv6_hdr(skb)->daddr);
1301 break; 1309 break;
1302 case ETH_P_IPX: 1310 case ETH_P_IPX:
1303 if (ipx_hdr(skb)->ipx_checksum != 1311 if (ipx_hdr(skb)->ipx_checksum !=
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index e4724d874e7c..cea3783c92c5 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2524,7 +2524,7 @@ static int bond_arp_rcv(struct sk_buff *skb, struct net_device *dev, struct pack
2524 (2 * sizeof(u32))))) 2524 (2 * sizeof(u32)))))
2525 goto out_unlock; 2525 goto out_unlock;
2526 2526
2527 arp = skb->nh.arph; 2527 arp = arp_hdr(skb);
2528 if (arp->ar_hln != dev->addr_len || 2528 if (arp->ar_hln != dev->addr_len ||
2529 skb->pkt_type == PACKET_OTHERHOST || 2529 skb->pkt_type == PACKET_OTHERHOST ||
2530 skb->pkt_type == PACKET_LOOPBACK || 2530 skb->pkt_type == PACKET_LOOPBACK ||
@@ -3476,7 +3476,7 @@ static int bond_xmit_hash_policy_l34(struct sk_buff *skb,
3476 struct net_device *bond_dev, int count) 3476 struct net_device *bond_dev, int count)
3477{ 3477{
3478 struct ethhdr *data = (struct ethhdr *)skb->data; 3478 struct ethhdr *data = (struct ethhdr *)skb->data;
3479 struct iphdr *iph = skb->nh.iph; 3479 struct iphdr *iph = ip_hdr(skb);
3480 u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl); 3480 u16 *layer4hdr = (u16 *)((u32 *)iph + iph->ihl);
3481 int layer4_xor = 0; 3481 int layer4_xor = 0;
3482 3482
@@ -3640,9 +3640,8 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev)
3640 read_lock_bh(&bond->lock); 3640 read_lock_bh(&bond->lock);
3641 3641
3642 bond_for_each_slave(bond, slave, i) { 3642 bond_for_each_slave(bond, slave, i) {
3643 if (slave->dev->get_stats) { 3643 sstats = slave->dev->get_stats(slave->dev);
3644 sstats = slave->dev->get_stats(slave->dev); 3644 if (sstats) {
3645
3646 stats->rx_packets += sstats->rx_packets; 3645 stats->rx_packets += sstats->rx_packets;
3647 stats->rx_bytes += sstats->rx_bytes; 3646 stats->rx_bytes += sstats->rx_bytes;
3648 stats->rx_errors += sstats->rx_errors; 3647 stats->rx_errors += sstats->rx_errors;