xref: /openbmc/linux/net/sched/sch_blackhole.c (revision 520ac30f45519b0a82dd92117c181d1d6144677b)
163d886c9SThomas Graf /*
263d886c9SThomas Graf  * net/sched/sch_blackhole.c	Black hole queue
363d886c9SThomas Graf  *
463d886c9SThomas Graf  *		This program is free software; you can redistribute it and/or
563d886c9SThomas Graf  *		modify it under the terms of the GNU General Public License
663d886c9SThomas Graf  *		as published by the Free Software Foundation; either version
763d886c9SThomas Graf  *		2 of the License, or (at your option) any later version.
863d886c9SThomas Graf  *
963d886c9SThomas Graf  * Authors:	Thomas Graf <tgraf@suug.ch>
1063d886c9SThomas Graf  *
1163d886c9SThomas Graf  * Note: Quantum tunneling is not supported.
1263d886c9SThomas Graf  */
1363d886c9SThomas Graf 
14075640e3SPaul Gortmaker #include <linux/init.h>
1563d886c9SThomas Graf #include <linux/types.h>
1663d886c9SThomas Graf #include <linux/kernel.h>
1763d886c9SThomas Graf #include <linux/skbuff.h>
1863d886c9SThomas Graf #include <net/pkt_sched.h>
1963d886c9SThomas Graf 
20*520ac30fSEric Dumazet static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch,
21*520ac30fSEric Dumazet 			     struct sk_buff **to_free)
2263d886c9SThomas Graf {
23*520ac30fSEric Dumazet 	qdisc_drop(skb, sch, to_free);
2463d886c9SThomas Graf 	return NET_XMIT_SUCCESS;
2563d886c9SThomas Graf }
2663d886c9SThomas Graf 
2763d886c9SThomas Graf static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
2863d886c9SThomas Graf {
2963d886c9SThomas Graf 	return NULL;
3063d886c9SThomas Graf }
3163d886c9SThomas Graf 
3220fea08bSEric Dumazet static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
3363d886c9SThomas Graf 	.id		= "blackhole",
3463d886c9SThomas Graf 	.priv_size	= 0,
3563d886c9SThomas Graf 	.enqueue	= blackhole_enqueue,
3663d886c9SThomas Graf 	.dequeue	= blackhole_dequeue,
378e3af978SJarek Poplawski 	.peek		= blackhole_dequeue,
3863d886c9SThomas Graf 	.owner		= THIS_MODULE,
3963d886c9SThomas Graf };
4063d886c9SThomas Graf 
41075640e3SPaul Gortmaker static int __init blackhole_init(void)
4263d886c9SThomas Graf {
4363d886c9SThomas Graf 	return register_qdisc(&blackhole_qdisc_ops);
4463d886c9SThomas Graf }
45075640e3SPaul Gortmaker device_initcall(blackhole_init)
46