1 /* SPDX-License-Identifier: LGPL-2.1-or-later
2  * Copyright © 2020 VMware, Inc. */
3 #pragma once
4 
5 #include <linux/pkt_sched.h>
6 
7 #include "conf-parser.h"
8 #include "qdisc.h"
9 
10 typedef enum CakeCompensationMode {
11         CAKE_COMPENSATION_MODE_NONE = CAKE_ATM_NONE,
12         CAKE_COMPENSATION_MODE_ATM  = CAKE_ATM_ATM,
13         CAKE_COMPENSATION_MODE_PTM  = CAKE_ATM_PTM,
14         _CAKE_COMPENSATION_MODE_MAX,
15         _CAKE_COMPENSATION_MODE_INVALID = -EINVAL,
16 } CakeCompensationMode;
17 
18 typedef enum CakeFlowIsolationMode {
19         CAKE_FLOW_ISOLATION_MODE_NONE     = CAKE_FLOW_NONE,
20         CAKE_FLOW_ISOLATION_MODE_SRC_IP   = CAKE_FLOW_SRC_IP,
21         CAKE_FLOW_ISOLATION_MODE_DST_IP   = CAKE_FLOW_DST_IP,
22         CAKE_FLOW_ISOLATION_MODE_HOSTS    = CAKE_FLOW_HOSTS,
23         CAKE_FLOW_ISOLATION_MODE_FLOWS    = CAKE_FLOW_FLOWS,
24         CAKE_FLOW_ISOLATION_MODE_DUAL_SRC = CAKE_FLOW_DUAL_SRC,
25         CAKE_FLOW_ISOLATION_MODE_DUAL_DST = CAKE_FLOW_DUAL_DST,
26         CAKE_FLOW_ISOLATION_MODE_TRIPLE   = CAKE_FLOW_TRIPLE,
27         _CAKE_FLOW_ISOLATION_MODE_MAX,
28         _CAKE_FLOW_ISOLATION_MODE_INVALID = -EINVAL,
29 } CakeFlowIsolationMode;
30 
31 typedef enum CakePriorityQueueingPreset {
32         CAKE_PRESET_DIFFSERV3  = CAKE_DIFFSERV_DIFFSERV3,
33         CAKE_PRESET_DIFFSERV4  = CAKE_DIFFSERV_DIFFSERV4,
34         CAKE_PRESET_DIFFSERV8  = CAKE_DIFFSERV_DIFFSERV8,
35         CAKE_PRESET_BESTEFFORT = CAKE_DIFFSERV_BESTEFFORT,
36         CAKE_PRESET_PRECEDENCE = CAKE_DIFFSERV_PRECEDENCE,
37         _CAKE_PRESET_MAX,
38         _CAKE_PRESET_INVALID = -EINVAL,
39 } CakePriorityQueueingPreset;
40 
41 typedef struct CommonApplicationsKeptEnhanced {
42         QDisc meta;
43 
44         /* Shaper parameters */
45         int autorate;
46         uint64_t bandwidth;
47 
48         /* Overhead compensation parameters */
49         bool overhead_set;
50         int overhead;
51         uint32_t mpu;
52         CakeCompensationMode compensation_mode;
53         int raw;
54 
55         /* Flow isolation parameters */
56         CakeFlowIsolationMode flow_isolation_mode;
57         int nat;
58 
59         /* Priority queue parameters */
60         CakePriorityQueueingPreset preset;
61         uint32_t fwmark;
62 
63         /* Other parameters */
64         int wash;
65         int split_gso;
66 
67 } CommonApplicationsKeptEnhanced;
68 
69 DEFINE_QDISC_CAST(CAKE, CommonApplicationsKeptEnhanced);
70 extern const QDiscVTable cake_vtable;
71 
72 CONFIG_PARSER_PROTOTYPE(config_parse_cake_bandwidth);
73 CONFIG_PARSER_PROTOTYPE(config_parse_cake_overhead);
74 CONFIG_PARSER_PROTOTYPE(config_parse_cake_mpu);
75 CONFIG_PARSER_PROTOTYPE(config_parse_cake_tristate);
76 CONFIG_PARSER_PROTOTYPE(config_parse_cake_compensation_mode);
77 CONFIG_PARSER_PROTOTYPE(config_parse_cake_flow_isolation_mode);
78 CONFIG_PARSER_PROTOTYPE(config_parse_cake_priority_queueing_preset);
79 CONFIG_PARSER_PROTOTYPE(config_parse_cake_fwmark);
80