0001
0002
0003
0004
0005
0006 #ifndef _FSL_DPNI_CMD_H
0007 #define _FSL_DPNI_CMD_H
0008
0009 #include "dpni.h"
0010
0011
0012 #define DPNI_VER_MAJOR 7
0013 #define DPNI_VER_MINOR 0
0014 #define DPNI_CMD_BASE_VERSION 1
0015 #define DPNI_CMD_2ND_VERSION 2
0016 #define DPNI_CMD_ID_OFFSET 4
0017
0018 #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION)
0019 #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION)
0020
0021 #define DPNI_CMDID_OPEN DPNI_CMD(0x801)
0022 #define DPNI_CMDID_CLOSE DPNI_CMD(0x800)
0023 #define DPNI_CMDID_CREATE DPNI_CMD(0x901)
0024 #define DPNI_CMDID_DESTROY DPNI_CMD(0x900)
0025 #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01)
0026
0027 #define DPNI_CMDID_ENABLE DPNI_CMD(0x002)
0028 #define DPNI_CMDID_DISABLE DPNI_CMD(0x003)
0029 #define DPNI_CMDID_GET_ATTR DPNI_CMD(0x004)
0030 #define DPNI_CMDID_RESET DPNI_CMD(0x005)
0031 #define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006)
0032
0033 #define DPNI_CMDID_SET_IRQ DPNI_CMD(0x010)
0034 #define DPNI_CMDID_GET_IRQ DPNI_CMD(0x011)
0035 #define DPNI_CMDID_SET_IRQ_ENABLE DPNI_CMD(0x012)
0036 #define DPNI_CMDID_GET_IRQ_ENABLE DPNI_CMD(0x013)
0037 #define DPNI_CMDID_SET_IRQ_MASK DPNI_CMD(0x014)
0038 #define DPNI_CMDID_GET_IRQ_MASK DPNI_CMD(0x015)
0039 #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016)
0040 #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017)
0041
0042 #define DPNI_CMDID_SET_POOLS DPNI_CMD(0x200)
0043 #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B)
0044
0045 #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210)
0046 #define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212)
0047 #define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215)
0048 #define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216)
0049 #define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217)
0050 #define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A)
0051 #define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B)
0052
0053 #define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220)
0054 #define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221)
0055 #define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222)
0056 #define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223)
0057 #define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224)
0058 #define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225)
0059 #define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226)
0060 #define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227)
0061 #define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228)
0062
0063 #define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD(0x235)
0064
0065 #define DPNI_CMDID_ENABLE_VLAN_FILTER DPNI_CMD(0x230)
0066 #define DPNI_CMDID_ADD_VLAN_ID DPNI_CMD_V2(0x231)
0067 #define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232)
0068
0069 #define DPNI_CMDID_SET_QOS_TBL DPNI_CMD(0x240)
0070 #define DPNI_CMDID_ADD_QOS_ENT DPNI_CMD(0x241)
0071 #define DPNI_CMDID_REMOVE_QOS_ENT DPNI_CMD(0x242)
0072 #define DPNI_CMDID_CLR_QOS_TBL DPNI_CMD(0x243)
0073 #define DPNI_CMDID_ADD_FS_ENT DPNI_CMD(0x244)
0074 #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245)
0075 #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246)
0076
0077 #define DPNI_CMDID_GET_STATISTICS DPNI_CMD(0x25D)
0078 #define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F)
0079 #define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260)
0080 #define DPNI_CMDID_GET_TAILDROP DPNI_CMD(0x261)
0081 #define DPNI_CMDID_SET_TAILDROP DPNI_CMD(0x262)
0082
0083 #define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263)
0084
0085 #define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264)
0086 #define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265)
0087
0088 #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266)
0089 #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267)
0090 #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268)
0091 #define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD(0x269)
0092 #define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD(0x26A)
0093 #define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B)
0094 #define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C)
0095
0096 #define DPNI_CMDID_SET_RX_FS_DIST DPNI_CMD(0x273)
0097 #define DPNI_CMDID_SET_RX_HASH_DIST DPNI_CMD(0x274)
0098 #define DPNI_CMDID_GET_LINK_CFG DPNI_CMD(0x278)
0099
0100 #define DPNI_CMDID_SET_SINGLE_STEP_CFG DPNI_CMD(0x279)
0101 #define DPNI_CMDID_GET_SINGLE_STEP_CFG DPNI_CMD_V2(0x27a)
0102
0103
0104 #define DPNI_MASK(field) \
0105 GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \
0106 DPNI_##field##_SHIFT)
0107
0108 #define dpni_set_field(var, field, val) \
0109 ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field)))
0110 #define dpni_get_field(var, field) \
0111 (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT)
0112
0113 struct dpni_cmd_open {
0114 __le32 dpni_id;
0115 };
0116
0117 #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order))
0118 struct dpni_cmd_set_pools {
0119
0120 u8 num_dpbp;
0121 u8 backup_pool_mask;
0122 __le16 pad;
0123
0124 __le32 dpbp_id[DPNI_MAX_DPBP];
0125
0126 __le16 buffer_size[DPNI_MAX_DPBP];
0127 };
0128
0129
0130 #define DPNI_ENABLE_SHIFT 0
0131 #define DPNI_ENABLE_SIZE 1
0132
0133 struct dpni_rsp_is_enabled {
0134 u8 enabled;
0135 };
0136
0137 struct dpni_rsp_get_irq {
0138
0139 __le32 irq_val;
0140 __le32 pad;
0141
0142 __le64 irq_addr;
0143
0144 __le32 irq_num;
0145 __le32 type;
0146 };
0147
0148 struct dpni_cmd_set_irq_enable {
0149 u8 enable;
0150 u8 pad[3];
0151 u8 irq_index;
0152 };
0153
0154 struct dpni_cmd_get_irq_enable {
0155 __le32 pad;
0156 u8 irq_index;
0157 };
0158
0159 struct dpni_rsp_get_irq_enable {
0160 u8 enabled;
0161 };
0162
0163 struct dpni_cmd_set_irq_mask {
0164 __le32 mask;
0165 u8 irq_index;
0166 };
0167
0168 struct dpni_cmd_get_irq_mask {
0169 __le32 pad;
0170 u8 irq_index;
0171 };
0172
0173 struct dpni_rsp_get_irq_mask {
0174 __le32 mask;
0175 };
0176
0177 struct dpni_cmd_get_irq_status {
0178 __le32 status;
0179 u8 irq_index;
0180 };
0181
0182 struct dpni_rsp_get_irq_status {
0183 __le32 status;
0184 };
0185
0186 struct dpni_cmd_clear_irq_status {
0187 __le32 status;
0188 u8 irq_index;
0189 };
0190
0191 struct dpni_rsp_get_attr {
0192
0193 __le32 options;
0194 u8 num_queues;
0195 u8 num_tcs;
0196 u8 mac_filter_entries;
0197 u8 pad0;
0198
0199 u8 vlan_filter_entries;
0200 u8 pad1;
0201 u8 qos_entries;
0202 u8 pad2;
0203 __le16 fs_entries;
0204 __le16 pad3;
0205
0206 u8 qos_key_size;
0207 u8 fs_key_size;
0208 __le16 wriop_version;
0209 };
0210
0211 #define DPNI_ERROR_ACTION_SHIFT 0
0212 #define DPNI_ERROR_ACTION_SIZE 4
0213 #define DPNI_FRAME_ANN_SHIFT 4
0214 #define DPNI_FRAME_ANN_SIZE 1
0215
0216 struct dpni_cmd_set_errors_behavior {
0217 __le32 errors;
0218
0219 u8 flags;
0220 };
0221
0222
0223
0224
0225
0226
0227 #define DPNI_PASS_TS_SHIFT 0
0228 #define DPNI_PASS_TS_SIZE 1
0229 #define DPNI_PASS_PR_SHIFT 1
0230 #define DPNI_PASS_PR_SIZE 1
0231 #define DPNI_PASS_FS_SHIFT 2
0232 #define DPNI_PASS_FS_SIZE 1
0233
0234 struct dpni_cmd_get_buffer_layout {
0235 u8 qtype;
0236 };
0237
0238 struct dpni_rsp_get_buffer_layout {
0239
0240 u8 pad0[6];
0241
0242 u8 flags;
0243 u8 pad1;
0244
0245 __le16 private_data_size;
0246 __le16 data_align;
0247 __le16 head_room;
0248 __le16 tail_room;
0249 };
0250
0251 struct dpni_cmd_set_buffer_layout {
0252
0253 u8 qtype;
0254 u8 pad0[3];
0255 __le16 options;
0256
0257 u8 flags;
0258 u8 pad1;
0259
0260 __le16 private_data_size;
0261 __le16 data_align;
0262 __le16 head_room;
0263 __le16 tail_room;
0264 };
0265
0266 struct dpni_cmd_set_offload {
0267 u8 pad[3];
0268 u8 dpni_offload;
0269 __le32 config;
0270 };
0271
0272 struct dpni_cmd_get_offload {
0273 u8 pad[3];
0274 u8 dpni_offload;
0275 };
0276
0277 struct dpni_rsp_get_offload {
0278 __le32 pad;
0279 __le32 config;
0280 };
0281
0282 struct dpni_cmd_get_qdid {
0283 u8 qtype;
0284 };
0285
0286 struct dpni_rsp_get_qdid {
0287 __le16 qdid;
0288 };
0289
0290 struct dpni_rsp_get_tx_data_offset {
0291 __le16 data_offset;
0292 };
0293
0294 struct dpni_cmd_get_statistics {
0295 u8 page_number;
0296 };
0297
0298 struct dpni_rsp_get_statistics {
0299 __le64 counter[DPNI_STATISTICS_CNT];
0300 };
0301
0302 struct dpni_cmd_link_cfg {
0303
0304 __le64 pad0;
0305
0306 __le32 rate;
0307 __le32 pad1;
0308
0309 __le64 options;
0310 };
0311
0312 #define DPNI_LINK_STATE_SHIFT 0
0313 #define DPNI_LINK_STATE_SIZE 1
0314
0315 struct dpni_rsp_get_link_state {
0316
0317 __le32 pad0;
0318
0319 u8 flags;
0320 u8 pad1[3];
0321
0322 __le32 rate;
0323 __le32 pad2;
0324
0325 __le64 options;
0326 };
0327
0328 struct dpni_cmd_set_max_frame_length {
0329 __le16 max_frame_length;
0330 };
0331
0332 struct dpni_rsp_get_max_frame_length {
0333 __le16 max_frame_length;
0334 };
0335
0336 struct dpni_cmd_set_multicast_promisc {
0337 u8 enable;
0338 };
0339
0340 struct dpni_rsp_get_multicast_promisc {
0341 u8 enabled;
0342 };
0343
0344 struct dpni_cmd_set_unicast_promisc {
0345 u8 enable;
0346 };
0347
0348 struct dpni_rsp_get_unicast_promisc {
0349 u8 enabled;
0350 };
0351
0352 struct dpni_cmd_set_primary_mac_addr {
0353 __le16 pad;
0354 u8 mac_addr[6];
0355 };
0356
0357 struct dpni_rsp_get_primary_mac_addr {
0358 __le16 pad;
0359 u8 mac_addr[6];
0360 };
0361
0362 struct dpni_rsp_get_port_mac_addr {
0363 __le16 pad;
0364 u8 mac_addr[6];
0365 };
0366
0367 struct dpni_cmd_add_mac_addr {
0368 __le16 pad;
0369 u8 mac_addr[6];
0370 };
0371
0372 struct dpni_cmd_remove_mac_addr {
0373 __le16 pad;
0374 u8 mac_addr[6];
0375 };
0376
0377 #define DPNI_UNICAST_FILTERS_SHIFT 0
0378 #define DPNI_UNICAST_FILTERS_SIZE 1
0379 #define DPNI_MULTICAST_FILTERS_SHIFT 1
0380 #define DPNI_MULTICAST_FILTERS_SIZE 1
0381
0382 struct dpni_cmd_clear_mac_filters {
0383
0384 u8 flags;
0385 };
0386
0387 #define DPNI_DIST_MODE_SHIFT 0
0388 #define DPNI_DIST_MODE_SIZE 4
0389 #define DPNI_MISS_ACTION_SHIFT 4
0390 #define DPNI_MISS_ACTION_SIZE 4
0391
0392 struct dpni_cmd_set_rx_tc_dist {
0393
0394 __le16 dist_size;
0395 u8 tc_id;
0396
0397 u8 flags;
0398 __le16 pad0;
0399 __le16 default_flow_id;
0400
0401 __le64 pad1[5];
0402
0403 __le64 key_cfg_iova;
0404 };
0405
0406
0407
0408
0409 struct dpni_mask_cfg {
0410 u8 mask;
0411 u8 offset;
0412 };
0413
0414 #define DPNI_EFH_TYPE_SHIFT 0
0415 #define DPNI_EFH_TYPE_SIZE 4
0416 #define DPNI_EXTRACT_TYPE_SHIFT 0
0417 #define DPNI_EXTRACT_TYPE_SIZE 4
0418
0419 struct dpni_dist_extract {
0420
0421 u8 prot;
0422
0423 u8 efh_type;
0424 u8 size;
0425 u8 offset;
0426 __le32 field;
0427
0428 u8 hdr_index;
0429 u8 constant;
0430 u8 num_of_repeats;
0431 u8 num_of_byte_masks;
0432
0433 u8 extract_type;
0434 u8 pad[3];
0435
0436 struct dpni_mask_cfg masks[4];
0437 };
0438
0439 struct dpni_ext_set_rx_tc_dist {
0440
0441 u8 num_extracts;
0442 u8 pad[7];
0443
0444 struct dpni_dist_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS];
0445 };
0446
0447 struct dpni_cmd_get_queue {
0448 u8 qtype;
0449 u8 tc;
0450 u8 index;
0451 };
0452
0453 #define DPNI_DEST_TYPE_SHIFT 0
0454 #define DPNI_DEST_TYPE_SIZE 4
0455 #define DPNI_STASH_CTRL_SHIFT 6
0456 #define DPNI_STASH_CTRL_SIZE 1
0457 #define DPNI_HOLD_ACTIVE_SHIFT 7
0458 #define DPNI_HOLD_ACTIVE_SIZE 1
0459
0460 struct dpni_rsp_get_queue {
0461
0462 __le64 pad0;
0463
0464 __le32 dest_id;
0465 __le16 pad1;
0466 u8 dest_prio;
0467
0468 u8 flags;
0469
0470 __le64 flc;
0471
0472 __le64 user_context;
0473
0474 __le32 fqid;
0475 __le16 qdbin;
0476 };
0477
0478 struct dpni_cmd_set_queue {
0479
0480 u8 qtype;
0481 u8 tc;
0482 u8 index;
0483 u8 options;
0484 __le32 pad0;
0485
0486 __le32 dest_id;
0487 __le16 pad1;
0488 u8 dest_prio;
0489 u8 flags;
0490
0491 __le64 flc;
0492
0493 __le64 user_context;
0494 };
0495
0496 struct dpni_cmd_set_taildrop {
0497
0498 u8 congestion_point;
0499 u8 qtype;
0500 u8 tc;
0501 u8 index;
0502 __le32 pad0;
0503
0504
0505 u8 enable;
0506 u8 pad1;
0507 u8 units;
0508 u8 pad2;
0509 __le32 threshold;
0510 };
0511
0512 struct dpni_cmd_get_taildrop {
0513 u8 congestion_point;
0514 u8 qtype;
0515 u8 tc;
0516 u8 index;
0517 };
0518
0519 struct dpni_rsp_get_taildrop {
0520
0521 __le64 pad0;
0522
0523
0524 u8 enable;
0525 u8 pad1;
0526 u8 units;
0527 u8 pad2;
0528 __le32 threshold;
0529 };
0530
0531 struct dpni_rsp_get_api_version {
0532 __le16 major;
0533 __le16 minor;
0534 };
0535
0536 #define DPNI_RX_FS_DIST_ENABLE_SHIFT 0
0537 #define DPNI_RX_FS_DIST_ENABLE_SIZE 1
0538 struct dpni_cmd_set_rx_fs_dist {
0539 __le16 dist_size;
0540 u8 enable;
0541 u8 tc;
0542 __le16 miss_flow_id;
0543 __le16 pad;
0544 __le64 key_cfg_iova;
0545 };
0546
0547 #define DPNI_RX_HASH_DIST_ENABLE_SHIFT 0
0548 #define DPNI_RX_HASH_DIST_ENABLE_SIZE 1
0549 struct dpni_cmd_set_rx_hash_dist {
0550 __le16 dist_size;
0551 u8 enable;
0552 u8 tc;
0553 __le32 pad;
0554 __le64 key_cfg_iova;
0555 };
0556
0557 struct dpni_cmd_add_fs_entry {
0558
0559 __le16 options;
0560 u8 tc_id;
0561 u8 key_size;
0562 __le16 index;
0563 __le16 flow_id;
0564
0565 __le64 key_iova;
0566
0567 __le64 mask_iova;
0568
0569 __le64 flc;
0570 };
0571
0572 struct dpni_cmd_remove_fs_entry {
0573
0574 __le16 pad0;
0575 u8 tc_id;
0576 u8 key_size;
0577 __le32 pad1;
0578
0579 __le64 key_iova;
0580
0581 __le64 mask_iova;
0582 };
0583
0584 #define DPNI_DISCARD_ON_MISS_SHIFT 0
0585 #define DPNI_DISCARD_ON_MISS_SIZE 1
0586
0587 struct dpni_cmd_set_qos_table {
0588 __le32 pad;
0589 u8 default_tc;
0590
0591 u8 discard_on_miss;
0592 __le16 pad1[21];
0593 __le64 key_cfg_iova;
0594 };
0595
0596 struct dpni_cmd_add_qos_entry {
0597 __le16 pad;
0598 u8 tc_id;
0599 u8 key_size;
0600 __le16 index;
0601 __le16 pad1;
0602 __le64 key_iova;
0603 __le64 mask_iova;
0604 };
0605
0606 struct dpni_cmd_remove_qos_entry {
0607 u8 pad[3];
0608 u8 key_size;
0609 __le32 pad1;
0610 __le64 key_iova;
0611 __le64 mask_iova;
0612 };
0613
0614 #define DPNI_DEST_TYPE_SHIFT 0
0615 #define DPNI_DEST_TYPE_SIZE 4
0616 #define DPNI_CONG_UNITS_SHIFT 4
0617 #define DPNI_CONG_UNITS_SIZE 2
0618
0619 struct dpni_cmd_set_congestion_notification {
0620
0621 u8 qtype;
0622 u8 tc;
0623 u8 pad[6];
0624
0625 __le32 dest_id;
0626 __le16 notification_mode;
0627 u8 dest_priority;
0628
0629 u8 type_units;
0630
0631 __le64 message_iova;
0632
0633 __le64 message_ctx;
0634
0635 __le32 threshold_entry;
0636 __le32 threshold_exit;
0637 };
0638
0639 #define DPNI_COUPLED_SHIFT 0
0640 #define DPNI_COUPLED_SIZE 1
0641
0642 struct dpni_cmd_set_tx_shaping {
0643 __le16 tx_cr_max_burst_size;
0644 __le16 tx_er_max_burst_size;
0645 __le32 pad;
0646 __le32 tx_cr_rate_limit;
0647 __le32 tx_er_rate_limit;
0648
0649 u8 coupled;
0650 };
0651
0652 #define DPNI_PTP_ENABLE_SHIFT 0
0653 #define DPNI_PTP_ENABLE_SIZE 1
0654 #define DPNI_PTP_CH_UPDATE_SHIFT 1
0655 #define DPNI_PTP_CH_UPDATE_SIZE 1
0656
0657 struct dpni_cmd_single_step_cfg {
0658 __le16 flags;
0659 __le16 offset;
0660 __le32 peer_delay;
0661 __le32 ptp_onestep_reg_base;
0662 __le32 pad0;
0663 };
0664
0665 struct dpni_rsp_single_step_cfg {
0666 __le16 flags;
0667 __le16 offset;
0668 __le32 peer_delay;
0669 __le32 ptp_onestep_reg_base;
0670 __le32 pad0;
0671 };
0672
0673 struct dpni_cmd_enable_vlan_filter {
0674
0675 u8 en;
0676 };
0677
0678 struct dpni_cmd_vlan_id {
0679 u8 flags;
0680 u8 tc_id;
0681 u8 flow_id;
0682 u8 pad;
0683 __le16 vlan_id;
0684 };
0685
0686 #endif