xref: /openbmc/linux/net/sched/sch_blackhole.c (revision 075640e364f3b46311766f0eff28bd3695637e16)
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 
14*075640e3SPaul 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 
2063d886c9SThomas Graf static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
2163d886c9SThomas Graf {
2263d886c9SThomas Graf 	qdisc_drop(skb, sch);
2363d886c9SThomas Graf 	return NET_XMIT_SUCCESS;
2463d886c9SThomas Graf }
2563d886c9SThomas Graf 
2663d886c9SThomas Graf static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
2763d886c9SThomas Graf {
2863d886c9SThomas Graf 	return NULL;
2963d886c9SThomas Graf }
3063d886c9SThomas Graf 
3120fea08bSEric Dumazet static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
3263d886c9SThomas Graf 	.id		= "blackhole",
3363d886c9SThomas Graf 	.priv_size	= 0,
3463d886c9SThomas Graf 	.enqueue	= blackhole_enqueue,
3563d886c9SThomas Graf 	.dequeue	= blackhole_dequeue,
368e3af978SJarek Poplawski 	.peek		= blackhole_dequeue,
3763d886c9SThomas Graf 	.owner		= THIS_MODULE,
3863d886c9SThomas Graf };
3963d886c9SThomas Graf 
40*075640e3SPaul Gortmaker static int __init blackhole_init(void)
4163d886c9SThomas Graf {
4263d886c9SThomas Graf 	return register_qdisc(&blackhole_qdisc_ops);
4363d886c9SThomas Graf }
44*075640e3SPaul Gortmaker device_initcall(blackhole_init)
45