aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJakub Kicinski2018-05-08 19:37:06 -0700
committerDaniel Borkmann2018-05-09 18:04:36 +0200
commit0d8300325660f81787892a1c58dc1f9428a67143 (patch)
treef4da9a224e333ac48b3110e1a3c4490646fef6d5 /net
parenta1d1f07935000fb810b75678f8f8ca6cbb14a417 (diff)
bpf: xdp: allow offloads to store into rx_queue_index
It's fairly easy for offloaded XDP programs to select the RX queue packets go to. We need a way of expressing this in the software. Allow write to the rx_queue_index field of struct xdp_md for device-bound programs. Skip convert_ctx_access callback entirely for offloads. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/filter.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/net/core/filter.c b/net/core/filter.c
index 6877426c23a6..0baa715e4699 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -4645,8 +4645,15 @@ static bool xdp_is_valid_access(int off, int size,
const struct bpf_prog *prog,
struct bpf_insn_access_aux *info)
{
- if (type == BPF_WRITE)
+ if (type == BPF_WRITE) {
+ if (bpf_prog_is_dev_bound(prog->aux)) {
+ switch (off) {
+ case offsetof(struct xdp_md, rx_queue_index):
+ return __is_valid_xdp_access(off, size);
+ }
+ }
return false;
+ }
switch (off) {
case offsetof(struct xdp_md, data):