[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <800c88e5-c3a8-65f8-bc8c-c7d18b667157@iogearbox.net>
Date: Sat, 29 Aug 2020 00:05:42 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Hangbin Liu <liuhangbin@...il.com>, bpf@...r.kernel.org
Cc: netdev@...r.kernel.org,
Toke Høiland-Jørgensen <toke@...hat.com>,
Jiri Benc <jbenc@...hat.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Eelco Chaudron <echaudro@...hat.com>, ast@...nel.org,
Lorenzo Bianconi <lorenzo.bianconi@...hat.com>,
David Ahern <dsahern@...il.com>,
Andrii Nakryiko B <andrii.nakryiko@...il.com>
Subject: Re: [PATCHv9 bpf-next 2/5] xdp: add a new helper for dev map
multicast support
On 8/26/20 3:19 PM, Hangbin Liu wrote:
[...]
> +BPF_CALL_3(bpf_xdp_redirect_map_multi, struct bpf_map *, map,
> + struct bpf_map *, ex_map, u64, flags)
> +{
> + struct bpf_redirect_info *ri = this_cpu_ptr(&bpf_redirect_info);
> +
> + /* Limit ex_map type to DEVMAP_HASH to get better performance */
> + if (unlikely(!map ||
Why is test on !map needed when arg1_type is ARG_CONST_MAP_PTR? Verifier must
guarantee that it's a valid map ptr .. are you saying this is not the case for
this helper?
> + (ex_map && ex_map->map_type != BPF_MAP_TYPE_DEVMAP_HASH) ||
> + flags & ~BPF_F_EXCLUDE_INGRESS))
> + return XDP_ABORTED;
> +
> + ri->tgt_index = 0;
> + /* Set the tgt_value to NULL to distinguish with bpf_xdp_redirect_map */
> + ri->tgt_value = NULL;
> + ri->flags = flags;
> + ri->ex_map = ex_map;
> +
> + WRITE_ONCE(ri->map, map);
> +
> + return XDP_REDIRECT;
> +}
> +
> +static const struct bpf_func_proto bpf_xdp_redirect_map_multi_proto = {
> + .func = bpf_xdp_redirect_map_multi,
> + .gpl_only = false,
> + .ret_type = RET_INTEGER,
> + .arg1_type = ARG_CONST_MAP_PTR,
> + .arg2_type = ARG_CONST_MAP_PTR_OR_NULL,
> + .arg3_type = ARG_ANYTHING,
> +};
> +
> static unsigned long bpf_skb_copy(void *dst_buff, const void *skb,
> unsigned long off, unsigned long len)
> {
> @@ -6833,6 +6933,8 @@ xdp_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
> return &bpf_xdp_redirect_proto;
> case BPF_FUNC_redirect_map:
> return &bpf_xdp_redirect_map_proto;
> + case BPF_FUNC_redirect_map_multi:
> + return &bpf_xdp_redirect_map_multi_proto;
> case BPF_FUNC_xdp_adjust_tail:
> return &bpf_xdp_adjust_tail_proto;
> case BPF_FUNC_fib_lookup:
Powered by blists - more mailing lists