netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* macvlan: optimizing the receive path?
@ 2014-10-02 20:28 Jason Baron
  2014-10-02 21:31 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jason Baron @ 2014-10-02 20:28 UTC (permalink / raw)
  To: netdev; +Cc: kaber

Hi,

I was just wondering why the netif_rx(skb) call in macvlan_handle_frame()
was necessary? IE:

macvlan_handle_frame()
{
       ........

        skb->dev = dev;
        skb->pkt_type = PACKET_HOST;

****>ret = netif_rx(skb);

out:
        macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
        return RX_HANDLER_CONSUMED;
}


I think the point of going through netif_rx() is to ensure that we throttle
incoming packets, but hasn't that already been accomplished in this path?
That is if the packets are arriving from the physical NIC, we've already
throttled them by this point. Otherwise, if they are coming via
macvlan_queue_xmit(), it calls either 'dev_forward_skb()', which ends
up calling netif_rx_internal(), or else in broadcast mode there is
to be throttling via macvlan_broadcast_enqueue().

So I suspect there is a code path that I am missing but the netif_rx() call in
question essentially re-queues packets coming from off the box. I've tried the
simple patch below to optimize this path, and obviously performs a lot better
in my limited testing.

Thanks,

-Jason

--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -321,8 +321,8 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
        skb->dev = dev;
        skb->pkt_type = PACKET_HOST;
 
-       ret = netif_rx(skb);
-
+      macvlan_count_rx(vlan, len, true, 0);
+      return RX_HANDLER_ANOTHER;
 out:
        macvlan_count_rx(vlan, len, ret == NET_RX_SUCCESS, 0);
        return RX_HANDLER_CONSUMED;

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-10-07 18:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-02 20:28 macvlan: optimizing the receive path? Jason Baron
2014-10-02 21:31 ` Stephen Hemminger
2014-10-03 15:08   ` Jason Baron
2014-10-03 16:16 ` Vlad Yasevich
2014-10-05  0:42 ` David Miller
2014-10-06 13:04   ` Vlad Yasevich
2014-10-07 17:35     ` Jason Baron
2014-10-07 18:00       ` Eric Dumazet
2014-10-07 18:49       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).