1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (c) 2016 Qualcomm Atheros, Inc
5 * Based on net/sched/sch_fq_codel.c
7 #ifndef __NET_SCHED_FQ_H
8 #define __NET_SCHED_FQ_H
10 #include <linux/skbuff.h>
11 #include <linux/spinlock.h>
12 #include <linux/types.h>
17 * struct fq_flow - per traffic flow queue
19 * @tin: owner of this flow. Used to manage collisions, i.e. when a packet
20 * hashes to an index which points to a flow that is already owned by a
21 * different tin the packet is destined to. In such case the implementer
22 * must provide a fallback flow
23 * @flowchain: can be linked to fq_tin's new_flows or old_flows. Used for DRR++
24 * (deficit round robin) based round robin queuing similar to the one
25 * found in net/sched/sch_fq_codel.c
26 * @queue: sk_buff queue to hold packets
27 * @backlog: number of bytes pending in the queue. The number of packets can be
28 * found in @queue.qlen
29 * @deficit: used for DRR++
33 struct list_head flowchain
;
34 struct sk_buff_head queue
;
40 * struct fq_tin - a logical container of fq_flows
42 * Used to group fq_flows into a logical aggregate. DRR++ scheme is used to
43 * pull interleaved packets out of the associated flows.
45 * @new_flows: linked list of fq_flow
46 * @old_flows: linked list of fq_flow
49 struct list_head new_flows
;
50 struct list_head old_flows
;
51 struct list_head tin_list
;
52 struct fq_flow default_flow
;
63 * struct fq - main container for fair queuing purposes
65 * @limit: max number of packets that can be queued across all flows
66 * @backlog: number of packets queued across all flows
69 struct fq_flow
*flows
;
70 unsigned long *flows_bitmap
;
72 struct list_head tin_backlog
;
85 typedef struct sk_buff
*fq_tin_dequeue_t(struct fq
*,
87 struct fq_flow
*flow
);
89 typedef void fq_skb_free_t(struct fq
*,
94 /* Return %true to filter (drop) the frame. */
95 typedef bool fq_skb_filter_t(struct fq
*,