1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Microchip Sparx5 Switch driver
4 * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
7 #ifndef __SPARX5_TC_H__
8 #define __SPARX5_TC_H__
10 #include <net/flow_offload.h>
11 #include <net/pkt_cls.h>
12 #include <linux/netdevice.h>
14 /* Controls how PORT_MASK is applied */
15 enum SPX5_PORT_MASK_MODE
{
17 SPX5_PMM_AND_VLANMASK
,
18 SPX5_PMM_REPLACE_PGID
,
21 SPX5_PMM_OR_PGID_MASK
,
24 /* Controls ES0 forwarding */
25 enum SPX5_FORWARDING_SEL
{
27 SPX5_FWSEL_COPY_TO_LOOPBACK
,
28 SPX5_FWSEL_REDIRECT_TO_LOOPBACK
,
32 /* Controls tag A (outer tagging) */
33 enum SPX5_OUTER_TAG_SEL
{
36 SPX5_OTAG_FORCED_PORT
,
40 /* Selects TPID for ES0 tag A */
41 enum SPX5_TPID_A_SEL
{
47 SPX5_TPID_A_CLASSIFIED
,
50 /* Selects VID for ES0 tag A */
52 SPX5_VID_A_CLASSIFIED
,
58 /* Select PCP source for ES0 tag A */
60 SPX5_PCP_A_CLASSIFIED
,
70 /* Select DEI source for ES0 tag A */
72 SPX5_DEI_A_CLASSIFIED
,
82 /* Controls tag B (inner tagging) */
83 enum SPX5_INNER_TAG_SEL
{
88 /* Selects TPID for ES0 tag B. */
89 enum SPX5_TPID_B_SEL
{
95 SPX5_TPID_B_CLASSIFIED
,
98 int sparx5_port_setup_tc(struct net_device
*ndev
, enum tc_setup_type type
,
101 int sparx5_tc_matchall(struct net_device
*ndev
,
102 struct tc_cls_matchall_offload
*tmo
,
105 int sparx5_tc_flower(struct net_device
*ndev
, struct flow_cls_offload
*fco
,
108 #endif /* __SPARX5_TC_H__ */