[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <F99B20F3-4F88-4AFC-9DF8-B32EFD417785@gmail.com>
Date: Tue, 4 Aug 2020 20:27:47 +0900
From: Yoshiki Komachi <komachi.yoshiki@...il.com>
To: David Ahern <dsahern@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Jesper Dangaard Brouer <hawk@...nel.org>,
John Fastabend <john.fastabend@...il.com>,
Jakub Kicinski <kuba@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
KP Singh <kpsingh@...omium.org>,
Roopa Prabhu <roopa@...ulusnetworks.com>,
Nikolay Aleksandrov <nikolay@...ulusnetworks.com>,
David Ahern <dsahern@...nel.org>, netdev@...r.kernel.org,
bridge@...ts.linux-foundation.org, bpf@...r.kernel.org
Subject: Re: [RFC PATCH bpf-next 2/3] bpf: Add helper to do forwarding lookups
in kernel FDB table
> 2020/08/01 2:15、David Ahern <dsahern@...il.com>のメール:
>
> On 7/30/20 10:44 PM, Yoshiki Komachi wrote:
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 654c346b7d91..68800d1b8cd5 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -5084,6 +5085,46 @@ static const struct bpf_func_proto bpf_skb_fib_lookup_proto = {
>> .arg4_type = ARG_ANYTHING,
>> };
>>
>> +#if IS_ENABLED(CONFIG_BRIDGE)
>> +BPF_CALL_4(bpf_xdp_fdb_lookup, struct xdp_buff *, ctx,
>> + struct bpf_fdb_lookup *, params, int, plen, u32, flags)
>> +{
>> + struct net_device *src, *dst;
>> + struct net *net;
>> +
>> + if (plen < sizeof(*params))
>> + return -EINVAL;
>
> I need to look at the details more closely, but on first reading 2
> things caught me eye:
> 1. you need to make sure flags is 0 since there are no supported flags
> at the moment, and
Thanks for your initial comments!
I will make sure whether this flag is required or not.
>> +
>> + net = dev_net(ctx->rxq->dev);
>> +
>> + if (is_multicast_ether_addr(params->addr) ||
>> + is_broadcast_ether_addr(params->addr))
>> + return BPF_FDB_LKUP_RET_NOENT;
>> +
>> + src = dev_get_by_index_rcu(net, params->ifindex);
>> + if (unlikely(!src))
>> + return -ENODEV;
>> +
>> + dst = br_fdb_find_port_xdp(src, params->addr, params->vlan_id);
>
> 2. this needs to be done via netdev ops to avoid referencing bridge code
> which can be compiled as a module. I suspect the build robots will id
> this part soon.
I guess that no build errors will occur because the API is allowed when
CONFIG_BRIDGE is enabled.
I successfully build my kernel applying this patch, and I don’t receive any
messages from build robots for now.
Thanks & Best regards,
—
Yoshiki Komachi
komachi.yoshiki@...il.com
Powered by blists - more mailing lists