1f48298d3SIoana Ciornei /* SPDX-License-Identifier: GPL-2.0 */ 2f48298d3SIoana Ciornei /* 3f48298d3SIoana Ciornei * Copyright 2014-2016 Freescale Semiconductor Inc. 4f48298d3SIoana Ciornei * Copyright 2017-2021 NXP 5f48298d3SIoana Ciornei * 6f48298d3SIoana Ciornei */ 7f48298d3SIoana Ciornei 8f48298d3SIoana Ciornei #ifndef __FSL_DPSW_CMD_H 9f48298d3SIoana Ciornei #define __FSL_DPSW_CMD_H 10f48298d3SIoana Ciornei 11f48298d3SIoana Ciornei #include "dpsw.h" 12f48298d3SIoana Ciornei 13f48298d3SIoana Ciornei /* DPSW Version */ 14f48298d3SIoana Ciornei #define DPSW_VER_MAJOR 8 15f48298d3SIoana Ciornei #define DPSW_VER_MINOR 9 16f48298d3SIoana Ciornei 17f48298d3SIoana Ciornei #define DPSW_CMD_BASE_VERSION 1 18f48298d3SIoana Ciornei #define DPSW_CMD_VERSION_2 2 19f48298d3SIoana Ciornei #define DPSW_CMD_ID_OFFSET 4 20f48298d3SIoana Ciornei 21f48298d3SIoana Ciornei #define DPSW_CMD_ID(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_BASE_VERSION) 22f48298d3SIoana Ciornei #define DPSW_CMD_V2(id) (((id) << DPSW_CMD_ID_OFFSET) | DPSW_CMD_VERSION_2) 23f48298d3SIoana Ciornei 24f48298d3SIoana Ciornei /* Command IDs */ 25f48298d3SIoana Ciornei #define DPSW_CMDID_CLOSE DPSW_CMD_ID(0x800) 26f48298d3SIoana Ciornei #define DPSW_CMDID_OPEN DPSW_CMD_ID(0x802) 27f48298d3SIoana Ciornei 28f48298d3SIoana Ciornei #define DPSW_CMDID_GET_API_VERSION DPSW_CMD_ID(0xa02) 29f48298d3SIoana Ciornei 30f48298d3SIoana Ciornei #define DPSW_CMDID_ENABLE DPSW_CMD_ID(0x002) 31f48298d3SIoana Ciornei #define DPSW_CMDID_DISABLE DPSW_CMD_ID(0x003) 32f48298d3SIoana Ciornei #define DPSW_CMDID_GET_ATTR DPSW_CMD_V2(0x004) 33f48298d3SIoana Ciornei #define DPSW_CMDID_RESET DPSW_CMD_ID(0x005) 34f48298d3SIoana Ciornei 35f48298d3SIoana Ciornei #define DPSW_CMDID_SET_IRQ_ENABLE DPSW_CMD_ID(0x012) 36f48298d3SIoana Ciornei 37f48298d3SIoana Ciornei #define DPSW_CMDID_SET_IRQ_MASK DPSW_CMD_ID(0x014) 38f48298d3SIoana Ciornei 39f48298d3SIoana Ciornei #define DPSW_CMDID_GET_IRQ_STATUS DPSW_CMD_ID(0x016) 40f48298d3SIoana Ciornei #define DPSW_CMDID_CLEAR_IRQ_STATUS DPSW_CMD_ID(0x017) 41f48298d3SIoana Ciornei 42*cbc2a889SIoana Ciornei #define DPSW_CMDID_SET_REFLECTION_IF DPSW_CMD_ID(0x022) 43*cbc2a889SIoana Ciornei 44f48298d3SIoana Ciornei #define DPSW_CMDID_IF_SET_TCI DPSW_CMD_ID(0x030) 45f48298d3SIoana Ciornei #define DPSW_CMDID_IF_SET_STP DPSW_CMD_ID(0x031) 46f48298d3SIoana Ciornei 47f48298d3SIoana Ciornei #define DPSW_CMDID_IF_GET_COUNTER DPSW_CMD_V2(0x034) 48f48298d3SIoana Ciornei 49*cbc2a889SIoana Ciornei #define DPSW_CMDID_IF_ADD_REFLECTION DPSW_CMD_ID(0x037) 50*cbc2a889SIoana Ciornei #define DPSW_CMDID_IF_REMOVE_REFLECTION DPSW_CMD_ID(0x038) 51*cbc2a889SIoana Ciornei 52f48298d3SIoana Ciornei #define DPSW_CMDID_IF_ENABLE DPSW_CMD_ID(0x03D) 53f48298d3SIoana Ciornei #define DPSW_CMDID_IF_DISABLE DPSW_CMD_ID(0x03E) 54f48298d3SIoana Ciornei 55f48298d3SIoana Ciornei #define DPSW_CMDID_IF_GET_ATTR DPSW_CMD_ID(0x042) 56f48298d3SIoana Ciornei 57f48298d3SIoana Ciornei #define DPSW_CMDID_IF_SET_MAX_FRAME_LENGTH DPSW_CMD_ID(0x044) 58f48298d3SIoana Ciornei 59f48298d3SIoana Ciornei #define DPSW_CMDID_IF_GET_LINK_STATE DPSW_CMD_ID(0x046) 60f48298d3SIoana Ciornei 61f48298d3SIoana Ciornei #define DPSW_CMDID_IF_GET_TCI DPSW_CMD_ID(0x04A) 62f48298d3SIoana Ciornei 63f48298d3SIoana Ciornei #define DPSW_CMDID_IF_SET_LINK_CFG DPSW_CMD_ID(0x04C) 64f48298d3SIoana Ciornei 65f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_ADD DPSW_CMD_ID(0x060) 66f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_ADD_IF DPSW_CMD_V2(0x061) 67f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_ADD_IF_UNTAGGED DPSW_CMD_ID(0x062) 68f48298d3SIoana Ciornei 69f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_REMOVE_IF DPSW_CMD_ID(0x064) 70f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_REMOVE_IF_UNTAGGED DPSW_CMD_ID(0x065) 71f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_REMOVE_IF_FLOODING DPSW_CMD_ID(0x066) 72f48298d3SIoana Ciornei #define DPSW_CMDID_VLAN_REMOVE DPSW_CMD_ID(0x067) 73f48298d3SIoana Ciornei 74f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_ADD DPSW_CMD_ID(0x082) 75f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_REMOVE DPSW_CMD_ID(0x083) 76f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_ADD_UNICAST DPSW_CMD_ID(0x084) 77f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_REMOVE_UNICAST DPSW_CMD_ID(0x085) 78f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_ADD_MULTICAST DPSW_CMD_ID(0x086) 79f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_REMOVE_MULTICAST DPSW_CMD_ID(0x087) 80f48298d3SIoana Ciornei #define DPSW_CMDID_FDB_DUMP DPSW_CMD_ID(0x08A) 81f48298d3SIoana Ciornei 8290f07102SIoana Ciornei #define DPSW_CMDID_ACL_ADD DPSW_CMD_ID(0x090) 8390f07102SIoana Ciornei #define DPSW_CMDID_ACL_REMOVE DPSW_CMD_ID(0x091) 841a64ed12SIoana Ciornei #define DPSW_CMDID_ACL_ADD_ENTRY DPSW_CMD_ID(0x092) 851110318dSIoana Ciornei #define DPSW_CMDID_ACL_REMOVE_ENTRY DPSW_CMD_ID(0x093) 8690f07102SIoana Ciornei #define DPSW_CMDID_ACL_ADD_IF DPSW_CMD_ID(0x094) 8790f07102SIoana Ciornei #define DPSW_CMDID_ACL_REMOVE_IF DPSW_CMD_ID(0x095) 8890f07102SIoana Ciornei 89f48298d3SIoana Ciornei #define DPSW_CMDID_IF_GET_PORT_MAC_ADDR DPSW_CMD_ID(0x0A7) 90f48298d3SIoana Ciornei 91f48298d3SIoana Ciornei #define DPSW_CMDID_CTRL_IF_GET_ATTR DPSW_CMD_ID(0x0A0) 92f48298d3SIoana Ciornei #define DPSW_CMDID_CTRL_IF_SET_POOLS DPSW_CMD_ID(0x0A1) 93f48298d3SIoana Ciornei #define DPSW_CMDID_CTRL_IF_ENABLE DPSW_CMD_ID(0x0A2) 94f48298d3SIoana Ciornei #define DPSW_CMDID_CTRL_IF_DISABLE DPSW_CMD_ID(0x0A3) 95f48298d3SIoana Ciornei #define DPSW_CMDID_CTRL_IF_SET_QUEUE DPSW_CMD_ID(0x0A6) 96f48298d3SIoana Ciornei 97f48298d3SIoana Ciornei #define DPSW_CMDID_SET_EGRESS_FLOOD DPSW_CMD_ID(0x0AC) 981e7cbabfSIoana Ciornei #define DPSW_CMDID_IF_SET_LEARNING_MODE DPSW_CMD_ID(0x0AD) 99f48298d3SIoana Ciornei 100f48298d3SIoana Ciornei /* Macros for accessing command fields smaller than 1byte */ 101f48298d3SIoana Ciornei #define DPSW_MASK(field) \ 102f48298d3SIoana Ciornei GENMASK(DPSW_##field##_SHIFT + DPSW_##field##_SIZE - 1, \ 103f48298d3SIoana Ciornei DPSW_##field##_SHIFT) 104f48298d3SIoana Ciornei #define dpsw_set_field(var, field, val) \ 105f48298d3SIoana Ciornei ((var) |= (((val) << DPSW_##field##_SHIFT) & DPSW_MASK(field))) 106f48298d3SIoana Ciornei #define dpsw_get_field(var, field) \ 107f48298d3SIoana Ciornei (((var) & DPSW_MASK(field)) >> DPSW_##field##_SHIFT) 108f48298d3SIoana Ciornei #define dpsw_get_bit(var, bit) \ 109f48298d3SIoana Ciornei (((var) >> (bit)) & GENMASK(0, 0)) 110f48298d3SIoana Ciornei 111f48298d3SIoana Ciornei #pragma pack(push, 1) 112f48298d3SIoana Ciornei struct dpsw_cmd_open { 113f48298d3SIoana Ciornei __le32 dpsw_id; 114f48298d3SIoana Ciornei }; 115f48298d3SIoana Ciornei 116f48298d3SIoana Ciornei #define DPSW_COMPONENT_TYPE_SHIFT 0 117f48298d3SIoana Ciornei #define DPSW_COMPONENT_TYPE_SIZE 4 118f48298d3SIoana Ciornei 119f48298d3SIoana Ciornei struct dpsw_cmd_create { 120f48298d3SIoana Ciornei /* cmd word 0 */ 121f48298d3SIoana Ciornei __le16 num_ifs; 122f48298d3SIoana Ciornei u8 max_fdbs; 123f48298d3SIoana Ciornei u8 max_meters_per_if; 124f48298d3SIoana Ciornei /* from LSB: only the first 4 bits */ 125f48298d3SIoana Ciornei u8 component_type; 126f48298d3SIoana Ciornei u8 pad[3]; 127f48298d3SIoana Ciornei /* cmd word 1 */ 128f48298d3SIoana Ciornei __le16 max_vlans; 129f48298d3SIoana Ciornei __le16 max_fdb_entries; 130f48298d3SIoana Ciornei __le16 fdb_aging_time; 131f48298d3SIoana Ciornei __le16 max_fdb_mc_groups; 132f48298d3SIoana Ciornei /* cmd word 2 */ 133f48298d3SIoana Ciornei __le64 options; 134f48298d3SIoana Ciornei }; 135f48298d3SIoana Ciornei 136f48298d3SIoana Ciornei struct dpsw_cmd_destroy { 137f48298d3SIoana Ciornei __le32 dpsw_id; 138f48298d3SIoana Ciornei }; 139f48298d3SIoana Ciornei 140f48298d3SIoana Ciornei #define DPSW_ENABLE_SHIFT 0 141f48298d3SIoana Ciornei #define DPSW_ENABLE_SIZE 1 142f48298d3SIoana Ciornei 143f48298d3SIoana Ciornei struct dpsw_rsp_is_enabled { 144f48298d3SIoana Ciornei /* from LSB: enable:1 */ 145f48298d3SIoana Ciornei u8 enabled; 146f48298d3SIoana Ciornei }; 147f48298d3SIoana Ciornei 148f48298d3SIoana Ciornei struct dpsw_cmd_set_irq_enable { 149f48298d3SIoana Ciornei u8 enable_state; 150f48298d3SIoana Ciornei u8 pad[3]; 151f48298d3SIoana Ciornei u8 irq_index; 152f48298d3SIoana Ciornei }; 153f48298d3SIoana Ciornei 154f48298d3SIoana Ciornei struct dpsw_cmd_get_irq_enable { 155f48298d3SIoana Ciornei __le32 pad; 156f48298d3SIoana Ciornei u8 irq_index; 157f48298d3SIoana Ciornei }; 158f48298d3SIoana Ciornei 159f48298d3SIoana Ciornei struct dpsw_rsp_get_irq_enable { 160f48298d3SIoana Ciornei u8 enable_state; 161f48298d3SIoana Ciornei }; 162f48298d3SIoana Ciornei 163f48298d3SIoana Ciornei struct dpsw_cmd_set_irq_mask { 164f48298d3SIoana Ciornei __le32 mask; 165f48298d3SIoana Ciornei u8 irq_index; 166f48298d3SIoana Ciornei }; 167f48298d3SIoana Ciornei 168f48298d3SIoana Ciornei struct dpsw_cmd_get_irq_mask { 169f48298d3SIoana Ciornei __le32 pad; 170f48298d3SIoana Ciornei u8 irq_index; 171f48298d3SIoana Ciornei }; 172f48298d3SIoana Ciornei 173f48298d3SIoana Ciornei struct dpsw_rsp_get_irq_mask { 174f48298d3SIoana Ciornei __le32 mask; 175f48298d3SIoana Ciornei }; 176f48298d3SIoana Ciornei 177f48298d3SIoana Ciornei struct dpsw_cmd_get_irq_status { 178f48298d3SIoana Ciornei __le32 status; 179f48298d3SIoana Ciornei u8 irq_index; 180f48298d3SIoana Ciornei }; 181f48298d3SIoana Ciornei 182f48298d3SIoana Ciornei struct dpsw_rsp_get_irq_status { 183f48298d3SIoana Ciornei __le32 status; 184f48298d3SIoana Ciornei }; 185f48298d3SIoana Ciornei 186f48298d3SIoana Ciornei struct dpsw_cmd_clear_irq_status { 187f48298d3SIoana Ciornei __le32 status; 188f48298d3SIoana Ciornei u8 irq_index; 189f48298d3SIoana Ciornei }; 190f48298d3SIoana Ciornei 191f48298d3SIoana Ciornei #define DPSW_COMPONENT_TYPE_SHIFT 0 192f48298d3SIoana Ciornei #define DPSW_COMPONENT_TYPE_SIZE 4 193f48298d3SIoana Ciornei 194f48298d3SIoana Ciornei #define DPSW_FLOODING_CFG_SHIFT 0 195f48298d3SIoana Ciornei #define DPSW_FLOODING_CFG_SIZE 4 196f48298d3SIoana Ciornei 197f48298d3SIoana Ciornei #define DPSW_BROADCAST_CFG_SHIFT 4 198f48298d3SIoana Ciornei #define DPSW_BROADCAST_CFG_SIZE 4 199f48298d3SIoana Ciornei 200f48298d3SIoana Ciornei struct dpsw_rsp_get_attr { 201f48298d3SIoana Ciornei /* cmd word 0 */ 202f48298d3SIoana Ciornei __le16 num_ifs; 203f48298d3SIoana Ciornei u8 max_fdbs; 204f48298d3SIoana Ciornei u8 num_fdbs; 205f48298d3SIoana Ciornei __le16 max_vlans; 206f48298d3SIoana Ciornei __le16 num_vlans; 207f48298d3SIoana Ciornei /* cmd word 1 */ 208f48298d3SIoana Ciornei __le16 max_fdb_entries; 209f48298d3SIoana Ciornei __le16 fdb_aging_time; 210f48298d3SIoana Ciornei __le32 dpsw_id; 211f48298d3SIoana Ciornei /* cmd word 2 */ 212f48298d3SIoana Ciornei __le16 mem_size; 213f48298d3SIoana Ciornei __le16 max_fdb_mc_groups; 214f48298d3SIoana Ciornei u8 max_meters_per_if; 215f48298d3SIoana Ciornei /* from LSB only the first 4 bits */ 216f48298d3SIoana Ciornei u8 component_type; 217f48298d3SIoana Ciornei /* [0:3] - flooding configuration 218f48298d3SIoana Ciornei * [4:7] - broadcast configuration 219f48298d3SIoana Ciornei */ 220f48298d3SIoana Ciornei u8 repl_cfg; 221f48298d3SIoana Ciornei u8 pad; 222f48298d3SIoana Ciornei /* cmd word 3 */ 223f48298d3SIoana Ciornei __le64 options; 224f48298d3SIoana Ciornei }; 225f48298d3SIoana Ciornei 226f48298d3SIoana Ciornei #define DPSW_VLAN_ID_SHIFT 0 227f48298d3SIoana Ciornei #define DPSW_VLAN_ID_SIZE 12 228f48298d3SIoana Ciornei #define DPSW_DEI_SHIFT 12 229f48298d3SIoana Ciornei #define DPSW_DEI_SIZE 1 230f48298d3SIoana Ciornei #define DPSW_PCP_SHIFT 13 231f48298d3SIoana Ciornei #define DPSW_PCP_SIZE 3 232f48298d3SIoana Ciornei 233f48298d3SIoana Ciornei struct dpsw_cmd_if_set_tci { 234f48298d3SIoana Ciornei __le16 if_id; 235f48298d3SIoana Ciornei /* from LSB: VLAN_ID:12 DEI:1 PCP:3 */ 236f48298d3SIoana Ciornei __le16 conf; 237f48298d3SIoana Ciornei }; 238f48298d3SIoana Ciornei 239f48298d3SIoana Ciornei struct dpsw_cmd_if_get_tci { 240f48298d3SIoana Ciornei __le16 if_id; 241f48298d3SIoana Ciornei }; 242f48298d3SIoana Ciornei 243f48298d3SIoana Ciornei struct dpsw_rsp_if_get_tci { 244f48298d3SIoana Ciornei __le16 pad; 245f48298d3SIoana Ciornei __le16 vlan_id; 246f48298d3SIoana Ciornei u8 dei; 247f48298d3SIoana Ciornei u8 pcp; 248f48298d3SIoana Ciornei }; 249f48298d3SIoana Ciornei 250f48298d3SIoana Ciornei #define DPSW_STATE_SHIFT 0 251f48298d3SIoana Ciornei #define DPSW_STATE_SIZE 4 252f48298d3SIoana Ciornei 253f48298d3SIoana Ciornei struct dpsw_cmd_if_set_stp { 254f48298d3SIoana Ciornei __le16 if_id; 255f48298d3SIoana Ciornei __le16 vlan_id; 256f48298d3SIoana Ciornei /* only the first LSB 4 bits */ 257f48298d3SIoana Ciornei u8 state; 258f48298d3SIoana Ciornei }; 259f48298d3SIoana Ciornei 260f48298d3SIoana Ciornei #define DPSW_COUNTER_TYPE_SHIFT 0 261f48298d3SIoana Ciornei #define DPSW_COUNTER_TYPE_SIZE 5 262f48298d3SIoana Ciornei 263f48298d3SIoana Ciornei struct dpsw_cmd_if_get_counter { 264f48298d3SIoana Ciornei __le16 if_id; 265f48298d3SIoana Ciornei /* from LSB: type:5 */ 266f48298d3SIoana Ciornei u8 type; 267f48298d3SIoana Ciornei }; 268f48298d3SIoana Ciornei 269f48298d3SIoana Ciornei struct dpsw_rsp_if_get_counter { 270f48298d3SIoana Ciornei __le64 pad; 271f48298d3SIoana Ciornei __le64 counter; 272f48298d3SIoana Ciornei }; 273f48298d3SIoana Ciornei 274f48298d3SIoana Ciornei struct dpsw_cmd_if { 275f48298d3SIoana Ciornei __le16 if_id; 276f48298d3SIoana Ciornei }; 277f48298d3SIoana Ciornei 278f48298d3SIoana Ciornei #define DPSW_ADMIT_UNTAGGED_SHIFT 0 279f48298d3SIoana Ciornei #define DPSW_ADMIT_UNTAGGED_SIZE 4 280f48298d3SIoana Ciornei #define DPSW_ENABLED_SHIFT 5 281f48298d3SIoana Ciornei #define DPSW_ENABLED_SIZE 1 282f48298d3SIoana Ciornei #define DPSW_ACCEPT_ALL_VLAN_SHIFT 6 283f48298d3SIoana Ciornei #define DPSW_ACCEPT_ALL_VLAN_SIZE 1 284f48298d3SIoana Ciornei 285f48298d3SIoana Ciornei struct dpsw_rsp_if_get_attr { 286f48298d3SIoana Ciornei /* cmd word 0 */ 287f48298d3SIoana Ciornei /* from LSB: admit_untagged:4 enabled:1 accept_all_vlan:1 */ 288f48298d3SIoana Ciornei u8 conf; 289f48298d3SIoana Ciornei u8 pad1; 290f48298d3SIoana Ciornei u8 num_tcs; 291f48298d3SIoana Ciornei u8 pad2; 292f48298d3SIoana Ciornei __le16 qdid; 293f48298d3SIoana Ciornei /* cmd word 1 */ 294f48298d3SIoana Ciornei __le32 options; 295f48298d3SIoana Ciornei __le32 pad3; 296f48298d3SIoana Ciornei /* cmd word 2 */ 297f48298d3SIoana Ciornei __le32 rate; 298f48298d3SIoana Ciornei }; 299f48298d3SIoana Ciornei 300f48298d3SIoana Ciornei struct dpsw_cmd_if_set_max_frame_length { 301f48298d3SIoana Ciornei __le16 if_id; 302f48298d3SIoana Ciornei __le16 frame_length; 303f48298d3SIoana Ciornei }; 304f48298d3SIoana Ciornei 305f48298d3SIoana Ciornei struct dpsw_cmd_if_set_link_cfg { 306f48298d3SIoana Ciornei /* cmd word 0 */ 307f48298d3SIoana Ciornei __le16 if_id; 308f48298d3SIoana Ciornei u8 pad[6]; 309f48298d3SIoana Ciornei /* cmd word 1 */ 310f48298d3SIoana Ciornei __le32 rate; 311f48298d3SIoana Ciornei __le32 pad1; 312f48298d3SIoana Ciornei /* cmd word 2 */ 313f48298d3SIoana Ciornei __le64 options; 314f48298d3SIoana Ciornei }; 315f48298d3SIoana Ciornei 316f48298d3SIoana Ciornei struct dpsw_cmd_if_get_link_state { 317f48298d3SIoana Ciornei __le16 if_id; 318f48298d3SIoana Ciornei }; 319f48298d3SIoana Ciornei 320f48298d3SIoana Ciornei #define DPSW_UP_SHIFT 0 321f48298d3SIoana Ciornei #define DPSW_UP_SIZE 1 322f48298d3SIoana Ciornei 323f48298d3SIoana Ciornei struct dpsw_rsp_if_get_link_state { 324f48298d3SIoana Ciornei /* cmd word 0 */ 325f48298d3SIoana Ciornei __le32 pad0; 326f48298d3SIoana Ciornei u8 up; 327f48298d3SIoana Ciornei u8 pad1[3]; 328f48298d3SIoana Ciornei /* cmd word 1 */ 329f48298d3SIoana Ciornei __le32 rate; 330f48298d3SIoana Ciornei __le32 pad2; 331f48298d3SIoana Ciornei /* cmd word 2 */ 332f48298d3SIoana Ciornei __le64 options; 333f48298d3SIoana Ciornei }; 334f48298d3SIoana Ciornei 335f48298d3SIoana Ciornei struct dpsw_vlan_add { 336f48298d3SIoana Ciornei __le16 fdb_id; 337f48298d3SIoana Ciornei __le16 vlan_id; 338f48298d3SIoana Ciornei }; 339f48298d3SIoana Ciornei 340f48298d3SIoana Ciornei struct dpsw_cmd_vlan_add_if { 341f48298d3SIoana Ciornei /* cmd word 0 */ 342f48298d3SIoana Ciornei __le16 options; 343f48298d3SIoana Ciornei __le16 vlan_id; 344f48298d3SIoana Ciornei __le16 fdb_id; 345f48298d3SIoana Ciornei __le16 pad0; 346f48298d3SIoana Ciornei /* cmd word 1-4 */ 347f48298d3SIoana Ciornei __le64 if_id; 348f48298d3SIoana Ciornei }; 349f48298d3SIoana Ciornei 350f48298d3SIoana Ciornei struct dpsw_cmd_vlan_manage_if { 351f48298d3SIoana Ciornei /* cmd word 0 */ 352f48298d3SIoana Ciornei __le16 pad0; 353f48298d3SIoana Ciornei __le16 vlan_id; 354f48298d3SIoana Ciornei __le32 pad1; 355f48298d3SIoana Ciornei /* cmd word 1-4 */ 3562b7e3f7dSIoana Ciornei __le64 if_id; 357f48298d3SIoana Ciornei }; 358f48298d3SIoana Ciornei 359f48298d3SIoana Ciornei struct dpsw_cmd_vlan_remove { 360f48298d3SIoana Ciornei __le16 pad; 361f48298d3SIoana Ciornei __le16 vlan_id; 362f48298d3SIoana Ciornei }; 363f48298d3SIoana Ciornei 364f48298d3SIoana Ciornei struct dpsw_cmd_fdb_add { 365f48298d3SIoana Ciornei __le32 pad; 366f48298d3SIoana Ciornei __le16 fdb_ageing_time; 367f48298d3SIoana Ciornei __le16 num_fdb_entries; 368f48298d3SIoana Ciornei }; 369f48298d3SIoana Ciornei 370f48298d3SIoana Ciornei struct dpsw_rsp_fdb_add { 371f48298d3SIoana Ciornei __le16 fdb_id; 372f48298d3SIoana Ciornei }; 373f48298d3SIoana Ciornei 374f48298d3SIoana Ciornei struct dpsw_cmd_fdb_remove { 375f48298d3SIoana Ciornei __le16 fdb_id; 376f48298d3SIoana Ciornei }; 377f48298d3SIoana Ciornei 378f48298d3SIoana Ciornei #define DPSW_ENTRY_TYPE_SHIFT 0 379f48298d3SIoana Ciornei #define DPSW_ENTRY_TYPE_SIZE 4 380f48298d3SIoana Ciornei 381f48298d3SIoana Ciornei struct dpsw_cmd_fdb_unicast_op { 382f48298d3SIoana Ciornei /* cmd word 0 */ 383f48298d3SIoana Ciornei __le16 fdb_id; 384f48298d3SIoana Ciornei u8 mac_addr[6]; 385f48298d3SIoana Ciornei /* cmd word 1 */ 386f48298d3SIoana Ciornei __le16 if_egress; 387f48298d3SIoana Ciornei /* only the first 4 bits from LSB */ 388f48298d3SIoana Ciornei u8 type; 389f48298d3SIoana Ciornei }; 390f48298d3SIoana Ciornei 391f48298d3SIoana Ciornei struct dpsw_cmd_fdb_multicast_op { 392f48298d3SIoana Ciornei /* cmd word 0 */ 393f48298d3SIoana Ciornei __le16 fdb_id; 394f48298d3SIoana Ciornei __le16 num_ifs; 395f48298d3SIoana Ciornei /* only the first 4 bits from LSB */ 396f48298d3SIoana Ciornei u8 type; 397f48298d3SIoana Ciornei u8 pad[3]; 398f48298d3SIoana Ciornei /* cmd word 1 */ 399f48298d3SIoana Ciornei u8 mac_addr[6]; 400f48298d3SIoana Ciornei __le16 pad2; 401f48298d3SIoana Ciornei /* cmd word 2-5 */ 4022b7e3f7dSIoana Ciornei __le64 if_id; 403f48298d3SIoana Ciornei }; 404f48298d3SIoana Ciornei 405f48298d3SIoana Ciornei struct dpsw_cmd_fdb_dump { 406f48298d3SIoana Ciornei __le16 fdb_id; 407f48298d3SIoana Ciornei __le16 pad0; 408f48298d3SIoana Ciornei __le32 pad1; 409f48298d3SIoana Ciornei __le64 iova_addr; 410f48298d3SIoana Ciornei __le32 iova_size; 411f48298d3SIoana Ciornei }; 412f48298d3SIoana Ciornei 413f48298d3SIoana Ciornei struct dpsw_rsp_fdb_dump { 414f48298d3SIoana Ciornei __le16 num_entries; 415f48298d3SIoana Ciornei }; 416f48298d3SIoana Ciornei 417f48298d3SIoana Ciornei struct dpsw_rsp_ctrl_if_get_attr { 418f48298d3SIoana Ciornei __le64 pad; 419f48298d3SIoana Ciornei __le32 rx_fqid; 420f48298d3SIoana Ciornei __le32 rx_err_fqid; 421f48298d3SIoana Ciornei __le32 tx_err_conf_fqid; 422f48298d3SIoana Ciornei }; 423f48298d3SIoana Ciornei 424f48298d3SIoana Ciornei #define DPSW_BACKUP_POOL(val, order) (((val) & 0x1) << (order)) 425f48298d3SIoana Ciornei struct dpsw_cmd_ctrl_if_set_pools { 426f48298d3SIoana Ciornei u8 num_dpbp; 427f48298d3SIoana Ciornei u8 backup_pool_mask; 428f48298d3SIoana Ciornei __le16 pad; 429f48298d3SIoana Ciornei __le32 dpbp_id[DPSW_MAX_DPBP]; 430f48298d3SIoana Ciornei __le16 buffer_size[DPSW_MAX_DPBP]; 431f48298d3SIoana Ciornei }; 432f48298d3SIoana Ciornei 433f48298d3SIoana Ciornei #define DPSW_DEST_TYPE_SHIFT 0 434f48298d3SIoana Ciornei #define DPSW_DEST_TYPE_SIZE 4 435f48298d3SIoana Ciornei 436f48298d3SIoana Ciornei struct dpsw_cmd_ctrl_if_set_queue { 437f48298d3SIoana Ciornei __le32 dest_id; 438f48298d3SIoana Ciornei u8 dest_priority; 439f48298d3SIoana Ciornei u8 pad; 440f48298d3SIoana Ciornei /* from LSB: dest_type:4 */ 441f48298d3SIoana Ciornei u8 dest_type; 442f48298d3SIoana Ciornei u8 qtype; 443f48298d3SIoana Ciornei __le64 user_ctx; 444f48298d3SIoana Ciornei __le32 options; 445f48298d3SIoana Ciornei }; 446f48298d3SIoana Ciornei 447f48298d3SIoana Ciornei struct dpsw_rsp_get_api_version { 448f48298d3SIoana Ciornei __le16 version_major; 449f48298d3SIoana Ciornei __le16 version_minor; 450f48298d3SIoana Ciornei }; 451f48298d3SIoana Ciornei 452f48298d3SIoana Ciornei struct dpsw_rsp_if_get_mac_addr { 453f48298d3SIoana Ciornei __le16 pad; 454f48298d3SIoana Ciornei u8 mac_addr[6]; 455f48298d3SIoana Ciornei }; 456f48298d3SIoana Ciornei 457f48298d3SIoana Ciornei struct dpsw_cmd_set_egress_flood { 458f48298d3SIoana Ciornei __le16 fdb_id; 459f48298d3SIoana Ciornei u8 flood_type; 460f48298d3SIoana Ciornei u8 pad[5]; 461f48298d3SIoana Ciornei __le64 if_id; 462f48298d3SIoana Ciornei }; 4631e7cbabfSIoana Ciornei 4641e7cbabfSIoana Ciornei #define DPSW_LEARNING_MODE_SHIFT 0 4651e7cbabfSIoana Ciornei #define DPSW_LEARNING_MODE_SIZE 4 4661e7cbabfSIoana Ciornei 4671e7cbabfSIoana Ciornei struct dpsw_cmd_if_set_learning_mode { 4681e7cbabfSIoana Ciornei __le16 if_id; 4691e7cbabfSIoana Ciornei /* only the first 4 bits from LSB */ 4701e7cbabfSIoana Ciornei u8 mode; 4711e7cbabfSIoana Ciornei }; 47290f07102SIoana Ciornei 47390f07102SIoana Ciornei struct dpsw_cmd_acl_add { 47490f07102SIoana Ciornei __le16 pad; 47590f07102SIoana Ciornei __le16 max_entries; 47690f07102SIoana Ciornei }; 47790f07102SIoana Ciornei 47890f07102SIoana Ciornei struct dpsw_rsp_acl_add { 47990f07102SIoana Ciornei __le16 acl_id; 48090f07102SIoana Ciornei }; 48190f07102SIoana Ciornei 48290f07102SIoana Ciornei struct dpsw_cmd_acl_remove { 48390f07102SIoana Ciornei __le16 acl_id; 48490f07102SIoana Ciornei }; 48590f07102SIoana Ciornei 48690f07102SIoana Ciornei struct dpsw_cmd_acl_if { 48790f07102SIoana Ciornei __le16 acl_id; 48890f07102SIoana Ciornei __le16 num_ifs; 48990f07102SIoana Ciornei __le32 pad; 49090f07102SIoana Ciornei __le64 if_id; 49190f07102SIoana Ciornei }; 49290f07102SIoana Ciornei 4931a64ed12SIoana Ciornei struct dpsw_prep_acl_entry { 4941a64ed12SIoana Ciornei u8 match_l2_dest_mac[6]; 4951a64ed12SIoana Ciornei __le16 match_l2_tpid; 4961a64ed12SIoana Ciornei 4971a64ed12SIoana Ciornei u8 match_l2_source_mac[6]; 4981a64ed12SIoana Ciornei __le16 match_l2_vlan_id; 4991a64ed12SIoana Ciornei 5001a64ed12SIoana Ciornei __le32 match_l3_dest_ip; 5011a64ed12SIoana Ciornei __le32 match_l3_source_ip; 5021a64ed12SIoana Ciornei 5031a64ed12SIoana Ciornei __le16 match_l4_dest_port; 5041a64ed12SIoana Ciornei __le16 match_l4_source_port; 5051a64ed12SIoana Ciornei __le16 match_l2_ether_type; 5061a64ed12SIoana Ciornei u8 match_l2_pcp_dei; 5071a64ed12SIoana Ciornei u8 match_l3_dscp; 5081a64ed12SIoana Ciornei 5091a64ed12SIoana Ciornei u8 mask_l2_dest_mac[6]; 5101a64ed12SIoana Ciornei __le16 mask_l2_tpid; 5111a64ed12SIoana Ciornei 5121a64ed12SIoana Ciornei u8 mask_l2_source_mac[6]; 5131a64ed12SIoana Ciornei __le16 mask_l2_vlan_id; 5141a64ed12SIoana Ciornei 5151a64ed12SIoana Ciornei __le32 mask_l3_dest_ip; 5161a64ed12SIoana Ciornei __le32 mask_l3_source_ip; 5171a64ed12SIoana Ciornei 5181a64ed12SIoana Ciornei __le16 mask_l4_dest_port; 5191a64ed12SIoana Ciornei __le16 mask_l4_source_port; 5201a64ed12SIoana Ciornei __le16 mask_l2_ether_type; 5211a64ed12SIoana Ciornei u8 mask_l2_pcp_dei; 5221a64ed12SIoana Ciornei u8 mask_l3_dscp; 5231a64ed12SIoana Ciornei 5241a64ed12SIoana Ciornei u8 match_l3_protocol; 5251a64ed12SIoana Ciornei u8 mask_l3_protocol; 5261a64ed12SIoana Ciornei }; 5271a64ed12SIoana Ciornei 5281a64ed12SIoana Ciornei #define DPSW_RESULT_ACTION_SHIFT 0 5291a64ed12SIoana Ciornei #define DPSW_RESULT_ACTION_SIZE 4 5301a64ed12SIoana Ciornei 5311a64ed12SIoana Ciornei struct dpsw_cmd_acl_entry { 5321a64ed12SIoana Ciornei __le16 acl_id; 5331a64ed12SIoana Ciornei __le16 result_if_id; 5341a64ed12SIoana Ciornei __le32 precedence; 5351a64ed12SIoana Ciornei /* from LSB only the first 4 bits */ 5361a64ed12SIoana Ciornei u8 result_action; 5371a64ed12SIoana Ciornei u8 pad[7]; 5381a64ed12SIoana Ciornei __le64 pad2[4]; 5391a64ed12SIoana Ciornei __le64 key_iova; 5401a64ed12SIoana Ciornei }; 541*cbc2a889SIoana Ciornei 542*cbc2a889SIoana Ciornei struct dpsw_cmd_set_reflection_if { 543*cbc2a889SIoana Ciornei __le16 if_id; 544*cbc2a889SIoana Ciornei }; 545*cbc2a889SIoana Ciornei 546*cbc2a889SIoana Ciornei #define DPSW_FILTER_SHIFT 0 547*cbc2a889SIoana Ciornei #define DPSW_FILTER_SIZE 2 548*cbc2a889SIoana Ciornei 549*cbc2a889SIoana Ciornei struct dpsw_cmd_if_reflection { 550*cbc2a889SIoana Ciornei __le16 if_id; 551*cbc2a889SIoana Ciornei __le16 vlan_id; 552*cbc2a889SIoana Ciornei /* only 2 bits from the LSB */ 553*cbc2a889SIoana Ciornei u8 filter; 554*cbc2a889SIoana Ciornei }; 555f48298d3SIoana Ciornei #pragma pack(pop) 556f48298d3SIoana Ciornei #endif /* __FSL_DPSW_CMD_H */ 557