diff options
Diffstat (limited to 'drivers/net/bonding/bond_alb.c')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 36 |
1 files changed, 22 insertions, 14 deletions
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 | ||
107 | static 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 */ |
108 | static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); | 113 | static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[]); |
109 | 114 | ||
110 | static inline u8 _simple_hash(u8 *hash_start, int hash_size) | 115 | static 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) | |||
613 | static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bond) | 618 | static 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 | */ |
702 | static struct slave *rlb_arp_xmit(struct sk_buff *skb, struct bonding *bond) | 707 | static 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 != |