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 1463d886c9SThomas Graf #include <linux/module.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 31*20fea08bSEric 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, 3663d886c9SThomas Graf .owner = THIS_MODULE, 3763d886c9SThomas Graf }; 3863d886c9SThomas Graf 3963d886c9SThomas Graf static int __init blackhole_module_init(void) 4063d886c9SThomas Graf { 4163d886c9SThomas Graf return register_qdisc(&blackhole_qdisc_ops); 4263d886c9SThomas Graf } 4363d886c9SThomas Graf 4463d886c9SThomas Graf static void __exit blackhole_module_exit(void) 4563d886c9SThomas Graf { 4663d886c9SThomas Graf unregister_qdisc(&blackhole_qdisc_ops); 4763d886c9SThomas Graf } 4863d886c9SThomas Graf 4963d886c9SThomas Graf module_init(blackhole_module_init) 5063d886c9SThomas Graf module_exit(blackhole_module_exit) 5163d886c9SThomas Graf 5263d886c9SThomas Graf MODULE_LICENSE("GPL"); 53