diff options
author | David Ahern <dsahern@kernel.org> | 2020-05-30 00:07:14 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-06-01 23:48:32 +0200 |
commit | 64b59025c15b244c0954cf52b24fbabfcf5ed8f6 (patch) | |
tree | 6d47a7f0f047306a1aede92a803a50e629b6c50a /kernel/bpf | |
parent | bpf: Add support to attach bpf program to a devmap entry (diff) | |
download | linux-64b59025c15b244c0954cf52b24fbabfcf5ed8f6.tar.xz linux-64b59025c15b244c0954cf52b24fbabfcf5ed8f6.zip |
xdp: Add xdp_txq_info to xdp_buff
Add xdp_txq_info as the Tx counterpart to xdp_rxq_info. At the
moment only the device is added. Other fields (queue_index)
can be added as use cases arise.
>From a UAPI perspective, add egress_ifindex to xdp context for
bpf programs to see the Tx device.
Update the verifier to only allow accesses to egress_ifindex by
XDP programs with BPF_XDP_DEVMAP expected attach type.
Signed-off-by: David Ahern <dsahern@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20200529220716.75383-4-dsahern@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/devmap.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/bpf/devmap.c b/kernel/bpf/devmap.c index 0089d56617ec..c04fb1c72f5e 100644 --- a/kernel/bpf/devmap.c +++ b/kernel/bpf/devmap.c @@ -476,8 +476,11 @@ static struct xdp_buff *dev_map_run_prog(struct net_device *dev, struct xdp_buff *xdp, struct bpf_prog *xdp_prog) { + struct xdp_txq_info txq = { .dev = dev }; u32 act; + xdp->txq = &txq; + act = bpf_prog_run_xdp(xdp_prog, xdp); switch (act) { case XDP_PASS: |