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 > + > + 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.