134ff6846SIoana Radulescu /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 234ff6846SIoana Radulescu /* Copyright 2013-2016 Freescale Semiconductor Inc. 334ff6846SIoana Radulescu * Copyright 2016 NXP 423cd4f27SYangbo Lu * Copyright 2020 NXP 534ff6846SIoana Radulescu */ 634ff6846SIoana Radulescu #ifndef _FSL_DPNI_CMD_H 734ff6846SIoana Radulescu #define _FSL_DPNI_CMD_H 834ff6846SIoana Radulescu 934ff6846SIoana Radulescu #include "dpni.h" 1034ff6846SIoana Radulescu 1134ff6846SIoana Radulescu /* DPNI Version */ 1234ff6846SIoana Radulescu #define DPNI_VER_MAJOR 7 1334ff6846SIoana Radulescu #define DPNI_VER_MINOR 0 1434ff6846SIoana Radulescu #define DPNI_CMD_BASE_VERSION 1 1572e27c38SIoana Ciornei #define DPNI_CMD_2ND_VERSION 2 16*801c76ddSRobert-Ionut Alexa #define DPNI_CMD_3RD_VERSION 3 1734ff6846SIoana Radulescu #define DPNI_CMD_ID_OFFSET 4 1834ff6846SIoana Radulescu 1934ff6846SIoana Radulescu #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) 2072e27c38SIoana Ciornei #define DPNI_CMD_V2(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_2ND_VERSION) 21*801c76ddSRobert-Ionut Alexa #define DPNI_CMD_V3(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_3RD_VERSION) 2234ff6846SIoana Radulescu 2334ff6846SIoana Radulescu #define DPNI_CMDID_OPEN DPNI_CMD(0x801) 2434ff6846SIoana Radulescu #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) 2534ff6846SIoana Radulescu #define DPNI_CMDID_CREATE DPNI_CMD(0x901) 2634ff6846SIoana Radulescu #define DPNI_CMDID_DESTROY DPNI_CMD(0x900) 2734ff6846SIoana Radulescu #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01) 2834ff6846SIoana Radulescu 2934ff6846SIoana Radulescu #define DPNI_CMDID_ENABLE DPNI_CMD(0x002) 3034ff6846SIoana Radulescu #define DPNI_CMDID_DISABLE DPNI_CMD(0x003) 3134ff6846SIoana Radulescu #define DPNI_CMDID_GET_ATTR DPNI_CMD(0x004) 3234ff6846SIoana Radulescu #define DPNI_CMDID_RESET DPNI_CMD(0x005) 3334ff6846SIoana Radulescu #define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006) 3434ff6846SIoana Radulescu 3534ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ DPNI_CMD(0x010) 3634ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ DPNI_CMD(0x011) 3734ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ_ENABLE DPNI_CMD(0x012) 3834ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_ENABLE DPNI_CMD(0x013) 3934ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ_MASK DPNI_CMD(0x014) 4034ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_MASK DPNI_CMD(0x015) 4134ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016) 4234ff6846SIoana Radulescu #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017) 4334ff6846SIoana Radulescu 44*801c76ddSRobert-Ionut Alexa #define DPNI_CMDID_SET_POOLS DPNI_CMD_V3(0x200) 4534ff6846SIoana Radulescu #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B) 4634ff6846SIoana Radulescu 4734ff6846SIoana Radulescu #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210) 4834ff6846SIoana Radulescu #define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212) 4934ff6846SIoana Radulescu #define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215) 5034ff6846SIoana Radulescu #define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216) 5134ff6846SIoana Radulescu #define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217) 5234ff6846SIoana Radulescu #define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A) 5372e27c38SIoana Ciornei #define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD_V2(0x21B) 5434ff6846SIoana Radulescu 5534ff6846SIoana Radulescu #define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220) 5634ff6846SIoana Radulescu #define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221) 5734ff6846SIoana Radulescu #define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222) 5834ff6846SIoana Radulescu #define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223) 5934ff6846SIoana Radulescu #define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224) 6034ff6846SIoana Radulescu #define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225) 6134ff6846SIoana Radulescu #define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226) 6234ff6846SIoana Radulescu #define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227) 6334ff6846SIoana Radulescu #define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228) 6434ff6846SIoana Radulescu 6534ff6846SIoana Radulescu #define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD(0x235) 6634ff6846SIoana Radulescu 6770b32d82SIonut-robert Aron #define DPNI_CMDID_ENABLE_VLAN_FILTER DPNI_CMD(0x230) 6870b32d82SIonut-robert Aron #define DPNI_CMDID_ADD_VLAN_ID DPNI_CMD_V2(0x231) 6970b32d82SIonut-robert Aron #define DPNI_CMDID_REMOVE_VLAN_ID DPNI_CMD(0x232) 7070b32d82SIonut-robert Aron 716aa90fe2SIoana Radulescu #define DPNI_CMDID_SET_QOS_TBL DPNI_CMD(0x240) 726aa90fe2SIoana Radulescu #define DPNI_CMDID_ADD_QOS_ENT DPNI_CMD(0x241) 736aa90fe2SIoana Radulescu #define DPNI_CMDID_REMOVE_QOS_ENT DPNI_CMD(0x242) 746aa90fe2SIoana Radulescu #define DPNI_CMDID_CLR_QOS_TBL DPNI_CMD(0x243) 7534ff6846SIoana Radulescu #define DPNI_CMDID_ADD_FS_ENT DPNI_CMD(0x244) 7634ff6846SIoana Radulescu #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245) 7734ff6846SIoana Radulescu #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246) 7834ff6846SIoana Radulescu 7934ff6846SIoana Radulescu #define DPNI_CMDID_GET_STATISTICS DPNI_CMD(0x25D) 8034ff6846SIoana Radulescu #define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F) 8134ff6846SIoana Radulescu #define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260) 8234ff6846SIoana Radulescu #define DPNI_CMDID_GET_TAILDROP DPNI_CMD(0x261) 8334ff6846SIoana Radulescu #define DPNI_CMDID_SET_TAILDROP DPNI_CMD(0x262) 8434ff6846SIoana Radulescu 8534ff6846SIoana Radulescu #define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263) 8634ff6846SIoana Radulescu 8734ff6846SIoana Radulescu #define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264) 8834ff6846SIoana Radulescu #define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265) 8934ff6846SIoana Radulescu 9034ff6846SIoana Radulescu #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266) 9134ff6846SIoana Radulescu #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267) 9234ff6846SIoana Radulescu #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268) 9334ff6846SIoana Radulescu #define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD(0x269) 9434ff6846SIoana Radulescu #define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD(0x26A) 9534ff6846SIoana Radulescu #define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B) 9634ff6846SIoana Radulescu #define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C) 9734ff6846SIoana Radulescu 984aaaf9b9SIoana Radulescu #define DPNI_CMDID_SET_RX_FS_DIST DPNI_CMD(0x273) 99df85aeb9SIoana Radulescu #define DPNI_CMDID_SET_RX_HASH_DIST DPNI_CMD(0x274) 1008eb3cef8SIoana Radulescu #define DPNI_CMDID_GET_LINK_CFG DPNI_CMD(0x278) 101df85aeb9SIoana Radulescu 10223cd4f27SYangbo Lu #define DPNI_CMDID_SET_SINGLE_STEP_CFG DPNI_CMD(0x279) 1039572594eSRadu Bulie #define DPNI_CMDID_GET_SINGLE_STEP_CFG DPNI_CMD_V2(0x27a) 10423cd4f27SYangbo Lu 10534ff6846SIoana Radulescu /* Macros for accessing command fields smaller than 1byte */ 10634ff6846SIoana Radulescu #define DPNI_MASK(field) \ 10734ff6846SIoana Radulescu GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \ 10834ff6846SIoana Radulescu DPNI_##field##_SHIFT) 10934ff6846SIoana Radulescu 11034ff6846SIoana Radulescu #define dpni_set_field(var, field, val) \ 11134ff6846SIoana Radulescu ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field))) 11234ff6846SIoana Radulescu #define dpni_get_field(var, field) \ 11334ff6846SIoana Radulescu (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT) 11434ff6846SIoana Radulescu 11534ff6846SIoana Radulescu struct dpni_cmd_open { 11634ff6846SIoana Radulescu __le32 dpni_id; 11734ff6846SIoana Radulescu }; 11834ff6846SIoana Radulescu 11934ff6846SIoana Radulescu #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order)) 120*801c76ddSRobert-Ionut Alexa 121*801c76ddSRobert-Ionut Alexa struct dpni_cmd_pool { 122*801c76ddSRobert-Ionut Alexa __le16 dpbp_id; 123*801c76ddSRobert-Ionut Alexa u8 priority_mask; 124*801c76ddSRobert-Ionut Alexa u8 pad; 125*801c76ddSRobert-Ionut Alexa }; 126*801c76ddSRobert-Ionut Alexa 12734ff6846SIoana Radulescu struct dpni_cmd_set_pools { 12834ff6846SIoana Radulescu u8 num_dpbp; 12934ff6846SIoana Radulescu u8 backup_pool_mask; 130*801c76ddSRobert-Ionut Alexa u8 pad; 131*801c76ddSRobert-Ionut Alexa u8 pool_options; 132*801c76ddSRobert-Ionut Alexa struct dpni_cmd_pool pool[DPNI_MAX_DPBP]; 13334ff6846SIoana Radulescu __le16 buffer_size[DPNI_MAX_DPBP]; 13434ff6846SIoana Radulescu }; 13534ff6846SIoana Radulescu 13634ff6846SIoana Radulescu /* The enable indication is always the least significant bit */ 13734ff6846SIoana Radulescu #define DPNI_ENABLE_SHIFT 0 13834ff6846SIoana Radulescu #define DPNI_ENABLE_SIZE 1 13934ff6846SIoana Radulescu 14034ff6846SIoana Radulescu struct dpni_rsp_is_enabled { 14134ff6846SIoana Radulescu u8 enabled; 14234ff6846SIoana Radulescu }; 14334ff6846SIoana Radulescu 14434ff6846SIoana Radulescu struct dpni_rsp_get_irq { 14534ff6846SIoana Radulescu /* response word 0 */ 14634ff6846SIoana Radulescu __le32 irq_val; 14734ff6846SIoana Radulescu __le32 pad; 14834ff6846SIoana Radulescu /* response word 1 */ 14934ff6846SIoana Radulescu __le64 irq_addr; 15034ff6846SIoana Radulescu /* response word 2 */ 15134ff6846SIoana Radulescu __le32 irq_num; 15234ff6846SIoana Radulescu __le32 type; 15334ff6846SIoana Radulescu }; 15434ff6846SIoana Radulescu 15534ff6846SIoana Radulescu struct dpni_cmd_set_irq_enable { 15634ff6846SIoana Radulescu u8 enable; 15734ff6846SIoana Radulescu u8 pad[3]; 15834ff6846SIoana Radulescu u8 irq_index; 15934ff6846SIoana Radulescu }; 16034ff6846SIoana Radulescu 16134ff6846SIoana Radulescu struct dpni_cmd_get_irq_enable { 16234ff6846SIoana Radulescu __le32 pad; 16334ff6846SIoana Radulescu u8 irq_index; 16434ff6846SIoana Radulescu }; 16534ff6846SIoana Radulescu 16634ff6846SIoana Radulescu struct dpni_rsp_get_irq_enable { 16734ff6846SIoana Radulescu u8 enabled; 16834ff6846SIoana Radulescu }; 16934ff6846SIoana Radulescu 17034ff6846SIoana Radulescu struct dpni_cmd_set_irq_mask { 17134ff6846SIoana Radulescu __le32 mask; 17234ff6846SIoana Radulescu u8 irq_index; 17334ff6846SIoana Radulescu }; 17434ff6846SIoana Radulescu 17534ff6846SIoana Radulescu struct dpni_cmd_get_irq_mask { 17634ff6846SIoana Radulescu __le32 pad; 17734ff6846SIoana Radulescu u8 irq_index; 17834ff6846SIoana Radulescu }; 17934ff6846SIoana Radulescu 18034ff6846SIoana Radulescu struct dpni_rsp_get_irq_mask { 18134ff6846SIoana Radulescu __le32 mask; 18234ff6846SIoana Radulescu }; 18334ff6846SIoana Radulescu 18434ff6846SIoana Radulescu struct dpni_cmd_get_irq_status { 18534ff6846SIoana Radulescu __le32 status; 18634ff6846SIoana Radulescu u8 irq_index; 18734ff6846SIoana Radulescu }; 18834ff6846SIoana Radulescu 18934ff6846SIoana Radulescu struct dpni_rsp_get_irq_status { 19034ff6846SIoana Radulescu __le32 status; 19134ff6846SIoana Radulescu }; 19234ff6846SIoana Radulescu 19334ff6846SIoana Radulescu struct dpni_cmd_clear_irq_status { 19434ff6846SIoana Radulescu __le32 status; 19534ff6846SIoana Radulescu u8 irq_index; 19634ff6846SIoana Radulescu }; 19734ff6846SIoana Radulescu 19834ff6846SIoana Radulescu struct dpni_rsp_get_attr { 19934ff6846SIoana Radulescu /* response word 0 */ 20034ff6846SIoana Radulescu __le32 options; 20134ff6846SIoana Radulescu u8 num_queues; 20234ff6846SIoana Radulescu u8 num_tcs; 20334ff6846SIoana Radulescu u8 mac_filter_entries; 20434ff6846SIoana Radulescu u8 pad0; 20534ff6846SIoana Radulescu /* response word 1 */ 20634ff6846SIoana Radulescu u8 vlan_filter_entries; 20734ff6846SIoana Radulescu u8 pad1; 20834ff6846SIoana Radulescu u8 qos_entries; 20934ff6846SIoana Radulescu u8 pad2; 21034ff6846SIoana Radulescu __le16 fs_entries; 21134ff6846SIoana Radulescu __le16 pad3; 21234ff6846SIoana Radulescu /* response word 2 */ 21334ff6846SIoana Radulescu u8 qos_key_size; 21434ff6846SIoana Radulescu u8 fs_key_size; 21534ff6846SIoana Radulescu __le16 wriop_version; 21634ff6846SIoana Radulescu }; 21734ff6846SIoana Radulescu 21834ff6846SIoana Radulescu #define DPNI_ERROR_ACTION_SHIFT 0 21934ff6846SIoana Radulescu #define DPNI_ERROR_ACTION_SIZE 4 22034ff6846SIoana Radulescu #define DPNI_FRAME_ANN_SHIFT 4 22134ff6846SIoana Radulescu #define DPNI_FRAME_ANN_SIZE 1 22234ff6846SIoana Radulescu 22334ff6846SIoana Radulescu struct dpni_cmd_set_errors_behavior { 22434ff6846SIoana Radulescu __le32 errors; 22534ff6846SIoana Radulescu /* from least significant bit: error_action:4, set_frame_annotation:1 */ 22634ff6846SIoana Radulescu u8 flags; 22734ff6846SIoana Radulescu }; 22834ff6846SIoana Radulescu 22934ff6846SIoana Radulescu /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation 23034ff6846SIoana Radulescu * buffer layouts, but they all share the same parameters. 23134ff6846SIoana Radulescu * If one of the functions changes, below structure needs to be split. 23234ff6846SIoana Radulescu */ 23334ff6846SIoana Radulescu 23434ff6846SIoana Radulescu #define DPNI_PASS_TS_SHIFT 0 23534ff6846SIoana Radulescu #define DPNI_PASS_TS_SIZE 1 23634ff6846SIoana Radulescu #define DPNI_PASS_PR_SHIFT 1 23734ff6846SIoana Radulescu #define DPNI_PASS_PR_SIZE 1 23834ff6846SIoana Radulescu #define DPNI_PASS_FS_SHIFT 2 23934ff6846SIoana Radulescu #define DPNI_PASS_FS_SIZE 1 24034ff6846SIoana Radulescu 24134ff6846SIoana Radulescu struct dpni_cmd_get_buffer_layout { 24234ff6846SIoana Radulescu u8 qtype; 24334ff6846SIoana Radulescu }; 24434ff6846SIoana Radulescu 24534ff6846SIoana Radulescu struct dpni_rsp_get_buffer_layout { 24634ff6846SIoana Radulescu /* response word 0 */ 24734ff6846SIoana Radulescu u8 pad0[6]; 24834ff6846SIoana Radulescu /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */ 24934ff6846SIoana Radulescu u8 flags; 25034ff6846SIoana Radulescu u8 pad1; 25134ff6846SIoana Radulescu /* response word 1 */ 25234ff6846SIoana Radulescu __le16 private_data_size; 25334ff6846SIoana Radulescu __le16 data_align; 25434ff6846SIoana Radulescu __le16 head_room; 25534ff6846SIoana Radulescu __le16 tail_room; 25634ff6846SIoana Radulescu }; 25734ff6846SIoana Radulescu 25834ff6846SIoana Radulescu struct dpni_cmd_set_buffer_layout { 25934ff6846SIoana Radulescu /* cmd word 0 */ 26034ff6846SIoana Radulescu u8 qtype; 26134ff6846SIoana Radulescu u8 pad0[3]; 26234ff6846SIoana Radulescu __le16 options; 26334ff6846SIoana Radulescu /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */ 26434ff6846SIoana Radulescu u8 flags; 26534ff6846SIoana Radulescu u8 pad1; 26634ff6846SIoana Radulescu /* cmd word 1 */ 26734ff6846SIoana Radulescu __le16 private_data_size; 26834ff6846SIoana Radulescu __le16 data_align; 26934ff6846SIoana Radulescu __le16 head_room; 27034ff6846SIoana Radulescu __le16 tail_room; 27134ff6846SIoana Radulescu }; 27234ff6846SIoana Radulescu 27334ff6846SIoana Radulescu struct dpni_cmd_set_offload { 27434ff6846SIoana Radulescu u8 pad[3]; 27534ff6846SIoana Radulescu u8 dpni_offload; 27634ff6846SIoana Radulescu __le32 config; 27734ff6846SIoana Radulescu }; 27834ff6846SIoana Radulescu 27934ff6846SIoana Radulescu struct dpni_cmd_get_offload { 28034ff6846SIoana Radulescu u8 pad[3]; 28134ff6846SIoana Radulescu u8 dpni_offload; 28234ff6846SIoana Radulescu }; 28334ff6846SIoana Radulescu 28434ff6846SIoana Radulescu struct dpni_rsp_get_offload { 28534ff6846SIoana Radulescu __le32 pad; 28634ff6846SIoana Radulescu __le32 config; 28734ff6846SIoana Radulescu }; 28834ff6846SIoana Radulescu 28934ff6846SIoana Radulescu struct dpni_cmd_get_qdid { 29034ff6846SIoana Radulescu u8 qtype; 29134ff6846SIoana Radulescu }; 29234ff6846SIoana Radulescu 29334ff6846SIoana Radulescu struct dpni_rsp_get_qdid { 29434ff6846SIoana Radulescu __le16 qdid; 29534ff6846SIoana Radulescu }; 29634ff6846SIoana Radulescu 29734ff6846SIoana Radulescu struct dpni_rsp_get_tx_data_offset { 29834ff6846SIoana Radulescu __le16 data_offset; 29934ff6846SIoana Radulescu }; 30034ff6846SIoana Radulescu 30134ff6846SIoana Radulescu struct dpni_cmd_get_statistics { 30234ff6846SIoana Radulescu u8 page_number; 30334ff6846SIoana Radulescu }; 30434ff6846SIoana Radulescu 30534ff6846SIoana Radulescu struct dpni_rsp_get_statistics { 30634ff6846SIoana Radulescu __le64 counter[DPNI_STATISTICS_CNT]; 30734ff6846SIoana Radulescu }; 30834ff6846SIoana Radulescu 3098eb3cef8SIoana Radulescu struct dpni_cmd_link_cfg { 31034ff6846SIoana Radulescu /* cmd word 0 */ 31134ff6846SIoana Radulescu __le64 pad0; 31234ff6846SIoana Radulescu /* cmd word 1 */ 31334ff6846SIoana Radulescu __le32 rate; 31434ff6846SIoana Radulescu __le32 pad1; 31534ff6846SIoana Radulescu /* cmd word 2 */ 31634ff6846SIoana Radulescu __le64 options; 31734ff6846SIoana Radulescu }; 31834ff6846SIoana Radulescu 31934ff6846SIoana Radulescu #define DPNI_LINK_STATE_SHIFT 0 32034ff6846SIoana Radulescu #define DPNI_LINK_STATE_SIZE 1 32134ff6846SIoana Radulescu 32234ff6846SIoana Radulescu struct dpni_rsp_get_link_state { 32334ff6846SIoana Radulescu /* response word 0 */ 32434ff6846SIoana Radulescu __le32 pad0; 32534ff6846SIoana Radulescu /* from LSB: up:1 */ 32634ff6846SIoana Radulescu u8 flags; 32734ff6846SIoana Radulescu u8 pad1[3]; 32834ff6846SIoana Radulescu /* response word 1 */ 32934ff6846SIoana Radulescu __le32 rate; 33034ff6846SIoana Radulescu __le32 pad2; 33134ff6846SIoana Radulescu /* response word 2 */ 33234ff6846SIoana Radulescu __le64 options; 33334ff6846SIoana Radulescu }; 33434ff6846SIoana Radulescu 33534ff6846SIoana Radulescu struct dpni_cmd_set_max_frame_length { 33634ff6846SIoana Radulescu __le16 max_frame_length; 33734ff6846SIoana Radulescu }; 33834ff6846SIoana Radulescu 33934ff6846SIoana Radulescu struct dpni_rsp_get_max_frame_length { 34034ff6846SIoana Radulescu __le16 max_frame_length; 34134ff6846SIoana Radulescu }; 34234ff6846SIoana Radulescu 34334ff6846SIoana Radulescu struct dpni_cmd_set_multicast_promisc { 34434ff6846SIoana Radulescu u8 enable; 34534ff6846SIoana Radulescu }; 34634ff6846SIoana Radulescu 34734ff6846SIoana Radulescu struct dpni_rsp_get_multicast_promisc { 34834ff6846SIoana Radulescu u8 enabled; 34934ff6846SIoana Radulescu }; 35034ff6846SIoana Radulescu 35134ff6846SIoana Radulescu struct dpni_cmd_set_unicast_promisc { 35234ff6846SIoana Radulescu u8 enable; 35334ff6846SIoana Radulescu }; 35434ff6846SIoana Radulescu 35534ff6846SIoana Radulescu struct dpni_rsp_get_unicast_promisc { 35634ff6846SIoana Radulescu u8 enabled; 35734ff6846SIoana Radulescu }; 35834ff6846SIoana Radulescu 35934ff6846SIoana Radulescu struct dpni_cmd_set_primary_mac_addr { 36034ff6846SIoana Radulescu __le16 pad; 36134ff6846SIoana Radulescu u8 mac_addr[6]; 36234ff6846SIoana Radulescu }; 36334ff6846SIoana Radulescu 36434ff6846SIoana Radulescu struct dpni_rsp_get_primary_mac_addr { 36534ff6846SIoana Radulescu __le16 pad; 36634ff6846SIoana Radulescu u8 mac_addr[6]; 36734ff6846SIoana Radulescu }; 36834ff6846SIoana Radulescu 36934ff6846SIoana Radulescu struct dpni_rsp_get_port_mac_addr { 37034ff6846SIoana Radulescu __le16 pad; 37134ff6846SIoana Radulescu u8 mac_addr[6]; 37234ff6846SIoana Radulescu }; 37334ff6846SIoana Radulescu 37434ff6846SIoana Radulescu struct dpni_cmd_add_mac_addr { 37534ff6846SIoana Radulescu __le16 pad; 37634ff6846SIoana Radulescu u8 mac_addr[6]; 37734ff6846SIoana Radulescu }; 37834ff6846SIoana Radulescu 37934ff6846SIoana Radulescu struct dpni_cmd_remove_mac_addr { 38034ff6846SIoana Radulescu __le16 pad; 38134ff6846SIoana Radulescu u8 mac_addr[6]; 38234ff6846SIoana Radulescu }; 38334ff6846SIoana Radulescu 38434ff6846SIoana Radulescu #define DPNI_UNICAST_FILTERS_SHIFT 0 38534ff6846SIoana Radulescu #define DPNI_UNICAST_FILTERS_SIZE 1 38634ff6846SIoana Radulescu #define DPNI_MULTICAST_FILTERS_SHIFT 1 38734ff6846SIoana Radulescu #define DPNI_MULTICAST_FILTERS_SIZE 1 38834ff6846SIoana Radulescu 38934ff6846SIoana Radulescu struct dpni_cmd_clear_mac_filters { 39034ff6846SIoana Radulescu /* from LSB: unicast:1, multicast:1 */ 39134ff6846SIoana Radulescu u8 flags; 39234ff6846SIoana Radulescu }; 39334ff6846SIoana Radulescu 39434ff6846SIoana Radulescu #define DPNI_DIST_MODE_SHIFT 0 39534ff6846SIoana Radulescu #define DPNI_DIST_MODE_SIZE 4 39634ff6846SIoana Radulescu #define DPNI_MISS_ACTION_SHIFT 4 39734ff6846SIoana Radulescu #define DPNI_MISS_ACTION_SIZE 4 39834ff6846SIoana Radulescu 39934ff6846SIoana Radulescu struct dpni_cmd_set_rx_tc_dist { 40034ff6846SIoana Radulescu /* cmd word 0 */ 40134ff6846SIoana Radulescu __le16 dist_size; 40234ff6846SIoana Radulescu u8 tc_id; 40334ff6846SIoana Radulescu /* from LSB: dist_mode:4, miss_action:4 */ 40434ff6846SIoana Radulescu u8 flags; 40534ff6846SIoana Radulescu __le16 pad0; 40634ff6846SIoana Radulescu __le16 default_flow_id; 40734ff6846SIoana Radulescu /* cmd word 1..5 */ 40834ff6846SIoana Radulescu __le64 pad1[5]; 40934ff6846SIoana Radulescu /* cmd word 6 */ 41034ff6846SIoana Radulescu __le64 key_cfg_iova; 41134ff6846SIoana Radulescu }; 41234ff6846SIoana Radulescu 41334ff6846SIoana Radulescu /* dpni_set_rx_tc_dist extension (structure of the DMA-able memory at 41434ff6846SIoana Radulescu * key_cfg_iova) 41534ff6846SIoana Radulescu */ 41634ff6846SIoana Radulescu struct dpni_mask_cfg { 41734ff6846SIoana Radulescu u8 mask; 41834ff6846SIoana Radulescu u8 offset; 41934ff6846SIoana Radulescu }; 42034ff6846SIoana Radulescu 42134ff6846SIoana Radulescu #define DPNI_EFH_TYPE_SHIFT 0 42234ff6846SIoana Radulescu #define DPNI_EFH_TYPE_SIZE 4 42334ff6846SIoana Radulescu #define DPNI_EXTRACT_TYPE_SHIFT 0 42434ff6846SIoana Radulescu #define DPNI_EXTRACT_TYPE_SIZE 4 42534ff6846SIoana Radulescu 42634ff6846SIoana Radulescu struct dpni_dist_extract { 42734ff6846SIoana Radulescu /* word 0 */ 42834ff6846SIoana Radulescu u8 prot; 42934ff6846SIoana Radulescu /* EFH type stored in the 4 least significant bits */ 43034ff6846SIoana Radulescu u8 efh_type; 43134ff6846SIoana Radulescu u8 size; 43234ff6846SIoana Radulescu u8 offset; 43334ff6846SIoana Radulescu __le32 field; 43434ff6846SIoana Radulescu /* word 1 */ 43534ff6846SIoana Radulescu u8 hdr_index; 43634ff6846SIoana Radulescu u8 constant; 43734ff6846SIoana Radulescu u8 num_of_repeats; 43834ff6846SIoana Radulescu u8 num_of_byte_masks; 43934ff6846SIoana Radulescu /* Extraction type is stored in the 4 LSBs */ 44034ff6846SIoana Radulescu u8 extract_type; 44134ff6846SIoana Radulescu u8 pad[3]; 44234ff6846SIoana Radulescu /* word 2 */ 44334ff6846SIoana Radulescu struct dpni_mask_cfg masks[4]; 44434ff6846SIoana Radulescu }; 44534ff6846SIoana Radulescu 44634ff6846SIoana Radulescu struct dpni_ext_set_rx_tc_dist { 44734ff6846SIoana Radulescu /* extension word 0 */ 44834ff6846SIoana Radulescu u8 num_extracts; 44934ff6846SIoana Radulescu u8 pad[7]; 45034ff6846SIoana Radulescu /* words 1..25 */ 45134ff6846SIoana Radulescu struct dpni_dist_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS]; 45234ff6846SIoana Radulescu }; 45334ff6846SIoana Radulescu 45434ff6846SIoana Radulescu struct dpni_cmd_get_queue { 45534ff6846SIoana Radulescu u8 qtype; 45634ff6846SIoana Radulescu u8 tc; 45734ff6846SIoana Radulescu u8 index; 45834ff6846SIoana Radulescu }; 45934ff6846SIoana Radulescu 46034ff6846SIoana Radulescu #define DPNI_DEST_TYPE_SHIFT 0 46134ff6846SIoana Radulescu #define DPNI_DEST_TYPE_SIZE 4 46234ff6846SIoana Radulescu #define DPNI_STASH_CTRL_SHIFT 6 46334ff6846SIoana Radulescu #define DPNI_STASH_CTRL_SIZE 1 46434ff6846SIoana Radulescu #define DPNI_HOLD_ACTIVE_SHIFT 7 46534ff6846SIoana Radulescu #define DPNI_HOLD_ACTIVE_SIZE 1 46634ff6846SIoana Radulescu 46734ff6846SIoana Radulescu struct dpni_rsp_get_queue { 46834ff6846SIoana Radulescu /* response word 0 */ 46934ff6846SIoana Radulescu __le64 pad0; 47034ff6846SIoana Radulescu /* response word 1 */ 47134ff6846SIoana Radulescu __le32 dest_id; 47234ff6846SIoana Radulescu __le16 pad1; 47334ff6846SIoana Radulescu u8 dest_prio; 47434ff6846SIoana Radulescu /* From LSB: dest_type:4, pad:2, flc_stash_ctrl:1, hold_active:1 */ 47534ff6846SIoana Radulescu u8 flags; 47634ff6846SIoana Radulescu /* response word 2 */ 47734ff6846SIoana Radulescu __le64 flc; 47834ff6846SIoana Radulescu /* response word 3 */ 47934ff6846SIoana Radulescu __le64 user_context; 48034ff6846SIoana Radulescu /* response word 4 */ 48134ff6846SIoana Radulescu __le32 fqid; 48234ff6846SIoana Radulescu __le16 qdbin; 48334ff6846SIoana Radulescu }; 48434ff6846SIoana Radulescu 48534ff6846SIoana Radulescu struct dpni_cmd_set_queue { 48634ff6846SIoana Radulescu /* cmd word 0 */ 48734ff6846SIoana Radulescu u8 qtype; 48834ff6846SIoana Radulescu u8 tc; 48934ff6846SIoana Radulescu u8 index; 49034ff6846SIoana Radulescu u8 options; 49134ff6846SIoana Radulescu __le32 pad0; 49234ff6846SIoana Radulescu /* cmd word 1 */ 49334ff6846SIoana Radulescu __le32 dest_id; 49434ff6846SIoana Radulescu __le16 pad1; 49534ff6846SIoana Radulescu u8 dest_prio; 49634ff6846SIoana Radulescu u8 flags; 49734ff6846SIoana Radulescu /* cmd word 2 */ 49834ff6846SIoana Radulescu __le64 flc; 49934ff6846SIoana Radulescu /* cmd word 3 */ 50034ff6846SIoana Radulescu __le64 user_context; 50134ff6846SIoana Radulescu }; 50234ff6846SIoana Radulescu 50334ff6846SIoana Radulescu struct dpni_cmd_set_taildrop { 50434ff6846SIoana Radulescu /* cmd word 0 */ 50534ff6846SIoana Radulescu u8 congestion_point; 50634ff6846SIoana Radulescu u8 qtype; 50734ff6846SIoana Radulescu u8 tc; 50834ff6846SIoana Radulescu u8 index; 50934ff6846SIoana Radulescu __le32 pad0; 51034ff6846SIoana Radulescu /* cmd word 1 */ 51134ff6846SIoana Radulescu /* Only least significant bit is relevant */ 51234ff6846SIoana Radulescu u8 enable; 51334ff6846SIoana Radulescu u8 pad1; 51434ff6846SIoana Radulescu u8 units; 51534ff6846SIoana Radulescu u8 pad2; 51634ff6846SIoana Radulescu __le32 threshold; 51734ff6846SIoana Radulescu }; 51834ff6846SIoana Radulescu 51934ff6846SIoana Radulescu struct dpni_cmd_get_taildrop { 52034ff6846SIoana Radulescu u8 congestion_point; 52134ff6846SIoana Radulescu u8 qtype; 52234ff6846SIoana Radulescu u8 tc; 52334ff6846SIoana Radulescu u8 index; 52434ff6846SIoana Radulescu }; 52534ff6846SIoana Radulescu 52634ff6846SIoana Radulescu struct dpni_rsp_get_taildrop { 52734ff6846SIoana Radulescu /* cmd word 0 */ 52834ff6846SIoana Radulescu __le64 pad0; 52934ff6846SIoana Radulescu /* cmd word 1 */ 53034ff6846SIoana Radulescu /* only least significant bit is relevant */ 53134ff6846SIoana Radulescu u8 enable; 53234ff6846SIoana Radulescu u8 pad1; 53334ff6846SIoana Radulescu u8 units; 53434ff6846SIoana Radulescu u8 pad2; 53534ff6846SIoana Radulescu __le32 threshold; 53634ff6846SIoana Radulescu }; 53734ff6846SIoana Radulescu 53834ff6846SIoana Radulescu struct dpni_rsp_get_api_version { 53934ff6846SIoana Radulescu __le16 major; 54034ff6846SIoana Radulescu __le16 minor; 54134ff6846SIoana Radulescu }; 54234ff6846SIoana Radulescu 5434aaaf9b9SIoana Radulescu #define DPNI_RX_FS_DIST_ENABLE_SHIFT 0 5444aaaf9b9SIoana Radulescu #define DPNI_RX_FS_DIST_ENABLE_SIZE 1 5454aaaf9b9SIoana Radulescu struct dpni_cmd_set_rx_fs_dist { 5464aaaf9b9SIoana Radulescu __le16 dist_size; 5474aaaf9b9SIoana Radulescu u8 enable; 5484aaaf9b9SIoana Radulescu u8 tc; 5494aaaf9b9SIoana Radulescu __le16 miss_flow_id; 5504aaaf9b9SIoana Radulescu __le16 pad; 5514aaaf9b9SIoana Radulescu __le64 key_cfg_iova; 5524aaaf9b9SIoana Radulescu }; 5534aaaf9b9SIoana Radulescu 554df85aeb9SIoana Radulescu #define DPNI_RX_HASH_DIST_ENABLE_SHIFT 0 555df85aeb9SIoana Radulescu #define DPNI_RX_HASH_DIST_ENABLE_SIZE 1 556df85aeb9SIoana Radulescu struct dpni_cmd_set_rx_hash_dist { 557df85aeb9SIoana Radulescu __le16 dist_size; 558df85aeb9SIoana Radulescu u8 enable; 559df85aeb9SIoana Radulescu u8 tc; 560df85aeb9SIoana Radulescu __le32 pad; 561df85aeb9SIoana Radulescu __le64 key_cfg_iova; 562df85aeb9SIoana Radulescu }; 563df85aeb9SIoana Radulescu 564afb90dbbSIoana Radulescu struct dpni_cmd_add_fs_entry { 565afb90dbbSIoana Radulescu /* cmd word 0 */ 566afb90dbbSIoana Radulescu __le16 options; 567afb90dbbSIoana Radulescu u8 tc_id; 568afb90dbbSIoana Radulescu u8 key_size; 569afb90dbbSIoana Radulescu __le16 index; 570afb90dbbSIoana Radulescu __le16 flow_id; 571afb90dbbSIoana Radulescu /* cmd word 1 */ 572afb90dbbSIoana Radulescu __le64 key_iova; 573afb90dbbSIoana Radulescu /* cmd word 2 */ 574afb90dbbSIoana Radulescu __le64 mask_iova; 575afb90dbbSIoana Radulescu /* cmd word 3 */ 576afb90dbbSIoana Radulescu __le64 flc; 577afb90dbbSIoana Radulescu }; 578afb90dbbSIoana Radulescu 579afb90dbbSIoana Radulescu struct dpni_cmd_remove_fs_entry { 580afb90dbbSIoana Radulescu /* cmd word 0 */ 581afb90dbbSIoana Radulescu __le16 pad0; 582afb90dbbSIoana Radulescu u8 tc_id; 583afb90dbbSIoana Radulescu u8 key_size; 584afb90dbbSIoana Radulescu __le32 pad1; 585afb90dbbSIoana Radulescu /* cmd word 1 */ 586afb90dbbSIoana Radulescu __le64 key_iova; 587afb90dbbSIoana Radulescu /* cmd word 2 */ 588afb90dbbSIoana Radulescu __le64 mask_iova; 589afb90dbbSIoana Radulescu }; 590afb90dbbSIoana Radulescu 5916aa90fe2SIoana Radulescu #define DPNI_DISCARD_ON_MISS_SHIFT 0 5926aa90fe2SIoana Radulescu #define DPNI_DISCARD_ON_MISS_SIZE 1 5936aa90fe2SIoana Radulescu 5946aa90fe2SIoana Radulescu struct dpni_cmd_set_qos_table { 5956aa90fe2SIoana Radulescu __le32 pad; 5966aa90fe2SIoana Radulescu u8 default_tc; 5976aa90fe2SIoana Radulescu /* only the LSB */ 5986aa90fe2SIoana Radulescu u8 discard_on_miss; 5996aa90fe2SIoana Radulescu __le16 pad1[21]; 6006aa90fe2SIoana Radulescu __le64 key_cfg_iova; 6016aa90fe2SIoana Radulescu }; 6026aa90fe2SIoana Radulescu 6036aa90fe2SIoana Radulescu struct dpni_cmd_add_qos_entry { 6046aa90fe2SIoana Radulescu __le16 pad; 6056aa90fe2SIoana Radulescu u8 tc_id; 6066aa90fe2SIoana Radulescu u8 key_size; 6076aa90fe2SIoana Radulescu __le16 index; 6086aa90fe2SIoana Radulescu __le16 pad1; 6096aa90fe2SIoana Radulescu __le64 key_iova; 6106aa90fe2SIoana Radulescu __le64 mask_iova; 6116aa90fe2SIoana Radulescu }; 6126aa90fe2SIoana Radulescu 6136aa90fe2SIoana Radulescu struct dpni_cmd_remove_qos_entry { 6146aa90fe2SIoana Radulescu u8 pad[3]; 6156aa90fe2SIoana Radulescu u8 key_size; 6166aa90fe2SIoana Radulescu __le32 pad1; 6176aa90fe2SIoana Radulescu __le64 key_iova; 6186aa90fe2SIoana Radulescu __le64 mask_iova; 6196aa90fe2SIoana Radulescu }; 6206aa90fe2SIoana Radulescu 621f395b69fSIoana Ciornei #define DPNI_DEST_TYPE_SHIFT 0 622f395b69fSIoana Ciornei #define DPNI_DEST_TYPE_SIZE 4 623f395b69fSIoana Ciornei #define DPNI_CONG_UNITS_SHIFT 4 624f395b69fSIoana Ciornei #define DPNI_CONG_UNITS_SIZE 2 625f395b69fSIoana Ciornei 626f395b69fSIoana Ciornei struct dpni_cmd_set_congestion_notification { 627f395b69fSIoana Ciornei /* cmd word 0 */ 628f395b69fSIoana Ciornei u8 qtype; 629f395b69fSIoana Ciornei u8 tc; 630f395b69fSIoana Ciornei u8 pad[6]; 631f395b69fSIoana Ciornei /* cmd word 1 */ 632f395b69fSIoana Ciornei __le32 dest_id; 633f395b69fSIoana Ciornei __le16 notification_mode; 634f395b69fSIoana Ciornei u8 dest_priority; 635f395b69fSIoana Ciornei /* from LSB: dest_type: 4 units:2 */ 636f395b69fSIoana Ciornei u8 type_units; 637f395b69fSIoana Ciornei /* cmd word 2 */ 638f395b69fSIoana Ciornei __le64 message_iova; 639f395b69fSIoana Ciornei /* cmd word 3 */ 640f395b69fSIoana Ciornei __le64 message_ctx; 641f395b69fSIoana Ciornei /* cmd word 4 */ 642f395b69fSIoana Ciornei __le32 threshold_entry; 643f395b69fSIoana Ciornei __le32 threshold_exit; 644f395b69fSIoana Ciornei }; 645f395b69fSIoana Ciornei 64639344a89SIoana Ciornei #define DPNI_COUPLED_SHIFT 0 64739344a89SIoana Ciornei #define DPNI_COUPLED_SIZE 1 64839344a89SIoana Ciornei 64939344a89SIoana Ciornei struct dpni_cmd_set_tx_shaping { 65039344a89SIoana Ciornei __le16 tx_cr_max_burst_size; 65139344a89SIoana Ciornei __le16 tx_er_max_burst_size; 65239344a89SIoana Ciornei __le32 pad; 65339344a89SIoana Ciornei __le32 tx_cr_rate_limit; 65439344a89SIoana Ciornei __le32 tx_er_rate_limit; 65539344a89SIoana Ciornei /* from LSB: coupled:1 */ 65639344a89SIoana Ciornei u8 coupled; 65739344a89SIoana Ciornei }; 65839344a89SIoana Ciornei 65923cd4f27SYangbo Lu #define DPNI_PTP_ENABLE_SHIFT 0 66023cd4f27SYangbo Lu #define DPNI_PTP_ENABLE_SIZE 1 66123cd4f27SYangbo Lu #define DPNI_PTP_CH_UPDATE_SHIFT 1 66223cd4f27SYangbo Lu #define DPNI_PTP_CH_UPDATE_SIZE 1 66323cd4f27SYangbo Lu 66423cd4f27SYangbo Lu struct dpni_cmd_single_step_cfg { 66523cd4f27SYangbo Lu __le16 flags; 66623cd4f27SYangbo Lu __le16 offset; 66723cd4f27SYangbo Lu __le32 peer_delay; 6689572594eSRadu Bulie __le32 ptp_onestep_reg_base; 6699572594eSRadu Bulie __le32 pad0; 67023cd4f27SYangbo Lu }; 67123cd4f27SYangbo Lu 67223cd4f27SYangbo Lu struct dpni_rsp_single_step_cfg { 67323cd4f27SYangbo Lu __le16 flags; 67423cd4f27SYangbo Lu __le16 offset; 67523cd4f27SYangbo Lu __le32 peer_delay; 6769572594eSRadu Bulie __le32 ptp_onestep_reg_base; 6779572594eSRadu Bulie __le32 pad0; 67823cd4f27SYangbo Lu }; 67923cd4f27SYangbo Lu 68070b32d82SIonut-robert Aron struct dpni_cmd_enable_vlan_filter { 68170b32d82SIonut-robert Aron /* only the LSB */ 68270b32d82SIonut-robert Aron u8 en; 68370b32d82SIonut-robert Aron }; 68470b32d82SIonut-robert Aron 68570b32d82SIonut-robert Aron struct dpni_cmd_vlan_id { 68670b32d82SIonut-robert Aron u8 flags; 68770b32d82SIonut-robert Aron u8 tc_id; 68870b32d82SIonut-robert Aron u8 flow_id; 68970b32d82SIonut-robert Aron u8 pad; 69070b32d82SIonut-robert Aron __le16 vlan_id; 69170b32d82SIonut-robert Aron }; 69270b32d82SIonut-robert Aron 69334ff6846SIoana Radulescu #endif /* _FSL_DPNI_CMD_H */ 694