3882 Remove xmod & friends
[illumos-gate.git] / usr / src / uts / common / sys / aggr.h
blobc63cc9e99f56ff016f457bea34e54c1992b3b775
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_AGGR_H
27 #define _SYS_AGGR_H
29 #include <sys/types.h>
30 #include <sys/ethernet.h>
31 #include <sys/param.h>
32 #include <sys/mac.h>
33 #include <sys/dld_ioc.h>
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
40 * Note that the data structures defined here define an ioctl interface
41 * that is shared betwen user and kernel space. The aggr driver thus
42 * assumes that the structures have identical layout and size when
43 * compiled in either IPL32 or LP64.
47 * Transmit load balancing policies.
50 #define AGGR_POLICY_L2 0x01
51 #define AGGR_POLICY_L3 0x02
52 #define AGGR_POLICY_L4 0x04
55 * LACP mode and timer.
58 typedef enum {
59 AGGR_LACP_OFF = 0,
60 AGGR_LACP_ACTIVE = 1,
61 AGGR_LACP_PASSIVE = 2
62 } aggr_lacp_mode_t;
64 typedef enum {
65 AGGR_LACP_TIMER_LONG = 0,
66 AGGR_LACP_TIMER_SHORT = 1
67 } aggr_lacp_timer_t;
70 * MAC port state.
72 typedef enum {
73 AGGR_PORT_STATE_STANDBY = 1,
74 AGGR_PORT_STATE_ATTACHED = 2
75 } aggr_port_state_t;
77 /* Maximum number of ports per aggregation. */
78 #define AGGR_MAX_PORTS 256
81 * The largest configurable aggregation key. Because by default the key is
82 * used as the DLPI device PPA and default VLAN PPA's are calculated as
83 * ((1000 * vid) + PPA), the largest key can't be > 999.
85 #define AGGR_MAX_KEY 999
88 * LACP port state.
90 typedef union {
91 struct {
92 #if defined(_BIT_FIELDS_HTOL)
93 uint8_t expired: 1;
94 uint8_t defaulted: 1;
95 uint8_t distributing: 1;
96 uint8_t collecting: 1;
97 uint8_t sync: 1;
98 uint8_t aggregation: 1;
99 uint8_t timeout: 1;
100 uint8_t activity: 1;
101 #elif defined(_BIT_FIELDS_LTOH)
102 uint8_t activity: 1;
103 uint8_t timeout: 1;
104 uint8_t aggregation: 1;
105 uint8_t sync: 1;
106 uint8_t collecting: 1;
107 uint8_t distributing: 1;
108 uint8_t defaulted: 1;
109 uint8_t expired: 1;
110 #else
111 #error "unknown bit fields ordering"
112 #endif
113 } bit;
114 uint8_t state;
115 } aggr_lacp_state_t;
117 /* one of the ports of a link aggregation group */
118 typedef struct laioc_port {
119 datalink_id_t lp_linkid;
120 } laioc_port_t;
122 #define LAIOC_CREATE AGGRIOC(1)
124 typedef struct laioc_create {
125 datalink_id_t lc_linkid;
126 uint32_t lc_key;
127 uint32_t lc_nports;
128 uint32_t lc_policy;
129 uchar_t lc_mac[ETHERADDRL];
130 aggr_lacp_mode_t lc_lacp_mode;
131 aggr_lacp_timer_t lc_lacp_timer;
132 uint32_t lc_mac_fixed : 1,
133 lc_force : 1,
134 lc_pad_bits : 30;
135 } laioc_create_t;
137 #define LAIOC_DELETE AGGRIOC(2)
139 typedef struct laioc_delete {
140 datalink_id_t ld_linkid;
141 } laioc_delete_t;
143 #define LAIOC_INFO AGGRIOC(3)
145 typedef enum aggr_link_duplex {
146 AGGR_LINK_DUPLEX_FULL = 1,
147 AGGR_LINK_DUPLEX_HALF = 2,
148 AGGR_LINK_DUPLEX_UNKNOWN = 3
149 } aggr_link_duplex_t;
151 typedef enum aggr_link_state {
152 AGGR_LINK_STATE_UP = 1,
153 AGGR_LINK_STATE_DOWN = 2,
154 AGGR_LINK_STATE_UNKNOWN = 3
155 } aggr_link_state_t;
157 typedef struct laioc_info_port {
158 datalink_id_t lp_linkid;
159 uchar_t lp_mac[ETHERADDRL];
160 aggr_port_state_t lp_state;
161 aggr_lacp_state_t lp_lacp_state;
162 } laioc_info_port_t;
164 typedef struct laioc_info_group {
165 datalink_id_t lg_linkid;
166 uint32_t lg_key;
167 uchar_t lg_mac[ETHERADDRL];
168 boolean_t lg_mac_fixed;
169 boolean_t lg_force;
170 uint32_t lg_policy;
171 uint32_t lg_nports;
172 aggr_lacp_mode_t lg_lacp_mode;
173 aggr_lacp_timer_t lg_lacp_timer;
174 } laioc_info_group_t;
176 typedef struct laioc_info {
177 /* Must not be DLADM_INVALID_LINKID */
178 datalink_id_t li_group_linkid;
179 uint32_t li_bufsize;
180 } laioc_info_t;
182 #define LAIOC_ADD AGGRIOC(4)
183 #define LAIOC_REMOVE AGGRIOC(5)
185 typedef struct laioc_add_rem {
186 datalink_id_t la_linkid;
187 uint32_t la_nports;
188 uint32_t la_force;
189 } laioc_add_rem_t;
191 #define LAIOC_MODIFY AGGRIOC(6)
193 #define LAIOC_MODIFY_POLICY 0x01
194 #define LAIOC_MODIFY_MAC 0x02
195 #define LAIOC_MODIFY_LACP_MODE 0x04
196 #define LAIOC_MODIFY_LACP_TIMER 0x08
198 typedef struct laioc_modify {
199 datalink_id_t lu_linkid;
200 uint8_t lu_modify_mask;
201 uint32_t lu_policy;
202 uchar_t lu_mac[ETHERADDRL];
203 boolean_t lu_mac_fixed;
204 aggr_lacp_mode_t lu_lacp_mode;
205 aggr_lacp_timer_t lu_lacp_timer;
206 } laioc_modify_t;
208 #ifdef __cplusplus
210 #endif
212 #endif /* _SYS_AGGR_H */