xref: /titanic_52/usr/src/lib/libdladm/common/libdlaggr.h (revision 911106dfb16696472af8c1b7b4c554a829354fa8)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _LIBDLAGGR_H
27 #define	_LIBDLAGGR_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * This file includes structures, macros and routines used by aggregation link
33  * administration.
34  */
35 
36 #include <sys/types.h>
37 #include <sys/aggr.h>
38 #include <libdladm.h>
39 
40 #ifdef	__cplusplus
41 extern "C" {
42 #endif
43 
44 /*
45  * Modification flags sent with the LAIOC_MODIFY ioctl
46  */
47 #define	DLADM_AGGR_MODIFY_POLICY		0x01
48 #define	DLADM_AGGR_MODIFY_MAC			0x02
49 #define	DLADM_AGGR_MODIFY_LACP_MODE		0x04
50 #define	DLADM_AGGR_MODIFY_LACP_TIMER		0x08
51 
52 typedef struct dladm_aggr_port_attr_db {
53 	char		lp_devname[MAXNAMELEN + 1];
54 } dladm_aggr_port_attr_db_t;
55 
56 typedef struct dladm_aggr_port_attr {
57 	char		lp_devname[MAXNAMELEN + 1];
58 	uchar_t		lp_mac[ETHERADDRL];
59 	aggr_port_state_t lp_state;
60 	aggr_lacp_state_t lp_lacp_state;
61 } dladm_aggr_port_attr_t;
62 
63 typedef struct dladm_aggr_grp_attr {
64 	uint32_t	lg_key;
65 	uint32_t	lg_nports;
66 	dladm_aggr_port_attr_t *lg_ports;
67 	uint32_t	lg_policy;
68 	uchar_t		lg_mac[ETHERADDRL];
69 	boolean_t	lg_mac_fixed;
70 	aggr_lacp_mode_t lg_lacp_mode;
71 	aggr_lacp_timer_t lg_lacp_timer;
72 } dladm_aggr_grp_attr_t;
73 
74 extern dladm_status_t	dladm_aggr_create(uint32_t, uint32_t,
75 			    dladm_aggr_port_attr_db_t *, uint32_t, boolean_t,
76 			    uchar_t *, aggr_lacp_mode_t, aggr_lacp_timer_t,
77 			    boolean_t, const char *);
78 extern dladm_status_t	dladm_aggr_delete(uint32_t, boolean_t, const char *);
79 extern dladm_status_t	dladm_aggr_add(uint32_t, uint32_t,
80 			    dladm_aggr_port_attr_db_t *, boolean_t,
81 			    const char *);
82 extern dladm_status_t	dladm_aggr_remove(uint32_t, uint32_t,
83 			    dladm_aggr_port_attr_db_t *, boolean_t,
84 			    const char *);
85 extern dladm_status_t	dladm_aggr_modify(uint32_t, uint32_t, uint32_t,
86 			    boolean_t, uchar_t *, aggr_lacp_mode_t,
87 			    aggr_lacp_timer_t, boolean_t, const char *);
88 extern dladm_status_t	dladm_aggr_up(uint32_t, const char *);
89 extern dladm_status_t	dladm_aggr_down(uint32_t);
90 
91 extern boolean_t	dladm_aggr_str2policy(const char *, uint32_t *);
92 extern char		*dladm_aggr_policy2str(uint32_t, char *);
93 extern boolean_t	dladm_aggr_str2macaddr(const char *, boolean_t *,
94 			    uchar_t *);
95 extern const char	*dladm_aggr_macaddr2str(unsigned char *, char *);
96 
97 extern boolean_t	dladm_aggr_str2lacpmode(const char *,
98 			    aggr_lacp_mode_t *);
99 extern const char	*dladm_aggr_lacpmode2str(aggr_lacp_mode_t, char *);
100 extern boolean_t	dladm_aggr_str2lacptimer(const char *,
101 			    aggr_lacp_timer_t *);
102 extern const char	*dladm_aggr_lacptimer2str(aggr_lacp_timer_t, char *);
103 
104 extern const char	*dladm_aggr_portstate2str(aggr_port_state_t, char *);
105 
106 extern int		dladm_aggr_walk(int (*)(void *,
107 			    dladm_aggr_grp_attr_t *), void *);
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _LIBDLAGGR_H */
114