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 434ff6846SIoana Radulescu */ 534ff6846SIoana Radulescu #ifndef _FSL_DPNI_CMD_H 634ff6846SIoana Radulescu #define _FSL_DPNI_CMD_H 734ff6846SIoana Radulescu 834ff6846SIoana Radulescu #include "dpni.h" 934ff6846SIoana Radulescu 1034ff6846SIoana Radulescu /* DPNI Version */ 1134ff6846SIoana Radulescu #define DPNI_VER_MAJOR 7 1234ff6846SIoana Radulescu #define DPNI_VER_MINOR 0 1334ff6846SIoana Radulescu #define DPNI_CMD_BASE_VERSION 1 1434ff6846SIoana Radulescu #define DPNI_CMD_ID_OFFSET 4 1534ff6846SIoana Radulescu 1634ff6846SIoana Radulescu #define DPNI_CMD(id) (((id) << DPNI_CMD_ID_OFFSET) | DPNI_CMD_BASE_VERSION) 1734ff6846SIoana Radulescu 1834ff6846SIoana Radulescu #define DPNI_CMDID_OPEN DPNI_CMD(0x801) 1934ff6846SIoana Radulescu #define DPNI_CMDID_CLOSE DPNI_CMD(0x800) 2034ff6846SIoana Radulescu #define DPNI_CMDID_CREATE DPNI_CMD(0x901) 2134ff6846SIoana Radulescu #define DPNI_CMDID_DESTROY DPNI_CMD(0x900) 2234ff6846SIoana Radulescu #define DPNI_CMDID_GET_API_VERSION DPNI_CMD(0xa01) 2334ff6846SIoana Radulescu 2434ff6846SIoana Radulescu #define DPNI_CMDID_ENABLE DPNI_CMD(0x002) 2534ff6846SIoana Radulescu #define DPNI_CMDID_DISABLE DPNI_CMD(0x003) 2634ff6846SIoana Radulescu #define DPNI_CMDID_GET_ATTR DPNI_CMD(0x004) 2734ff6846SIoana Radulescu #define DPNI_CMDID_RESET DPNI_CMD(0x005) 2834ff6846SIoana Radulescu #define DPNI_CMDID_IS_ENABLED DPNI_CMD(0x006) 2934ff6846SIoana Radulescu 3034ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ DPNI_CMD(0x010) 3134ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ DPNI_CMD(0x011) 3234ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ_ENABLE DPNI_CMD(0x012) 3334ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_ENABLE DPNI_CMD(0x013) 3434ff6846SIoana Radulescu #define DPNI_CMDID_SET_IRQ_MASK DPNI_CMD(0x014) 3534ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_MASK DPNI_CMD(0x015) 3634ff6846SIoana Radulescu #define DPNI_CMDID_GET_IRQ_STATUS DPNI_CMD(0x016) 3734ff6846SIoana Radulescu #define DPNI_CMDID_CLEAR_IRQ_STATUS DPNI_CMD(0x017) 3834ff6846SIoana Radulescu 3934ff6846SIoana Radulescu #define DPNI_CMDID_SET_POOLS DPNI_CMD(0x200) 4034ff6846SIoana Radulescu #define DPNI_CMDID_SET_ERRORS_BEHAVIOR DPNI_CMD(0x20B) 4134ff6846SIoana Radulescu 4234ff6846SIoana Radulescu #define DPNI_CMDID_GET_QDID DPNI_CMD(0x210) 4334ff6846SIoana Radulescu #define DPNI_CMDID_GET_TX_DATA_OFFSET DPNI_CMD(0x212) 4434ff6846SIoana Radulescu #define DPNI_CMDID_GET_LINK_STATE DPNI_CMD(0x215) 4534ff6846SIoana Radulescu #define DPNI_CMDID_SET_MAX_FRAME_LENGTH DPNI_CMD(0x216) 4634ff6846SIoana Radulescu #define DPNI_CMDID_GET_MAX_FRAME_LENGTH DPNI_CMD(0x217) 4734ff6846SIoana Radulescu #define DPNI_CMDID_SET_LINK_CFG DPNI_CMD(0x21A) 4834ff6846SIoana Radulescu #define DPNI_CMDID_SET_TX_SHAPING DPNI_CMD(0x21B) 4934ff6846SIoana Radulescu 5034ff6846SIoana Radulescu #define DPNI_CMDID_SET_MCAST_PROMISC DPNI_CMD(0x220) 5134ff6846SIoana Radulescu #define DPNI_CMDID_GET_MCAST_PROMISC DPNI_CMD(0x221) 5234ff6846SIoana Radulescu #define DPNI_CMDID_SET_UNICAST_PROMISC DPNI_CMD(0x222) 5334ff6846SIoana Radulescu #define DPNI_CMDID_GET_UNICAST_PROMISC DPNI_CMD(0x223) 5434ff6846SIoana Radulescu #define DPNI_CMDID_SET_PRIM_MAC DPNI_CMD(0x224) 5534ff6846SIoana Radulescu #define DPNI_CMDID_GET_PRIM_MAC DPNI_CMD(0x225) 5634ff6846SIoana Radulescu #define DPNI_CMDID_ADD_MAC_ADDR DPNI_CMD(0x226) 5734ff6846SIoana Radulescu #define DPNI_CMDID_REMOVE_MAC_ADDR DPNI_CMD(0x227) 5834ff6846SIoana Radulescu #define DPNI_CMDID_CLR_MAC_FILTERS DPNI_CMD(0x228) 5934ff6846SIoana Radulescu 6034ff6846SIoana Radulescu #define DPNI_CMDID_SET_RX_TC_DIST DPNI_CMD(0x235) 6134ff6846SIoana Radulescu 6234ff6846SIoana Radulescu #define DPNI_CMDID_ADD_FS_ENT DPNI_CMD(0x244) 6334ff6846SIoana Radulescu #define DPNI_CMDID_REMOVE_FS_ENT DPNI_CMD(0x245) 6434ff6846SIoana Radulescu #define DPNI_CMDID_CLR_FS_ENT DPNI_CMD(0x246) 6534ff6846SIoana Radulescu 6634ff6846SIoana Radulescu #define DPNI_CMDID_GET_STATISTICS DPNI_CMD(0x25D) 6734ff6846SIoana Radulescu #define DPNI_CMDID_GET_QUEUE DPNI_CMD(0x25F) 6834ff6846SIoana Radulescu #define DPNI_CMDID_SET_QUEUE DPNI_CMD(0x260) 6934ff6846SIoana Radulescu #define DPNI_CMDID_GET_TAILDROP DPNI_CMD(0x261) 7034ff6846SIoana Radulescu #define DPNI_CMDID_SET_TAILDROP DPNI_CMD(0x262) 7134ff6846SIoana Radulescu 7234ff6846SIoana Radulescu #define DPNI_CMDID_GET_PORT_MAC_ADDR DPNI_CMD(0x263) 7334ff6846SIoana Radulescu 7434ff6846SIoana Radulescu #define DPNI_CMDID_GET_BUFFER_LAYOUT DPNI_CMD(0x264) 7534ff6846SIoana Radulescu #define DPNI_CMDID_SET_BUFFER_LAYOUT DPNI_CMD(0x265) 7634ff6846SIoana Radulescu 7734ff6846SIoana Radulescu #define DPNI_CMDID_SET_TX_CONFIRMATION_MODE DPNI_CMD(0x266) 7834ff6846SIoana Radulescu #define DPNI_CMDID_SET_CONGESTION_NOTIFICATION DPNI_CMD(0x267) 7934ff6846SIoana Radulescu #define DPNI_CMDID_GET_CONGESTION_NOTIFICATION DPNI_CMD(0x268) 8034ff6846SIoana Radulescu #define DPNI_CMDID_SET_EARLY_DROP DPNI_CMD(0x269) 8134ff6846SIoana Radulescu #define DPNI_CMDID_GET_EARLY_DROP DPNI_CMD(0x26A) 8234ff6846SIoana Radulescu #define DPNI_CMDID_GET_OFFLOAD DPNI_CMD(0x26B) 8334ff6846SIoana Radulescu #define DPNI_CMDID_SET_OFFLOAD DPNI_CMD(0x26C) 8434ff6846SIoana Radulescu 854aaaf9b9SIoana Radulescu #define DPNI_CMDID_SET_RX_FS_DIST DPNI_CMD(0x273) 86df85aeb9SIoana Radulescu #define DPNI_CMDID_SET_RX_HASH_DIST DPNI_CMD(0x274) 87df85aeb9SIoana Radulescu 8834ff6846SIoana Radulescu /* Macros for accessing command fields smaller than 1byte */ 8934ff6846SIoana Radulescu #define DPNI_MASK(field) \ 9034ff6846SIoana Radulescu GENMASK(DPNI_##field##_SHIFT + DPNI_##field##_SIZE - 1, \ 9134ff6846SIoana Radulescu DPNI_##field##_SHIFT) 9234ff6846SIoana Radulescu 9334ff6846SIoana Radulescu #define dpni_set_field(var, field, val) \ 9434ff6846SIoana Radulescu ((var) |= (((val) << DPNI_##field##_SHIFT) & DPNI_MASK(field))) 9534ff6846SIoana Radulescu #define dpni_get_field(var, field) \ 9634ff6846SIoana Radulescu (((var) & DPNI_MASK(field)) >> DPNI_##field##_SHIFT) 9734ff6846SIoana Radulescu 9834ff6846SIoana Radulescu struct dpni_cmd_open { 9934ff6846SIoana Radulescu __le32 dpni_id; 10034ff6846SIoana Radulescu }; 10134ff6846SIoana Radulescu 10234ff6846SIoana Radulescu #define DPNI_BACKUP_POOL(val, order) (((val) & 0x1) << (order)) 10334ff6846SIoana Radulescu struct dpni_cmd_set_pools { 10434ff6846SIoana Radulescu /* cmd word 0 */ 10534ff6846SIoana Radulescu u8 num_dpbp; 10634ff6846SIoana Radulescu u8 backup_pool_mask; 10734ff6846SIoana Radulescu __le16 pad; 10834ff6846SIoana Radulescu /* cmd word 0..4 */ 10934ff6846SIoana Radulescu __le32 dpbp_id[DPNI_MAX_DPBP]; 11034ff6846SIoana Radulescu /* cmd word 4..6 */ 11134ff6846SIoana Radulescu __le16 buffer_size[DPNI_MAX_DPBP]; 11234ff6846SIoana Radulescu }; 11334ff6846SIoana Radulescu 11434ff6846SIoana Radulescu /* The enable indication is always the least significant bit */ 11534ff6846SIoana Radulescu #define DPNI_ENABLE_SHIFT 0 11634ff6846SIoana Radulescu #define DPNI_ENABLE_SIZE 1 11734ff6846SIoana Radulescu 11834ff6846SIoana Radulescu struct dpni_rsp_is_enabled { 11934ff6846SIoana Radulescu u8 enabled; 12034ff6846SIoana Radulescu }; 12134ff6846SIoana Radulescu 12234ff6846SIoana Radulescu struct dpni_rsp_get_irq { 12334ff6846SIoana Radulescu /* response word 0 */ 12434ff6846SIoana Radulescu __le32 irq_val; 12534ff6846SIoana Radulescu __le32 pad; 12634ff6846SIoana Radulescu /* response word 1 */ 12734ff6846SIoana Radulescu __le64 irq_addr; 12834ff6846SIoana Radulescu /* response word 2 */ 12934ff6846SIoana Radulescu __le32 irq_num; 13034ff6846SIoana Radulescu __le32 type; 13134ff6846SIoana Radulescu }; 13234ff6846SIoana Radulescu 13334ff6846SIoana Radulescu struct dpni_cmd_set_irq_enable { 13434ff6846SIoana Radulescu u8 enable; 13534ff6846SIoana Radulescu u8 pad[3]; 13634ff6846SIoana Radulescu u8 irq_index; 13734ff6846SIoana Radulescu }; 13834ff6846SIoana Radulescu 13934ff6846SIoana Radulescu struct dpni_cmd_get_irq_enable { 14034ff6846SIoana Radulescu __le32 pad; 14134ff6846SIoana Radulescu u8 irq_index; 14234ff6846SIoana Radulescu }; 14334ff6846SIoana Radulescu 14434ff6846SIoana Radulescu struct dpni_rsp_get_irq_enable { 14534ff6846SIoana Radulescu u8 enabled; 14634ff6846SIoana Radulescu }; 14734ff6846SIoana Radulescu 14834ff6846SIoana Radulescu struct dpni_cmd_set_irq_mask { 14934ff6846SIoana Radulescu __le32 mask; 15034ff6846SIoana Radulescu u8 irq_index; 15134ff6846SIoana Radulescu }; 15234ff6846SIoana Radulescu 15334ff6846SIoana Radulescu struct dpni_cmd_get_irq_mask { 15434ff6846SIoana Radulescu __le32 pad; 15534ff6846SIoana Radulescu u8 irq_index; 15634ff6846SIoana Radulescu }; 15734ff6846SIoana Radulescu 15834ff6846SIoana Radulescu struct dpni_rsp_get_irq_mask { 15934ff6846SIoana Radulescu __le32 mask; 16034ff6846SIoana Radulescu }; 16134ff6846SIoana Radulescu 16234ff6846SIoana Radulescu struct dpni_cmd_get_irq_status { 16334ff6846SIoana Radulescu __le32 status; 16434ff6846SIoana Radulescu u8 irq_index; 16534ff6846SIoana Radulescu }; 16634ff6846SIoana Radulescu 16734ff6846SIoana Radulescu struct dpni_rsp_get_irq_status { 16834ff6846SIoana Radulescu __le32 status; 16934ff6846SIoana Radulescu }; 17034ff6846SIoana Radulescu 17134ff6846SIoana Radulescu struct dpni_cmd_clear_irq_status { 17234ff6846SIoana Radulescu __le32 status; 17334ff6846SIoana Radulescu u8 irq_index; 17434ff6846SIoana Radulescu }; 17534ff6846SIoana Radulescu 17634ff6846SIoana Radulescu struct dpni_rsp_get_attr { 17734ff6846SIoana Radulescu /* response word 0 */ 17834ff6846SIoana Radulescu __le32 options; 17934ff6846SIoana Radulescu u8 num_queues; 18034ff6846SIoana Radulescu u8 num_tcs; 18134ff6846SIoana Radulescu u8 mac_filter_entries; 18234ff6846SIoana Radulescu u8 pad0; 18334ff6846SIoana Radulescu /* response word 1 */ 18434ff6846SIoana Radulescu u8 vlan_filter_entries; 18534ff6846SIoana Radulescu u8 pad1; 18634ff6846SIoana Radulescu u8 qos_entries; 18734ff6846SIoana Radulescu u8 pad2; 18834ff6846SIoana Radulescu __le16 fs_entries; 18934ff6846SIoana Radulescu __le16 pad3; 19034ff6846SIoana Radulescu /* response word 2 */ 19134ff6846SIoana Radulescu u8 qos_key_size; 19234ff6846SIoana Radulescu u8 fs_key_size; 19334ff6846SIoana Radulescu __le16 wriop_version; 19434ff6846SIoana Radulescu }; 19534ff6846SIoana Radulescu 19634ff6846SIoana Radulescu #define DPNI_ERROR_ACTION_SHIFT 0 19734ff6846SIoana Radulescu #define DPNI_ERROR_ACTION_SIZE 4 19834ff6846SIoana Radulescu #define DPNI_FRAME_ANN_SHIFT 4 19934ff6846SIoana Radulescu #define DPNI_FRAME_ANN_SIZE 1 20034ff6846SIoana Radulescu 20134ff6846SIoana Radulescu struct dpni_cmd_set_errors_behavior { 20234ff6846SIoana Radulescu __le32 errors; 20334ff6846SIoana Radulescu /* from least significant bit: error_action:4, set_frame_annotation:1 */ 20434ff6846SIoana Radulescu u8 flags; 20534ff6846SIoana Radulescu }; 20634ff6846SIoana Radulescu 20734ff6846SIoana Radulescu /* There are 3 separate commands for configuring Rx, Tx and Tx confirmation 20834ff6846SIoana Radulescu * buffer layouts, but they all share the same parameters. 20934ff6846SIoana Radulescu * If one of the functions changes, below structure needs to be split. 21034ff6846SIoana Radulescu */ 21134ff6846SIoana Radulescu 21234ff6846SIoana Radulescu #define DPNI_PASS_TS_SHIFT 0 21334ff6846SIoana Radulescu #define DPNI_PASS_TS_SIZE 1 21434ff6846SIoana Radulescu #define DPNI_PASS_PR_SHIFT 1 21534ff6846SIoana Radulescu #define DPNI_PASS_PR_SIZE 1 21634ff6846SIoana Radulescu #define DPNI_PASS_FS_SHIFT 2 21734ff6846SIoana Radulescu #define DPNI_PASS_FS_SIZE 1 21834ff6846SIoana Radulescu 21934ff6846SIoana Radulescu struct dpni_cmd_get_buffer_layout { 22034ff6846SIoana Radulescu u8 qtype; 22134ff6846SIoana Radulescu }; 22234ff6846SIoana Radulescu 22334ff6846SIoana Radulescu struct dpni_rsp_get_buffer_layout { 22434ff6846SIoana Radulescu /* response word 0 */ 22534ff6846SIoana Radulescu u8 pad0[6]; 22634ff6846SIoana Radulescu /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */ 22734ff6846SIoana Radulescu u8 flags; 22834ff6846SIoana Radulescu u8 pad1; 22934ff6846SIoana Radulescu /* response word 1 */ 23034ff6846SIoana Radulescu __le16 private_data_size; 23134ff6846SIoana Radulescu __le16 data_align; 23234ff6846SIoana Radulescu __le16 head_room; 23334ff6846SIoana Radulescu __le16 tail_room; 23434ff6846SIoana Radulescu }; 23534ff6846SIoana Radulescu 23634ff6846SIoana Radulescu struct dpni_cmd_set_buffer_layout { 23734ff6846SIoana Radulescu /* cmd word 0 */ 23834ff6846SIoana Radulescu u8 qtype; 23934ff6846SIoana Radulescu u8 pad0[3]; 24034ff6846SIoana Radulescu __le16 options; 24134ff6846SIoana Radulescu /* from LSB: pass_timestamp:1, parser_result:1, frame_status:1 */ 24234ff6846SIoana Radulescu u8 flags; 24334ff6846SIoana Radulescu u8 pad1; 24434ff6846SIoana Radulescu /* cmd word 1 */ 24534ff6846SIoana Radulescu __le16 private_data_size; 24634ff6846SIoana Radulescu __le16 data_align; 24734ff6846SIoana Radulescu __le16 head_room; 24834ff6846SIoana Radulescu __le16 tail_room; 24934ff6846SIoana Radulescu }; 25034ff6846SIoana Radulescu 25134ff6846SIoana Radulescu struct dpni_cmd_set_offload { 25234ff6846SIoana Radulescu u8 pad[3]; 25334ff6846SIoana Radulescu u8 dpni_offload; 25434ff6846SIoana Radulescu __le32 config; 25534ff6846SIoana Radulescu }; 25634ff6846SIoana Radulescu 25734ff6846SIoana Radulescu struct dpni_cmd_get_offload { 25834ff6846SIoana Radulescu u8 pad[3]; 25934ff6846SIoana Radulescu u8 dpni_offload; 26034ff6846SIoana Radulescu }; 26134ff6846SIoana Radulescu 26234ff6846SIoana Radulescu struct dpni_rsp_get_offload { 26334ff6846SIoana Radulescu __le32 pad; 26434ff6846SIoana Radulescu __le32 config; 26534ff6846SIoana Radulescu }; 26634ff6846SIoana Radulescu 26734ff6846SIoana Radulescu struct dpni_cmd_get_qdid { 26834ff6846SIoana Radulescu u8 qtype; 26934ff6846SIoana Radulescu }; 27034ff6846SIoana Radulescu 27134ff6846SIoana Radulescu struct dpni_rsp_get_qdid { 27234ff6846SIoana Radulescu __le16 qdid; 27334ff6846SIoana Radulescu }; 27434ff6846SIoana Radulescu 27534ff6846SIoana Radulescu struct dpni_rsp_get_tx_data_offset { 27634ff6846SIoana Radulescu __le16 data_offset; 27734ff6846SIoana Radulescu }; 27834ff6846SIoana Radulescu 27934ff6846SIoana Radulescu struct dpni_cmd_get_statistics { 28034ff6846SIoana Radulescu u8 page_number; 28134ff6846SIoana Radulescu }; 28234ff6846SIoana Radulescu 28334ff6846SIoana Radulescu struct dpni_rsp_get_statistics { 28434ff6846SIoana Radulescu __le64 counter[DPNI_STATISTICS_CNT]; 28534ff6846SIoana Radulescu }; 28634ff6846SIoana Radulescu 28734ff6846SIoana Radulescu struct dpni_cmd_set_link_cfg { 28834ff6846SIoana Radulescu /* cmd word 0 */ 28934ff6846SIoana Radulescu __le64 pad0; 29034ff6846SIoana Radulescu /* cmd word 1 */ 29134ff6846SIoana Radulescu __le32 rate; 29234ff6846SIoana Radulescu __le32 pad1; 29334ff6846SIoana Radulescu /* cmd word 2 */ 29434ff6846SIoana Radulescu __le64 options; 29534ff6846SIoana Radulescu }; 29634ff6846SIoana Radulescu 29734ff6846SIoana Radulescu #define DPNI_LINK_STATE_SHIFT 0 29834ff6846SIoana Radulescu #define DPNI_LINK_STATE_SIZE 1 29934ff6846SIoana Radulescu 30034ff6846SIoana Radulescu struct dpni_rsp_get_link_state { 30134ff6846SIoana Radulescu /* response word 0 */ 30234ff6846SIoana Radulescu __le32 pad0; 30334ff6846SIoana Radulescu /* from LSB: up:1 */ 30434ff6846SIoana Radulescu u8 flags; 30534ff6846SIoana Radulescu u8 pad1[3]; 30634ff6846SIoana Radulescu /* response word 1 */ 30734ff6846SIoana Radulescu __le32 rate; 30834ff6846SIoana Radulescu __le32 pad2; 30934ff6846SIoana Radulescu /* response word 2 */ 31034ff6846SIoana Radulescu __le64 options; 31134ff6846SIoana Radulescu }; 31234ff6846SIoana Radulescu 31334ff6846SIoana Radulescu struct dpni_cmd_set_max_frame_length { 31434ff6846SIoana Radulescu __le16 max_frame_length; 31534ff6846SIoana Radulescu }; 31634ff6846SIoana Radulescu 31734ff6846SIoana Radulescu struct dpni_rsp_get_max_frame_length { 31834ff6846SIoana Radulescu __le16 max_frame_length; 31934ff6846SIoana Radulescu }; 32034ff6846SIoana Radulescu 32134ff6846SIoana Radulescu struct dpni_cmd_set_multicast_promisc { 32234ff6846SIoana Radulescu u8 enable; 32334ff6846SIoana Radulescu }; 32434ff6846SIoana Radulescu 32534ff6846SIoana Radulescu struct dpni_rsp_get_multicast_promisc { 32634ff6846SIoana Radulescu u8 enabled; 32734ff6846SIoana Radulescu }; 32834ff6846SIoana Radulescu 32934ff6846SIoana Radulescu struct dpni_cmd_set_unicast_promisc { 33034ff6846SIoana Radulescu u8 enable; 33134ff6846SIoana Radulescu }; 33234ff6846SIoana Radulescu 33334ff6846SIoana Radulescu struct dpni_rsp_get_unicast_promisc { 33434ff6846SIoana Radulescu u8 enabled; 33534ff6846SIoana Radulescu }; 33634ff6846SIoana Radulescu 33734ff6846SIoana Radulescu struct dpni_cmd_set_primary_mac_addr { 33834ff6846SIoana Radulescu __le16 pad; 33934ff6846SIoana Radulescu u8 mac_addr[6]; 34034ff6846SIoana Radulescu }; 34134ff6846SIoana Radulescu 34234ff6846SIoana Radulescu struct dpni_rsp_get_primary_mac_addr { 34334ff6846SIoana Radulescu __le16 pad; 34434ff6846SIoana Radulescu u8 mac_addr[6]; 34534ff6846SIoana Radulescu }; 34634ff6846SIoana Radulescu 34734ff6846SIoana Radulescu struct dpni_rsp_get_port_mac_addr { 34834ff6846SIoana Radulescu __le16 pad; 34934ff6846SIoana Radulescu u8 mac_addr[6]; 35034ff6846SIoana Radulescu }; 35134ff6846SIoana Radulescu 35234ff6846SIoana Radulescu struct dpni_cmd_add_mac_addr { 35334ff6846SIoana Radulescu __le16 pad; 35434ff6846SIoana Radulescu u8 mac_addr[6]; 35534ff6846SIoana Radulescu }; 35634ff6846SIoana Radulescu 35734ff6846SIoana Radulescu struct dpni_cmd_remove_mac_addr { 35834ff6846SIoana Radulescu __le16 pad; 35934ff6846SIoana Radulescu u8 mac_addr[6]; 36034ff6846SIoana Radulescu }; 36134ff6846SIoana Radulescu 36234ff6846SIoana Radulescu #define DPNI_UNICAST_FILTERS_SHIFT 0 36334ff6846SIoana Radulescu #define DPNI_UNICAST_FILTERS_SIZE 1 36434ff6846SIoana Radulescu #define DPNI_MULTICAST_FILTERS_SHIFT 1 36534ff6846SIoana Radulescu #define DPNI_MULTICAST_FILTERS_SIZE 1 36634ff6846SIoana Radulescu 36734ff6846SIoana Radulescu struct dpni_cmd_clear_mac_filters { 36834ff6846SIoana Radulescu /* from LSB: unicast:1, multicast:1 */ 36934ff6846SIoana Radulescu u8 flags; 37034ff6846SIoana Radulescu }; 37134ff6846SIoana Radulescu 37234ff6846SIoana Radulescu #define DPNI_DIST_MODE_SHIFT 0 37334ff6846SIoana Radulescu #define DPNI_DIST_MODE_SIZE 4 37434ff6846SIoana Radulescu #define DPNI_MISS_ACTION_SHIFT 4 37534ff6846SIoana Radulescu #define DPNI_MISS_ACTION_SIZE 4 37634ff6846SIoana Radulescu 37734ff6846SIoana Radulescu struct dpni_cmd_set_rx_tc_dist { 37834ff6846SIoana Radulescu /* cmd word 0 */ 37934ff6846SIoana Radulescu __le16 dist_size; 38034ff6846SIoana Radulescu u8 tc_id; 38134ff6846SIoana Radulescu /* from LSB: dist_mode:4, miss_action:4 */ 38234ff6846SIoana Radulescu u8 flags; 38334ff6846SIoana Radulescu __le16 pad0; 38434ff6846SIoana Radulescu __le16 default_flow_id; 38534ff6846SIoana Radulescu /* cmd word 1..5 */ 38634ff6846SIoana Radulescu __le64 pad1[5]; 38734ff6846SIoana Radulescu /* cmd word 6 */ 38834ff6846SIoana Radulescu __le64 key_cfg_iova; 38934ff6846SIoana Radulescu }; 39034ff6846SIoana Radulescu 39134ff6846SIoana Radulescu /* dpni_set_rx_tc_dist extension (structure of the DMA-able memory at 39234ff6846SIoana Radulescu * key_cfg_iova) 39334ff6846SIoana Radulescu */ 39434ff6846SIoana Radulescu struct dpni_mask_cfg { 39534ff6846SIoana Radulescu u8 mask; 39634ff6846SIoana Radulescu u8 offset; 39734ff6846SIoana Radulescu }; 39834ff6846SIoana Radulescu 39934ff6846SIoana Radulescu #define DPNI_EFH_TYPE_SHIFT 0 40034ff6846SIoana Radulescu #define DPNI_EFH_TYPE_SIZE 4 40134ff6846SIoana Radulescu #define DPNI_EXTRACT_TYPE_SHIFT 0 40234ff6846SIoana Radulescu #define DPNI_EXTRACT_TYPE_SIZE 4 40334ff6846SIoana Radulescu 40434ff6846SIoana Radulescu struct dpni_dist_extract { 40534ff6846SIoana Radulescu /* word 0 */ 40634ff6846SIoana Radulescu u8 prot; 40734ff6846SIoana Radulescu /* EFH type stored in the 4 least significant bits */ 40834ff6846SIoana Radulescu u8 efh_type; 40934ff6846SIoana Radulescu u8 size; 41034ff6846SIoana Radulescu u8 offset; 41134ff6846SIoana Radulescu __le32 field; 41234ff6846SIoana Radulescu /* word 1 */ 41334ff6846SIoana Radulescu u8 hdr_index; 41434ff6846SIoana Radulescu u8 constant; 41534ff6846SIoana Radulescu u8 num_of_repeats; 41634ff6846SIoana Radulescu u8 num_of_byte_masks; 41734ff6846SIoana Radulescu /* Extraction type is stored in the 4 LSBs */ 41834ff6846SIoana Radulescu u8 extract_type; 41934ff6846SIoana Radulescu u8 pad[3]; 42034ff6846SIoana Radulescu /* word 2 */ 42134ff6846SIoana Radulescu struct dpni_mask_cfg masks[4]; 42234ff6846SIoana Radulescu }; 42334ff6846SIoana Radulescu 42434ff6846SIoana Radulescu struct dpni_ext_set_rx_tc_dist { 42534ff6846SIoana Radulescu /* extension word 0 */ 42634ff6846SIoana Radulescu u8 num_extracts; 42734ff6846SIoana Radulescu u8 pad[7]; 42834ff6846SIoana Radulescu /* words 1..25 */ 42934ff6846SIoana Radulescu struct dpni_dist_extract extracts[DPKG_MAX_NUM_OF_EXTRACTS]; 43034ff6846SIoana Radulescu }; 43134ff6846SIoana Radulescu 43234ff6846SIoana Radulescu struct dpni_cmd_get_queue { 43334ff6846SIoana Radulescu u8 qtype; 43434ff6846SIoana Radulescu u8 tc; 43534ff6846SIoana Radulescu u8 index; 43634ff6846SIoana Radulescu }; 43734ff6846SIoana Radulescu 43834ff6846SIoana Radulescu #define DPNI_DEST_TYPE_SHIFT 0 43934ff6846SIoana Radulescu #define DPNI_DEST_TYPE_SIZE 4 44034ff6846SIoana Radulescu #define DPNI_STASH_CTRL_SHIFT 6 44134ff6846SIoana Radulescu #define DPNI_STASH_CTRL_SIZE 1 44234ff6846SIoana Radulescu #define DPNI_HOLD_ACTIVE_SHIFT 7 44334ff6846SIoana Radulescu #define DPNI_HOLD_ACTIVE_SIZE 1 44434ff6846SIoana Radulescu 44534ff6846SIoana Radulescu struct dpni_rsp_get_queue { 44634ff6846SIoana Radulescu /* response word 0 */ 44734ff6846SIoana Radulescu __le64 pad0; 44834ff6846SIoana Radulescu /* response word 1 */ 44934ff6846SIoana Radulescu __le32 dest_id; 45034ff6846SIoana Radulescu __le16 pad1; 45134ff6846SIoana Radulescu u8 dest_prio; 45234ff6846SIoana Radulescu /* From LSB: dest_type:4, pad:2, flc_stash_ctrl:1, hold_active:1 */ 45334ff6846SIoana Radulescu u8 flags; 45434ff6846SIoana Radulescu /* response word 2 */ 45534ff6846SIoana Radulescu __le64 flc; 45634ff6846SIoana Radulescu /* response word 3 */ 45734ff6846SIoana Radulescu __le64 user_context; 45834ff6846SIoana Radulescu /* response word 4 */ 45934ff6846SIoana Radulescu __le32 fqid; 46034ff6846SIoana Radulescu __le16 qdbin; 46134ff6846SIoana Radulescu }; 46234ff6846SIoana Radulescu 46334ff6846SIoana Radulescu struct dpni_cmd_set_queue { 46434ff6846SIoana Radulescu /* cmd word 0 */ 46534ff6846SIoana Radulescu u8 qtype; 46634ff6846SIoana Radulescu u8 tc; 46734ff6846SIoana Radulescu u8 index; 46834ff6846SIoana Radulescu u8 options; 46934ff6846SIoana Radulescu __le32 pad0; 47034ff6846SIoana Radulescu /* cmd word 1 */ 47134ff6846SIoana Radulescu __le32 dest_id; 47234ff6846SIoana Radulescu __le16 pad1; 47334ff6846SIoana Radulescu u8 dest_prio; 47434ff6846SIoana Radulescu u8 flags; 47534ff6846SIoana Radulescu /* cmd word 2 */ 47634ff6846SIoana Radulescu __le64 flc; 47734ff6846SIoana Radulescu /* cmd word 3 */ 47834ff6846SIoana Radulescu __le64 user_context; 47934ff6846SIoana Radulescu }; 48034ff6846SIoana Radulescu 48134ff6846SIoana Radulescu struct dpni_cmd_set_taildrop { 48234ff6846SIoana Radulescu /* cmd word 0 */ 48334ff6846SIoana Radulescu u8 congestion_point; 48434ff6846SIoana Radulescu u8 qtype; 48534ff6846SIoana Radulescu u8 tc; 48634ff6846SIoana Radulescu u8 index; 48734ff6846SIoana Radulescu __le32 pad0; 48834ff6846SIoana Radulescu /* cmd word 1 */ 48934ff6846SIoana Radulescu /* Only least significant bit is relevant */ 49034ff6846SIoana Radulescu u8 enable; 49134ff6846SIoana Radulescu u8 pad1; 49234ff6846SIoana Radulescu u8 units; 49334ff6846SIoana Radulescu u8 pad2; 49434ff6846SIoana Radulescu __le32 threshold; 49534ff6846SIoana Radulescu }; 49634ff6846SIoana Radulescu 49734ff6846SIoana Radulescu struct dpni_cmd_get_taildrop { 49834ff6846SIoana Radulescu u8 congestion_point; 49934ff6846SIoana Radulescu u8 qtype; 50034ff6846SIoana Radulescu u8 tc; 50134ff6846SIoana Radulescu u8 index; 50234ff6846SIoana Radulescu }; 50334ff6846SIoana Radulescu 50434ff6846SIoana Radulescu struct dpni_rsp_get_taildrop { 50534ff6846SIoana Radulescu /* cmd word 0 */ 50634ff6846SIoana Radulescu __le64 pad0; 50734ff6846SIoana Radulescu /* cmd word 1 */ 50834ff6846SIoana Radulescu /* only least significant bit is relevant */ 50934ff6846SIoana Radulescu u8 enable; 51034ff6846SIoana Radulescu u8 pad1; 51134ff6846SIoana Radulescu u8 units; 51234ff6846SIoana Radulescu u8 pad2; 51334ff6846SIoana Radulescu __le32 threshold; 51434ff6846SIoana Radulescu }; 51534ff6846SIoana Radulescu 51634ff6846SIoana Radulescu struct dpni_rsp_get_api_version { 51734ff6846SIoana Radulescu __le16 major; 51834ff6846SIoana Radulescu __le16 minor; 51934ff6846SIoana Radulescu }; 52034ff6846SIoana Radulescu 5214aaaf9b9SIoana Radulescu #define DPNI_RX_FS_DIST_ENABLE_SHIFT 0 5224aaaf9b9SIoana Radulescu #define DPNI_RX_FS_DIST_ENABLE_SIZE 1 5234aaaf9b9SIoana Radulescu struct dpni_cmd_set_rx_fs_dist { 5244aaaf9b9SIoana Radulescu __le16 dist_size; 5254aaaf9b9SIoana Radulescu u8 enable; 5264aaaf9b9SIoana Radulescu u8 tc; 5274aaaf9b9SIoana Radulescu __le16 miss_flow_id; 5284aaaf9b9SIoana Radulescu __le16 pad; 5294aaaf9b9SIoana Radulescu __le64 key_cfg_iova; 5304aaaf9b9SIoana Radulescu }; 5314aaaf9b9SIoana Radulescu 532df85aeb9SIoana Radulescu #define DPNI_RX_HASH_DIST_ENABLE_SHIFT 0 533df85aeb9SIoana Radulescu #define DPNI_RX_HASH_DIST_ENABLE_SIZE 1 534df85aeb9SIoana Radulescu struct dpni_cmd_set_rx_hash_dist { 535df85aeb9SIoana Radulescu __le16 dist_size; 536df85aeb9SIoana Radulescu u8 enable; 537df85aeb9SIoana Radulescu u8 tc; 538df85aeb9SIoana Radulescu __le32 pad; 539df85aeb9SIoana Radulescu __le64 key_cfg_iova; 540df85aeb9SIoana Radulescu }; 541df85aeb9SIoana Radulescu 542*afb90dbbSIoana Radulescu struct dpni_cmd_add_fs_entry { 543*afb90dbbSIoana Radulescu /* cmd word 0 */ 544*afb90dbbSIoana Radulescu __le16 options; 545*afb90dbbSIoana Radulescu u8 tc_id; 546*afb90dbbSIoana Radulescu u8 key_size; 547*afb90dbbSIoana Radulescu __le16 index; 548*afb90dbbSIoana Radulescu __le16 flow_id; 549*afb90dbbSIoana Radulescu /* cmd word 1 */ 550*afb90dbbSIoana Radulescu __le64 key_iova; 551*afb90dbbSIoana Radulescu /* cmd word 2 */ 552*afb90dbbSIoana Radulescu __le64 mask_iova; 553*afb90dbbSIoana Radulescu /* cmd word 3 */ 554*afb90dbbSIoana Radulescu __le64 flc; 555*afb90dbbSIoana Radulescu }; 556*afb90dbbSIoana Radulescu 557*afb90dbbSIoana Radulescu struct dpni_cmd_remove_fs_entry { 558*afb90dbbSIoana Radulescu /* cmd word 0 */ 559*afb90dbbSIoana Radulescu __le16 pad0; 560*afb90dbbSIoana Radulescu u8 tc_id; 561*afb90dbbSIoana Radulescu u8 key_size; 562*afb90dbbSIoana Radulescu __le32 pad1; 563*afb90dbbSIoana Radulescu /* cmd word 1 */ 564*afb90dbbSIoana Radulescu __le64 key_iova; 565*afb90dbbSIoana Radulescu /* cmd word 2 */ 566*afb90dbbSIoana Radulescu __le64 mask_iova; 567*afb90dbbSIoana Radulescu }; 568*afb90dbbSIoana Radulescu 56934ff6846SIoana Radulescu #endif /* _FSL_DPNI_CMD_H */ 570