10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*2311Sseb * Common Development and Distribution License (the "License"). 6*2311Sseb * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 22*2311Sseb * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_AGGR_H 270Sstevel@tonic-gate #define _SYS_AGGR_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 300Sstevel@tonic-gate 310Sstevel@tonic-gate #include <sys/types.h> 320Sstevel@tonic-gate #include <sys/ethernet.h> 330Sstevel@tonic-gate #include <sys/param.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 390Sstevel@tonic-gate /* control interface name */ 400Sstevel@tonic-gate #define AGGR_DEVNAME_CTL "ctl" 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Transmit load balancing policies. 440Sstevel@tonic-gate */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate #define AGGR_POLICY_L2 0x01 470Sstevel@tonic-gate #define AGGR_POLICY_L3 0x02 480Sstevel@tonic-gate #define AGGR_POLICY_L4 0x04 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * LACP mode and timer. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate typedef enum { 550Sstevel@tonic-gate AGGR_LACP_OFF = 0, 560Sstevel@tonic-gate AGGR_LACP_ACTIVE = 1, 570Sstevel@tonic-gate AGGR_LACP_PASSIVE = 2 580Sstevel@tonic-gate } aggr_lacp_mode_t; 590Sstevel@tonic-gate 600Sstevel@tonic-gate typedef enum { 610Sstevel@tonic-gate AGGR_LACP_TIMER_LONG = 0, 620Sstevel@tonic-gate AGGR_LACP_TIMER_SHORT = 1 630Sstevel@tonic-gate } aggr_lacp_timer_t; 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * MAC port state. 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate typedef enum { 690Sstevel@tonic-gate AGGR_PORT_STATE_STANDBY = 1, 700Sstevel@tonic-gate AGGR_PORT_STATE_ATTACHED = 2 710Sstevel@tonic-gate } aggr_port_state_t; 720Sstevel@tonic-gate 730Sstevel@tonic-gate /* Maximum number of ports per aggregation. */ 740Sstevel@tonic-gate #define AGGR_MAX_PORTS 256 750Sstevel@tonic-gate 760Sstevel@tonic-gate /* 770Sstevel@tonic-gate * LACP port state. 780Sstevel@tonic-gate */ 790Sstevel@tonic-gate typedef union { 800Sstevel@tonic-gate struct { 810Sstevel@tonic-gate #if defined(_BIT_FIELDS_HTOL) 820Sstevel@tonic-gate uint8_t expired: 1; 830Sstevel@tonic-gate uint8_t defaulted: 1; 840Sstevel@tonic-gate uint8_t distributing: 1; 850Sstevel@tonic-gate uint8_t collecting: 1; 860Sstevel@tonic-gate uint8_t sync: 1; 870Sstevel@tonic-gate uint8_t aggregation: 1; 880Sstevel@tonic-gate uint8_t timeout: 1; 890Sstevel@tonic-gate uint8_t activity: 1; 900Sstevel@tonic-gate #elif defined(_BIT_FIELDS_LTOH) 910Sstevel@tonic-gate uint8_t activity: 1; 920Sstevel@tonic-gate uint8_t timeout: 1; 930Sstevel@tonic-gate uint8_t aggregation: 1; 940Sstevel@tonic-gate uint8_t sync: 1; 950Sstevel@tonic-gate uint8_t collecting: 1; 960Sstevel@tonic-gate uint8_t distributing: 1; 970Sstevel@tonic-gate uint8_t defaulted: 1; 980Sstevel@tonic-gate uint8_t expired: 1; 990Sstevel@tonic-gate #else 1000Sstevel@tonic-gate #error "unknown bit fields ordering" 1010Sstevel@tonic-gate #endif 1020Sstevel@tonic-gate } bit; 1030Sstevel@tonic-gate uint8_t state; 1040Sstevel@tonic-gate } aggr_lacp_state_t; 1050Sstevel@tonic-gate 1060Sstevel@tonic-gate #define LAIOC(x) (('l' << 24) | ('a' << 16) | ('m' << 8) | (x)) 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* one of the ports of a link aggregation group */ 1090Sstevel@tonic-gate typedef struct laioc_port { 1100Sstevel@tonic-gate char lp_devname[MAXNAMELEN + 1]; 1110Sstevel@tonic-gate } laioc_port_t; 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate #define LAIOC_CREATE LAIOC(1) 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate typedef struct laioc_create { 1160Sstevel@tonic-gate uint32_t lc_key; 1170Sstevel@tonic-gate uint32_t lc_nports; 1180Sstevel@tonic-gate uint32_t lc_policy; 1190Sstevel@tonic-gate uchar_t lc_mac[ETHERADDRL]; 1200Sstevel@tonic-gate boolean_t lc_mac_fixed; 1210Sstevel@tonic-gate aggr_lacp_mode_t lc_lacp_mode; 1220Sstevel@tonic-gate aggr_lacp_timer_t lc_lacp_timer; 1230Sstevel@tonic-gate } laioc_create_t; 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate #ifdef _SYSCALL32 1260Sstevel@tonic-gate 1270Sstevel@tonic-gate typedef struct laioc_create32 { 1280Sstevel@tonic-gate uint32_t lc_key; 1290Sstevel@tonic-gate uint32_t lc_nports; 1300Sstevel@tonic-gate uint32_t lc_policy; 1310Sstevel@tonic-gate uchar_t lc_mac[ETHERADDRL]; 1320Sstevel@tonic-gate boolean_t lc_mac_fixed; 1330Sstevel@tonic-gate aggr_lacp_mode_t lc_lacp_mode; 1340Sstevel@tonic-gate aggr_lacp_timer_t lc_lacp_timer; 1350Sstevel@tonic-gate } laioc_create32_t; 1360Sstevel@tonic-gate 1370Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate #define LAIOC_DELETE LAIOC(2) 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate typedef struct laioc_delete { 1420Sstevel@tonic-gate uint32_t ld_key; 1430Sstevel@tonic-gate } laioc_delete_t; 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate #ifdef _SYSCALL32 1460Sstevel@tonic-gate 1470Sstevel@tonic-gate typedef struct laioc_delete32 { 1480Sstevel@tonic-gate uint32_t ld_key; 1490Sstevel@tonic-gate } laioc_delete32_t; 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate #define LAIOC_INFO LAIOC(3) 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate typedef enum aggr_link_duplex { 1560Sstevel@tonic-gate AGGR_LINK_DUPLEX_FULL = 1, 1570Sstevel@tonic-gate AGGR_LINK_DUPLEX_HALF = 2, 1580Sstevel@tonic-gate AGGR_LINK_DUPLEX_UNKNOWN = 3 1590Sstevel@tonic-gate } aggr_link_duplex_t; 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate typedef enum aggr_link_state { 1620Sstevel@tonic-gate AGGR_LINK_STATE_UP = 1, 1630Sstevel@tonic-gate AGGR_LINK_STATE_DOWN = 2, 1640Sstevel@tonic-gate AGGR_LINK_STATE_UNKNOWN = 3 1650Sstevel@tonic-gate } aggr_link_state_t; 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate typedef struct laioc_info_port { 1680Sstevel@tonic-gate char lp_devname[MAXNAMELEN + 1]; 1690Sstevel@tonic-gate uchar_t lp_mac[ETHERADDRL]; 1700Sstevel@tonic-gate aggr_port_state_t lp_state; 1710Sstevel@tonic-gate aggr_lacp_state_t lp_lacp_state; 1720Sstevel@tonic-gate } laioc_info_port_t; 1730Sstevel@tonic-gate 1740Sstevel@tonic-gate typedef struct laioc_info_group { 1750Sstevel@tonic-gate uint32_t lg_key; 1760Sstevel@tonic-gate uchar_t lg_mac[ETHERADDRL]; 1770Sstevel@tonic-gate boolean_t lg_mac_fixed; 1780Sstevel@tonic-gate uint32_t lg_policy; 1790Sstevel@tonic-gate uint32_t lg_nports; 1800Sstevel@tonic-gate aggr_lacp_mode_t lg_lacp_mode; 1810Sstevel@tonic-gate aggr_lacp_timer_t lg_lacp_timer; 1820Sstevel@tonic-gate } laioc_info_group_t; 1830Sstevel@tonic-gate 1840Sstevel@tonic-gate typedef struct laioc_info { 1850Sstevel@tonic-gate uint32_t li_ngroups; 1860Sstevel@tonic-gate uint32_t li_group_key; /* 0 returns all */ 1870Sstevel@tonic-gate } laioc_info_t; 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate #define LAIOC_ADD LAIOC(4) 1900Sstevel@tonic-gate #define LAIOC_REMOVE LAIOC(5) 1910Sstevel@tonic-gate 1920Sstevel@tonic-gate typedef struct laioc_add_rem { 1930Sstevel@tonic-gate uint32_t la_key; 1940Sstevel@tonic-gate uint32_t la_nports; 195269Sericheng } laioc_add_rem_t; 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate #ifdef _SYSCALL32 1980Sstevel@tonic-gate 1990Sstevel@tonic-gate typedef struct laioc_add_rem32 { 2000Sstevel@tonic-gate uint32_t la_key; 2010Sstevel@tonic-gate uint32_t la_nports; 2020Sstevel@tonic-gate } laioc_add_rem32_t; 2030Sstevel@tonic-gate 2040Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate #define LAIOC_MODIFY LAIOC(6) 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate #define LAIOC_MODIFY_POLICY 0x01 2090Sstevel@tonic-gate #define LAIOC_MODIFY_MAC 0x02 2100Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_MODE 0x04 2110Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_TIMER 0x08 2120Sstevel@tonic-gate 2130Sstevel@tonic-gate typedef struct laioc_modify { 2140Sstevel@tonic-gate uint32_t lu_key; 2150Sstevel@tonic-gate uint8_t lu_modify_mask; 2160Sstevel@tonic-gate uint32_t lu_policy; 2170Sstevel@tonic-gate uchar_t lu_mac[ETHERADDRL]; 2180Sstevel@tonic-gate boolean_t lu_mac_fixed; 2190Sstevel@tonic-gate aggr_lacp_mode_t lu_lacp_mode; 2200Sstevel@tonic-gate aggr_lacp_timer_t lu_lacp_timer; 2210Sstevel@tonic-gate } laioc_modify_t; 2220Sstevel@tonic-gate 2230Sstevel@tonic-gate #ifdef _SYSCALL32 2240Sstevel@tonic-gate 2250Sstevel@tonic-gate typedef struct laioc_modify32 { 2260Sstevel@tonic-gate uint32_t lu_key; 2270Sstevel@tonic-gate uint8_t lu_modify_mask; 2280Sstevel@tonic-gate uint32_t lu_policy; 2290Sstevel@tonic-gate uchar_t lu_mac[ETHERADDRL]; 2300Sstevel@tonic-gate boolean_t lu_mac_fixed; 2310Sstevel@tonic-gate aggr_lacp_mode_t lu_lacp_mode; 2320Sstevel@tonic-gate aggr_lacp_timer_t lu_lacp_timer; 2330Sstevel@tonic-gate } laioc_modify32_t; 2340Sstevel@tonic-gate 2350Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2360Sstevel@tonic-gate 2370Sstevel@tonic-gate #ifdef __cplusplus 2380Sstevel@tonic-gate } 2390Sstevel@tonic-gate #endif 2400Sstevel@tonic-gate 2410Sstevel@tonic-gate #endif /* _SYS_AGGR_H */ 242