From: Vlad Yasevich <vyasevich@gmail.com>
To: Jason Baron <jbaron@akamai.com>, netdev@vger.kernel.org
Cc: kaber@trash.net
Subject: Re: macvlan: optimizing the receive path?
Date: Fri, 03 Oct 2014 12:16:23 -0400 [thread overview]
Message-ID: <542ECBD7.7030807@gmail.com> (raw)
In-Reply-To: <542DB55D.3090601@akamai.com>
On 10/02/2014 04:28 PM, Jason Baron wrote:
> 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.
Hi Jason
I think the patch below is fine and in this particular case, it's OK to do this.
-vlad
>
> 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;
>
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-10-03 16:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=542ECBD7.7030807@gmail.com \
--to=vyasevich@gmail.com \
--cc=jbaron@akamai.com \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).