bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	netdev@vger.kernel.org, davem@davemloft.net
Cc: xdp-newbies@vger.kernel.org, bpf@vger.kernel.org,
	Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH net 2/3] net: core: generic XDP support for stacked device
Date: Fri, 17 May 2019 09:09:27 +0800	[thread overview]
Message-ID: <cb8e4c5a-0455-abf8-3211-72e5226df3a4@redhat.com> (raw)
In-Reply-To: <20190516215423.14185-3-sthemmin@microsoft.com>


On 2019/5/17 上午5:54, Stephen Hemminger wrote:
> When a device is stacked like (team, bonding, failsafe or netvsc) the
> XDP generic program for the parent device is not called.  In these
> cases, the rx handler changes skb->dev to its own in the receive
> handler, and returns RX_HANDLER_ANOTHER.  Fix this by calling
> do_xdp_generic if necessary before starting another round.
>
> Review of all the places RX_HANDLER_ANOTHER is returned
> show that the current devices do correctly change skb->dev.
>
> There was an older patch that got abandoned that did the
> same thing, this is just a rewrite.
>
> Suggested-by: Jason Wang <jasowang@redhat.com>
> Fixes: d445516966dc ("net: xdp: support xdp generic on virtual devices")
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> ---
>   net/core/dev.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 108ac8137b9b..9165fd3c9e90 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4921,6 +4921,16 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,
>   			ret = NET_RX_SUCCESS;
>   			goto out;
>   		case RX_HANDLER_ANOTHER:
> +			if (static_branch_unlikely(&generic_xdp_needed_key)) {
> +				struct bpf_prog *xdp_prog;
> +
> +				xdp_prog = rcu_dereference(skb->dev->xdp_prog);
> +				ret = do_xdp_generic(xdp_prog, skb);
> +				if (ret != XDP_PASS) {
> +					ret = NET_RX_SUCCESS;
> +					goto out;
> +				}
> +			}
>   			goto another_round;
>   		case RX_HANDLER_EXACT:
>   			deliver_exact = true;


Acked-by: Jason Wang <jasowang@redhat.com>



  reply	other threads:[~2019-05-17  1:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 21:54 [PATCH net 0/3] XDP generic related fixes Stephen Hemminger
2019-05-16 21:54 ` [PATCH net 1/3] netvsc: unshare skb in VF rx handler Stephen Hemminger
2019-05-16 21:54 ` [PATCH net 2/3] net: core: generic XDP support for stacked device Stephen Hemminger
2019-05-17  1:09   ` Jason Wang [this message]
2019-05-16 21:54 ` [PATCH net 3/3] netdevice: clarify meaning of rx_handler_result Stephen Hemminger
2019-05-16 22:25   ` Jakub Kicinski
2019-05-16 23:25     ` Stephen Hemminger

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=cb8e4c5a-0455-abf8-3211-72e5226df3a4@redhat.com \
    --to=jasowang@redhat.com \
    --cc=bpf@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.com \
    --cc=xdp-newbies@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).