aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-10-10 15:09:51 -0400
committerDavid S. Miller <davem@davemloft.net>2014-10-10 15:09:51 -0400
commit3ab52c69282fbc7384fe7e9d14f68ce11040feac (patch)
treeca97b979d908b286cc28449dfa887bbb9071ee58
parent2403077d47991a8385789779ee5fc90b003f9fbe (diff)
parentd1dd911930885659420421cfe123957610c54299 (diff)
Merge branch 'macvlan'
Jason Baron says: ==================== macvlan: optimize receive path So after porting this optimization to net-next, I found that the netperf results of TCP_RR regress right at the maximum peak of transactions/sec. That is as I increase the number of threads via the first argument to super_netperf, the number of transactions/sec keep increasing, peak, and then start decreasing. It is right at the peak, that I see a small regression with this patch (see results in patch 2/2). Without the patch, the ksoftirqd threads are the top cpu consumers threads on the system, since the extra 'netif_rx()', is queuing more softirq work, whereas with the patch, the ksoftirqd threads are below all of the 'netserver' threads in terms of their cpu usage. So there appears to be some interaction between how softirqs are serviced at the peak here and this patch. I think the test results are still supportive of this approach, but I wanted to be clear on my findings. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/macvlan.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 38b4fae61f04..29b3bb410781 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -260,7 +260,7 @@ static void macvlan_broadcast(struct sk_buff *skb,
260 mode == MACVLAN_MODE_BRIDGE) ?: 260 mode == MACVLAN_MODE_BRIDGE) ?:
261 netif_rx_ni(nskb); 261 netif_rx_ni(nskb);
262 macvlan_count_rx(vlan, skb->len + ETH_HLEN, 262 macvlan_count_rx(vlan, skb->len + ETH_HLEN,
263 err == NET_RX_SUCCESS, 1); 263 err == NET_RX_SUCCESS, true);
264 } 264 }
265 } 265 }
266} 266}
@@ -379,7 +379,7 @@ static void macvlan_forward_source_one(struct sk_buff *skb,
379 nskb->pkt_type = PACKET_HOST; 379 nskb->pkt_type = PACKET_HOST;
380 380
381 ret = netif_rx(nskb); 381 ret = netif_rx(nskb);
382 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0); 382 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, false);
383} 383}
384 384
385static void macvlan_forward_source(struct sk_buff *skb, 385static void macvlan_forward_source(struct sk_buff *skb,
@@ -407,7 +407,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
407 const struct macvlan_dev *src; 407 const struct macvlan_dev *src;
408 struct net_device *dev; 408 struct net_device *dev;
409 unsigned int len = 0; 409 unsigned int len = 0;
410 int ret = NET_RX_DROP; 410 int ret;
411 rx_handler_result_t handle_res;
411 412
412 port = macvlan_port_get_rcu(skb->dev); 413 port = macvlan_port_get_rcu(skb->dev);
413 if (is_multicast_ether_addr(eth->h_dest)) { 414 if (is_multicast_ether_addr(eth->h_dest)) {
@@ -423,6 +424,7 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
423 vlan = src; 424 vlan = src;
424 ret = macvlan_broadcast_one(skb, vlan, eth, 0) ?: 425 ret = macvlan_broadcast_one(skb, vlan, eth, 0) ?:
425 netif_rx(skb); 426 netif_rx(skb);
427 handle_res = RX_HANDLER_CONSUMED;
426 goto out; 428 goto out;
427 } 429 }
428 430
@@ -448,17 +450,20 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
448 } 450 }
449 len = skb->len + ETH_HLEN; 451 len = skb->len + ETH_HLEN;
450 skb = skb_share_check(skb, GFP_ATOMIC); 452 skb = skb_share_check(skb, GFP_ATOMIC);
451 if (!skb) 453 if (!skb) {
454 ret = NET_RX_DROP;
455 handle_res = RX_HANDLER_CONSUMED;
452 goto out; 456 goto out;
457 }
453 458
454 skb->dev = dev; 459 skb->dev = dev;
455 skb->pkt_type = PACKET_HOST; 460 skb->pkt_type = PACKET_HOST;
456 461
457 ret = netif_rx(skb); 462 ret = NET_RX_SUCCESS;
458 463 handle_res = RX_HANDLER_ANOTHER;
459out: 464out:
460 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0); 465 macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, false);
461 return RX_HANDLER_CONSUMED; 466 return handle_res;
462} 467}
463 468
464static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev) 469static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)