xref: /illumos-gate/usr/src/uts/common/io/hxge/hxge_classify.h (revision 0fb96ba1f1ce26ff8b286f8f928769a6afcb00a6)
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 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <hxge_pfc.h>
35 #include <hxge_pfc_hw.h>
36 #include <hpi_pfc.h>
37 
38 
39 /*
40  * The following are the user configurable ether types. Refer to
41  * /usr/include/sys/ethernet.h
42  *
43  * ETHERTYPE_PUP	(0x0200)
44  * ETHERTYPE_802_MIN	(0x0600)
45  * ETHERTYPE_IP		(0x0800)
46  * ETHERTYPE_ARP	(0x0806)
47  * ETHERTYPE_REVARP	(0x8035)
48  * ETHERTYPE_AT		(0x809b)
49  * ETHERTYPE_AARP	(0x80f3)
50  * ETHERTYPE_IPV6	(0x86dd)
51  * ETHERTYPE_SLOW	(0x8809)
52  * ETHERTYPE_PPPOED	(0x8863)
53  * ETHERTYPE_PPPOES	(0x8864)
54  * ETHERTYPE_MAX	(0xffff)
55  */
56 
57 /*
58  * Used for ip class tcam key config
59  */
60 #define	HXGE_CLASS_TCAM_LOOKUP		0x10000
61 #define	HXGE_CLASS_DISCARD		0x20000
62 #define	HXGE_CLASS_VALID		0x40000
63 #define	HXGE_CLASS_ETHER_TYPE_MASK	0x0FFFF
64 
65 typedef struct _tcam_flow_spec {
66 	hxge_tcam_entry_t tce;
67 	uint64_t flags;
68 	uint64_t user_info;
69 } tcam_flow_spec_t, *p_tcam_flow_spec_t;
70 
71 typedef struct {
72 	uint16_t	ether_type;
73 	int		count;	/* How many TCAM entries using this class. */
74 } hxge_class_usage_t;
75 
76 #define	HXGE_PFC_HW_RESET	0x1
77 #define	HXGE_PFC_HW_INIT	0x2
78 #define	HXGE_PFC_SW_INIT	0x4
79 
80 typedef struct _hxge_classify {
81 	uint32_t 		tcam_size;
82 	uint32_t		n_used;
83 	uint32_t 		state;
84 	p_hxge_pfc_stats_t	pfc_stats;
85 
86 	tcam_flow_spec_t	*tcam_entries;
87 	uint8_t			tcam_location;
88 	hxge_class_usage_t	class_usage[TCAM_CLASS_MAX];
89 } hxge_classify_t, *p_hxge_classify_t;
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif	/* _HXGE_CLASSIFY_H */
96