57#include <netlink-private/netlink.h>
58#include <netlink-private/tc.h>
59#include <netlink/netlink.h>
60#include <netlink/utils.h>
61#include <netlink-private/route/tc-api.h>
62#include <netlink/route/qdisc/plug.h>
64static int plug_msg_fill(
struct rtnl_tc *tc,
void *data,
struct nl_msg *msg)
66 struct rtnl_plug *plug = data;
67 struct tc_plug_qopt opts;
72 opts.action = plug->action;
73 opts.limit = plug->limit;
75 return nlmsg_append(msg, &opts,
sizeof(opts), NL_DONTPAD);
90 struct rtnl_plug *plug;
95 plug->action = TCQ_PLUG_BUFFER;
107 struct rtnl_plug *plug;
112 plug->action = TCQ_PLUG_RELEASE_ONE;
124 struct rtnl_plug *plug;
129 plug->action = TCQ_PLUG_RELEASE_INDEFINITE;
141 struct rtnl_plug *plug;
146 plug->action = TCQ_PLUG_LIMIT;
154static struct rtnl_tc_ops plug_ops = {
156 .to_type = RTNL_TC_TYPE_QDISC,
157 .to_size =
sizeof(
struct rtnl_plug),
158 .to_msg_fill = plug_msg_fill,
161static void __init plug_init(
void)
166static void __exit plug_exit(
void)
int nlmsg_append(struct nl_msg *n, void *data, size_t len, int pad)
Append data to tail of a netlink message.
int rtnl_qdisc_plug_release_indefinite(struct rtnl_qdisc *qdisc)
Indefinitely unplug the qdisc, releasing all packets.
int rtnl_qdisc_plug_release_one(struct rtnl_qdisc *qdisc)
Unplug the qdisc, releasing packets from queue head to the last complete buffer, while new traffic co...
int rtnl_qdisc_plug_buffer(struct rtnl_qdisc *qdisc)
Insert a plug into the qdisc and buffer any incoming network traffic.
int rtnl_qdisc_plug_set_limit(struct rtnl_qdisc *qdisc, int limit)
Set limit of PLUG qdisc.
#define TC_CAST(ptr)
Macro to cast qdisc/class/classifier to tc object.
void * rtnl_tc_data(struct rtnl_tc *tc)
Return pointer to private data of traffic control object.
int rtnl_tc_register(struct rtnl_tc_ops *ops)
Register a traffic control module.
void rtnl_tc_unregister(struct rtnl_tc_ops *ops)
Unregister a traffic control module.