xref: /openbmc/linux/net/sched/sch_blackhole.c (revision 63d886c96b2a580b1bf764de238ba3c63515b5ee)
1*63d886c9SThomas Graf /*
2*63d886c9SThomas Graf  * net/sched/sch_blackhole.c	Black hole queue
3*63d886c9SThomas Graf  *
4*63d886c9SThomas Graf  *		This program is free software; you can redistribute it and/or
5*63d886c9SThomas Graf  *		modify it under the terms of the GNU General Public License
6*63d886c9SThomas Graf  *		as published by the Free Software Foundation; either version
7*63d886c9SThomas Graf  *		2 of the License, or (at your option) any later version.
8*63d886c9SThomas Graf  *
9*63d886c9SThomas Graf  * Authors:	Thomas Graf <tgraf@suug.ch>
10*63d886c9SThomas Graf  *
11*63d886c9SThomas Graf  * Note: Quantum tunneling is not supported.
12*63d886c9SThomas Graf  */
13*63d886c9SThomas Graf 
14*63d886c9SThomas Graf #include <linux/config.h>
15*63d886c9SThomas Graf #include <linux/module.h>
16*63d886c9SThomas Graf #include <linux/types.h>
17*63d886c9SThomas Graf #include <linux/kernel.h>
18*63d886c9SThomas Graf #include <linux/netdevice.h>
19*63d886c9SThomas Graf #include <linux/skbuff.h>
20*63d886c9SThomas Graf #include <net/pkt_sched.h>
21*63d886c9SThomas Graf 
22*63d886c9SThomas Graf static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
23*63d886c9SThomas Graf {
24*63d886c9SThomas Graf 	qdisc_drop(skb, sch);
25*63d886c9SThomas Graf 	return NET_XMIT_SUCCESS;
26*63d886c9SThomas Graf }
27*63d886c9SThomas Graf 
28*63d886c9SThomas Graf static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
29*63d886c9SThomas Graf {
30*63d886c9SThomas Graf 	return NULL;
31*63d886c9SThomas Graf }
32*63d886c9SThomas Graf 
33*63d886c9SThomas Graf static struct Qdisc_ops blackhole_qdisc_ops = {
34*63d886c9SThomas Graf 	.id		= "blackhole",
35*63d886c9SThomas Graf 	.priv_size	= 0,
36*63d886c9SThomas Graf 	.enqueue	= blackhole_enqueue,
37*63d886c9SThomas Graf 	.dequeue	= blackhole_dequeue,
38*63d886c9SThomas Graf 	.owner		= THIS_MODULE,
39*63d886c9SThomas Graf };
40*63d886c9SThomas Graf 
41*63d886c9SThomas Graf static int __init blackhole_module_init(void)
42*63d886c9SThomas Graf {
43*63d886c9SThomas Graf 	return register_qdisc(&blackhole_qdisc_ops);
44*63d886c9SThomas Graf }
45*63d886c9SThomas Graf 
46*63d886c9SThomas Graf static void __exit blackhole_module_exit(void)
47*63d886c9SThomas Graf {
48*63d886c9SThomas Graf 	unregister_qdisc(&blackhole_qdisc_ops);
49*63d886c9SThomas Graf }
50*63d886c9SThomas Graf 
51*63d886c9SThomas Graf module_init(blackhole_module_init)
52*63d886c9SThomas Graf module_exit(blackhole_module_exit)
53*63d886c9SThomas Graf 
54*63d886c9SThomas Graf MODULE_LICENSE("GPL");
55