From: Eric Dumazet <eric.dumazet@gmail.com>
To: brakmo <brakmo@fb.com>, netdev <netdev@vger.kernel.org>
Cc: Martin Lau <kafai@fb.com>, Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
Kernel Team <Kernel-team@fb.com>
Subject: Re: [PATCH v3 bpf-next 1/6] bpf: Create BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY
Date: Tue, 28 May 2019 06:42:51 -0700 [thread overview]
Message-ID: <75cd4d0a-7cf8-ee63-2662-1664aedcd468@gmail.com> (raw)
In-Reply-To: <20190528034907.1957536-2-brakmo@fb.com>
On 5/27/19 8:49 PM, brakmo wrote:
> Create new macro BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY() to be used by
> __cgroup_bpf_run_filter_skb for EGRESS BPF progs so BPF programs can
> request cwr for TCP packets.
>
...
> +#define BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY(array, ctx, func) \
> + ({ \
> + struct bpf_prog_array_item *_item; \
> + struct bpf_prog *_prog; \
> + struct bpf_prog_array *_array; \
> + u32 ret; \
> + u32 _ret = 1; \
> + u32 _cn = 0; \
> + preempt_disable(); \
> + rcu_read_lock(); \
> + _array = rcu_dereference(array); \
Why _array can not be NULL here ?
> + _item = &_array->items[0]; \
> + while ((_prog = READ_ONCE(_item->prog))) { \
> + bpf_cgroup_storage_set(_item->cgroup_storage); \
> + ret = func(_prog, ctx); \
> + _ret &= (ret & 1); \
> + _cn |= (ret & 2); \
> + _item++; \
> + } \
> + rcu_read_unlock(); \
> + preempt_enable_no_resched();
Why are you using preempt_enable_no_resched() here ?
\
> + if (_ret) \
> + _ret = (_cn ? NET_XMIT_CN : NET_XMIT_SUCCESS); \
> + else \
> + _ret = (_cn ? NET_XMIT_DROP : -EPERM); \
> + _ret; \
> + })
> +
> #define BPF_PROG_RUN_ARRAY(array, ctx, func) \
> __BPF_PROG_RUN_ARRAY(array, ctx, func, false)
>
>
next prev parent reply other threads:[~2019-05-28 13:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-28 3:49 [PATCH v3 bpf-next 0/6] bpf: Propagate cn to TCP brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 1/6] bpf: Create BPF_PROG_CGROUP_INET_EGRESS_RUN_ARRAY brakmo
2019-05-28 13:42 ` Eric Dumazet [this message]
2019-05-28 18:54 ` Lawrence Brakmo
2019-05-28 20:43 ` Eric Dumazet
2019-05-28 21:23 ` Lawrence Brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 2/6] bpf: cgroup inet skb programs can return 0 to 3 brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 3/6] bpf: Update __cgroup_bpf_run_filter_skb with cn brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 4/6] bpf: Update BPF_CGROUP_RUN_PROG_INET_EGRESS calls brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 5/6] bpf: Add cn support to hbm_out_kern.c brakmo
2019-05-28 3:49 ` [PATCH v3 bpf-next 6/6] bpf: Add more stats to HBM brakmo
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=75cd4d0a-7cf8-ee63-2662-1664aedcd468@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=Kernel-team@fb.com \
--cc=ast@fb.com \
--cc=brakmo@fb.com \
--cc=daniel@iogearbox.net \
--cc=kafai@fb.com \
--cc=netdev@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.