1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_AGGR_H 28*0Sstevel@tonic-gate #define _SYS_AGGR_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #include <sys/types.h> 33*0Sstevel@tonic-gate #include <sys/ethernet.h> 34*0Sstevel@tonic-gate #include <sys/param.h> 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #ifdef __cplusplus 37*0Sstevel@tonic-gate extern "C" { 38*0Sstevel@tonic-gate #endif 39*0Sstevel@tonic-gate 40*0Sstevel@tonic-gate /* control interface name */ 41*0Sstevel@tonic-gate #define AGGR_DEVNAME_CTL "ctl" 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate /* 44*0Sstevel@tonic-gate * Transmit load balancing policies. 45*0Sstevel@tonic-gate */ 46*0Sstevel@tonic-gate 47*0Sstevel@tonic-gate #define AGGR_POLICY_L2 0x01 48*0Sstevel@tonic-gate #define AGGR_POLICY_L3 0x02 49*0Sstevel@tonic-gate #define AGGR_POLICY_L4 0x04 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate /* 52*0Sstevel@tonic-gate * LACP mode and timer. 53*0Sstevel@tonic-gate */ 54*0Sstevel@tonic-gate 55*0Sstevel@tonic-gate typedef enum { 56*0Sstevel@tonic-gate AGGR_LACP_OFF = 0, 57*0Sstevel@tonic-gate AGGR_LACP_ACTIVE = 1, 58*0Sstevel@tonic-gate AGGR_LACP_PASSIVE = 2 59*0Sstevel@tonic-gate } aggr_lacp_mode_t; 60*0Sstevel@tonic-gate 61*0Sstevel@tonic-gate typedef enum { 62*0Sstevel@tonic-gate AGGR_LACP_TIMER_LONG = 0, 63*0Sstevel@tonic-gate AGGR_LACP_TIMER_SHORT = 1 64*0Sstevel@tonic-gate } aggr_lacp_timer_t; 65*0Sstevel@tonic-gate 66*0Sstevel@tonic-gate /* 67*0Sstevel@tonic-gate * MAC port state. 68*0Sstevel@tonic-gate */ 69*0Sstevel@tonic-gate typedef enum { 70*0Sstevel@tonic-gate AGGR_PORT_STATE_STANDBY = 1, 71*0Sstevel@tonic-gate AGGR_PORT_STATE_ATTACHED = 2 72*0Sstevel@tonic-gate } aggr_port_state_t; 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate /* Maximum number of ports per aggregation. */ 75*0Sstevel@tonic-gate #define AGGR_MAX_PORTS 256 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate /* 78*0Sstevel@tonic-gate * LACP port state. 79*0Sstevel@tonic-gate */ 80*0Sstevel@tonic-gate typedef union { 81*0Sstevel@tonic-gate struct { 82*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_HTOL) 83*0Sstevel@tonic-gate uint8_t expired: 1; 84*0Sstevel@tonic-gate uint8_t defaulted: 1; 85*0Sstevel@tonic-gate uint8_t distributing: 1; 86*0Sstevel@tonic-gate uint8_t collecting: 1; 87*0Sstevel@tonic-gate uint8_t sync: 1; 88*0Sstevel@tonic-gate uint8_t aggregation: 1; 89*0Sstevel@tonic-gate uint8_t timeout: 1; 90*0Sstevel@tonic-gate uint8_t activity: 1; 91*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_LTOH) 92*0Sstevel@tonic-gate uint8_t activity: 1; 93*0Sstevel@tonic-gate uint8_t timeout: 1; 94*0Sstevel@tonic-gate uint8_t aggregation: 1; 95*0Sstevel@tonic-gate uint8_t sync: 1; 96*0Sstevel@tonic-gate uint8_t collecting: 1; 97*0Sstevel@tonic-gate uint8_t distributing: 1; 98*0Sstevel@tonic-gate uint8_t defaulted: 1; 99*0Sstevel@tonic-gate uint8_t expired: 1; 100*0Sstevel@tonic-gate #else 101*0Sstevel@tonic-gate #error "unknown bit fields ordering" 102*0Sstevel@tonic-gate #endif 103*0Sstevel@tonic-gate } bit; 104*0Sstevel@tonic-gate uint8_t state; 105*0Sstevel@tonic-gate } aggr_lacp_state_t; 106*0Sstevel@tonic-gate 107*0Sstevel@tonic-gate #define LAIOC(x) (('l' << 24) | ('a' << 16) | ('m' << 8) | (x)) 108*0Sstevel@tonic-gate 109*0Sstevel@tonic-gate /* one of the ports of a link aggregation group */ 110*0Sstevel@tonic-gate typedef struct laioc_port { 111*0Sstevel@tonic-gate char lp_devname[MAXNAMELEN + 1]; 112*0Sstevel@tonic-gate uint_t lp_port; 113*0Sstevel@tonic-gate } laioc_port_t; 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate #define LAIOC_CREATE LAIOC(1) 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate typedef struct laioc_create { 118*0Sstevel@tonic-gate uint32_t lc_key; 119*0Sstevel@tonic-gate uint32_t lc_nports; 120*0Sstevel@tonic-gate caddr_t lc_ports; /* ptr to lacio_port_t */ 121*0Sstevel@tonic-gate uint32_t lc_policy; 122*0Sstevel@tonic-gate uchar_t lc_mac[ETHERADDRL]; 123*0Sstevel@tonic-gate boolean_t lc_mac_fixed; 124*0Sstevel@tonic-gate aggr_lacp_mode_t lc_lacp_mode; 125*0Sstevel@tonic-gate aggr_lacp_timer_t lc_lacp_timer; 126*0Sstevel@tonic-gate } laioc_create_t; 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate #ifdef _SYSCALL32 129*0Sstevel@tonic-gate 130*0Sstevel@tonic-gate typedef struct laioc_create32 { 131*0Sstevel@tonic-gate uint32_t lc_key; 132*0Sstevel@tonic-gate uint32_t lc_nports; 133*0Sstevel@tonic-gate caddr32_t lc_ports; 134*0Sstevel@tonic-gate uint32_t lc_policy; 135*0Sstevel@tonic-gate uchar_t lc_mac[ETHERADDRL]; 136*0Sstevel@tonic-gate boolean_t lc_mac_fixed; 137*0Sstevel@tonic-gate aggr_lacp_mode_t lc_lacp_mode; 138*0Sstevel@tonic-gate aggr_lacp_timer_t lc_lacp_timer; 139*0Sstevel@tonic-gate } laioc_create32_t; 140*0Sstevel@tonic-gate 141*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate #define LAIOC_DELETE LAIOC(2) 144*0Sstevel@tonic-gate 145*0Sstevel@tonic-gate typedef struct laioc_delete { 146*0Sstevel@tonic-gate uint32_t ld_key; 147*0Sstevel@tonic-gate } laioc_delete_t; 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate #ifdef _SYSCALL32 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate typedef struct laioc_delete32 { 152*0Sstevel@tonic-gate uint32_t ld_key; 153*0Sstevel@tonic-gate } laioc_delete32_t; 154*0Sstevel@tonic-gate 155*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate #define LAIOC_INFO LAIOC(3) 158*0Sstevel@tonic-gate 159*0Sstevel@tonic-gate typedef enum aggr_link_duplex { 160*0Sstevel@tonic-gate AGGR_LINK_DUPLEX_FULL = 1, 161*0Sstevel@tonic-gate AGGR_LINK_DUPLEX_HALF = 2, 162*0Sstevel@tonic-gate AGGR_LINK_DUPLEX_UNKNOWN = 3 163*0Sstevel@tonic-gate } aggr_link_duplex_t; 164*0Sstevel@tonic-gate 165*0Sstevel@tonic-gate typedef enum aggr_link_state { 166*0Sstevel@tonic-gate AGGR_LINK_STATE_UP = 1, 167*0Sstevel@tonic-gate AGGR_LINK_STATE_DOWN = 2, 168*0Sstevel@tonic-gate AGGR_LINK_STATE_UNKNOWN = 3 169*0Sstevel@tonic-gate } aggr_link_state_t; 170*0Sstevel@tonic-gate 171*0Sstevel@tonic-gate typedef struct laioc_info_port { 172*0Sstevel@tonic-gate char lp_devname[MAXNAMELEN + 1]; 173*0Sstevel@tonic-gate uint32_t lp_port; 174*0Sstevel@tonic-gate uchar_t lp_mac[ETHERADDRL]; 175*0Sstevel@tonic-gate aggr_port_state_t lp_state; 176*0Sstevel@tonic-gate aggr_lacp_state_t lp_lacp_state; 177*0Sstevel@tonic-gate } laioc_info_port_t; 178*0Sstevel@tonic-gate 179*0Sstevel@tonic-gate typedef struct laioc_info_group { 180*0Sstevel@tonic-gate uint32_t lg_key; 181*0Sstevel@tonic-gate uchar_t lg_mac[ETHERADDRL]; 182*0Sstevel@tonic-gate boolean_t lg_mac_fixed; 183*0Sstevel@tonic-gate uint32_t lg_policy; 184*0Sstevel@tonic-gate uint32_t lg_nports; 185*0Sstevel@tonic-gate aggr_lacp_mode_t lg_lacp_mode; 186*0Sstevel@tonic-gate aggr_lacp_timer_t lg_lacp_timer; 187*0Sstevel@tonic-gate } laioc_info_group_t; 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate typedef struct laioc_info { 190*0Sstevel@tonic-gate uint32_t li_bufsize; 191*0Sstevel@tonic-gate uint32_t li_ngroups; 192*0Sstevel@tonic-gate uint32_t li_group_key; /* 0 returns all */ 193*0Sstevel@tonic-gate } laioc_info_t; 194*0Sstevel@tonic-gate 195*0Sstevel@tonic-gate #define LAIOC_ADD LAIOC(4) 196*0Sstevel@tonic-gate #define LAIOC_REMOVE LAIOC(5) 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate typedef struct laioc_add_rem { 199*0Sstevel@tonic-gate uint32_t la_key; 200*0Sstevel@tonic-gate uint32_t la_nports; 201*0Sstevel@tonic-gate caddr_t la_ports; 202*0Sstevel@tonic-gate } laioc_add_t; 203*0Sstevel@tonic-gate 204*0Sstevel@tonic-gate #ifdef _SYSCALL32 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate typedef struct laioc_add_rem32 { 207*0Sstevel@tonic-gate uint32_t la_key; 208*0Sstevel@tonic-gate uint32_t la_nports; 209*0Sstevel@tonic-gate caddr32_t la_ports; 210*0Sstevel@tonic-gate } laioc_add_rem32_t; 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 213*0Sstevel@tonic-gate 214*0Sstevel@tonic-gate #define LAIOC_MODIFY LAIOC(6) 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate #define LAIOC_MODIFY_POLICY 0x01 217*0Sstevel@tonic-gate #define LAIOC_MODIFY_MAC 0x02 218*0Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_MODE 0x04 219*0Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_TIMER 0x08 220*0Sstevel@tonic-gate 221*0Sstevel@tonic-gate typedef struct laioc_modify { 222*0Sstevel@tonic-gate uint32_t lu_key; 223*0Sstevel@tonic-gate uint8_t lu_modify_mask; 224*0Sstevel@tonic-gate uint32_t lu_policy; 225*0Sstevel@tonic-gate uchar_t lu_mac[ETHERADDRL]; 226*0Sstevel@tonic-gate boolean_t lu_mac_fixed; 227*0Sstevel@tonic-gate aggr_lacp_mode_t lu_lacp_mode; 228*0Sstevel@tonic-gate aggr_lacp_timer_t lu_lacp_timer; 229*0Sstevel@tonic-gate } laioc_modify_t; 230*0Sstevel@tonic-gate 231*0Sstevel@tonic-gate #ifdef _SYSCALL32 232*0Sstevel@tonic-gate 233*0Sstevel@tonic-gate typedef struct laioc_modify32 { 234*0Sstevel@tonic-gate uint32_t lu_key; 235*0Sstevel@tonic-gate uint8_t lu_modify_mask; 236*0Sstevel@tonic-gate uint32_t lu_policy; 237*0Sstevel@tonic-gate uchar_t lu_mac[ETHERADDRL]; 238*0Sstevel@tonic-gate boolean_t lu_mac_fixed; 239*0Sstevel@tonic-gate aggr_lacp_mode_t lu_lacp_mode; 240*0Sstevel@tonic-gate aggr_lacp_timer_t lu_lacp_timer; 241*0Sstevel@tonic-gate } laioc_modify32_t; 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate #endif /* _SYSCALL32 */ 244*0Sstevel@tonic-gate 245*0Sstevel@tonic-gate #ifdef __cplusplus 246*0Sstevel@tonic-gate } 247*0Sstevel@tonic-gate #endif 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate #endif /* _SYS_AGGR_H */ 250