diff options
author | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-16 22:17:37 -0400 |
commit | 028940342a906db8da014a7603a0deddc2c323dd (patch) | |
tree | 688dbc38a3e218f2493d311b1d70a67668837347 /drivers/net/bonding | |
parent | be3eed2e96340d3c7a4d1ea1d63e7bd6095d1e34 (diff) | |
parent | 0e93b4b304ae052ba1bc73f6d34a68556fe93429 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_3ad.c | 18 | ||||
-rw-r--r-- | drivers/net/bonding/bond_3ad.h | 2 | ||||
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 12 | ||||
-rw-r--r-- | drivers/net/bonding/bond_main.c | 16 | ||||
-rw-r--r-- | drivers/net/bonding/bonding.h | 2 |
5 files changed, 32 insertions, 18 deletions
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 793b00138275..3463b469e657 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2173,9 +2173,10 @@ re_arm: | |||
2173 | * received frames (loopback). Since only the payload is given to this | 2173 | * received frames (loopback). Since only the payload is given to this |
2174 | * function, it check for loopback. | 2174 | * function, it check for loopback. |
2175 | */ | 2175 | */ |
2176 | static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length) | 2176 | static int bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u16 length) |
2177 | { | 2177 | { |
2178 | struct port *port; | 2178 | struct port *port; |
2179 | int ret = RX_HANDLER_ANOTHER; | ||
2179 | 2180 | ||
2180 | if (length >= sizeof(struct lacpdu)) { | 2181 | if (length >= sizeof(struct lacpdu)) { |
2181 | 2182 | ||
@@ -2184,11 +2185,12 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2184 | if (!port->slave) { | 2185 | if (!port->slave) { |
2185 | pr_warning("%s: Warning: port of slave %s is uninitialized\n", | 2186 | pr_warning("%s: Warning: port of slave %s is uninitialized\n", |
2186 | slave->dev->name, slave->dev->master->name); | 2187 | slave->dev->name, slave->dev->master->name); |
2187 | return; | 2188 | return ret; |
2188 | } | 2189 | } |
2189 | 2190 | ||
2190 | switch (lacpdu->subtype) { | 2191 | switch (lacpdu->subtype) { |
2191 | case AD_TYPE_LACPDU: | 2192 | case AD_TYPE_LACPDU: |
2193 | ret = RX_HANDLER_CONSUMED; | ||
2192 | pr_debug("Received LACPDU on port %d\n", | 2194 | pr_debug("Received LACPDU on port %d\n", |
2193 | port->actor_port_number); | 2195 | port->actor_port_number); |
2194 | /* Protect against concurrent state machines */ | 2196 | /* Protect against concurrent state machines */ |
@@ -2198,6 +2200,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2198 | break; | 2200 | break; |
2199 | 2201 | ||
2200 | case AD_TYPE_MARKER: | 2202 | case AD_TYPE_MARKER: |
2203 | ret = RX_HANDLER_CONSUMED; | ||
2201 | // No need to convert fields to Little Endian since we don't use the marker's fields. | 2204 | // No need to convert fields to Little Endian since we don't use the marker's fields. |
2202 | 2205 | ||
2203 | switch (((struct bond_marker *)lacpdu)->tlv_type) { | 2206 | switch (((struct bond_marker *)lacpdu)->tlv_type) { |
@@ -2219,6 +2222,7 @@ static void bond_3ad_rx_indication(struct lacpdu *lacpdu, struct slave *slave, u | |||
2219 | } | 2222 | } |
2220 | } | 2223 | } |
2221 | } | 2224 | } |
2225 | return ret; | ||
2222 | } | 2226 | } |
2223 | 2227 | ||
2224 | /** | 2228 | /** |
@@ -2456,18 +2460,20 @@ out: | |||
2456 | return NETDEV_TX_OK; | 2460 | return NETDEV_TX_OK; |
2457 | } | 2461 | } |
2458 | 2462 | ||
2459 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, | 2463 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, |
2460 | struct slave *slave) | 2464 | struct slave *slave) |
2461 | { | 2465 | { |
2466 | int ret = RX_HANDLER_ANOTHER; | ||
2462 | if (skb->protocol != PKT_TYPE_LACPDU) | 2467 | if (skb->protocol != PKT_TYPE_LACPDU) |
2463 | return; | 2468 | return ret; |
2464 | 2469 | ||
2465 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) | 2470 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) |
2466 | return; | 2471 | return ret; |
2467 | 2472 | ||
2468 | read_lock(&bond->lock); | 2473 | read_lock(&bond->lock); |
2469 | bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); | 2474 | ret = bond_3ad_rx_indication((struct lacpdu *) skb->data, slave, skb->len); |
2470 | read_unlock(&bond->lock); | 2475 | read_unlock(&bond->lock); |
2476 | return ret; | ||
2471 | } | 2477 | } |
2472 | 2478 | ||
2473 | /* | 2479 | /* |
diff --git a/drivers/net/bonding/bond_3ad.h b/drivers/net/bonding/bond_3ad.h index 235b2cc58b28..5ee7e3c45db7 100644 --- a/drivers/net/bonding/bond_3ad.h +++ b/drivers/net/bonding/bond_3ad.h | |||
@@ -274,7 +274,7 @@ void bond_3ad_adapter_duplex_changed(struct slave *slave); | |||
274 | void bond_3ad_handle_link_change(struct slave *slave, char link); | 274 | void bond_3ad_handle_link_change(struct slave *slave, char link); |
275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); | 275 | int bond_3ad_get_active_agg_info(struct bonding *bond, struct ad_info *ad_info); |
276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); | 276 | int bond_3ad_xmit_xor(struct sk_buff *skb, struct net_device *dev); |
277 | void bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, | 277 | int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct bonding *bond, |
278 | struct slave *slave); | 278 | struct slave *slave); |
279 | int bond_3ad_set_carrier(struct bonding *bond); | 279 | int bond_3ad_set_carrier(struct bonding *bond); |
280 | void bond_3ad_update_lacp_rate(struct bonding *bond); | 280 | void bond_3ad_update_lacp_rate(struct bonding *bond); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index b4f1b4ac92c6..0f59c1564e53 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -342,26 +342,26 @@ static void rlb_update_entry_from_arp(struct bonding *bond, struct arp_pkt *arp) | |||
342 | _unlock_rx_hashtbl_bh(bond); | 342 | _unlock_rx_hashtbl_bh(bond); |
343 | } | 343 | } |
344 | 344 | ||
345 | static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, | 345 | static int rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, |
346 | struct slave *slave) | 346 | struct slave *slave) |
347 | { | 347 | { |
348 | struct arp_pkt *arp; | 348 | struct arp_pkt *arp; |
349 | 349 | ||
350 | if (skb->protocol != cpu_to_be16(ETH_P_ARP)) | 350 | if (skb->protocol != cpu_to_be16(ETH_P_ARP)) |
351 | return; | 351 | goto out; |
352 | 352 | ||
353 | arp = (struct arp_pkt *) skb->data; | 353 | arp = (struct arp_pkt *) skb->data; |
354 | if (!arp) { | 354 | if (!arp) { |
355 | pr_debug("Packet has no ARP data\n"); | 355 | pr_debug("Packet has no ARP data\n"); |
356 | return; | 356 | goto out; |
357 | } | 357 | } |
358 | 358 | ||
359 | if (!pskb_may_pull(skb, arp_hdr_len(bond->dev))) | 359 | if (!pskb_may_pull(skb, arp_hdr_len(bond->dev))) |
360 | return; | 360 | goto out; |
361 | 361 | ||
362 | if (skb->len < sizeof(struct arp_pkt)) { | 362 | if (skb->len < sizeof(struct arp_pkt)) { |
363 | pr_debug("Packet is too small to be an ARP\n"); | 363 | pr_debug("Packet is too small to be an ARP\n"); |
364 | return; | 364 | goto out; |
365 | } | 365 | } |
366 | 366 | ||
367 | if (arp->op_code == htons(ARPOP_REPLY)) { | 367 | if (arp->op_code == htons(ARPOP_REPLY)) { |
@@ -369,6 +369,8 @@ static void rlb_arp_recv(struct sk_buff *skb, struct bonding *bond, | |||
369 | rlb_update_entry_from_arp(bond, arp); | 369 | rlb_update_entry_from_arp(bond, arp); |
370 | pr_debug("Server received an ARP Reply from client\n"); | 370 | pr_debug("Server received an ARP Reply from client\n"); |
371 | } | 371 | } |
372 | out: | ||
373 | return RX_HANDLER_ANOTHER; | ||
372 | } | 374 | } |
373 | 375 | ||
374 | /* Caller must hold bond lock for read */ | 376 | /* Caller must hold bond lock for read */ |
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index bbb004354bbd..2ee8cf9e8a3b 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1444,8 +1444,9 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1444 | struct sk_buff *skb = *pskb; | 1444 | struct sk_buff *skb = *pskb; |
1445 | struct slave *slave; | 1445 | struct slave *slave; |
1446 | struct bonding *bond; | 1446 | struct bonding *bond; |
1447 | void (*recv_probe)(struct sk_buff *, struct bonding *, | 1447 | int (*recv_probe)(struct sk_buff *, struct bonding *, |
1448 | struct slave *); | 1448 | struct slave *); |
1449 | int ret = RX_HANDLER_ANOTHER; | ||
1449 | 1450 | ||
1450 | skb = skb_share_check(skb, GFP_ATOMIC); | 1451 | skb = skb_share_check(skb, GFP_ATOMIC); |
1451 | if (unlikely(!skb)) | 1452 | if (unlikely(!skb)) |
@@ -1464,8 +1465,12 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1464 | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); | 1465 | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); |
1465 | 1466 | ||
1466 | if (likely(nskb)) { | 1467 | if (likely(nskb)) { |
1467 | recv_probe(nskb, bond, slave); | 1468 | ret = recv_probe(nskb, bond, slave); |
1468 | dev_kfree_skb(nskb); | 1469 | dev_kfree_skb(nskb); |
1470 | if (ret == RX_HANDLER_CONSUMED) { | ||
1471 | consume_skb(skb); | ||
1472 | return ret; | ||
1473 | } | ||
1469 | } | 1474 | } |
1470 | } | 1475 | } |
1471 | 1476 | ||
@@ -1487,7 +1492,7 @@ static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) | |||
1487 | memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); | 1492 | memcpy(eth_hdr(skb)->h_dest, bond->dev->dev_addr, ETH_ALEN); |
1488 | } | 1493 | } |
1489 | 1494 | ||
1490 | return RX_HANDLER_ANOTHER; | 1495 | return ret; |
1491 | } | 1496 | } |
1492 | 1497 | ||
1493 | /* enslave device <slave> to bond device <master> */ | 1498 | /* enslave device <slave> to bond device <master> */ |
@@ -2732,7 +2737,7 @@ static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 | |||
2732 | } | 2737 | } |
2733 | } | 2738 | } |
2734 | 2739 | ||
2735 | static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | 2740 | static int bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, |
2736 | struct slave *slave) | 2741 | struct slave *slave) |
2737 | { | 2742 | { |
2738 | struct arphdr *arp; | 2743 | struct arphdr *arp; |
@@ -2740,7 +2745,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | |||
2740 | __be32 sip, tip; | 2745 | __be32 sip, tip; |
2741 | 2746 | ||
2742 | if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) | 2747 | if (skb->protocol != __cpu_to_be16(ETH_P_ARP)) |
2743 | return; | 2748 | return RX_HANDLER_ANOTHER; |
2744 | 2749 | ||
2745 | read_lock(&bond->lock); | 2750 | read_lock(&bond->lock); |
2746 | 2751 | ||
@@ -2785,6 +2790,7 @@ static void bond_arp_rcv(struct sk_buff *skb, struct bonding *bond, | |||
2785 | 2790 | ||
2786 | out_unlock: | 2791 | out_unlock: |
2787 | read_unlock(&bond->lock); | 2792 | read_unlock(&bond->lock); |
2793 | return RX_HANDLER_ANOTHER; | ||
2788 | } | 2794 | } |
2789 | 2795 | ||
2790 | /* | 2796 | /* |
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h index 9f2bae6616d3..4581aa5ccaba 100644 --- a/drivers/net/bonding/bonding.h +++ b/drivers/net/bonding/bonding.h | |||
@@ -218,7 +218,7 @@ struct bonding { | |||
218 | struct slave *primary_slave; | 218 | struct slave *primary_slave; |
219 | bool force_primary; | 219 | bool force_primary; |
220 | s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ | 220 | s32 slave_cnt; /* never change this value outside the attach/detach wrappers */ |
221 | void (*recv_probe)(struct sk_buff *, struct bonding *, | 221 | int (*recv_probe)(struct sk_buff *, struct bonding *, |
222 | struct slave *); | 222 | struct slave *); |
223 | rwlock_t lock; | 223 | rwlock_t lock; |
224 | rwlock_t curr_slave_lock; | 224 | rwlock_t curr_slave_lock; |