summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/microchip/sparx5/sparx5_tc.h
blob: 7ef470b2856675b1fb214ab45600300c98242434 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* SPDX-License-Identifier: GPL-2.0+ */
/* Microchip Sparx5 Switch driver
 *
 * Copyright (c) 2022 Microchip Technology Inc. and its subsidiaries.
 */

#ifndef __SPARX5_TC_H__
#define __SPARX5_TC_H__

#include <net/flow_offload.h>
#include <net/pkt_cls.h>
#include <linux/netdevice.h>

/* Controls how PORT_MASK is applied */
enum SPX5_PORT_MASK_MODE {
	SPX5_PMM_OR_DSTMASK,
	SPX5_PMM_AND_VLANMASK,
	SPX5_PMM_REPLACE_PGID,
	SPX5_PMM_REPLACE_ALL,
	SPX5_PMM_REDIR_PGID,
	SPX5_PMM_OR_PGID_MASK,
};

/* Controls ES0 forwarding  */
enum SPX5_FORWARDING_SEL {
	SPX5_FWSEL_NO_ACTION,
	SPX5_FWSEL_COPY_TO_LOOPBACK,
	SPX5_FWSEL_REDIRECT_TO_LOOPBACK,
	SPX5_FWSEL_DISCARD,
};

/* Controls tag A (outer tagging) */
enum SPX5_OUTER_TAG_SEL {
	SPX5_OTAG_PORT,
	SPX5_OTAG_TAG_A,
	SPX5_OTAG_FORCED_PORT,
	SPX5_OTAG_UNTAG,
};

/* Selects TPID for ES0 tag A */
enum SPX5_TPID_A_SEL {
	SPX5_TPID_A_8100,
	SPX5_TPID_A_88A8,
	SPX5_TPID_A_CUST1,
	SPX5_TPID_A_CUST2,
	SPX5_TPID_A_CUST3,
	SPX5_TPID_A_CLASSIFIED,
};

/* Selects VID for ES0 tag A */
enum SPX5_VID_A_SEL {
	SPX5_VID_A_CLASSIFIED,
	SPX5_VID_A_VAL,
	SPX5_VID_A_IFH,
	SPX5_VID_A_RESERVED,
};

/* Select PCP source for ES0 tag A */
enum SPX5_PCP_A_SEL {
	SPX5_PCP_A_CLASSIFIED,
	SPX5_PCP_A_VAL,
	SPX5_PCP_A_RESERVED,
	SPX5_PCP_A_POPPED,
	SPX5_PCP_A_MAPPED_0,
	SPX5_PCP_A_MAPPED_1,
	SPX5_PCP_A_MAPPED_2,
	SPX5_PCP_A_MAPPED_3,
};

/* Select DEI source for ES0 tag A */
enum SPX5_DEI_A_SEL {
	SPX5_DEI_A_CLASSIFIED,
	SPX5_DEI_A_VAL,
	SPX5_DEI_A_REW,
	SPX5_DEI_A_POPPED,
	SPX5_DEI_A_MAPPED_0,
	SPX5_DEI_A_MAPPED_1,
	SPX5_DEI_A_MAPPED_2,
	SPX5_DEI_A_MAPPED_3,
};

/* Controls tag B (inner tagging) */
enum SPX5_INNER_TAG_SEL {
	SPX5_ITAG_NO_PUSH,
	SPX5_ITAG_PUSH_B_TAG,
};

/* Selects TPID for ES0 tag B. */
enum SPX5_TPID_B_SEL {
	SPX5_TPID_B_8100,
	SPX5_TPID_B_88A8,
	SPX5_TPID_B_CUST1,
	SPX5_TPID_B_CUST2,
	SPX5_TPID_B_CUST3,
	SPX5_TPID_B_CLASSIFIED,
};

int sparx5_port_setup_tc(struct net_device *ndev, enum tc_setup_type type,
			 void *type_data);

int sparx5_tc_matchall(struct net_device *ndev,
		       struct tc_cls_matchall_offload *tmo,
		       bool ingress);

int sparx5_tc_flower(struct net_device *ndev, struct flow_cls_offload *fco,
		     bool ingress);

#endif	/* __SPARX5_TC_H__ */