Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 /*
0003  * net/sched/sch_blackhole.c    Black hole queue
0004  *
0005  * Authors: Thomas Graf <tgraf@suug.ch>
0006  *
0007  * Note: Quantum tunneling is not supported.
0008  */
0009 
0010 #include <linux/init.h>
0011 #include <linux/types.h>
0012 #include <linux/kernel.h>
0013 #include <linux/skbuff.h>
0014 #include <net/pkt_sched.h>
0015 
0016 static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch,
0017                  struct sk_buff **to_free)
0018 {
0019     qdisc_drop(skb, sch, to_free);
0020     return NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
0021 }
0022 
0023 static struct sk_buff *blackhole_dequeue(struct Qdisc *sch)
0024 {
0025     return NULL;
0026 }
0027 
0028 static struct Qdisc_ops blackhole_qdisc_ops __read_mostly = {
0029     .id     = "blackhole",
0030     .priv_size  = 0,
0031     .enqueue    = blackhole_enqueue,
0032     .dequeue    = blackhole_dequeue,
0033     .peek       = blackhole_dequeue,
0034     .owner      = THIS_MODULE,
0035 };
0036 
0037 static int __init blackhole_init(void)
0038 {
0039     return register_qdisc(&blackhole_qdisc_ops);
0040 }
0041 device_initcall(blackhole_init)