blob: 996a59dcd01db8c8fadc7e638d997368216bc79f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
|
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright 2014-2016 Freescale Semiconductor Inc.
* Copyright 2017-2021 NXP
*
*/
#ifndef __FSL_DPSW_CMD_H
#define __FSL_DPSW_CMD_H
#include "dpsw.h"
/* DPSW Version */
#define DPSW_VER_MAJOR 8
#define DPSW_VER_MINOR 9
#define DPSW_CMD_BASE_VERSION 1
#define DPSW_CMD_VERSION_2 2
#define DPSW_CMD_ID_OFFSET 4
#define DPSW_CMD_ID(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_BASE_VERSION)
#define DPSW_CMD_V2(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_VERSION_2)
/* Command IDs */
#define DPSW_CMDID_CLOSE DPSW_CMD_ID(0x800)
#define DPSW_CMDID_OPEN DPSW_CMD_ID(0x802)
#define DPSW_CMDID_GET_API_VERSION DPSW_CMD_ID(0xa02)
#define DPSW_CMDID_ENABLE DPSW_CMD_ID(0x002)
#define DPSW_CMDID_DISABLE DPSW_CMD_ID(0x003)
#define DPSW_CMDID_GET_ATTR DPSW_CMD_V2(0x004)
#define DPSW_CMDID_RESET DPSW_CMD_ID(0x005)
#define DPSW_CMDID_SET_IRQ_ENABLE DPSW_CMD_ID(0x012)
#define DPSW_CMDID_SET_IRQ_MASK DPSW_CMD_ID(0x014)
#define DPSW_CMDID_GET_IRQ_STATUS DPSW_CMD_ID(0x016)
#define DPSW_CMDID_CLEAR_IRQ_STATUS DPSW_CMD_ID(0x017)
#define DPSW_CMDID_IF_SET_TCI DPSW_CMD_ID(0x030)
#define DPSW_CMDID_IF_SET_STP DPSW_CMD_ID(0x031)
#define DPSW_CMDID_IF_GET_COUNTER DPSW_CMD_V2(0x034)
#define DPSW_CMDID_IF_ENABLE DPSW_CMD_ID(0x03D)
#define DPSW_CMDID_IF_DISABLE DPSW_CMD_ID(0x03E)
#define DPSW_CMDID_IF_GET_ATTR DPSW_CMD_ID(0x042)
#define DPSW_CMDID_IF_SET_MAX_FRAME_LENGTH DPSW_CMD_ID(0x044)
#define DPSW_CMDID_IF_GET_LINK_STATE DPSW_CMD_ID(0x046)
#define DPSW_CMDID_IF_GET_TCI DPSW_CMD_ID(0x04A)
#define DPSW_CMDID_IF_SET_LINK_CFG DPSW_CMD_ID(0x04C)
#define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060)
#define DPSW_CMDID_VLAN_ADD_IF DPSW_CMD_V2(0x061)
#define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062)
#define DPSW_CMDID_VLAN_REMOVE_IF DPSW_CMD_ID(0x064)
#define DPSW_CMDID_VLAN_REMOVE_IF_UNTAGGED DPSW_CMD_ID(0x065)
#define DPSW_CMDID_VLAN_REMOVE_IF_FLOODING DPSW_CMD_ID(0x066)
#define DPSW_CMDID_VLAN_REMOVE DPSW_CMD_ID(0x067)
#define DPSW_CMDID_FDB_ADD DPSW_CMD_ID(0x082)
#define DPSW_CMDID_FDB_REMOVE DPSW_CMD_ID(0x083)
#define DPSW_CMDID_FDB_ADD_UNICAST DPSW_CMD_ID(0x084)
#define DPSW_CMDID_FDB_REMOVE_UNICAST DPSW_CMD_ID(0x085)
#define DPSW_CMDID_FDB_ADD_MULTICAST DPSW_CMD_ID(0x086)
#define DPSW_CMDID_FDB_REMOVE_MULTICAST DPSW_CMD_ID(0x087)
#define DPSW_CMDID_FDB_DUMP DPSW_CMD_ID(0x08A)
#define DPSW_CMDID_IF_GET_PORT_MAC_ADDR DPSW_CMD_ID(0x0A7)
#define DPSW_CMDID_CTRL_IF_GET_ATTR DPSW_CMD_ID(0x0A0)
#define DPSW_CMDID_CTRL_IF_SET_POOLS DPSW_CMD_ID(0x0A1)
#define DPSW_CMDID_CTRL_IF_ENABLE DPSW_CMD_ID(0x0A2)
#define DPSW_CMDID_CTRL_IF_DISABLE DPSW_CMD_ID(0x0A3)
#define DPSW_CMDID_CTRL_IF_SET_QUEUE DPSW_CMD_ID(0x0A6)
#define DPSW_CMDID_SET_EGRESS_FLOOD DPSW_CMD_ID(0x0AC)
/* Macros for accessing command fields smaller than 1byte */
#define DPSW_MASK(field) \
GENMASK(DPSW_##field##_SHIFT + DPSW_##field##_SIZE - 1, \
DPSW_##field##_SHIFT)
#define dpsw_set_field(var, field, val) \
((var) |= (((val) << DPSW_##field##_SHIFT) & DPSW_MASK(field)))
#define dpsw_get_field(var, field) \
(((var) & DPSW_MASK(field)) >> DPSW_##field##_SHIFT)
#define dpsw_get_bit(var, bit) \
(((var) >> (bit)) & GENMASK(0, 0))
#pragma pack(push, 1)
struct dpsw_cmd_open {
__le32 dpsw_id;
};
#define DPSW_COMPONENT_TYPE_SHIFT 0
#define DPSW_COMPONENT_TYPE_SIZE 4
struct dpsw_cmd_create {
/* cmd word 0 */
__le16 num_ifs;
u8 max_fdbs;
u8 max_meters_per_if;
/* from LSB: only the first 4 bits */
u8 component_type;
u8 pad[3];
/* cmd word 1 */
__le16 max_vlans;
__le16 max_fdb_entries;
__le16 fdb_aging_time;
__le16 max_fdb_mc_groups;
/* cmd word 2 */
__le64 options;
};
struct dpsw_cmd_destroy {
__le32 dpsw_id;
};
#define DPSW_ENABLE_SHIFT 0
#define DPSW_ENABLE_SIZE 1
struct dpsw_rsp_is_enabled {
/* from LSB: enable:1 */
u8 enabled;
};
struct dpsw_cmd_set_irq_enable {
u8 enable_state;
u8 pad[3];
u8 irq_index;
};
struct dpsw_cmd_get_irq_enable {
__le32 pad;
u8 irq_index;
};
struct dpsw_rsp_get_irq_enable {
u8 enable_state;
};
struct dpsw_cmd_set_irq_mask {
__le32 mask;
u8 irq_index;
};
struct dpsw_cmd_get_irq_mask {
__le32 pad;
u8 irq_index;
};
struct dpsw_rsp_get_irq_mask {
__le32 mask;
};
struct dpsw_cmd_get_irq_status {
__le32 status;
u8 irq_index;
};
struct dpsw_rsp_get_irq_status {
__le32 status;
};
struct dpsw_cmd_clear_irq_status {
__le32 status;
u8 irq_index;
};
#define DPSW_COMPONENT_TYPE_SHIFT 0
#define DPSW_COMPONENT_TYPE_SIZE 4
#define DPSW_FLOODING_CFG_SHIFT 0
#define DPSW_FLOODING_CFG_SIZE 4
#define DPSW_BROADCAST_CFG_SHIFT 4
#define DPSW_BROADCAST_CFG_SIZE 4
struct dpsw_rsp_get_attr {
/* cmd word 0 */
__le16 num_ifs;
u8 max_fdbs;
u8 num_fdbs;
__le16 max_vlans;
__le16 num_vlans;
/* cmd word 1 */
__le16 max_fdb_entries;
__le16 fdb_aging_time;
__le32 dpsw_id;
/* cmd word 2 */
__le16 mem_size;
__le16 max_fdb_mc_groups;
u8 max_meters_per_if;
/* from LSB only the first 4 bits */
u8 component_type;
/* [0:3] - flooding configuration
* [4:7] - broadcast configuration
*/
u8 repl_cfg;
u8 pad;
/* cmd word 3 */
__le64 options;
};
#define DPSW_VLAN_ID_SHIFT 0
#define DPSW_VLAN_ID_SIZE 12
#define DPSW_DEI_SHIFT 12
#define DPSW_DEI_SIZE 1
#define DPSW_PCP_SHIFT 13
#define DPSW_PCP_SIZE 3
struct dpsw_cmd_if_set_tci {
__le16 if_id;
/* from LSB: VLAN_ID:12 DEI:1 PCP:3 */
__le16 conf;
};
struct dpsw_cmd_if_get_tci {
__le16 if_id;
};
struct dpsw_rsp_if_get_tci {
__le16 pad;
__le16 vlan_id;
u8 dei;
u8 pcp;
};
#define DPSW_STATE_SHIFT 0
#define DPSW_STATE_SIZE 4
struct dpsw_cmd_if_set_stp {
__le16 if_id;
__le16 vlan_id;
/* only the first LSB 4 bits */
u8 state;
};
#define DPSW_COUNTER_TYPE_SHIFT 0
#define DPSW_COUNTER_TYPE_SIZE 5
struct dpsw_cmd_if_get_counter {
__le16 if_id;
/* from LSB: type:5 */
u8 type;
};
struct dpsw_rsp_if_get_counter {
__le64 pad;
__le64 counter;
};
struct dpsw_cmd_if {
__le16 if_id;
};
#define DPSW_ADMIT_UNTAGGED_SHIFT 0
#define DPSW_ADMIT_UNTAGGED_SIZE 4
#define DPSW_ENABLED_SHIFT 5
#define DPSW_ENABLED_SIZE 1
#define DPSW_ACCEPT_ALL_VLAN_SHIFT 6
#define DPSW_ACCEPT_ALL_VLAN_SIZE 1
struct dpsw_rsp_if_get_attr {
/* cmd word 0 */
/* from LSB: admit_untagged:4 enabled:1 accept_all_vlan:1 */
u8 conf;
u8 pad1;
u8 num_tcs;
u8 pad2;
__le16 qdid;
/* cmd word 1 */
__le32 options;
__le32 pad3;
/* cmd word 2 */
__le32 rate;
};
struct dpsw_cmd_if_set_max_frame_length {
__le16 if_id;
__le16 frame_length;
};
struct dpsw_cmd_if_set_link_cfg {
/* cmd word 0 */
__le16 if_id;
u8 pad[6];
/* cmd word 1 */
__le32 rate;
__le32 pad1;
/* cmd word 2 */
__le64 options;
};
struct dpsw_cmd_if_get_link_state {
__le16 if_id;
};
#define DPSW_UP_SHIFT 0
#define DPSW_UP_SIZE 1
struct dpsw_rsp_if_get_link_state {
/* cmd word 0 */
__le32 pad0;
u8 up;
u8 pad1[3];
/* cmd word 1 */
__le32 rate;
__le32 pad2;
/* cmd word 2 */
__le64 options;
};
struct dpsw_vlan_add {
__le16 fdb_id;
__le16 vlan_id;
};
struct dpsw_cmd_vlan_add_if {
/* cmd word 0 */
__le16 options;
__le16 vlan_id;
__le16 fdb_id;
__le16 pad0;
/* cmd word 1-4 */
__le64 if_id;
};
struct dpsw_cmd_vlan_manage_if {
/* cmd word 0 */
__le16 pad0;
__le16 vlan_id;
__le32 pad1;
/* cmd word 1-4 */
__le64 if_id;
};
struct dpsw_cmd_vlan_remove {
__le16 pad;
__le16 vlan_id;
};
struct dpsw_cmd_fdb_add {
__le32 pad;
__le16 fdb_ageing_time;
__le16 num_fdb_entries;
};
struct dpsw_rsp_fdb_add {
__le16 fdb_id;
};
struct dpsw_cmd_fdb_remove {
__le16 fdb_id;
};
#define DPSW_ENTRY_TYPE_SHIFT 0
#define DPSW_ENTRY_TYPE_SIZE 4
struct dpsw_cmd_fdb_unicast_op {
/* cmd word 0 */
__le16 fdb_id;
u8 mac_addr[6];
/* cmd word 1 */
__le16 if_egress;
/* only the first 4 bits from LSB */
u8 type;
};
struct dpsw_cmd_fdb_multicast_op {
/* cmd word 0 */
__le16 fdb_id;
__le16 num_ifs;
/* only the first 4 bits from LSB */
u8 type;
u8 pad[3];
/* cmd word 1 */
u8 mac_addr[6];
__le16 pad2;
/* cmd word 2-5 */
__le64 if_id;
};
struct dpsw_cmd_fdb_dump {
__le16 fdb_id;
__le16 pad0;
__le32 pad1;
__le64 iova_addr;
__le32 iova_size;
};
struct dpsw_rsp_fdb_dump {
__le16 num_entries;
};
struct dpsw_rsp_ctrl_if_get_attr {
__le64 pad;
__le32 rx_fqid;
__le32 rx_err_fqid;
__le32 tx_err_conf_fqid;
};
#define DPSW_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
struct dpsw_cmd_ctrl_if_set_pools {
u8 num_dpbp;
u8 backup_pool_mask;
__le16 pad;
__le32 dpbp_id[DPSW_MAX_DPBP];
__le16 buffer_size[DPSW_MAX_DPBP];
};
#define DPSW_DEST_TYPE_SHIFT 0
#define DPSW_DEST_TYPE_SIZE 4
struct dpsw_cmd_ctrl_if_set_queue {
__le32 dest_id;
u8 dest_priority;
u8 pad;
/* from LSB: dest_type:4 */
u8 dest_type;
u8 qtype;
__le64 user_ctx;
__le32 options;
};
struct dpsw_rsp_get_api_version {
__le16 version_major;
__le16 version_minor;
};
struct dpsw_rsp_if_get_mac_addr {
__le16 pad;
u8 mac_addr[6];
};
struct dpsw_cmd_set_egress_flood {
__le16 fdb_id;
u8 flood_type;
u8 pad[5];
__le64 if_id;
};
#pragma pack(pop)
#endif /* __FSL_DPSW_CMD_H */
|