tc: push bpf common code into separate file
Subsystems (2)
PATCH 1/2 tc: push bpf common code into separate file
Signed-off-by Jiri Pirko <[email protected]>
--- tc/Makefile | 2 +- tc/f_bpf.c | 136 +++++-------------------------------------------------- tc/tc_bpf.c | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tc/tc_bpf.h | 28 ++++++++++++ 4 files changed, 186 insertions(+), 126 deletions(-) create mode 100644 tc/tc_bpf.c create mode 100644 tc/tc_bpf.h
tc/Makefile +1 -1
@@ -1,5 +1,5 @@ TCOBJ= tc.o tc_qdisc.o tc_class.o tc_filter.o tc_util.o \ - tc_monitor.o m_police.o m_estimator.o m_action.o \ + tc_monitor.o tc_bpf.o m_police.o m_estimator.o m_action.o \ m_ematch.o emp_ematch.yacc.o emp_ematch.lex.o include ../Config
tc/f_bpf.c +11 -125
163 lines not on this page · raw message
tc/tc_bpf.c new file +146 -0
146 lines not on this page · raw message
tc/tc_bpf.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* tc_bpf.h BPF common code +* +* This program is free software; you can distribute it and/or +* modify it under the terms of the GNU General Public License +* as published by the Free Software Foundation; either version +* 2 of the License, or (at your option) any later version. +* +* Authors: Daniel Borkmann <[email protected]> +* Jiri Pirko <[email protected]> +*/ + +#ifndef _TC_BPF_H_ +#define _TC_BPF_H_ 1 + +#include <stdio.h> +#include <linux/filter.h> +#include <linux/netlink.h> +#include <linux/rtnetlink.h> + +int bpf_parse_string (char *arg,bool from_file,__u16 *bpf_len, +char **bpf_string,bool *need_release, +const char separator); +int bpf_parse_ops (int argc,char **argv,struct sock_filter *bpf_ops, +bool from_file); +void bpf_print_ops (FILE *f,struct rtattr *bpf_ops,__u16 len); + +#endif
Signature · 1 line
1.9.3
PATCH 2/2 tc: add support for BPF based actions
Signed-off-by Jiri Pirko <[email protected]>
--- include/linux/tc_act/tc_bpf.h | 31 +++++++ tc/Makefile | 1 + tc/m_bpf.c | 183 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 215 insertions(+) create mode 100644 include/linux/tc_act/tc_bpf.h create mode 100644 tc/m_bpf.c
include/linux/tc_act/tc_bpf.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (c) 2015 Jiri Pirko <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#ifndef __LINUX_TC_BPF_H +#define __LINUX_TC_BPF_H + +#include <linux/pkt_cls.h> + +#define TCA_ACT_BPF 13 + +struct tc_act_bpf { +tc_gen ; +}; + +enum { +TCA_ACT_BPF_UNSPEC , +TCA_ACT_BPF_TM , +TCA_ACT_BPF_PARMS , +TCA_ACT_BPF_OPS_LEN , +TCA_ACT_BPF_OPS , + __TCA_ACT_BPF_MAX, +}; +#define TCA_ACT_BPF_MAX (__TCA_ACT_BPF_MAX - 1) + +#endif
tc/Makefile +1 -0
@@ -46,6 +46,7 @@ TCMODULES += m_skbedit.o TCMODULES += m_csum.o TCMODULES += m_simple.o TCMODULES += m_vlan.o +TCMODULES += m_bpf.o TCMODULES += p_ip.o TCMODULES += p_icmp.o TCMODULES += p_tcp.o
tc/m_bpf.c new file +183 -0
183 lines not on this page · raw message
Signature · 1 line
1.9.3
Quoted 1 line · On Mon, 19 Jan 2015 16:56:29 +0100 Jiri Pirko <[email protected]> wrote:
Signed-off-by Jiri Pirko <[email protected]>
Both patches applied to net-next branch.