[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ebf12468-504c-fae7-b62d-2b6db47391f9@redhat.com>
Date: Fri, 24 May 2019 12:17:27 +0800
From: Jason Wang <jasowang@...hat.com>
To: Saeed Mahameed <saeedm@...lanox.com>,
"stephen@...workplumber.org" <stephen@...workplumber.org>,
"jiri@...nulli.us" <jiri@...nulli.us>,
"jesper.brouer@...il.com" <jesper.brouer@...il.com>
Cc: "sthemmin@...rosoft.com" <sthemmin@...rosoft.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH v3 2/2] net: core: support XDP generic on stacked devices.
On 2019/5/24 上午3:19, Saeed Mahameed wrote:
> On Thu, 2019-05-23 at 10:54 -0700, Stephen Hemminger wrote:
>> When a device is stacked like (team, bonding, failsafe or netvsc) the
>> XDP generic program for the parent device was not called.
>>
>> Move the call to XDP generic inside __netif_receive_skb_core where
>> it can be done multiple times for stacked case.
>>
>> Suggested-by: Jiri Pirko <jiri@...nulli.us>
>> Fixes: d445516966dc ("net: xdp: support xdp generic on virtual
>> devices")
>> Signed-off-by: Stephen Hemminger <sthemmin@...rosoft.com>
>> ---
>> v1 - call xdp_generic in netvsc handler
>> v2 - do xdp_generic in generic rx handler processing
>> v3 - move xdp_generic call inside the another pass loop
>>
>> net/core/dev.c | 56 ++++++++++------------------------------------
>> ----
>> 1 file changed, 11 insertions(+), 45 deletions(-)
>>
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index b6b8505cfb3e..696776e14d00 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -4502,23 +4502,6 @@ static int netif_rx_internal(struct sk_buff
>> *skb)
>>
>> trace_netif_rx(skb);
>>
>> - if (static_branch_unlikely(&generic_xdp_needed_key)) {
>> - int ret;
>> -
>> - preempt_disable();
>> - rcu_read_lock();
>> - ret = do_xdp_generic(rcu_dereference(skb->dev-
>>> xdp_prog), skb);
>> - rcu_read_unlock();
>> - preempt_enable();
>> -
>> - /* Consider XDP consuming the packet a success from
>> - * the netdev point of view we do not want to count
>> - * this as an error.
>> - */
>> - if (ret != XDP_PASS)
>> - return NET_RX_SUCCESS;
>> - }
>> -
> Adding Jesper,
>
> There is a small behavioral change due to this patch,
At least not for current code. We don't support skb in cpumap (though
the fix should not be hard), in dp_do_generic_redirect_map() we had:
} else {
/* TODO: Handle BPF_MAP_TYPE_CPUMAP */
err = -EBADRQC;
goto err;
}
> the XDP program after this patch will run on the RPS CPU, if
> configured, which could cause some behavioral changes in
> xdp_redirect_cpu: bpf_redirect_map(cpu_map).
>
> Maybe this is acceptable, but it should be documented, as the current
> assumption dictates: XDP program runs on the core where the XDP
> frame/SKB was first seen.
At lest for TUN, this is not true. XDP frames were built by vhost_net
and passed to TUN. There's no guarantee that vhost_net kthread won't
move to another core.
Thanks
Powered by blists - more mailing lists