net/mlx4: improve assert control
[dpdk.git] / drivers / net / dpaa2 / mc / fsl_dpdmux_cmd.h
1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
2  *
3  * Copyright 2013-2016 Freescale Semiconductor Inc.
4  * Copyright 2018-2019 NXP
5  *
6  */
7 #ifndef _FSL_DPDMUX_CMD_H
8 #define _FSL_DPDMUX_CMD_H
9
10 /* DPDMUX Version */
11 #define DPDMUX_VER_MAJOR                6
12 #define DPDMUX_VER_MINOR                3
13
14 #define DPDMUX_CMD_BASE_VERSION         1
15 #define DPDMUX_CMD_VERSION_2            2
16 #define DPDMUX_CMD_ID_OFFSET            4
17
18 #define DPDMUX_CMD(id)  (((id) << DPDMUX_CMD_ID_OFFSET) |\
19                                 DPDMUX_CMD_BASE_VERSION)
20 #define DPDMUX_CMD_V2(id) (((id) << DPDMUX_CMD_ID_OFFSET) | \
21                                 DPDMUX_CMD_VERSION_2)
22
23 /* Command IDs */
24 #define DPDMUX_CMDID_CLOSE                      DPDMUX_CMD(0x800)
25 #define DPDMUX_CMDID_OPEN                       DPDMUX_CMD(0x806)
26 #define DPDMUX_CMDID_CREATE                     DPDMUX_CMD(0x906)
27 #define DPDMUX_CMDID_DESTROY                    DPDMUX_CMD(0x986)
28 #define DPDMUX_CMDID_GET_API_VERSION            DPDMUX_CMD(0xa06)
29
30 #define DPDMUX_CMDID_ENABLE                     DPDMUX_CMD(0x002)
31 #define DPDMUX_CMDID_DISABLE                    DPDMUX_CMD(0x003)
32 #define DPDMUX_CMDID_GET_ATTR                   DPDMUX_CMD(0x004)
33 #define DPDMUX_CMDID_RESET                      DPDMUX_CMD(0x005)
34 #define DPDMUX_CMDID_IS_ENABLED                 DPDMUX_CMD(0x006)
35
36 #define DPDMUX_CMDID_SET_MAX_FRAME_LENGTH       DPDMUX_CMD(0x0a1)
37
38 #define DPDMUX_CMDID_UL_RESET_COUNTERS          DPDMUX_CMD(0x0a3)
39
40 #define DPDMUX_CMDID_IF_SET_ACCEPTED_FRAMES     DPDMUX_CMD(0x0a7)
41 #define DPDMUX_CMDID_IF_GET_ATTR                DPDMUX_CMD(0x0a8)
42 #define DPDMUX_CMDID_IF_ENABLE                  DPDMUX_CMD(0x0a9)
43 #define DPDMUX_CMDID_IF_DISABLE                 DPDMUX_CMD(0x0aa)
44
45 #define DPDMUX_CMDID_IF_ADD_L2_RULE             DPDMUX_CMD(0x0b0)
46 #define DPDMUX_CMDID_IF_REMOVE_L2_RULE          DPDMUX_CMD(0x0b1)
47 #define DPDMUX_CMDID_IF_GET_COUNTER             DPDMUX_CMD(0x0b2)
48 #define DPDMUX_CMDID_IF_SET_LINK_CFG            DPDMUX_CMD_V2(0x0b3)
49 #define DPDMUX_CMDID_IF_GET_LINK_STATE          DPDMUX_CMD_V2(0x0b4)
50
51 #define DPDMUX_CMDID_SET_CUSTOM_KEY             DPDMUX_CMD(0x0b5)
52 #define DPDMUX_CMDID_ADD_CUSTOM_CLS_ENTRY       DPDMUX_CMD(0x0b6)
53 #define DPDMUX_CMDID_REMOVE_CUSTOM_CLS_ENTRY    DPDMUX_CMD(0x0b7)
54
55 #define DPDMUX_CMDID_IF_SET_DEFAULT             DPDMUX_CMD(0x0b8)
56 #define DPDMUX_CMDID_IF_GET_DEFAULT             DPDMUX_CMD(0x0b9)
57
58 #define DPDMUX_MASK(field)        \
59         GENMASK(DPDMUX_##field##_SHIFT + DPDMUX_##field##_SIZE - 1, \
60                 DPDMUX_##field##_SHIFT)
61 #define dpdmux_set_field(var, field, val) \
62         ((var) |= (((val) << DPDMUX_##field##_SHIFT) & DPDMUX_MASK(field)))
63 #define dpdmux_get_field(var, field)      \
64         (((var) & DPDMUX_MASK(field)) >> DPDMUX_##field##_SHIFT)
65
66 #pragma pack(push, 1)
67 struct dpdmux_cmd_open {
68         uint32_t dpdmux_id;
69 };
70
71 struct dpdmux_cmd_create {
72         uint8_t method;
73         uint8_t manip;
74         uint16_t num_ifs;
75         uint32_t pad;
76
77         uint16_t adv_max_dmat_entries;
78         uint16_t adv_max_mc_groups;
79         uint16_t adv_max_vlan_ids;
80         uint16_t pad1;
81
82         uint64_t options;
83 };
84
85 struct dpdmux_cmd_destroy {
86         uint32_t dpdmux_id;
87 };
88
89 #define DPDMUX_ENABLE_SHIFT     0
90 #define DPDMUX_ENABLE_SIZE      1
91 #define DPDMUX_IS_DEFAULT_SHIFT         1
92 #define DPDMUX_IS_DEFAULT_SIZE          1
93
94 struct dpdmux_rsp_is_enabled {
95         uint8_t en;
96 };
97
98 struct dpdmux_rsp_get_attr {
99         uint8_t method;
100         uint8_t manip;
101         uint16_t num_ifs;
102         uint16_t mem_size;
103         uint16_t pad;
104
105         uint64_t pad1;
106
107         uint32_t id;
108         uint32_t pad2;
109
110         uint64_t options;
111 };
112
113 struct dpdmux_cmd_set_max_frame_length {
114         uint16_t max_frame_length;
115 };
116
117 #define DPDMUX_ACCEPTED_FRAMES_TYPE_SHIFT       0
118 #define DPDMUX_ACCEPTED_FRAMES_TYPE_SIZE        4
119 #define DPDMUX_UNACCEPTED_FRAMES_ACTION_SHIFT   4
120 #define DPDMUX_UNACCEPTED_FRAMES_ACTION_SIZE    4
121
122 struct dpdmux_cmd_if_set_accepted_frames {
123         uint16_t if_id;
124         uint8_t frames_options;
125 };
126
127 struct dpdmux_cmd_if {
128         uint16_t if_id;
129 };
130
131 struct dpdmux_rsp_if_get_attr {
132         uint8_t pad[3];
133         uint8_t enabled;
134         uint8_t pad1[3];
135         uint8_t accepted_frames_type;
136         uint32_t rate;
137 };
138
139 struct dpdmux_cmd_if_l2_rule {
140         uint16_t if_id;
141         uint8_t mac_addr5;
142         uint8_t mac_addr4;
143         uint8_t mac_addr3;
144         uint8_t mac_addr2;
145         uint8_t mac_addr1;
146         uint8_t mac_addr0;
147
148         uint32_t pad;
149         uint16_t vlan_id;
150 };
151
152 struct dpdmux_cmd_if_get_counter {
153         uint16_t if_id;
154         uint8_t counter_type;
155 };
156
157 struct dpdmux_rsp_if_get_counter {
158         uint64_t pad;
159         uint64_t counter;
160 };
161
162 struct dpdmux_cmd_if_set_link_cfg {
163         uint16_t if_id;
164         uint16_t pad[3];
165
166         uint32_t rate;
167         uint32_t pad1;
168
169         uint64_t options;
170         uint64_t advertising;
171 };
172
173 struct dpdmux_cmd_if_get_link_state {
174         uint16_t if_id;
175 };
176
177 #define DPDMUX_UP_SHIFT                         0
178 #define DPDMUX_UP_SIZE                          1
179 #define DPDMUX_STATE_VALID_SHIFT        1
180 #define DPDMUX_STATE_VALID_SIZE         1
181 struct dpdmux_rsp_if_get_link_state {
182         uint32_t pad;
183         uint8_t up;
184         uint8_t pad1[3];
185
186         uint32_t rate;
187         uint32_t pad2;
188
189         uint64_t options;
190         uint64_t supported;
191         uint64_t advertising;
192 };
193
194 struct dpdmux_rsp_get_api_version {
195         uint16_t major;
196         uint16_t minor;
197 };
198
199 struct dpdmux_set_custom_key {
200         uint64_t pad[6];
201         uint64_t key_cfg_iova;
202 };
203
204 struct dpdmux_cmd_add_custom_cls_entry {
205         uint8_t pad[3];
206         uint8_t key_size;
207         uint16_t pad1;
208         uint16_t dest_if;
209         uint64_t key_iova;
210         uint64_t mask_iova;
211 };
212
213 struct dpdmux_cmd_remove_custom_cls_entry {
214         uint8_t pad[3];
215         uint8_t key_size;
216         uint32_t pad1;
217         uint64_t key_iova;
218         uint64_t mask_iova;
219 };
220 #pragma pack(pop)
221 #endif /* _FSL_DPDMUX_CMD_H */