From df250654d871b8866bc3ec85ad2bee291c74a1d4 Mon Sep 17 00:00:00 2001 From: Przemyslaw Czarnota Date: Wed, 6 Jun 2018 08:23:00 +0200 Subject: [05/17] clsact: add clsact qdisc clsact qdisc is needed to be able to classify egress traffic --- Makefile.am | 1 + include/linux-private/linux/pkt_sched.h | 5 ++ lib/route/qdisc/clsact.c | 64 +++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 lib/route/qdisc/clsact.c diff --git a/Makefile.am b/Makefile.am index a720f41..d161419 100644 --- a/Makefile.am +++ b/Makefile.am @@ -410,6 +410,7 @@ lib_libnl_route_3_la_SOURCES = \ lib/route/qdisc/hfsc.c \ lib/route/qdisc/htb.c \ lib/route/qdisc/ingress.c \ + lib/route/qdisc/clsact.c \ lib/route/qdisc/netem.c \ lib/route/qdisc/plug.c \ lib/route/qdisc/prio.c \ diff --git a/include/linux-private/linux/pkt_sched.h b/include/linux-private/linux/pkt_sched.h index a0837a0..98b8311 100644 --- a/include/linux-private/linux/pkt_sched.h +++ b/include/linux-private/linux/pkt_sched.h @@ -72,6 +72,11 @@ struct tc_estimator { #define TC_H_UNSPEC (0U) #define TC_H_ROOT (0xFFFFFFFFU) #define TC_H_INGRESS (0xFFFFFFF1U) +#define TC_H_CLSACT TC_H_INGRESS + +#define TC_H_MIN_PRIORITY 0xFFE0U +#define TC_H_MIN_INGRESS 0xFFF2U +#define TC_H_MIN_EGRESS 0xFFF3U struct tc_ratespec { unsigned char cell_log; diff --git a/lib/route/qdisc/clsact.c b/lib/route/qdisc/clsact.c new file mode 100644 index 0000000..6badc91 --- /dev/null +++ b/lib/route/qdisc/clsact.c @@ -0,0 +1,64 @@ +/* + * lib/route/qdisc/clsact.c clsact + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation version 2.1 + * of the License. + * + * Copyright (c) 2018 Intel Corporation + */ + +/** + * @ingroup qdisc + * @defgroup qdisc_clsact clsact qdisc + * + * @{ + */ + +#include +#include +#include +#include +#include +#include + +struct dumb { + uint32_t foo; +}; + +static int dumb_msg_parser(struct rtnl_tc *tc, void *data) +{ + return 0; +} + +static void dumb_dump_line(struct rtnl_tc *tc, void *data, + struct nl_dump_params *p) +{ +} + +static int dumb_msg_fill(struct rtnl_tc *tc, void *data, struct nl_msg *msg) +{ + return 0; +} + +static struct rtnl_tc_ops clsact_ops = { + .to_kind = "clsact", + .to_type = RTNL_TC_TYPE_QDISC, + .to_size = sizeof(struct dumb), + .to_msg_parser = dumb_msg_parser, + .to_dump[NL_DUMP_LINE] = dumb_dump_line, + .to_msg_fill = dumb_msg_fill, +}; + +static void __init clsact_init(void) +{ + rtnl_tc_register(&clsact_ops); +} + +static void __exit clsact_exit(void) +{ + rtnl_tc_unregister(&clsact_ops); +} + +/** @} */ -- 2.17.1