1 /* SPDX-License-Identifier: (GPL-2.0 OR MIT)
2 * Microsemi Ocelot Switch driver
3 * Copyright (c) 2019 Microsemi Corporation
6 #ifndef _OCELOT_VCAP_H_
7 #define _OCELOT_VCAP_H_
9 #include <soc/mscc/ocelot.h>
11 /* =================================================================
13 * =================================================================
23 #define OCELOT_NUM_VCAP_BLOCKS __VCAP_COUNT
26 u16 tg_width; /* Type-group width (in bits) */
27 u16 sw_count; /* Sub word count */
28 u16 entry_count; /* Entry count */
29 u16 entry_words; /* Number of entry words */
30 u16 entry_width; /* Entry width (in bits) */
31 u16 action_count; /* Action count */
32 u16 action_words; /* Number of action words */
33 u16 action_width; /* Action width (in bits) */
34 u16 action_type_width; /* Action type width (in bits) */
36 u16 width; /* Action type width (in bits) */
37 u16 count; /* Action type sub word count */
39 u16 counter_words; /* Number of counter words */
40 u16 counter_width; /* Counter width (in bits) */
42 enum ocelot_target target;
44 const struct vcap_field *keys;
45 const struct vcap_field *actions;
48 /* VCAP Type-Group values */
49 #define VCAP_TG_NONE 0 /* Entry is invalid */
50 #define VCAP_TG_FULL 1 /* Full entry */
51 #define VCAP_TG_HALF 2 /* Half entry */
52 #define VCAP_TG_QUARTER 3 /* Quarter entry */
54 #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD(x) (((x) << 22) & GENMASK(24, 22))
55 #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_M GENMASK(24, 22)
56 #define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_X(x) (((x) & GENMASK(24, 22)) >> 22)
57 #define VCAP_CORE_UPDATE_CTRL_UPDATE_ENTRY_DIS BIT(21)
58 #define VCAP_CORE_UPDATE_CTRL_UPDATE_ACTION_DIS BIT(20)
59 #define VCAP_CORE_UPDATE_CTRL_UPDATE_CNT_DIS BIT(19)
60 #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR(x) (((x) << 3) & GENMASK(18, 3))
61 #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_M GENMASK(18, 3)
62 #define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_X(x) (((x) & GENMASK(18, 3)) >> 3)
63 #define VCAP_CORE_UPDATE_CTRL_UPDATE_SHOT BIT(2)
64 #define VCAP_CORE_UPDATE_CTRL_CLEAR_CACHE BIT(1)
65 #define VCAP_CORE_UPDATE_CTRL_MV_TRAFFIC_IGN BIT(0)
67 #define VCAP_CORE_MV_CFG_MV_NUM_POS(x) (((x) << 16) & GENMASK(31, 16))
68 #define VCAP_CORE_MV_CFG_MV_NUM_POS_M GENMASK(31, 16)
69 #define VCAP_CORE_MV_CFG_MV_NUM_POS_X(x) (((x) & GENMASK(31, 16)) >> 16)
70 #define VCAP_CORE_MV_CFG_MV_SIZE(x) ((x) & GENMASK(15, 0))
71 #define VCAP_CORE_MV_CFG_MV_SIZE_M GENMASK(15, 0)
73 #define VCAP_CACHE_ENTRY_DAT_RSZ 0x4
75 #define VCAP_CACHE_MASK_DAT_RSZ 0x4
77 #define VCAP_CACHE_ACTION_DAT_RSZ 0x4
79 #define VCAP_CACHE_CNT_DAT_RSZ 0x4
81 #define VCAP_STICKY_VCAP_ROW_DELETED_STICKY BIT(0)
83 #define TCAM_BIST_CTRL_TCAM_BIST BIT(1)
84 #define TCAM_BIST_CTRL_TCAM_INIT BIT(0)
86 #define TCAM_BIST_CFG_TCAM_BIST_SOE_ENA BIT(8)
87 #define TCAM_BIST_CFG_TCAM_HCG_DIS BIT(7)
88 #define TCAM_BIST_CFG_TCAM_CG_DIS BIT(6)
89 #define TCAM_BIST_CFG_TCAM_BIAS(x) ((x) & GENMASK(5, 0))
90 #define TCAM_BIST_CFG_TCAM_BIAS_M GENMASK(5, 0)
92 #define TCAM_BIST_STAT_BIST_RT_ERR BIT(15)
93 #define TCAM_BIST_STAT_BIST_PENC_ERR BIT(14)
94 #define TCAM_BIST_STAT_BIST_COMP_ERR BIT(13)
95 #define TCAM_BIST_STAT_BIST_ADDR_ERR BIT(12)
96 #define TCAM_BIST_STAT_BIST_BL1E_ERR BIT(11)
97 #define TCAM_BIST_STAT_BIST_BL1_ERR BIT(10)
98 #define TCAM_BIST_STAT_BIST_BL0E_ERR BIT(9)
99 #define TCAM_BIST_STAT_BIST_BL0_ERR BIT(8)
100 #define TCAM_BIST_STAT_BIST_PH1_ERR BIT(7)
101 #define TCAM_BIST_STAT_BIST_PH0_ERR BIT(6)
102 #define TCAM_BIST_STAT_BIST_PV1_ERR BIT(5)
103 #define TCAM_BIST_STAT_BIST_PV0_ERR BIT(4)
104 #define TCAM_BIST_STAT_BIST_RUN BIT(3)
105 #define TCAM_BIST_STAT_BIST_ERR BIT(2)
106 #define TCAM_BIST_STAT_BIST_BUSY BIT(1)
107 #define TCAM_BIST_STAT_TCAM_RDY BIT(0)
109 /* =================================================================
111 * =================================================================
114 /* IS2 half key types */
115 #define IS2_TYPE_ETYPE 0
116 #define IS2_TYPE_LLC 1
117 #define IS2_TYPE_SNAP 2
118 #define IS2_TYPE_ARP 3
119 #define IS2_TYPE_IP_UDP_TCP 4
120 #define IS2_TYPE_IP_OTHER 5
121 #define IS2_TYPE_IPV6 6
122 #define IS2_TYPE_OAM 7
123 #define IS2_TYPE_SMAC_SIP6 8
124 #define IS2_TYPE_ANY 100 /* Pseudo type */
126 /* IS2 half key type mask for matching any IP */
127 #define IS2_TYPE_MASK_IP_ANY 0xe
130 IS2_ACTION_TYPE_NORMAL,
131 IS2_ACTION_TYPE_SMAC_SIP,
135 /* IS2 MASK_MODE values */
136 #define IS2_ACT_MASK_MODE_NONE 0
137 #define IS2_ACT_MASK_MODE_FILTER 1
138 #define IS2_ACT_MASK_MODE_POLICY 2
139 #define IS2_ACT_MASK_MODE_REDIR 3
141 /* IS2 REW_OP values */
142 #define IS2_ACT_REW_OP_NONE 0
143 #define IS2_ACT_REW_OP_PTP_ONE 2
144 #define IS2_ACT_REW_OP_PTP_TWO 3
145 #define IS2_ACT_REW_OP_SPECIAL 8
146 #define IS2_ACT_REW_OP_PTP_ORG 9
147 #define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_1 (IS2_ACT_REW_OP_PTP_ONE | (1 << 3))
148 #define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_2 (IS2_ACT_REW_OP_PTP_ONE | (2 << 3))
149 #define IS2_ACT_REW_OP_PTP_ONE_ADD_DELAY (IS2_ACT_REW_OP_PTP_ONE | (1 << 5))
150 #define IS2_ACT_REW_OP_PTP_ONE_ADD_SUB BIT(7)
152 #define VCAP_PORT_WIDTH 4
154 /* IS2 quarter key - SMAC_SIP4 */
155 #define IS2_QKO_IGR_PORT 0
156 #define IS2_QKL_IGR_PORT VCAP_PORT_WIDTH
157 #define IS2_QKO_L2_SMAC (IS2_QKO_IGR_PORT + IS2_QKL_IGR_PORT)
158 #define IS2_QKL_L2_SMAC 48
159 #define IS2_QKO_L3_IP4_SIP (IS2_QKO_L2_SMAC + IS2_QKL_L2_SMAC)
160 #define IS2_QKL_L3_IP4_SIP 32
162 enum vcap_is2_half_key_field {
168 VCAP_IS2_HK_IGR_PORT_MASK,
170 VCAP_IS2_HK_HOST_MATCH,
173 VCAP_IS2_HK_VLAN_TAGGED,
177 /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */
180 /* MAC_ETYPE (TYPE=000) */
181 VCAP_IS2_HK_MAC_ETYPE_ETYPE,
182 VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0,
183 VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1,
184 VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2,
185 /* MAC_LLC (TYPE=001) */
186 VCAP_IS2_HK_MAC_LLC_DMAC,
187 VCAP_IS2_HK_MAC_LLC_SMAC,
188 VCAP_IS2_HK_MAC_LLC_L2_LLC,
189 /* MAC_SNAP (TYPE=010) */
190 VCAP_IS2_HK_MAC_SNAP_SMAC,
191 VCAP_IS2_HK_MAC_SNAP_DMAC,
192 VCAP_IS2_HK_MAC_SNAP_L2_SNAP,
193 /* MAC_ARP (TYPE=011) */
194 VCAP_IS2_HK_MAC_ARP_SMAC,
195 VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK,
196 VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK,
197 VCAP_IS2_HK_MAC_ARP_LEN_OK,
198 VCAP_IS2_HK_MAC_ARP_TARGET_MATCH,
199 VCAP_IS2_HK_MAC_ARP_SENDER_MATCH,
200 VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN,
201 VCAP_IS2_HK_MAC_ARP_OPCODE,
202 VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP,
203 VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP,
204 VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP,
205 /* IP4_TCP_UDP / IP4_OTHER common */
207 VCAP_IS2_HK_L3_FRAGMENT,
208 VCAP_IS2_HK_L3_FRAG_OFS_GT0,
209 VCAP_IS2_HK_L3_OPTIONS,
210 VCAP_IS2_HK_IP4_L3_TTL_GT0,
212 VCAP_IS2_HK_L3_IP4_DIP,
213 VCAP_IS2_HK_L3_IP4_SIP,
214 VCAP_IS2_HK_DIP_EQ_SIP,
215 /* IP4_TCP_UDP (TYPE=100) */
217 VCAP_IS2_HK_L4_SPORT,
218 VCAP_IS2_HK_L4_DPORT,
220 VCAP_IS2_HK_L4_SPORT_EQ_DPORT,
221 VCAP_IS2_HK_L4_SEQUENCE_EQ0,
228 VCAP_IS2_HK_L4_1588_DOM,
229 VCAP_IS2_HK_L4_1588_VER,
230 /* IP4_OTHER (TYPE=101) */
231 VCAP_IS2_HK_IP4_L3_PROTO,
232 VCAP_IS2_HK_L3_PAYLOAD,
233 /* IP6_STD (TYPE=110) */
234 VCAP_IS2_HK_IP6_L3_TTL_GT0,
235 VCAP_IS2_HK_IP6_L3_PROTO,
236 VCAP_IS2_HK_L3_IP6_SIP,
238 VCAP_IS2_HK_OAM_MEL_FLAGS,
240 VCAP_IS2_HK_OAM_OPCODE,
241 VCAP_IS2_HK_OAM_FLAGS,
242 VCAP_IS2_HK_OAM_MEPID,
243 VCAP_IS2_HK_OAM_CCM_CNTS_EQ0,
244 VCAP_IS2_HK_OAM_IS_Y1731,
252 enum vcap_is2_action_field {
253 VCAP_IS2_ACT_HIT_ME_ONCE,
254 VCAP_IS2_ACT_CPU_COPY_ENA,
255 VCAP_IS2_ACT_CPU_QU_NUM,
256 VCAP_IS2_ACT_MASK_MODE,
257 VCAP_IS2_ACT_MIRROR_ENA,
258 VCAP_IS2_ACT_LRN_DIS,
259 VCAP_IS2_ACT_POLICE_ENA,
260 VCAP_IS2_ACT_POLICE_IDX,
261 VCAP_IS2_ACT_POLICE_VCAP_ONLY,
262 VCAP_IS2_ACT_PORT_MASK,
264 VCAP_IS2_ACT_SMAC_REPLACE_ENA,
267 VCAP_IS2_ACT_HIT_CNT,
270 /* =================================================================
272 * =================================================================
275 /* IS1 half key types */
276 #define IS1_TYPE_S1_NORMAL 0
277 #define IS1_TYPE_S1_5TUPLE_IP4 1
279 /* IS1 full key types */
280 #define IS1_TYPE_S1_NORMAL_IP6 0
281 #define IS1_TYPE_S1_7TUPLE 1
282 #define IS2_TYPE_S1_5TUPLE_IP6 2
285 IS1_ACTION_TYPE_NORMAL,
289 enum vcap_is1_half_key_field {
292 VCAP_IS1_HK_IGR_PORT_MASK,
294 VCAP_IS1_HK_OAM_Y1731,
298 VCAP_IS1_HK_VLAN_TAGGED,
299 VCAP_IS1_HK_VLAN_DBL_TAGGED,
304 /* Specific Fields for IS1 Half Key S1_NORMAL */
306 VCAP_IS1_HK_ETYPE_LEN,
310 VCAP_IS1_HK_L3_FRAGMENT,
311 VCAP_IS1_HK_L3_FRAG_OFS_GT0,
312 VCAP_IS1_HK_L3_OPTIONS,
314 VCAP_IS1_HK_L3_IP4_SIP,
317 VCAP_IS1_HK_L4_SPORT,
319 /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */
320 VCAP_IS1_HK_IP4_INNER_TPID,
321 VCAP_IS1_HK_IP4_INNER_VID,
322 VCAP_IS1_HK_IP4_INNER_DEI,
323 VCAP_IS1_HK_IP4_INNER_PCP,
325 VCAP_IS1_HK_IP4_L3_FRAGMENT,
326 VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0,
327 VCAP_IS1_HK_IP4_L3_OPTIONS,
328 VCAP_IS1_HK_IP4_L3_DSCP,
329 VCAP_IS1_HK_IP4_L3_IP4_DIP,
330 VCAP_IS1_HK_IP4_L3_IP4_SIP,
331 VCAP_IS1_HK_IP4_L3_PROTO,
332 VCAP_IS1_HK_IP4_TCP_UDP,
334 VCAP_IS1_HK_IP4_L4_RNG,
335 VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE,
338 enum vcap_is1_action_field {
339 VCAP_IS1_ACT_DSCP_ENA,
340 VCAP_IS1_ACT_DSCP_VAL,
341 VCAP_IS1_ACT_QOS_ENA,
342 VCAP_IS1_ACT_QOS_VAL,
345 VCAP_IS1_ACT_PAG_OVERRIDE_MASK,
346 VCAP_IS1_ACT_PAG_VAL,
348 VCAP_IS1_ACT_VID_REPLACE_ENA,
349 VCAP_IS1_ACT_VID_ADD_VAL,
350 VCAP_IS1_ACT_FID_SEL,
351 VCAP_IS1_ACT_FID_VAL,
352 VCAP_IS1_ACT_PCP_DEI_ENA,
353 VCAP_IS1_ACT_PCP_VAL,
354 VCAP_IS1_ACT_DEI_VAL,
355 VCAP_IS1_ACT_VLAN_POP_CNT_ENA,
356 VCAP_IS1_ACT_VLAN_POP_CNT,
357 VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA,
358 VCAP_IS1_ACT_HIT_STICKY,
361 /* =================================================================
363 * =================================================================
367 ES0_ACTION_TYPE_NORMAL,
371 enum vcap_es0_key_field {
382 enum vcap_es0_action_field {
383 VCAP_ES0_ACT_PUSH_OUTER_TAG,
384 VCAP_ES0_ACT_PUSH_INNER_TAG,
385 VCAP_ES0_ACT_TAG_A_TPID_SEL,
386 VCAP_ES0_ACT_TAG_A_VID_SEL,
387 VCAP_ES0_ACT_TAG_A_PCP_SEL,
388 VCAP_ES0_ACT_TAG_A_DEI_SEL,
389 VCAP_ES0_ACT_TAG_B_TPID_SEL,
390 VCAP_ES0_ACT_TAG_B_VID_SEL,
391 VCAP_ES0_ACT_TAG_B_PCP_SEL,
392 VCAP_ES0_ACT_TAG_B_DEI_SEL,
393 VCAP_ES0_ACT_VID_A_VAL,
394 VCAP_ES0_ACT_PCP_A_VAL,
395 VCAP_ES0_ACT_DEI_A_VAL,
396 VCAP_ES0_ACT_VID_B_VAL,
397 VCAP_ES0_ACT_PCP_B_VAL,
398 VCAP_ES0_ACT_DEI_B_VAL,
400 VCAP_ES0_ACT_HIT_STICKY,
407 enum ocelot_vcap_bit {
413 struct ocelot_vcap_u8 {
418 struct ocelot_vcap_u16 {
423 struct ocelot_vcap_u24 {
428 struct ocelot_vcap_u32 {
433 struct ocelot_vcap_u40 {
438 struct ocelot_vcap_u48 {
443 struct ocelot_vcap_u64 {
448 struct ocelot_vcap_u128 {
453 struct ocelot_vcap_vid {
458 struct ocelot_vcap_ipv4 {
459 struct ocelot_ipv4 value;
460 struct ocelot_ipv4 mask;
463 struct ocelot_vcap_udp_tcp {
468 struct ocelot_vcap_port {
473 enum ocelot_vcap_key_type {
475 OCELOT_VCAP_KEY_ETYPE,
477 OCELOT_VCAP_KEY_SNAP,
479 OCELOT_VCAP_KEY_IPV4,
483 struct ocelot_vcap_key_vlan {
484 struct ocelot_vcap_vid vid; /* VLAN ID (12 bit) */
485 struct ocelot_vcap_u8 pcp; /* PCP (3 bit) */
486 enum ocelot_vcap_bit dei; /* DEI */
487 enum ocelot_vcap_bit tagged; /* Tagged/untagged frame */
490 struct ocelot_vcap_key_etype {
491 struct ocelot_vcap_u48 dmac;
492 struct ocelot_vcap_u48 smac;
493 struct ocelot_vcap_u16 etype;
494 struct ocelot_vcap_u16 data; /* MAC data */
497 struct ocelot_vcap_key_llc {
498 struct ocelot_vcap_u48 dmac;
499 struct ocelot_vcap_u48 smac;
501 /* LLC header: DSAP at byte 0, SSAP at byte 1, Control at byte 2 */
502 struct ocelot_vcap_u32 llc;
505 struct ocelot_vcap_key_snap {
506 struct ocelot_vcap_u48 dmac;
507 struct ocelot_vcap_u48 smac;
509 /* SNAP header: Organization Code at byte 0, Type at byte 3 */
510 struct ocelot_vcap_u40 snap;
513 struct ocelot_vcap_key_arp {
514 struct ocelot_vcap_u48 smac;
515 enum ocelot_vcap_bit arp; /* Opcode ARP/RARP */
516 enum ocelot_vcap_bit req; /* Opcode request/reply */
517 enum ocelot_vcap_bit unknown; /* Opcode unknown */
518 enum ocelot_vcap_bit smac_match; /* Sender MAC matches SMAC */
519 enum ocelot_vcap_bit dmac_match; /* Target MAC matches DMAC */
521 /**< Protocol addr. length 4, hardware length 6 */
522 enum ocelot_vcap_bit length;
524 enum ocelot_vcap_bit ip; /* Protocol address type IP */
525 enum ocelot_vcap_bit ethernet; /* Hardware address type Ethernet */
526 struct ocelot_vcap_ipv4 sip; /* Sender IP address */
527 struct ocelot_vcap_ipv4 dip; /* Target IP address */
530 struct ocelot_vcap_key_ipv4 {
531 enum ocelot_vcap_bit ttl; /* TTL zero */
532 enum ocelot_vcap_bit fragment; /* Fragment */
533 enum ocelot_vcap_bit options; /* Header options */
534 struct ocelot_vcap_u8 ds;
535 struct ocelot_vcap_u8 proto; /* Protocol */
536 struct ocelot_vcap_ipv4 sip; /* Source IP address */
537 struct ocelot_vcap_ipv4 dip; /* Destination IP address */
538 struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */
539 struct ocelot_vcap_udp_tcp sport; /* UDP/TCP: Source port */
540 struct ocelot_vcap_udp_tcp dport; /* UDP/TCP: Destination port */
541 enum ocelot_vcap_bit tcp_fin;
542 enum ocelot_vcap_bit tcp_syn;
543 enum ocelot_vcap_bit tcp_rst;
544 enum ocelot_vcap_bit tcp_psh;
545 enum ocelot_vcap_bit tcp_ack;
546 enum ocelot_vcap_bit tcp_urg;
547 enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */
548 enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */
549 enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */
552 struct ocelot_vcap_key_ipv6 {
553 struct ocelot_vcap_u8 proto; /* IPv6 protocol */
554 struct ocelot_vcap_u128 sip; /* IPv6 source (byte 0-7 ignored) */
555 struct ocelot_vcap_u128 dip; /* IPv6 destination (byte 0-7 ignored) */
556 enum ocelot_vcap_bit ttl; /* TTL zero */
557 struct ocelot_vcap_u8 ds;
558 struct ocelot_vcap_u48 data; /* Not UDP/TCP: IP data */
559 struct ocelot_vcap_udp_tcp sport;
560 struct ocelot_vcap_udp_tcp dport;
561 enum ocelot_vcap_bit tcp_fin;
562 enum ocelot_vcap_bit tcp_syn;
563 enum ocelot_vcap_bit tcp_rst;
564 enum ocelot_vcap_bit tcp_psh;
565 enum ocelot_vcap_bit tcp_ack;
566 enum ocelot_vcap_bit tcp_urg;
567 enum ocelot_vcap_bit sip_eq_dip; /* SIP equals DIP */
568 enum ocelot_vcap_bit sport_eq_dport; /* SPORT equals DPORT */
569 enum ocelot_vcap_bit seq_zero; /* TCP sequence number is zero */
572 enum ocelot_mask_mode {
573 OCELOT_MASK_MODE_NONE,
574 OCELOT_MASK_MODE_PERMIT_DENY,
575 OCELOT_MASK_MODE_POLICY,
576 OCELOT_MASK_MODE_REDIRECT,
579 enum ocelot_es0_tag {
582 OCELOT_FORCE_PORT_TAG,
586 enum ocelot_tag_tpid_sel {
587 OCELOT_TAG_TPID_SEL_8021Q,
588 OCELOT_TAG_TPID_SEL_8021AD,
591 struct ocelot_vcap_action {
595 enum ocelot_es0_tag push_outer_tag;
596 enum ocelot_es0_tag push_inner_tag;
597 enum ocelot_tag_tpid_sel tag_a_tpid_sel;
603 enum ocelot_tag_tpid_sel tag_b_tpid_sel;
613 bool vid_replace_ena;
615 bool vlan_pop_cnt_ena;
622 u8 pag_override_mask;
630 enum ocelot_mask_mode mask_mode;
631 unsigned long port_mask;
633 struct ocelot_policer pol;
639 struct ocelot_vcap_stats {
645 enum ocelot_vcap_filter_type {
646 OCELOT_VCAP_FILTER_DUMMY,
647 OCELOT_VCAP_FILTER_PAG,
648 OCELOT_VCAP_FILTER_OFFLOAD,
651 struct ocelot_vcap_id {
652 unsigned long cookie;
656 struct ocelot_vcap_filter {
657 struct list_head list;
659 enum ocelot_vcap_filter_type type;
665 struct ocelot_vcap_id id;
667 struct ocelot_vcap_action action;
668 struct ocelot_vcap_stats stats;
669 /* For VCAP IS1 and IS2 */
670 unsigned long ingress_port_mask;
672 struct ocelot_vcap_port ingress_port;
673 struct ocelot_vcap_port egress_port;
675 enum ocelot_vcap_bit dmac_mc;
676 enum ocelot_vcap_bit dmac_bc;
677 struct ocelot_vcap_key_vlan vlan;
679 enum ocelot_vcap_key_type key_type;
681 /* OCELOT_VCAP_KEY_ANY: No specific fields */
682 struct ocelot_vcap_key_etype etype;
683 struct ocelot_vcap_key_llc llc;
684 struct ocelot_vcap_key_snap snap;
685 struct ocelot_vcap_key_arp arp;
686 struct ocelot_vcap_key_ipv4 ipv4;
687 struct ocelot_vcap_key_ipv6 ipv6;
691 int ocelot_vcap_filter_add(struct ocelot *ocelot,
692 struct ocelot_vcap_filter *rule,
693 struct netlink_ext_ack *extack);
694 int ocelot_vcap_filter_del(struct ocelot *ocelot,
695 struct ocelot_vcap_filter *rule);
696 struct ocelot_vcap_filter *
697 ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block,
698 unsigned long cookie, bool tc_offload);
700 #endif /* _OCELOT_VCAP_H_ */