diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 22 | ||||
-rw-r--r-- | drivers/net/macvlan.c | 11 |
2 files changed, 18 insertions, 15 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 04119b1e7cdb..27c413aa15da 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1480,20 +1480,23 @@ static bool bond_should_deliver_exact_match(struct sk_buff *skb, | |||
1480 | return false; | 1480 | return false; |
1481 | } | 1481 | } |
1482 | 1482 | ||
1483 | static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | 1483 | static rx_handler_result_t bond_handle_frame(struct sk_buff **pskb) |
1484 | { | 1484 | { |
1485 | struct sk_buff *skb = *pskb; | ||
1485 | struct slave *slave; | 1486 | struct slave *slave; |
1486 | struct net_device *bond_dev; | 1487 | struct net_device *bond_dev; |
1487 | struct bonding *bond; | 1488 | struct bonding *bond; |
1488 | 1489 | ||
1489 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
1490 | if (unlikely(!skb)) | ||
1491 | return NULL; | ||
1492 | |||
1493 | slave = bond_slave_get_rcu(skb->dev); | 1490 | slave = bond_slave_get_rcu(skb->dev); |
1494 | bond_dev = ACCESS_ONCE(slave->dev->master); | 1491 | bond_dev = ACCESS_ONCE(slave->dev->master); |
1495 | if (unlikely(!bond_dev)) | 1492 | if (unlikely(!bond_dev)) |
1496 | return skb; | 1493 | return RX_HANDLER_PASS; |
1494 | |||
1495 | skb = skb_share_check(skb, GFP_ATOMIC); | ||
1496 | if (unlikely(!skb)) | ||
1497 | return RX_HANDLER_CONSUMED; | ||
1498 | |||
1499 | *pskb = skb; | ||
1497 | 1500 | ||
1498 | bond = netdev_priv(bond_dev); | 1501 | bond = netdev_priv(bond_dev); |
1499 | 1502 | ||
@@ -1501,8 +1504,7 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | |||
1501 | slave->dev->last_rx = jiffies; | 1504 | slave->dev->last_rx = jiffies; |
1502 | 1505 | ||
1503 | if (bond_should_deliver_exact_match(skb, slave, bond)) { | 1506 | if (bond_should_deliver_exact_match(skb, slave, bond)) { |
1504 | skb->deliver_no_wcard = 1; | 1507 | return RX_HANDLER_EXACT; |
1505 | return skb; | ||
1506 | } | 1508 | } |
1507 | 1509 | ||
1508 | skb->dev = bond_dev; | 1510 | skb->dev = bond_dev; |
@@ -1514,12 +1516,12 @@ static struct sk_buff *bond_handle_frame(struct sk_buff *skb) | |||
1514 | if (unlikely(skb_cow_head(skb, | 1516 | if (unlikely(skb_cow_head(skb, |
1515 | skb->data - skb_mac_header(skb)))) { | 1517 | skb->data - skb_mac_header(skb)))) { |
1516 | kfree_skb(skb); | 1518 | kfree_skb(skb); |
1517 | return NULL; | 1519 | return RX_HANDLER_CONSUMED; |
1518 | } | 1520 | } |
1519 | memcpy(eth_hdr(skb)->h_dest, bond_dev->dev_addr, ETH_ALEN); | 1521 | memcpy(eth_hdr(skb)->h_dest, bond_dev->dev_addr, ETH_ALEN); |
1520 | } | 1522 | } |
1521 | 1523 | ||
1522 | return skb; | 1524 | return RX_HANDLER_ANOTHER; |
1523 | } | 1525 | } |
1524 | 1526 | ||
1525 | /* enslave device <slave> to bond device <master> */ | 1527 | /* enslave device <slave> to bond device <master> */ |
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c index 497991bd3b64..5b37d3c191e4 100644 --- a/drivers/net/macvlan.c +++ b/drivers/net/macvlan.c | |||
@@ -152,9 +152,10 @@ static void macvlan_broadcast(struct sk_buff *skb, | |||
152 | } | 152 | } |
153 | 153 | ||
154 | /* called under rcu_read_lock() from netif_receive_skb */ | 154 | /* called under rcu_read_lock() from netif_receive_skb */ |
155 | static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) | 155 | static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb) |
156 | { | 156 | { |
157 | struct macvlan_port *port; | 157 | struct macvlan_port *port; |
158 | struct sk_buff *skb = *pskb; | ||
158 | const struct ethhdr *eth = eth_hdr(skb); | 159 | const struct ethhdr *eth = eth_hdr(skb); |
159 | const struct macvlan_dev *vlan; | 160 | const struct macvlan_dev *vlan; |
160 | const struct macvlan_dev *src; | 161 | const struct macvlan_dev *src; |
@@ -184,7 +185,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) | |||
184 | */ | 185 | */ |
185 | macvlan_broadcast(skb, port, src->dev, | 186 | macvlan_broadcast(skb, port, src->dev, |
186 | MACVLAN_MODE_VEPA); | 187 | MACVLAN_MODE_VEPA); |
187 | return skb; | 188 | return RX_HANDLER_PASS; |
188 | } | 189 | } |
189 | 190 | ||
190 | if (port->passthru) | 191 | if (port->passthru) |
@@ -192,12 +193,12 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) | |||
192 | else | 193 | else |
193 | vlan = macvlan_hash_lookup(port, eth->h_dest); | 194 | vlan = macvlan_hash_lookup(port, eth->h_dest); |
194 | if (vlan == NULL) | 195 | if (vlan == NULL) |
195 | return skb; | 196 | return RX_HANDLER_PASS; |
196 | 197 | ||
197 | dev = vlan->dev; | 198 | dev = vlan->dev; |
198 | if (unlikely(!(dev->flags & IFF_UP))) { | 199 | if (unlikely(!(dev->flags & IFF_UP))) { |
199 | kfree_skb(skb); | 200 | kfree_skb(skb); |
200 | return NULL; | 201 | return RX_HANDLER_CONSUMED; |
201 | } | 202 | } |
202 | len = skb->len + ETH_HLEN; | 203 | len = skb->len + ETH_HLEN; |
203 | skb = skb_share_check(skb, GFP_ATOMIC); | 204 | skb = skb_share_check(skb, GFP_ATOMIC); |
@@ -211,7 +212,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb) | |||
211 | 212 | ||
212 | out: | 213 | out: |
213 | macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0); | 214 | macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0); |
214 | return NULL; | 215 | return RX_HANDLER_CONSUMED; |
215 | } | 216 | } |
216 | 217 | ||
217 | static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) | 218 | static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) |