diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-11-03 16:56:18 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-11-05 08:26:18 -0500 |
commit | bd601b6ada11fdfb9e277f24ad2eb54bc599156b (patch) | |
tree | 358763b441dfcc6d0a3a8a6e75878f1f08cb60e3 /kernel/bpf/syscall.c | |
parent | ab3f0063c48c26c927851b6767824e35a716d878 (diff) |
bpf: report offload info to user space
Extend struct bpf_prog_info to contain information about program
being bound to a device. Since the netdev may get destroyed while
program still exists we need a flag to indicate the program is
loaded for a device, even if the device is gone.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 1574b9f0f24e..3217c20ea91b 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -1592,6 +1592,11 @@ static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, | |||
1592 | return -EFAULT; | 1592 | return -EFAULT; |
1593 | } | 1593 | } |
1594 | 1594 | ||
1595 | if (bpf_prog_is_dev_bound(prog->aux)) { | ||
1596 | info.status |= BPF_PROG_STATUS_DEV_BOUND; | ||
1597 | info.ifindex = bpf_prog_offload_ifindex(prog); | ||
1598 | } | ||
1599 | |||
1595 | done: | 1600 | done: |
1596 | if (copy_to_user(uinfo, &info, info_len) || | 1601 | if (copy_to_user(uinfo, &info, info_len) || |
1597 | put_user(info_len, &uattr->info.info_len)) | 1602 | put_user(info_len, &uattr->info.info_len)) |