Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (c) 2016 Qualcomm Atheros, Inc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Based on net/sched/sch_fq_codel.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #ifndef __NET_SCHED_FQ_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #define __NET_SCHED_FQ_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) struct fq_tin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * struct fq_flow - per traffic flow queue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * @tin: owner of this flow. Used to manage collisions, i.e. when a packet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  *	hashes to an index which points to a flow that is already owned by a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  *	different tin the packet is destined to. In such case the implementer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18)  *	must provide a fallback flow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19)  * @flowchain: can be linked to fq_tin's new_flows or old_flows. Used for DRR++
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20)  *	(deficit round robin) based round robin queuing similar to the one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21)  *	found in net/sched/sch_fq_codel.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * @backlogchain: can be linked to other fq_flow and fq. Used to keep track of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  *	fat flows and efficient head-dropping if packet limit is reached
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  * @queue: sk_buff queue to hold packets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25)  * @backlog: number of bytes pending in the queue. The number of packets can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26)  *	found in @queue.qlen
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27)  * @deficit: used for DRR++
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) struct fq_flow {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	struct fq_tin *tin;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct list_head flowchain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	struct list_head backlogchain;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	struct sk_buff_head queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	u32 backlog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	int deficit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  * struct fq_tin - a logical container of fq_flows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  * Used to group fq_flows into a logical aggregate. DRR++ scheme is used to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  * pull interleaved packets out of the associated flows.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * @new_flows: linked list of fq_flow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * @old_flows: linked list of fq_flow
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) struct fq_tin {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct list_head new_flows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct list_head old_flows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u32 backlog_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	u32 backlog_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	u32 overlimit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	u32 collisions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	u32 flows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	u32 tx_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	u32 tx_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * struct fq - main container for fair queuing purposes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @backlogs: linked to fq_flows. Used to maintain fat flows for efficient
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  *	head-dropping when @backlog reaches @limit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @limit: max number of packets that can be queued across all flows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * @backlog: number of packets queued across all flows
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) struct fq {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	struct fq_flow *flows;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	struct list_head backlogs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	spinlock_t lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	u32 flows_cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	u32 limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	u32 memory_limit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	u32 memory_usage;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	u32 quantum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	u32 backlog;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	u32 overlimit;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	u32 overmemory;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	u32 collisions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) typedef struct sk_buff *fq_tin_dequeue_t(struct fq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 					 struct fq_tin *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 					 struct fq_flow *flow);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) typedef void fq_skb_free_t(struct fq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 			   struct fq_tin *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 			   struct fq_flow *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			   struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) /* Return %true to filter (drop) the frame. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) typedef bool fq_skb_filter_t(struct fq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			     struct fq_tin *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 			     struct fq_flow *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 			     struct sk_buff *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			     void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) typedef struct fq_flow *fq_flow_get_default_t(struct fq *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 					      struct fq_tin *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 					      int idx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 					      struct sk_buff *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #endif