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 52311Sseb * Common Development and Distribution License (the "License"). 62311Sseb * 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 /* 225895Syz147064 * Copyright 2008 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 #include <sys/types.h> 300Sstevel@tonic-gate #include <sys/ethernet.h> 31*8275SEric Cheng #include <sys/param.h> 325895Syz147064 #include <sys/mac.h> 337408SSebastien.Roy@Sun.COM #include <sys/dld_ioc.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate #ifdef __cplusplus 360Sstevel@tonic-gate extern "C" { 370Sstevel@tonic-gate #endif 380Sstevel@tonic-gate 397408SSebastien.Roy@Sun.COM /* 40*8275SEric Cheng * Note that the data structures defined here define an ioctl interface 417408SSebastien.Roy@Sun.COM * that is shared betwen user and kernel space. The aggr driver thus 427408SSebastien.Roy@Sun.COM * assumes that the structures have identical layout and size when 437408SSebastien.Roy@Sun.COM * compiled in either IPL32 or LP64. 447408SSebastien.Roy@Sun.COM */ 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * Transmit load balancing policies. 480Sstevel@tonic-gate */ 490Sstevel@tonic-gate 500Sstevel@tonic-gate #define AGGR_POLICY_L2 0x01 510Sstevel@tonic-gate #define AGGR_POLICY_L3 0x02 520Sstevel@tonic-gate #define AGGR_POLICY_L4 0x04 530Sstevel@tonic-gate 540Sstevel@tonic-gate /* 550Sstevel@tonic-gate * LACP mode and timer. 560Sstevel@tonic-gate */ 570Sstevel@tonic-gate 580Sstevel@tonic-gate typedef enum { 590Sstevel@tonic-gate AGGR_LACP_OFF = 0, 600Sstevel@tonic-gate AGGR_LACP_ACTIVE = 1, 610Sstevel@tonic-gate AGGR_LACP_PASSIVE = 2 620Sstevel@tonic-gate } aggr_lacp_mode_t; 630Sstevel@tonic-gate 640Sstevel@tonic-gate typedef enum { 650Sstevel@tonic-gate AGGR_LACP_TIMER_LONG = 0, 660Sstevel@tonic-gate AGGR_LACP_TIMER_SHORT = 1 670Sstevel@tonic-gate } aggr_lacp_timer_t; 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* 700Sstevel@tonic-gate * MAC port state. 710Sstevel@tonic-gate */ 720Sstevel@tonic-gate typedef enum { 730Sstevel@tonic-gate AGGR_PORT_STATE_STANDBY = 1, 740Sstevel@tonic-gate AGGR_PORT_STATE_ATTACHED = 2 750Sstevel@tonic-gate } aggr_port_state_t; 760Sstevel@tonic-gate 770Sstevel@tonic-gate /* Maximum number of ports per aggregation. */ 780Sstevel@tonic-gate #define AGGR_MAX_PORTS 256 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 815895Syz147064 * The largest configurable aggregation key. Because by default the key is 825895Syz147064 * used as the DLPI device PPA and default VLAN PPA's are calculated as 835895Syz147064 * ((1000 * vid) + PPA), the largest key can't be > 999. 845895Syz147064 */ 855895Syz147064 #define AGGR_MAX_KEY 999 865895Syz147064 875895Syz147064 /* 880Sstevel@tonic-gate * LACP port state. 890Sstevel@tonic-gate */ 900Sstevel@tonic-gate typedef union { 910Sstevel@tonic-gate struct { 920Sstevel@tonic-gate #if defined(_BIT_FIELDS_HTOL) 930Sstevel@tonic-gate uint8_t expired: 1; 940Sstevel@tonic-gate uint8_t defaulted: 1; 950Sstevel@tonic-gate uint8_t distributing: 1; 960Sstevel@tonic-gate uint8_t collecting: 1; 970Sstevel@tonic-gate uint8_t sync: 1; 980Sstevel@tonic-gate uint8_t aggregation: 1; 990Sstevel@tonic-gate uint8_t timeout: 1; 1000Sstevel@tonic-gate uint8_t activity: 1; 1010Sstevel@tonic-gate #elif defined(_BIT_FIELDS_LTOH) 1020Sstevel@tonic-gate uint8_t activity: 1; 1030Sstevel@tonic-gate uint8_t timeout: 1; 1040Sstevel@tonic-gate uint8_t aggregation: 1; 1050Sstevel@tonic-gate uint8_t sync: 1; 1060Sstevel@tonic-gate uint8_t collecting: 1; 1070Sstevel@tonic-gate uint8_t distributing: 1; 1080Sstevel@tonic-gate uint8_t defaulted: 1; 1090Sstevel@tonic-gate uint8_t expired: 1; 1100Sstevel@tonic-gate #else 1110Sstevel@tonic-gate #error "unknown bit fields ordering" 1120Sstevel@tonic-gate #endif 1130Sstevel@tonic-gate } bit; 1140Sstevel@tonic-gate uint8_t state; 1150Sstevel@tonic-gate } aggr_lacp_state_t; 1160Sstevel@tonic-gate 1170Sstevel@tonic-gate /* one of the ports of a link aggregation group */ 1180Sstevel@tonic-gate typedef struct laioc_port { 1195895Syz147064 datalink_id_t lp_linkid; 1200Sstevel@tonic-gate } laioc_port_t; 1210Sstevel@tonic-gate 1227408SSebastien.Roy@Sun.COM #define LAIOC_CREATE AGGRIOC(1) 1230Sstevel@tonic-gate 1240Sstevel@tonic-gate typedef struct laioc_create { 1255895Syz147064 datalink_id_t lc_linkid; 1260Sstevel@tonic-gate uint32_t lc_key; 1270Sstevel@tonic-gate uint32_t lc_nports; 1280Sstevel@tonic-gate uint32_t lc_policy; 1290Sstevel@tonic-gate uchar_t lc_mac[ETHERADDRL]; 1300Sstevel@tonic-gate aggr_lacp_mode_t lc_lacp_mode; 1310Sstevel@tonic-gate aggr_lacp_timer_t lc_lacp_timer; 1325895Syz147064 uint32_t lc_mac_fixed : 1, 1335895Syz147064 lc_force : 1, 1345895Syz147064 lc_pad_bits : 30; 1350Sstevel@tonic-gate } laioc_create_t; 1360Sstevel@tonic-gate 1377408SSebastien.Roy@Sun.COM #define LAIOC_DELETE AGGRIOC(2) 1380Sstevel@tonic-gate 1390Sstevel@tonic-gate typedef struct laioc_delete { 1405895Syz147064 datalink_id_t ld_linkid; 1410Sstevel@tonic-gate } laioc_delete_t; 1420Sstevel@tonic-gate 1437408SSebastien.Roy@Sun.COM #define LAIOC_INFO AGGRIOC(3) 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate typedef enum aggr_link_duplex { 1460Sstevel@tonic-gate AGGR_LINK_DUPLEX_FULL = 1, 1470Sstevel@tonic-gate AGGR_LINK_DUPLEX_HALF = 2, 1480Sstevel@tonic-gate AGGR_LINK_DUPLEX_UNKNOWN = 3 1490Sstevel@tonic-gate } aggr_link_duplex_t; 1500Sstevel@tonic-gate 1510Sstevel@tonic-gate typedef enum aggr_link_state { 1520Sstevel@tonic-gate AGGR_LINK_STATE_UP = 1, 1530Sstevel@tonic-gate AGGR_LINK_STATE_DOWN = 2, 1540Sstevel@tonic-gate AGGR_LINK_STATE_UNKNOWN = 3 1550Sstevel@tonic-gate } aggr_link_state_t; 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate typedef struct laioc_info_port { 1585895Syz147064 datalink_id_t lp_linkid; 1590Sstevel@tonic-gate uchar_t lp_mac[ETHERADDRL]; 1600Sstevel@tonic-gate aggr_port_state_t lp_state; 1610Sstevel@tonic-gate aggr_lacp_state_t lp_lacp_state; 1620Sstevel@tonic-gate } laioc_info_port_t; 1630Sstevel@tonic-gate 1640Sstevel@tonic-gate typedef struct laioc_info_group { 1655895Syz147064 datalink_id_t lg_linkid; 1660Sstevel@tonic-gate uint32_t lg_key; 1670Sstevel@tonic-gate uchar_t lg_mac[ETHERADDRL]; 1680Sstevel@tonic-gate boolean_t lg_mac_fixed; 1695895Syz147064 boolean_t lg_force; 1700Sstevel@tonic-gate uint32_t lg_policy; 1710Sstevel@tonic-gate uint32_t lg_nports; 1720Sstevel@tonic-gate aggr_lacp_mode_t lg_lacp_mode; 1730Sstevel@tonic-gate aggr_lacp_timer_t lg_lacp_timer; 1740Sstevel@tonic-gate } laioc_info_group_t; 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate typedef struct laioc_info { 1775895Syz147064 /* Must not be DLADM_INVALID_LINKID */ 1785895Syz147064 datalink_id_t li_group_linkid; 1797408SSebastien.Roy@Sun.COM uint32_t li_bufsize; 1800Sstevel@tonic-gate } laioc_info_t; 1810Sstevel@tonic-gate 1827408SSebastien.Roy@Sun.COM #define LAIOC_ADD AGGRIOC(4) 1837408SSebastien.Roy@Sun.COM #define LAIOC_REMOVE AGGRIOC(5) 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate typedef struct laioc_add_rem { 1865895Syz147064 datalink_id_t la_linkid; 1870Sstevel@tonic-gate uint32_t la_nports; 1885895Syz147064 uint32_t la_force; 189269Sericheng } laioc_add_rem_t; 1900Sstevel@tonic-gate 1917408SSebastien.Roy@Sun.COM #define LAIOC_MODIFY AGGRIOC(6) 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate #define LAIOC_MODIFY_POLICY 0x01 1940Sstevel@tonic-gate #define LAIOC_MODIFY_MAC 0x02 1950Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_MODE 0x04 1960Sstevel@tonic-gate #define LAIOC_MODIFY_LACP_TIMER 0x08 1970Sstevel@tonic-gate 1980Sstevel@tonic-gate typedef struct laioc_modify { 1995895Syz147064 datalink_id_t lu_linkid; 2000Sstevel@tonic-gate uint8_t lu_modify_mask; 2010Sstevel@tonic-gate uint32_t lu_policy; 2020Sstevel@tonic-gate uchar_t lu_mac[ETHERADDRL]; 2030Sstevel@tonic-gate boolean_t lu_mac_fixed; 2040Sstevel@tonic-gate aggr_lacp_mode_t lu_lacp_mode; 2050Sstevel@tonic-gate aggr_lacp_timer_t lu_lacp_timer; 2060Sstevel@tonic-gate } laioc_modify_t; 2070Sstevel@tonic-gate 2080Sstevel@tonic-gate #ifdef __cplusplus 2090Sstevel@tonic-gate } 2100Sstevel@tonic-gate #endif 2110Sstevel@tonic-gate 2120Sstevel@tonic-gate #endif /* _SYS_AGGR_H */ 213