* [PATCH net-next] ebpf: add skb->priority to offset map for usage in {cls,act}_bpf
@ 2015-04-03 18:52 Daniel Borkmann
2015-04-03 19:01 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Borkmann @ 2015-04-03 18:52 UTC (permalink / raw)
To: davem; +Cc: netdev, Daniel Borkmann, Alexei Starovoitov
This adds the ability to read out the skb->priority from an eBPF
program, so that it can be taken into account from a tc filter
or action for the use-case where the priority is not being used
to directly override the filter classification in a qdisc, but
to tag traffic otherwise for the classifier; the priority can be
assigned from various places incl. user space, in future we may
also mangle it from an eBPF program.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
---
include/uapi/linux/bpf.h | 1 +
net/core/filter.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 74aab6e..0db8580 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -184,6 +184,7 @@ struct __sk_buff {
__u32 vlan_present;
__u32 vlan_tci;
__u32 vlan_proto;
+ __u32 priority;
};
#endif /* _UAPI__LINUX_BPF_H__ */
diff --git a/net/core/filter.c b/net/core/filter.c
index 444a07e..955a7d7 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1304,6 +1304,13 @@ static u32 sk_filter_convert_ctx_access(int dst_reg, int src_reg, int ctx_off,
offsetof(struct sk_buff, vlan_proto));
break;
+ case offsetof(struct __sk_buff, priority):
+ BUILD_BUG_ON(FIELD_SIZEOF(struct sk_buff, priority) != 4);
+
+ *insn++ = BPF_LDX_MEM(BPF_W, dst_reg, src_reg,
+ offsetof(struct sk_buff, priority));
+ break;
+
case offsetof(struct __sk_buff, mark):
return convert_skb_access(SKF_AD_MARK, dst_reg, src_reg, insn);
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net-next] ebpf: add skb->priority to offset map for usage in {cls,act}_bpf
2015-04-03 18:52 [PATCH net-next] ebpf: add skb->priority to offset map for usage in {cls,act}_bpf Daniel Borkmann
@ 2015-04-03 19:01 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-04-03 19:01 UTC (permalink / raw)
To: daniel; +Cc: netdev, ast
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Fri, 3 Apr 2015 20:52:24 +0200
> This adds the ability to read out the skb->priority from an eBPF
> program, so that it can be taken into account from a tc filter
> or action for the use-case where the priority is not being used
> to directly override the filter classification in a qdisc, but
> to tag traffic otherwise for the classifier; the priority can be
> assigned from various places incl. user space, in future we may
> also mangle it from an eBPF program.
>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
This looks fine, applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-03 19:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-03 18:52 [PATCH net-next] ebpf: add skb->priority to offset map for usage in {cls,act}_bpf Daniel Borkmann
2015-04-03 19:01 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).