165ec1bbeSDaniel Machon /* SPDX-License-Identifier: GPL-2.0+ */ 265ec1bbeSDaniel Machon /* Microchip Sparx5 Switch driver 365ec1bbeSDaniel Machon * 465ec1bbeSDaniel Machon * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries. 565ec1bbeSDaniel Machon */ 665ec1bbeSDaniel Machon 765ec1bbeSDaniel Machon #ifndef __SPARX5_TC_H__ 865ec1bbeSDaniel Machon #define __SPARX5_TC_H__ 965ec1bbeSDaniel Machon 10c9da1ac1SSteen Hegelund #include <net/flow_offload.h> 1167456717SSteen Hegelund #include <net/pkt_cls.h> 1265ec1bbeSDaniel Machon #include <linux/netdevice.h> 1365ec1bbeSDaniel Machon 14c9da1ac1SSteen Hegelund /* Controls how PORT_MASK is applied */ 15c9da1ac1SSteen Hegelund enum SPX5_PORT_MASK_MODE { 16c9da1ac1SSteen Hegelund SPX5_PMM_OR_DSTMASK, 17c9da1ac1SSteen Hegelund SPX5_PMM_AND_VLANMASK, 18c9da1ac1SSteen Hegelund SPX5_PMM_REPLACE_PGID, 19c9da1ac1SSteen Hegelund SPX5_PMM_REPLACE_ALL, 20c9da1ac1SSteen Hegelund SPX5_PMM_REDIR_PGID, 21c9da1ac1SSteen Hegelund SPX5_PMM_OR_PGID_MASK, 22c9da1ac1SSteen Hegelund }; 23c9da1ac1SSteen Hegelund 2452b28a93SSteen Hegelund /* Controls ES0 forwarding */ 2552b28a93SSteen Hegelund enum SPX5_FORWARDING_SEL { 2652b28a93SSteen Hegelund SPX5_FWSEL_NO_ACTION, 2752b28a93SSteen Hegelund SPX5_FWSEL_COPY_TO_LOOPBACK, 2852b28a93SSteen Hegelund SPX5_FWSEL_REDIRECT_TO_LOOPBACK, 2952b28a93SSteen Hegelund SPX5_FWSEL_DISCARD, 3052b28a93SSteen Hegelund }; 3152b28a93SSteen Hegelund 32*ebf44dedSSteen Hegelund /* Controls tag A (outer tagging) */ 33*ebf44dedSSteen Hegelund enum SPX5_OUTER_TAG_SEL { 34*ebf44dedSSteen Hegelund SPX5_OTAG_PORT, 35*ebf44dedSSteen Hegelund SPX5_OTAG_TAG_A, 36*ebf44dedSSteen Hegelund SPX5_OTAG_FORCED_PORT, 37*ebf44dedSSteen Hegelund SPX5_OTAG_UNTAG, 38*ebf44dedSSteen Hegelund }; 39*ebf44dedSSteen Hegelund 40*ebf44dedSSteen Hegelund /* Selects TPID for ES0 tag A */ 41*ebf44dedSSteen Hegelund enum SPX5_TPID_A_SEL { 42*ebf44dedSSteen Hegelund SPX5_TPID_A_8100, 43*ebf44dedSSteen Hegelund SPX5_TPID_A_88A8, 44*ebf44dedSSteen Hegelund SPX5_TPID_A_CUST1, 45*ebf44dedSSteen Hegelund SPX5_TPID_A_CUST2, 46*ebf44dedSSteen Hegelund SPX5_TPID_A_CUST3, 47*ebf44dedSSteen Hegelund SPX5_TPID_A_CLASSIFIED, 48*ebf44dedSSteen Hegelund }; 49*ebf44dedSSteen Hegelund 50*ebf44dedSSteen Hegelund /* Selects VID for ES0 tag A */ 51*ebf44dedSSteen Hegelund enum SPX5_VID_A_SEL { 52*ebf44dedSSteen Hegelund SPX5_VID_A_CLASSIFIED, 53*ebf44dedSSteen Hegelund SPX5_VID_A_VAL, 54*ebf44dedSSteen Hegelund SPX5_VID_A_IFH, 55*ebf44dedSSteen Hegelund SPX5_VID_A_RESERVED, 56*ebf44dedSSteen Hegelund }; 57*ebf44dedSSteen Hegelund 58*ebf44dedSSteen Hegelund /* Select PCP source for ES0 tag A */ 59*ebf44dedSSteen Hegelund enum SPX5_PCP_A_SEL { 60*ebf44dedSSteen Hegelund SPX5_PCP_A_CLASSIFIED, 61*ebf44dedSSteen Hegelund SPX5_PCP_A_VAL, 62*ebf44dedSSteen Hegelund SPX5_PCP_A_RESERVED, 63*ebf44dedSSteen Hegelund SPX5_PCP_A_POPPED, 64*ebf44dedSSteen Hegelund SPX5_PCP_A_MAPPED_0, 65*ebf44dedSSteen Hegelund SPX5_PCP_A_MAPPED_1, 66*ebf44dedSSteen Hegelund SPX5_PCP_A_MAPPED_2, 67*ebf44dedSSteen Hegelund SPX5_PCP_A_MAPPED_3, 68*ebf44dedSSteen Hegelund }; 69*ebf44dedSSteen Hegelund 70*ebf44dedSSteen Hegelund /* Select DEI source for ES0 tag A */ 71*ebf44dedSSteen Hegelund enum SPX5_DEI_A_SEL { 72*ebf44dedSSteen Hegelund SPX5_DEI_A_CLASSIFIED, 73*ebf44dedSSteen Hegelund SPX5_DEI_A_VAL, 74*ebf44dedSSteen Hegelund SPX5_DEI_A_REW, 75*ebf44dedSSteen Hegelund SPX5_DEI_A_POPPED, 76*ebf44dedSSteen Hegelund SPX5_DEI_A_MAPPED_0, 77*ebf44dedSSteen Hegelund SPX5_DEI_A_MAPPED_1, 78*ebf44dedSSteen Hegelund SPX5_DEI_A_MAPPED_2, 79*ebf44dedSSteen Hegelund SPX5_DEI_A_MAPPED_3, 80*ebf44dedSSteen Hegelund }; 81*ebf44dedSSteen Hegelund 82*ebf44dedSSteen Hegelund /* Controls tag B (inner tagging) */ 83*ebf44dedSSteen Hegelund enum SPX5_INNER_TAG_SEL { 84*ebf44dedSSteen Hegelund SPX5_ITAG_NO_PUSH, 85*ebf44dedSSteen Hegelund SPX5_ITAG_PUSH_B_TAG, 86*ebf44dedSSteen Hegelund }; 87*ebf44dedSSteen Hegelund 88*ebf44dedSSteen Hegelund /* Selects TPID for ES0 tag B. */ 89*ebf44dedSSteen Hegelund enum SPX5_TPID_B_SEL { 90*ebf44dedSSteen Hegelund SPX5_TPID_B_8100, 91*ebf44dedSSteen Hegelund SPX5_TPID_B_88A8, 92*ebf44dedSSteen Hegelund SPX5_TPID_B_CUST1, 93*ebf44dedSSteen Hegelund SPX5_TPID_B_CUST2, 94*ebf44dedSSteen Hegelund SPX5_TPID_B_CUST3, 95*ebf44dedSSteen Hegelund SPX5_TPID_B_CLASSIFIED, 96*ebf44dedSSteen Hegelund }; 97*ebf44dedSSteen Hegelund 9865ec1bbeSDaniel Machon int sparx5_port_setup_tc(struct net_device *ndev, enum tc_setup_type type, 9965ec1bbeSDaniel Machon void *type_data); 10065ec1bbeSDaniel Machon 10167456717SSteen Hegelund int sparx5_tc_matchall(struct net_device *ndev, 10267456717SSteen Hegelund struct tc_cls_matchall_offload *tmo, 10367456717SSteen Hegelund bool ingress); 10467456717SSteen Hegelund 105c9da1ac1SSteen Hegelund int sparx5_tc_flower(struct net_device *ndev, struct flow_cls_offload *fco, 106c9da1ac1SSteen Hegelund bool ingress); 107c9da1ac1SSteen Hegelund 10865ec1bbeSDaniel Machon #endif /* __SPARX5_TC_H__ */ 109