12874c5fdSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
263d886c9SThomas Graf /*
363d886c9SThomas Graf * net/sched/sch_blackhole.c Black hole queue
463d886c9SThomas Graf *
563d886c9SThomas Graf * Authors: Thomas Graf <tgraf@suug.ch>
663d886c9SThomas Graf *
763d886c9SThomas Graf * Note: Quantum tunneling is not supported.
863d886c9SThomas Graf */
963d886c9SThomas Graf
10075640e3SPaul Gortmaker #include <linux/init.h>
1163d886c9SThomas Graf #include <linux/types.h>
1263d886c9SThomas Graf #include <linux/kernel.h>
1363d886c9SThomas Graf #include <linux/skbuff.h>
1463d886c9SThomas Graf #include <net/pkt_sched.h>
1563d886c9SThomas Graf
blackhole_enqueue(struct sk_buff * skb,struct Qdisc * sch,struct sk_buff ** to_free)16*ac5c66f2SPetr Machata static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch,
17520ac30fSEric Dumazet struct sk_buff **to_free)
1863d886c9SThomas Graf {
19520ac30fSEric Dumazet qdisc_drop(skb, sch, to_free);
207e85dc8cSKonstantin Khlebnikov return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
2163d886c9SThomas Graf }
2263d886c9SThomas Graf
blackhole_dequeue(struct Qdisc * sch)2363d886c9SThomas Graf static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
2463d886c9SThomas Graf {
2563d886c9SThomas Graf return NULL;
2663d886c9SThomas Graf }
2763d886c9SThomas Graf
2820fea08bSEric Dumazet static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
2963d886c9SThomas Graf .id = "blackhole",
3063d886c9SThomas Graf .priv_size = 0,
3163d886c9SThomas Graf .enqueue = blackhole_enqueue,
3263d886c9SThomas Graf .dequeue = blackhole_dequeue,
338e3af978SJarek Poplawski .peek = blackhole_dequeue,
3463d886c9SThomas Graf .owner = THIS_MODULE,
3563d886c9SThomas Graf };
3663d886c9SThomas Graf
blackhole_init(void)37075640e3SPaul Gortmaker static int __init blackhole_init(void)
3863d886c9SThomas Graf {
3963d886c9SThomas Graf return register_qdisc(&blackhole_qdisc_ops);
4063d886c9SThomas Graf }
41075640e3SPaul Gortmaker device_initcall(blackhole_init)
42