Skip to content

Commit f6877fc

Browse files
committed
Merge branch 'ebpf-next'
Daniel Borkmann says: ==================== This set adds native eBPF support also to act_bpf and thus covers tc with eBPF in the classifier *and* action part. A link to iproute2 preview has been provided in patch 2 and the code will be pushed out after Stephen has processed the classifier part and helper bits for tc. This set depends on ced585c ("act_bpf: allow non-default TC_ACT opcodes as BPF exec outcome"), so a net into net-next merge would be required first. Hope that's fine by you, Dave. ;) ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents 0fa74a4 + a8cb5f5 commit f6877fc

File tree

6 files changed

+228
-83
lines changed

6 files changed

+228
-83
lines changed

include/net/tc_act/tc_bpf.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
struct tcf_bpf {
1717
struct tcf_common common;
1818
struct bpf_prog *filter;
19+
union {
20+
u32 bpf_fd;
21+
u16 bpf_num_ops;
22+
};
1923
struct sock_filter *bpf_ops;
20-
u16 bpf_num_ops;
24+
const char *bpf_name;
2125
};
2226
#define to_bpf(a) \
2327
container_of(a->priv, struct tcf_bpf, common)

include/uapi/linux/bpf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ enum bpf_prog_type {
119119
BPF_PROG_TYPE_UNSPEC,
120120
BPF_PROG_TYPE_SOCKET_FILTER,
121121
BPF_PROG_TYPE_SCHED_CLS,
122+
BPF_PROG_TYPE_SCHED_ACT,
122123
};
123124

124125
#define BPF_PSEUDO_MAP_FD 1

include/uapi/linux/tc_act/tc_bpf.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ enum {
2424
TCA_ACT_BPF_PARMS,
2525
TCA_ACT_BPF_OPS_LEN,
2626
TCA_ACT_BPF_OPS,
27+
TCA_ACT_BPF_FD,
28+
TCA_ACT_BPF_NAME,
2729
__TCA_ACT_BPF_MAX,
2830
};
2931
#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1)

kernel/bpf/verifier.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,7 @@ static bool may_access_skb(enum bpf_prog_type type)
11801180
switch (type) {
11811181
case BPF_PROG_TYPE_SOCKET_FILTER:
11821182
case BPF_PROG_TYPE_SCHED_CLS:
1183+
case BPF_PROG_TYPE_SCHED_ACT:
11831184
return true;
11841185
default:
11851186
return false;

net/core/filter.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,10 +1263,16 @@ static struct bpf_prog_type_list sched_cls_type __read_mostly = {
12631263
.type = BPF_PROG_TYPE_SCHED_CLS,
12641264
};
12651265

1266+
static struct bpf_prog_type_list sched_act_type __read_mostly = {
1267+
.ops = &sk_filter_ops,
1268+
.type = BPF_PROG_TYPE_SCHED_ACT,
1269+
};
1270+
12661271
static int __init register_sk_filter_ops(void)
12671272
{
12681273
bpf_register_prog_type(&sk_filter_type);
12691274
bpf_register_prog_type(&sched_cls_type);
1275+
bpf_register_prog_type(&sched_act_type);
12701276

12711277
return 0;
12721278
}

0 commit comments

Comments
 (0)