162306a36Sopenharmony_ci/* SPDX-License-Identifier: (GPL-2.0 OR MIT) 262306a36Sopenharmony_ci * Microsemi Ocelot Switch driver 362306a36Sopenharmony_ci * Copyright (c) 2019 Microsemi Corporation 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#ifndef _OCELOT_VCAP_H_ 762306a36Sopenharmony_ci#define _OCELOT_VCAP_H_ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <soc/mscc/ocelot.h> 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci/* Cookie definitions for private VCAP filters installed by the driver. 1262306a36Sopenharmony_ci * Must be unique per VCAP block. 1362306a36Sopenharmony_ci */ 1462306a36Sopenharmony_ci#define OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream) ((upstream) << 16 | (port)) 1562306a36Sopenharmony_ci#define OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port) (port) 1662306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port) (port) 1762306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_MRP_REDIRECT(ocelot, port) ((ocelot)->num_phys_ports + (port)) 1862306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_MRP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2) 1962306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_L2_PTP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2 + 1) 2062306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_IPV4_GEN_PTP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2 + 2) 2162306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_IPV4_EV_PTP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2 + 3) 2262306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_IPV6_GEN_PTP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2 + 4) 2362306a36Sopenharmony_ci#define OCELOT_VCAP_IS2_IPV6_EV_PTP_TRAP(ocelot) ((ocelot)->num_phys_ports * 2 + 5) 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* ================================================================= 2662306a36Sopenharmony_ci * VCAP Common 2762306a36Sopenharmony_ci * ================================================================= 2862306a36Sopenharmony_ci */ 2962306a36Sopenharmony_ci 3062306a36Sopenharmony_cienum { 3162306a36Sopenharmony_ci VCAP_ES0, 3262306a36Sopenharmony_ci VCAP_IS1, 3362306a36Sopenharmony_ci VCAP_IS2, 3462306a36Sopenharmony_ci __VCAP_COUNT, 3562306a36Sopenharmony_ci}; 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#define OCELOT_NUM_VCAP_BLOCKS __VCAP_COUNT 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_cistruct vcap_props { 4062306a36Sopenharmony_ci u16 tg_width; /* Type-group width (in bits) */ 4162306a36Sopenharmony_ci u16 sw_count; /* Sub word count */ 4262306a36Sopenharmony_ci u16 entry_count; /* Entry count */ 4362306a36Sopenharmony_ci u16 entry_words; /* Number of entry words */ 4462306a36Sopenharmony_ci u16 entry_width; /* Entry width (in bits) */ 4562306a36Sopenharmony_ci u16 action_count; /* Action count */ 4662306a36Sopenharmony_ci u16 action_words; /* Number of action words */ 4762306a36Sopenharmony_ci u16 action_width; /* Action width (in bits) */ 4862306a36Sopenharmony_ci u16 action_type_width; /* Action type width (in bits) */ 4962306a36Sopenharmony_ci struct { 5062306a36Sopenharmony_ci u16 width; /* Action type width (in bits) */ 5162306a36Sopenharmony_ci u16 count; /* Action type sub word count */ 5262306a36Sopenharmony_ci } action_table[2]; 5362306a36Sopenharmony_ci u16 counter_words; /* Number of counter words */ 5462306a36Sopenharmony_ci u16 counter_width; /* Counter width (in bits) */ 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci enum ocelot_target target; 5762306a36Sopenharmony_ci 5862306a36Sopenharmony_ci const struct vcap_field *keys; 5962306a36Sopenharmony_ci const struct vcap_field *actions; 6062306a36Sopenharmony_ci}; 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci/* VCAP Type-Group values */ 6362306a36Sopenharmony_ci#define VCAP_TG_NONE 0 /* Entry is invalid */ 6462306a36Sopenharmony_ci#define VCAP_TG_FULL 1 /* Full entry */ 6562306a36Sopenharmony_ci#define VCAP_TG_HALF 2 /* Half entry */ 6662306a36Sopenharmony_ci#define VCAP_TG_QUARTER 3 /* Quarter entry */ 6762306a36Sopenharmony_ci 6862306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD(x) (((x) << 22) & GENMASK(24, 22)) 6962306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_M GENMASK(24, 22) 7062306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_X(x) (((x) & GENMASK(24, 22)) >> 22) 7162306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_ENTRY_DIS BIT(21) 7262306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_ACTION_DIS BIT(20) 7362306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_CNT_DIS BIT(19) 7462306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR(x) (((x) << 3) & GENMASK(18, 3)) 7562306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_M GENMASK(18, 3) 7662306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_X(x) (((x) & GENMASK(18, 3)) >> 3) 7762306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_UPDATE_SHOT BIT(2) 7862306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_CLEAR_CACHE BIT(1) 7962306a36Sopenharmony_ci#define VCAP_CORE_UPDATE_CTRL_MV_TRAFFIC_IGN BIT(0) 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci#define VCAP_CORE_MV_CFG_MV_NUM_POS(x) (((x) << 16) & GENMASK(31, 16)) 8262306a36Sopenharmony_ci#define VCAP_CORE_MV_CFG_MV_NUM_POS_M GENMASK(31, 16) 8362306a36Sopenharmony_ci#define VCAP_CORE_MV_CFG_MV_NUM_POS_X(x) (((x) & GENMASK(31, 16)) >> 16) 8462306a36Sopenharmony_ci#define VCAP_CORE_MV_CFG_MV_SIZE(x) ((x) & GENMASK(15, 0)) 8562306a36Sopenharmony_ci#define VCAP_CORE_MV_CFG_MV_SIZE_M GENMASK(15, 0) 8662306a36Sopenharmony_ci 8762306a36Sopenharmony_ci#define VCAP_CACHE_ENTRY_DAT_RSZ 0x4 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci#define VCAP_CACHE_MASK_DAT_RSZ 0x4 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci#define VCAP_CACHE_ACTION_DAT_RSZ 0x4 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci#define VCAP_CACHE_CNT_DAT_RSZ 0x4 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define VCAP_STICKY_VCAP_ROW_DELETED_STICKY BIT(0) 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci#define TCAM_BIST_CTRL_TCAM_BIST BIT(1) 9862306a36Sopenharmony_ci#define TCAM_BIST_CTRL_TCAM_INIT BIT(0) 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#define TCAM_BIST_CFG_TCAM_BIST_SOE_ENA BIT(8) 10162306a36Sopenharmony_ci#define TCAM_BIST_CFG_TCAM_HCG_DIS BIT(7) 10262306a36Sopenharmony_ci#define TCAM_BIST_CFG_TCAM_CG_DIS BIT(6) 10362306a36Sopenharmony_ci#define TCAM_BIST_CFG_TCAM_BIAS(x) ((x) & GENMASK(5, 0)) 10462306a36Sopenharmony_ci#define TCAM_BIST_CFG_TCAM_BIAS_M GENMASK(5, 0) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_RT_ERR BIT(15) 10762306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_PENC_ERR BIT(14) 10862306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_COMP_ERR BIT(13) 10962306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_ADDR_ERR BIT(12) 11062306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_BL1E_ERR BIT(11) 11162306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_BL1_ERR BIT(10) 11262306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_BL0E_ERR BIT(9) 11362306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_BL0_ERR BIT(8) 11462306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_PH1_ERR BIT(7) 11562306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_PH0_ERR BIT(6) 11662306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_PV1_ERR BIT(5) 11762306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_PV0_ERR BIT(4) 11862306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_RUN BIT(3) 11962306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_ERR BIT(2) 12062306a36Sopenharmony_ci#define TCAM_BIST_STAT_BIST_BUSY BIT(1) 12162306a36Sopenharmony_ci#define TCAM_BIST_STAT_TCAM_RDY BIT(0) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci/* ================================================================= 12462306a36Sopenharmony_ci * VCAP IS2 12562306a36Sopenharmony_ci * ================================================================= 12662306a36Sopenharmony_ci */ 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci/* IS2 half key types */ 12962306a36Sopenharmony_ci#define IS2_TYPE_ETYPE 0 13062306a36Sopenharmony_ci#define IS2_TYPE_LLC 1 13162306a36Sopenharmony_ci#define IS2_TYPE_SNAP 2 13262306a36Sopenharmony_ci#define IS2_TYPE_ARP 3 13362306a36Sopenharmony_ci#define IS2_TYPE_IP_UDP_TCP 4 13462306a36Sopenharmony_ci#define IS2_TYPE_IP_OTHER 5 13562306a36Sopenharmony_ci#define IS2_TYPE_IPV6 6 13662306a36Sopenharmony_ci#define IS2_TYPE_OAM 7 13762306a36Sopenharmony_ci#define IS2_TYPE_SMAC_SIP6 8 13862306a36Sopenharmony_ci#define IS2_TYPE_ANY 100 /* Pseudo type */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci/* IS2 half key type mask for matching any IP */ 14162306a36Sopenharmony_ci#define IS2_TYPE_MASK_IP_ANY 0xe 14262306a36Sopenharmony_ci 14362306a36Sopenharmony_cienum { 14462306a36Sopenharmony_ci IS2_ACTION_TYPE_NORMAL, 14562306a36Sopenharmony_ci IS2_ACTION_TYPE_SMAC_SIP, 14662306a36Sopenharmony_ci IS2_ACTION_TYPE_MAX, 14762306a36Sopenharmony_ci}; 14862306a36Sopenharmony_ci 14962306a36Sopenharmony_ci/* IS2 MASK_MODE values */ 15062306a36Sopenharmony_ci#define IS2_ACT_MASK_MODE_NONE 0 15162306a36Sopenharmony_ci#define IS2_ACT_MASK_MODE_FILTER 1 15262306a36Sopenharmony_ci#define IS2_ACT_MASK_MODE_POLICY 2 15362306a36Sopenharmony_ci#define IS2_ACT_MASK_MODE_REDIR 3 15462306a36Sopenharmony_ci 15562306a36Sopenharmony_ci/* IS2 REW_OP values */ 15662306a36Sopenharmony_ci#define IS2_ACT_REW_OP_NONE 0 15762306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ONE 2 15862306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_TWO 3 15962306a36Sopenharmony_ci#define IS2_ACT_REW_OP_SPECIAL 8 16062306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ORG 9 16162306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_1 (IS2_ACT_REW_OP_PTP_ONE | (1 << 3)) 16262306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_2 (IS2_ACT_REW_OP_PTP_ONE | (2 << 3)) 16362306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ONE_ADD_DELAY (IS2_ACT_REW_OP_PTP_ONE | (1 << 5)) 16462306a36Sopenharmony_ci#define IS2_ACT_REW_OP_PTP_ONE_ADD_SUB BIT(7) 16562306a36Sopenharmony_ci 16662306a36Sopenharmony_ci#define VCAP_PORT_WIDTH 4 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci/* IS2 quarter key - SMAC_SIP4 */ 16962306a36Sopenharmony_ci#define IS2_QKO_IGR_PORT 0 17062306a36Sopenharmony_ci#define IS2_QKL_IGR_PORT VCAP_PORT_WIDTH 17162306a36Sopenharmony_ci#define IS2_QKO_L2_SMAC (IS2_QKO_IGR_PORT + IS2_QKL_IGR_PORT) 17262306a36Sopenharmony_ci#define IS2_QKL_L2_SMAC 48 17362306a36Sopenharmony_ci#define IS2_QKO_L3_IP4_SIP (IS2_QKO_L2_SMAC + IS2_QKL_L2_SMAC) 17462306a36Sopenharmony_ci#define IS2_QKL_L3_IP4_SIP 32 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_cienum vcap_is2_half_key_field { 17762306a36Sopenharmony_ci /* Common */ 17862306a36Sopenharmony_ci VCAP_IS2_TYPE, 17962306a36Sopenharmony_ci VCAP_IS2_HK_FIRST, 18062306a36Sopenharmony_ci VCAP_IS2_HK_PAG, 18162306a36Sopenharmony_ci VCAP_IS2_HK_RSV1, 18262306a36Sopenharmony_ci VCAP_IS2_HK_IGR_PORT_MASK, 18362306a36Sopenharmony_ci VCAP_IS2_HK_RSV2, 18462306a36Sopenharmony_ci VCAP_IS2_HK_HOST_MATCH, 18562306a36Sopenharmony_ci VCAP_IS2_HK_L2_MC, 18662306a36Sopenharmony_ci VCAP_IS2_HK_L2_BC, 18762306a36Sopenharmony_ci VCAP_IS2_HK_VLAN_TAGGED, 18862306a36Sopenharmony_ci VCAP_IS2_HK_VID, 18962306a36Sopenharmony_ci VCAP_IS2_HK_DEI, 19062306a36Sopenharmony_ci VCAP_IS2_HK_PCP, 19162306a36Sopenharmony_ci /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ 19262306a36Sopenharmony_ci VCAP_IS2_HK_L2_DMAC, 19362306a36Sopenharmony_ci VCAP_IS2_HK_L2_SMAC, 19462306a36Sopenharmony_ci /* MAC_ETYPE (TYPE=000) */ 19562306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ETYPE_ETYPE, 19662306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0, 19762306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1, 19862306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2, 19962306a36Sopenharmony_ci /* MAC_LLC (TYPE=001) */ 20062306a36Sopenharmony_ci VCAP_IS2_HK_MAC_LLC_DMAC, 20162306a36Sopenharmony_ci VCAP_IS2_HK_MAC_LLC_SMAC, 20262306a36Sopenharmony_ci VCAP_IS2_HK_MAC_LLC_L2_LLC, 20362306a36Sopenharmony_ci /* MAC_SNAP (TYPE=010) */ 20462306a36Sopenharmony_ci VCAP_IS2_HK_MAC_SNAP_SMAC, 20562306a36Sopenharmony_ci VCAP_IS2_HK_MAC_SNAP_DMAC, 20662306a36Sopenharmony_ci VCAP_IS2_HK_MAC_SNAP_L2_SNAP, 20762306a36Sopenharmony_ci /* MAC_ARP (TYPE=011) */ 20862306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_SMAC, 20962306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK, 21062306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK, 21162306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_LEN_OK, 21262306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_TARGET_MATCH, 21362306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_SENDER_MATCH, 21462306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN, 21562306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_OPCODE, 21662306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP, 21762306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP, 21862306a36Sopenharmony_ci VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP, 21962306a36Sopenharmony_ci /* IP4_TCP_UDP / IP4_OTHER common */ 22062306a36Sopenharmony_ci VCAP_IS2_HK_IP4, 22162306a36Sopenharmony_ci VCAP_IS2_HK_L3_FRAGMENT, 22262306a36Sopenharmony_ci VCAP_IS2_HK_L3_FRAG_OFS_GT0, 22362306a36Sopenharmony_ci VCAP_IS2_HK_L3_OPTIONS, 22462306a36Sopenharmony_ci VCAP_IS2_HK_IP4_L3_TTL_GT0, 22562306a36Sopenharmony_ci VCAP_IS2_HK_L3_TOS, 22662306a36Sopenharmony_ci VCAP_IS2_HK_L3_IP4_DIP, 22762306a36Sopenharmony_ci VCAP_IS2_HK_L3_IP4_SIP, 22862306a36Sopenharmony_ci VCAP_IS2_HK_DIP_EQ_SIP, 22962306a36Sopenharmony_ci /* IP4_TCP_UDP (TYPE=100) */ 23062306a36Sopenharmony_ci VCAP_IS2_HK_TCP, 23162306a36Sopenharmony_ci VCAP_IS2_HK_L4_SPORT, 23262306a36Sopenharmony_ci VCAP_IS2_HK_L4_DPORT, 23362306a36Sopenharmony_ci VCAP_IS2_HK_L4_RNG, 23462306a36Sopenharmony_ci VCAP_IS2_HK_L4_SPORT_EQ_DPORT, 23562306a36Sopenharmony_ci VCAP_IS2_HK_L4_SEQUENCE_EQ0, 23662306a36Sopenharmony_ci VCAP_IS2_HK_L4_URG, 23762306a36Sopenharmony_ci VCAP_IS2_HK_L4_ACK, 23862306a36Sopenharmony_ci VCAP_IS2_HK_L4_PSH, 23962306a36Sopenharmony_ci VCAP_IS2_HK_L4_RST, 24062306a36Sopenharmony_ci VCAP_IS2_HK_L4_SYN, 24162306a36Sopenharmony_ci VCAP_IS2_HK_L4_FIN, 24262306a36Sopenharmony_ci VCAP_IS2_HK_L4_1588_DOM, 24362306a36Sopenharmony_ci VCAP_IS2_HK_L4_1588_VER, 24462306a36Sopenharmony_ci /* IP4_OTHER (TYPE=101) */ 24562306a36Sopenharmony_ci VCAP_IS2_HK_IP4_L3_PROTO, 24662306a36Sopenharmony_ci VCAP_IS2_HK_L3_PAYLOAD, 24762306a36Sopenharmony_ci /* IP6_STD (TYPE=110) */ 24862306a36Sopenharmony_ci VCAP_IS2_HK_IP6_L3_TTL_GT0, 24962306a36Sopenharmony_ci VCAP_IS2_HK_IP6_L3_PROTO, 25062306a36Sopenharmony_ci VCAP_IS2_HK_L3_IP6_SIP, 25162306a36Sopenharmony_ci /* OAM (TYPE=111) */ 25262306a36Sopenharmony_ci VCAP_IS2_HK_OAM_MEL_FLAGS, 25362306a36Sopenharmony_ci VCAP_IS2_HK_OAM_VER, 25462306a36Sopenharmony_ci VCAP_IS2_HK_OAM_OPCODE, 25562306a36Sopenharmony_ci VCAP_IS2_HK_OAM_FLAGS, 25662306a36Sopenharmony_ci VCAP_IS2_HK_OAM_MEPID, 25762306a36Sopenharmony_ci VCAP_IS2_HK_OAM_CCM_CNTS_EQ0, 25862306a36Sopenharmony_ci VCAP_IS2_HK_OAM_IS_Y1731, 25962306a36Sopenharmony_ci}; 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_cistruct vcap_field { 26262306a36Sopenharmony_ci int offset; 26362306a36Sopenharmony_ci int length; 26462306a36Sopenharmony_ci}; 26562306a36Sopenharmony_ci 26662306a36Sopenharmony_cienum vcap_is2_action_field { 26762306a36Sopenharmony_ci VCAP_IS2_ACT_HIT_ME_ONCE, 26862306a36Sopenharmony_ci VCAP_IS2_ACT_CPU_COPY_ENA, 26962306a36Sopenharmony_ci VCAP_IS2_ACT_CPU_QU_NUM, 27062306a36Sopenharmony_ci VCAP_IS2_ACT_MASK_MODE, 27162306a36Sopenharmony_ci VCAP_IS2_ACT_MIRROR_ENA, 27262306a36Sopenharmony_ci VCAP_IS2_ACT_LRN_DIS, 27362306a36Sopenharmony_ci VCAP_IS2_ACT_POLICE_ENA, 27462306a36Sopenharmony_ci VCAP_IS2_ACT_POLICE_IDX, 27562306a36Sopenharmony_ci VCAP_IS2_ACT_POLICE_VCAP_ONLY, 27662306a36Sopenharmony_ci VCAP_IS2_ACT_PORT_MASK, 27762306a36Sopenharmony_ci VCAP_IS2_ACT_REW_OP, 27862306a36Sopenharmony_ci VCAP_IS2_ACT_SMAC_REPLACE_ENA, 27962306a36Sopenharmony_ci VCAP_IS2_ACT_RSV, 28062306a36Sopenharmony_ci VCAP_IS2_ACT_ACL_ID, 28162306a36Sopenharmony_ci VCAP_IS2_ACT_HIT_CNT, 28262306a36Sopenharmony_ci}; 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci/* ================================================================= 28562306a36Sopenharmony_ci * VCAP IS1 28662306a36Sopenharmony_ci * ================================================================= 28762306a36Sopenharmony_ci */ 28862306a36Sopenharmony_ci 28962306a36Sopenharmony_ci/* IS1 half key types */ 29062306a36Sopenharmony_ci#define IS1_TYPE_S1_NORMAL 0 29162306a36Sopenharmony_ci#define IS1_TYPE_S1_5TUPLE_IP4 1 29262306a36Sopenharmony_ci 29362306a36Sopenharmony_ci/* IS1 full key types */ 29462306a36Sopenharmony_ci#define IS1_TYPE_S1_NORMAL_IP6 0 29562306a36Sopenharmony_ci#define IS1_TYPE_S1_7TUPLE 1 29662306a36Sopenharmony_ci#define IS2_TYPE_S1_5TUPLE_IP6 2 29762306a36Sopenharmony_ci 29862306a36Sopenharmony_cienum { 29962306a36Sopenharmony_ci IS1_ACTION_TYPE_NORMAL, 30062306a36Sopenharmony_ci IS1_ACTION_TYPE_MAX, 30162306a36Sopenharmony_ci}; 30262306a36Sopenharmony_ci 30362306a36Sopenharmony_cienum vcap_is1_half_key_field { 30462306a36Sopenharmony_ci VCAP_IS1_HK_TYPE, 30562306a36Sopenharmony_ci VCAP_IS1_HK_LOOKUP, 30662306a36Sopenharmony_ci VCAP_IS1_HK_IGR_PORT_MASK, 30762306a36Sopenharmony_ci VCAP_IS1_HK_RSV, 30862306a36Sopenharmony_ci VCAP_IS1_HK_OAM_Y1731, 30962306a36Sopenharmony_ci VCAP_IS1_HK_L2_MC, 31062306a36Sopenharmony_ci VCAP_IS1_HK_L2_BC, 31162306a36Sopenharmony_ci VCAP_IS1_HK_IP_MC, 31262306a36Sopenharmony_ci VCAP_IS1_HK_VLAN_TAGGED, 31362306a36Sopenharmony_ci VCAP_IS1_HK_VLAN_DBL_TAGGED, 31462306a36Sopenharmony_ci VCAP_IS1_HK_TPID, 31562306a36Sopenharmony_ci VCAP_IS1_HK_VID, 31662306a36Sopenharmony_ci VCAP_IS1_HK_DEI, 31762306a36Sopenharmony_ci VCAP_IS1_HK_PCP, 31862306a36Sopenharmony_ci /* Specific Fields for IS1 Half Key S1_NORMAL */ 31962306a36Sopenharmony_ci VCAP_IS1_HK_L2_SMAC, 32062306a36Sopenharmony_ci VCAP_IS1_HK_ETYPE_LEN, 32162306a36Sopenharmony_ci VCAP_IS1_HK_ETYPE, 32262306a36Sopenharmony_ci VCAP_IS1_HK_IP_SNAP, 32362306a36Sopenharmony_ci VCAP_IS1_HK_IP4, 32462306a36Sopenharmony_ci VCAP_IS1_HK_L3_FRAGMENT, 32562306a36Sopenharmony_ci VCAP_IS1_HK_L3_FRAG_OFS_GT0, 32662306a36Sopenharmony_ci VCAP_IS1_HK_L3_OPTIONS, 32762306a36Sopenharmony_ci VCAP_IS1_HK_L3_DSCP, 32862306a36Sopenharmony_ci VCAP_IS1_HK_L3_IP4_SIP, 32962306a36Sopenharmony_ci VCAP_IS1_HK_TCP_UDP, 33062306a36Sopenharmony_ci VCAP_IS1_HK_TCP, 33162306a36Sopenharmony_ci VCAP_IS1_HK_L4_SPORT, 33262306a36Sopenharmony_ci VCAP_IS1_HK_L4_RNG, 33362306a36Sopenharmony_ci /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ 33462306a36Sopenharmony_ci VCAP_IS1_HK_IP4_INNER_TPID, 33562306a36Sopenharmony_ci VCAP_IS1_HK_IP4_INNER_VID, 33662306a36Sopenharmony_ci VCAP_IS1_HK_IP4_INNER_DEI, 33762306a36Sopenharmony_ci VCAP_IS1_HK_IP4_INNER_PCP, 33862306a36Sopenharmony_ci VCAP_IS1_HK_IP4_IP4, 33962306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_FRAGMENT, 34062306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0, 34162306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_OPTIONS, 34262306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_DSCP, 34362306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_IP4_DIP, 34462306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_IP4_SIP, 34562306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L3_PROTO, 34662306a36Sopenharmony_ci VCAP_IS1_HK_IP4_TCP_UDP, 34762306a36Sopenharmony_ci VCAP_IS1_HK_IP4_TCP, 34862306a36Sopenharmony_ci VCAP_IS1_HK_IP4_L4_RNG, 34962306a36Sopenharmony_ci VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE, 35062306a36Sopenharmony_ci}; 35162306a36Sopenharmony_ci 35262306a36Sopenharmony_cienum vcap_is1_action_field { 35362306a36Sopenharmony_ci VCAP_IS1_ACT_DSCP_ENA, 35462306a36Sopenharmony_ci VCAP_IS1_ACT_DSCP_VAL, 35562306a36Sopenharmony_ci VCAP_IS1_ACT_QOS_ENA, 35662306a36Sopenharmony_ci VCAP_IS1_ACT_QOS_VAL, 35762306a36Sopenharmony_ci VCAP_IS1_ACT_DP_ENA, 35862306a36Sopenharmony_ci VCAP_IS1_ACT_DP_VAL, 35962306a36Sopenharmony_ci VCAP_IS1_ACT_PAG_OVERRIDE_MASK, 36062306a36Sopenharmony_ci VCAP_IS1_ACT_PAG_VAL, 36162306a36Sopenharmony_ci VCAP_IS1_ACT_RSV, 36262306a36Sopenharmony_ci VCAP_IS1_ACT_VID_REPLACE_ENA, 36362306a36Sopenharmony_ci VCAP_IS1_ACT_VID_ADD_VAL, 36462306a36Sopenharmony_ci VCAP_IS1_ACT_FID_SEL, 36562306a36Sopenharmony_ci VCAP_IS1_ACT_FID_VAL, 36662306a36Sopenharmony_ci VCAP_IS1_ACT_PCP_DEI_ENA, 36762306a36Sopenharmony_ci VCAP_IS1_ACT_PCP_VAL, 36862306a36Sopenharmony_ci VCAP_IS1_ACT_DEI_VAL, 36962306a36Sopenharmony_ci VCAP_IS1_ACT_VLAN_POP_CNT_ENA, 37062306a36Sopenharmony_ci VCAP_IS1_ACT_VLAN_POP_CNT, 37162306a36Sopenharmony_ci VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA, 37262306a36Sopenharmony_ci VCAP_IS1_ACT_HIT_STICKY, 37362306a36Sopenharmony_ci}; 37462306a36Sopenharmony_ci 37562306a36Sopenharmony_ci/* ================================================================= 37662306a36Sopenharmony_ci * VCAP ES0 37762306a36Sopenharmony_ci * ================================================================= 37862306a36Sopenharmony_ci */ 37962306a36Sopenharmony_ci 38062306a36Sopenharmony_cienum { 38162306a36Sopenharmony_ci ES0_ACTION_TYPE_NORMAL, 38262306a36Sopenharmony_ci ES0_ACTION_TYPE_MAX, 38362306a36Sopenharmony_ci}; 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_cienum vcap_es0_key_field { 38662306a36Sopenharmony_ci VCAP_ES0_EGR_PORT, 38762306a36Sopenharmony_ci VCAP_ES0_IGR_PORT, 38862306a36Sopenharmony_ci VCAP_ES0_RSV, 38962306a36Sopenharmony_ci VCAP_ES0_L2_MC, 39062306a36Sopenharmony_ci VCAP_ES0_L2_BC, 39162306a36Sopenharmony_ci VCAP_ES0_VID, 39262306a36Sopenharmony_ci VCAP_ES0_DP, 39362306a36Sopenharmony_ci VCAP_ES0_PCP, 39462306a36Sopenharmony_ci}; 39562306a36Sopenharmony_ci 39662306a36Sopenharmony_cienum vcap_es0_action_field { 39762306a36Sopenharmony_ci VCAP_ES0_ACT_PUSH_OUTER_TAG, 39862306a36Sopenharmony_ci VCAP_ES0_ACT_PUSH_INNER_TAG, 39962306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_A_TPID_SEL, 40062306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_A_VID_SEL, 40162306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_A_PCP_SEL, 40262306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_A_DEI_SEL, 40362306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_B_TPID_SEL, 40462306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_B_VID_SEL, 40562306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_B_PCP_SEL, 40662306a36Sopenharmony_ci VCAP_ES0_ACT_TAG_B_DEI_SEL, 40762306a36Sopenharmony_ci VCAP_ES0_ACT_VID_A_VAL, 40862306a36Sopenharmony_ci VCAP_ES0_ACT_PCP_A_VAL, 40962306a36Sopenharmony_ci VCAP_ES0_ACT_DEI_A_VAL, 41062306a36Sopenharmony_ci VCAP_ES0_ACT_VID_B_VAL, 41162306a36Sopenharmony_ci VCAP_ES0_ACT_PCP_B_VAL, 41262306a36Sopenharmony_ci VCAP_ES0_ACT_DEI_B_VAL, 41362306a36Sopenharmony_ci VCAP_ES0_ACT_RSV, 41462306a36Sopenharmony_ci VCAP_ES0_ACT_HIT_STICKY, 41562306a36Sopenharmony_ci}; 41662306a36Sopenharmony_ci 41762306a36Sopenharmony_cistruct ocelot_ipv4 { 41862306a36Sopenharmony_ci u8 addr[4]; 41962306a36Sopenharmony_ci}; 42062306a36Sopenharmony_ci 42162306a36Sopenharmony_cienum ocelot_vcap_bit { 42262306a36Sopenharmony_ci OCELOT_VCAP_BIT_ANY, 42362306a36Sopenharmony_ci OCELOT_VCAP_BIT_0, 42462306a36Sopenharmony_ci OCELOT_VCAP_BIT_1 42562306a36Sopenharmony_ci}; 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_cistruct ocelot_vcap_u8 { 42862306a36Sopenharmony_ci u8 value[1]; 42962306a36Sopenharmony_ci u8 mask[1]; 43062306a36Sopenharmony_ci}; 43162306a36Sopenharmony_ci 43262306a36Sopenharmony_cistruct ocelot_vcap_u16 { 43362306a36Sopenharmony_ci u8 value[2]; 43462306a36Sopenharmony_ci u8 mask[2]; 43562306a36Sopenharmony_ci}; 43662306a36Sopenharmony_ci 43762306a36Sopenharmony_cistruct ocelot_vcap_u24 { 43862306a36Sopenharmony_ci u8 value[3]; 43962306a36Sopenharmony_ci u8 mask[3]; 44062306a36Sopenharmony_ci}; 44162306a36Sopenharmony_ci 44262306a36Sopenharmony_cistruct ocelot_vcap_u32 { 44362306a36Sopenharmony_ci u8 value[4]; 44462306a36Sopenharmony_ci u8 mask[4]; 44562306a36Sopenharmony_ci}; 44662306a36Sopenharmony_ci 44762306a36Sopenharmony_cistruct ocelot_vcap_u40 { 44862306a36Sopenharmony_ci u8 value[5]; 44962306a36Sopenharmony_ci u8 mask[5]; 45062306a36Sopenharmony_ci}; 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_cistruct ocelot_vcap_u48 { 45362306a36Sopenharmony_ci u8 value[6]; 45462306a36Sopenharmony_ci u8 mask[6]; 45562306a36Sopenharmony_ci}; 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_cistruct ocelot_vcap_u64 { 45862306a36Sopenharmony_ci u8 value[8]; 45962306a36Sopenharmony_ci u8 mask[8]; 46062306a36Sopenharmony_ci}; 46162306a36Sopenharmony_ci 46262306a36Sopenharmony_cistruct ocelot_vcap_u128 { 46362306a36Sopenharmony_ci u8 value[16]; 46462306a36Sopenharmony_ci u8 mask[16]; 46562306a36Sopenharmony_ci}; 46662306a36Sopenharmony_ci 46762306a36Sopenharmony_cistruct ocelot_vcap_vid { 46862306a36Sopenharmony_ci u16 value; 46962306a36Sopenharmony_ci u16 mask; 47062306a36Sopenharmony_ci}; 47162306a36Sopenharmony_ci 47262306a36Sopenharmony_cistruct ocelot_vcap_ipv4 { 47362306a36Sopenharmony_ci struct ocelot_ipv4 value; 47462306a36Sopenharmony_ci struct ocelot_ipv4 mask; 47562306a36Sopenharmony_ci}; 47662306a36Sopenharmony_ci 47762306a36Sopenharmony_cistruct ocelot_vcap_udp_tcp { 47862306a36Sopenharmony_ci u16 value; 47962306a36Sopenharmony_ci u16 mask; 48062306a36Sopenharmony_ci}; 48162306a36Sopenharmony_ci 48262306a36Sopenharmony_cistruct ocelot_vcap_port { 48362306a36Sopenharmony_ci u8 value; 48462306a36Sopenharmony_ci u8 mask; 48562306a36Sopenharmony_ci}; 48662306a36Sopenharmony_ci 48762306a36Sopenharmony_cienum ocelot_vcap_key_type { 48862306a36Sopenharmony_ci OCELOT_VCAP_KEY_ANY, 48962306a36Sopenharmony_ci OCELOT_VCAP_KEY_ETYPE, 49062306a36Sopenharmony_ci OCELOT_VCAP_KEY_LLC, 49162306a36Sopenharmony_ci OCELOT_VCAP_KEY_SNAP, 49262306a36Sopenharmony_ci OCELOT_VCAP_KEY_ARP, 49362306a36Sopenharmony_ci OCELOT_VCAP_KEY_IPV4, 49462306a36Sopenharmony_ci OCELOT_VCAP_KEY_IPV6 49562306a36Sopenharmony_ci}; 49662306a36Sopenharmony_ci 49762306a36Sopenharmony_cistruct ocelot_vcap_key_vlan { 49862306a36Sopenharmony_ci struct ocelot_vcap_vid vid; /* VLAN ID (12 bit) */ 49962306a36Sopenharmony_ci struct ocelot_vcap_u8 pcp; /* PCP (3 bit) */ 50062306a36Sopenharmony_ci enum ocelot_vcap_bit dei; /* DEI */ 50162306a36Sopenharmony_ci enum ocelot_vcap_bit tagged; /* Tagged/untagged frame */ 50262306a36Sopenharmony_ci}; 50362306a36Sopenharmony_ci 50462306a36Sopenharmony_cistruct ocelot_vcap_key_etype { 50562306a36Sopenharmony_ci struct ocelot_vcap_u48 dmac; 50662306a36Sopenharmony_ci struct ocelot_vcap_u48 smac; 50762306a36Sopenharmony_ci struct ocelot_vcap_u16 etype; 50862306a36Sopenharmony_ci struct ocelot_vcap_u16 data; /* MAC data */ 50962306a36Sopenharmony_ci}; 51062306a36Sopenharmony_ci 51162306a36Sopenharmony_cistruct ocelot_vcap_key_llc { 51262306a36Sopenharmony_ci struct ocelot_vcap_u48 dmac; 51362306a36Sopenharmony_ci struct ocelot_vcap_u48 smac; 51462306a36Sopenharmony_ci 51562306a36Sopenharmony_ci /* LLC header: DSAP at byte 0, SSAP at byte 1, Control at byte 2 */ 51662306a36Sopenharmony_ci struct ocelot_vcap_u32 llc; 51762306a36Sopenharmony_ci}; 51862306a36Sopenharmony_ci 51962306a36Sopenharmony_cistruct ocelot_vcap_key_snap { 52062306a36Sopenharmony_ci struct ocelot_vcap_u48 dmac; 52162306a36Sopenharmony_ci struct ocelot_vcap_u48 smac; 52262306a36Sopenharmony_ci 52362306a36Sopenharmony_ci /* SNAP header: Organization Code at byte 0, Type at byte 3 */ 52462306a36Sopenharmony_ci struct ocelot_vcap_u40 snap; 52562306a36Sopenharmony_ci}; 52662306a36Sopenharmony_ci 52762306a36Sopenharmony_cistruct ocelot_vcap_key_arp { 52862306a36Sopenharmony_ci struct ocelot_vcap_u48 smac; 52962306a36Sopenharmony_ci enum ocelot_vcap_bit arp; /* Opcode ARP/RARP */ 53062306a36Sopenharmony_ci enum ocelot_vcap_bit req; /* Opcode request/reply */ 53162306a36Sopenharmony_ci enum ocelot_vcap_bit unknown; /* Opcode unknown */ 53262306a36Sopenharmony_ci enum ocelot_vcap_bit smac_match; /* Sender MAC matches SMAC */ 53362306a36Sopenharmony_ci enum ocelot_vcap_bit dmac_match; /* Target MAC matches DMAC */ 53462306a36Sopenharmony_ci 53562306a36Sopenharmony_ci /**< Protocol addr. length 4, hardware length 6 */ 53662306a36Sopenharmony_ci enum ocelot_vcap_bit length; 53762306a36Sopenharmony_ci 53862306a36Sopenharmony_ci enum ocelot_vcap_bit ip; /* Protocol address type IP */ 53962306a36Sopenharmony_ci enum ocelot_vcap_bit ethernet; /* Hardware address type Ethernet */ 54062306a36Sopenharmony_ci struct ocelot_vcap_ipv4 sip; /* Sender IP address */ 54162306a36Sopenharmony_ci struct ocelot_vcap_ipv4 dip; /* Target IP address */ 54262306a36Sopenharmony_ci}; 54362306a36Sopenharmony_ci 54462306a36Sopenharmony_cistruct ocelot_vcap_key_ipv4 { 54562306a36Sopenharmony_ci enum ocelot_vcap_bit ttl; /* TTL zero */ 54662306a36Sopenharmony_ci enum ocelot_vcap_bit fragment; /* Fragment */ 54762306a36Sopenharmony_ci enum ocelot_vcap_bit options; /* Header options */ 54862306a36Sopenharmony_ci struct ocelot_vcap_u8 ds; 54962306a36Sopenharmony_ci struct ocelot_vcap_u8 proto; /* Protocol */ 55062306a36Sopenharmony_ci struct ocelot_vcap_ipv4 sip; /* Source IP address */ 55162306a36Sopenharmony_ci struct ocelot_vcap_ipv4 dip; /* Destination IP address */ 55262306a36Sopenharmony_ci struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */ 55362306a36Sopenharmony_ci struct ocelot_vcap_udp_tcp sport; /* UDP/TCP: Source port */ 55462306a36Sopenharmony_ci struct ocelot_vcap_udp_tcp dport; /* UDP/TCP: Destination port */ 55562306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_fin; 55662306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_syn; 55762306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_rst; 55862306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_psh; 55962306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_ack; 56062306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_urg; 56162306a36Sopenharmony_ci enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */ 56262306a36Sopenharmony_ci enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */ 56362306a36Sopenharmony_ci enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */ 56462306a36Sopenharmony_ci}; 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_cistruct ocelot_vcap_key_ipv6 { 56762306a36Sopenharmony_ci struct ocelot_vcap_u8 proto; /* IPv6 protocol */ 56862306a36Sopenharmony_ci struct ocelot_vcap_u128 sip; /* IPv6 source (byte 0-7 ignored) */ 56962306a36Sopenharmony_ci struct ocelot_vcap_u128 dip; /* IPv6 destination (byte 0-7 ignored) */ 57062306a36Sopenharmony_ci enum ocelot_vcap_bit ttl; /* TTL zero */ 57162306a36Sopenharmony_ci struct ocelot_vcap_u8 ds; 57262306a36Sopenharmony_ci struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */ 57362306a36Sopenharmony_ci struct ocelot_vcap_udp_tcp sport; 57462306a36Sopenharmony_ci struct ocelot_vcap_udp_tcp dport; 57562306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_fin; 57662306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_syn; 57762306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_rst; 57862306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_psh; 57962306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_ack; 58062306a36Sopenharmony_ci enum ocelot_vcap_bit tcp_urg; 58162306a36Sopenharmony_ci enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */ 58262306a36Sopenharmony_ci enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */ 58362306a36Sopenharmony_ci enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */ 58462306a36Sopenharmony_ci}; 58562306a36Sopenharmony_ci 58662306a36Sopenharmony_cienum ocelot_mask_mode { 58762306a36Sopenharmony_ci OCELOT_MASK_MODE_NONE, 58862306a36Sopenharmony_ci OCELOT_MASK_MODE_PERMIT_DENY, 58962306a36Sopenharmony_ci OCELOT_MASK_MODE_POLICY, 59062306a36Sopenharmony_ci OCELOT_MASK_MODE_REDIRECT, 59162306a36Sopenharmony_ci}; 59262306a36Sopenharmony_ci 59362306a36Sopenharmony_cienum ocelot_es0_vid_sel { 59462306a36Sopenharmony_ci OCELOT_ES0_VID_PLUS_CLASSIFIED_VID = 0, 59562306a36Sopenharmony_ci OCELOT_ES0_VID = 1, 59662306a36Sopenharmony_ci}; 59762306a36Sopenharmony_ci 59862306a36Sopenharmony_cienum ocelot_es0_pcp_sel { 59962306a36Sopenharmony_ci OCELOT_CLASSIFIED_PCP = 0, 60062306a36Sopenharmony_ci OCELOT_ES0_PCP = 1, 60162306a36Sopenharmony_ci}; 60262306a36Sopenharmony_ci 60362306a36Sopenharmony_cienum ocelot_es0_tag { 60462306a36Sopenharmony_ci OCELOT_NO_ES0_TAG, 60562306a36Sopenharmony_ci OCELOT_ES0_TAG, 60662306a36Sopenharmony_ci OCELOT_FORCE_PORT_TAG, 60762306a36Sopenharmony_ci OCELOT_FORCE_UNTAG, 60862306a36Sopenharmony_ci}; 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_cienum ocelot_tag_tpid_sel { 61162306a36Sopenharmony_ci OCELOT_TAG_TPID_SEL_8021Q, 61262306a36Sopenharmony_ci OCELOT_TAG_TPID_SEL_8021AD, 61362306a36Sopenharmony_ci}; 61462306a36Sopenharmony_ci 61562306a36Sopenharmony_cistruct ocelot_vcap_action { 61662306a36Sopenharmony_ci union { 61762306a36Sopenharmony_ci /* VCAP ES0 */ 61862306a36Sopenharmony_ci struct { 61962306a36Sopenharmony_ci enum ocelot_es0_tag push_outer_tag; 62062306a36Sopenharmony_ci enum ocelot_es0_tag push_inner_tag; 62162306a36Sopenharmony_ci enum ocelot_tag_tpid_sel tag_a_tpid_sel; 62262306a36Sopenharmony_ci int tag_a_vid_sel; 62362306a36Sopenharmony_ci int tag_a_pcp_sel; 62462306a36Sopenharmony_ci u16 vid_a_val; 62562306a36Sopenharmony_ci u8 pcp_a_val; 62662306a36Sopenharmony_ci u8 dei_a_val; 62762306a36Sopenharmony_ci enum ocelot_tag_tpid_sel tag_b_tpid_sel; 62862306a36Sopenharmony_ci int tag_b_vid_sel; 62962306a36Sopenharmony_ci int tag_b_pcp_sel; 63062306a36Sopenharmony_ci u16 vid_b_val; 63162306a36Sopenharmony_ci u8 pcp_b_val; 63262306a36Sopenharmony_ci u8 dei_b_val; 63362306a36Sopenharmony_ci }; 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci /* VCAP IS1 */ 63662306a36Sopenharmony_ci struct { 63762306a36Sopenharmony_ci bool vid_replace_ena; 63862306a36Sopenharmony_ci u16 vid; 63962306a36Sopenharmony_ci bool vlan_pop_cnt_ena; 64062306a36Sopenharmony_ci int vlan_pop_cnt; 64162306a36Sopenharmony_ci bool pcp_dei_ena; 64262306a36Sopenharmony_ci u8 pcp; 64362306a36Sopenharmony_ci u8 dei; 64462306a36Sopenharmony_ci bool qos_ena; 64562306a36Sopenharmony_ci u8 qos_val; 64662306a36Sopenharmony_ci u8 pag_override_mask; 64762306a36Sopenharmony_ci u8 pag_val; 64862306a36Sopenharmony_ci }; 64962306a36Sopenharmony_ci 65062306a36Sopenharmony_ci /* VCAP IS2 */ 65162306a36Sopenharmony_ci struct { 65262306a36Sopenharmony_ci bool cpu_copy_ena; 65362306a36Sopenharmony_ci u8 cpu_qu_num; 65462306a36Sopenharmony_ci enum ocelot_mask_mode mask_mode; 65562306a36Sopenharmony_ci unsigned long port_mask; 65662306a36Sopenharmony_ci bool police_ena; 65762306a36Sopenharmony_ci bool mirror_ena; 65862306a36Sopenharmony_ci struct ocelot_policer pol; 65962306a36Sopenharmony_ci u32 pol_ix; 66062306a36Sopenharmony_ci }; 66162306a36Sopenharmony_ci }; 66262306a36Sopenharmony_ci}; 66362306a36Sopenharmony_ci 66462306a36Sopenharmony_cistruct ocelot_vcap_stats { 66562306a36Sopenharmony_ci u64 bytes; 66662306a36Sopenharmony_ci u64 pkts; 66762306a36Sopenharmony_ci u64 used; 66862306a36Sopenharmony_ci}; 66962306a36Sopenharmony_ci 67062306a36Sopenharmony_cienum ocelot_vcap_filter_type { 67162306a36Sopenharmony_ci OCELOT_VCAP_FILTER_DUMMY, 67262306a36Sopenharmony_ci OCELOT_VCAP_FILTER_PAG, 67362306a36Sopenharmony_ci OCELOT_VCAP_FILTER_OFFLOAD, 67462306a36Sopenharmony_ci OCELOT_PSFP_FILTER_OFFLOAD, 67562306a36Sopenharmony_ci}; 67662306a36Sopenharmony_ci 67762306a36Sopenharmony_cistruct ocelot_vcap_id { 67862306a36Sopenharmony_ci unsigned long cookie; 67962306a36Sopenharmony_ci bool tc_offload; 68062306a36Sopenharmony_ci}; 68162306a36Sopenharmony_ci 68262306a36Sopenharmony_cistruct ocelot_vcap_filter { 68362306a36Sopenharmony_ci struct list_head list; 68462306a36Sopenharmony_ci 68562306a36Sopenharmony_ci enum ocelot_vcap_filter_type type; 68662306a36Sopenharmony_ci int block_id; 68762306a36Sopenharmony_ci int goto_target; 68862306a36Sopenharmony_ci int lookup; 68962306a36Sopenharmony_ci u8 pag; 69062306a36Sopenharmony_ci u16 prio; 69162306a36Sopenharmony_ci struct ocelot_vcap_id id; 69262306a36Sopenharmony_ci 69362306a36Sopenharmony_ci struct ocelot_vcap_action action; 69462306a36Sopenharmony_ci struct ocelot_vcap_stats stats; 69562306a36Sopenharmony_ci /* For VCAP IS1 and IS2 */ 69662306a36Sopenharmony_ci bool take_ts; 69762306a36Sopenharmony_ci bool is_trap; 69862306a36Sopenharmony_ci unsigned long ingress_port_mask; 69962306a36Sopenharmony_ci /* For VCAP ES0 */ 70062306a36Sopenharmony_ci struct ocelot_vcap_port ingress_port; 70162306a36Sopenharmony_ci /* For VCAP IS2 mirrors and ES0 */ 70262306a36Sopenharmony_ci struct ocelot_vcap_port egress_port; 70362306a36Sopenharmony_ci 70462306a36Sopenharmony_ci enum ocelot_vcap_bit dmac_mc; 70562306a36Sopenharmony_ci enum ocelot_vcap_bit dmac_bc; 70662306a36Sopenharmony_ci struct ocelot_vcap_key_vlan vlan; 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_ci enum ocelot_vcap_key_type key_type; 70962306a36Sopenharmony_ci union { 71062306a36Sopenharmony_ci /* OCELOT_VCAP_KEY_ANY: No specific fields */ 71162306a36Sopenharmony_ci struct ocelot_vcap_key_etype etype; 71262306a36Sopenharmony_ci struct ocelot_vcap_key_llc llc; 71362306a36Sopenharmony_ci struct ocelot_vcap_key_snap snap; 71462306a36Sopenharmony_ci struct ocelot_vcap_key_arp arp; 71562306a36Sopenharmony_ci struct ocelot_vcap_key_ipv4 ipv4; 71662306a36Sopenharmony_ci struct ocelot_vcap_key_ipv6 ipv6; 71762306a36Sopenharmony_ci } key; 71862306a36Sopenharmony_ci}; 71962306a36Sopenharmony_ci 72062306a36Sopenharmony_ciint ocelot_vcap_filter_add(struct ocelot *ocelot, 72162306a36Sopenharmony_ci struct ocelot_vcap_filter *rule, 72262306a36Sopenharmony_ci struct netlink_ext_ack *extack); 72362306a36Sopenharmony_ciint ocelot_vcap_filter_del(struct ocelot *ocelot, 72462306a36Sopenharmony_ci struct ocelot_vcap_filter *rule); 72562306a36Sopenharmony_ciint ocelot_vcap_filter_replace(struct ocelot *ocelot, 72662306a36Sopenharmony_ci struct ocelot_vcap_filter *filter); 72762306a36Sopenharmony_cistruct ocelot_vcap_filter * 72862306a36Sopenharmony_ciocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block, 72962306a36Sopenharmony_ci unsigned long cookie, bool tc_offload); 73062306a36Sopenharmony_ci 73162306a36Sopenharmony_ci#endif /* _OCELOT_VCAP_H_ */ 732