xref: /titanic_41/usr/src/uts/common/io/hxge/hxge_classify.h (revision cc1a9a89a73172cc2db053635fab3b1b91691657)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _HXGE_CLASSIFY_H
28 #define	_HXGE_CLASSIFY_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #include <hxge_pfc.h>
37 #include <hxge_pfc_hw.h>
38 #include <hpi_pfc.h>
39 
40 
41 /*
42  * The following are the user configurable ether types. Refer to
43  * /usr/include/sys/ethernet.h
44  *
45  * ETHERTYPE_PUP	(0x0200)
46  * ETHERTYPE_802_MIN	(0x0600)
47  * ETHERTYPE_IP		(0x0800)
48  * ETHERTYPE_ARP	(0x0806)
49  * ETHERTYPE_REVARP	(0x8035)
50  * ETHERTYPE_AT		(0x809b)
51  * ETHERTYPE_AARP	(0x80f3)
52  * ETHERTYPE_IPV6	(0x86dd)
53  * ETHERTYPE_SLOW	(0x8809)
54  * ETHERTYPE_PPPOED	(0x8863)
55  * ETHERTYPE_PPPOES	(0x8864)
56  * ETHERTYPE_MAX	(0xffff)
57  */
58 
59 /*
60  * Used for ip class tcam key config
61  */
62 #define	HXGE_CLASS_TCAM_LOOKUP		0x10000
63 #define	HXGE_CLASS_DISCARD		0x20000
64 #define	HXGE_CLASS_VALID		0x40000
65 #define	HXGE_CLASS_ETHER_TYPE_MASK	0x0FFFF
66 
67 typedef struct _tcam_flow_spec {
68 	hxge_tcam_entry_t tce;
69 	uint64_t flags;
70 	uint64_t user_info;
71 } tcam_flow_spec_t, *p_tcam_flow_spec_t;
72 
73 typedef struct {
74 	uint16_t	ether_type;
75 	int		count;	/* How many TCAM entries using this class. */
76 } hxge_class_usage_t;
77 
78 #define	HXGE_PFC_HW_RESET	0x1
79 #define	HXGE_PFC_HW_INIT	0x2
80 #define	HXGE_PFC_SW_INIT	0x4
81 
82 typedef struct _hxge_classify {
83 	uint32_t 		tcam_size;
84 	uint32_t		n_used;
85 	uint32_t 		state;
86 	p_hxge_pfc_stats_t	pfc_stats;
87 
88 	tcam_flow_spec_t	*tcam_entries;
89 	uint8_t			tcam_location;
90 	hxge_class_usage_t	class_usage[TCAM_CLASS_MAX];
91 } hxge_classify_t, *p_hxge_classify_t;
92 
93 #ifdef	__cplusplus
94 }
95 #endif
96 
97 #endif	/* _HXGE_CLASSIFY_H */
98