xref: /titanic_51/usr/src/lib/libdladm/common/libdlaggr.h (revision a31148363f598def767ac48c5d82e1572e44b935)
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 2008 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 /*
30  * This file includes structures, macros and routines used by aggregation link
31  * administration.
32  */
33 
34 #include <sys/types.h>
35 #include <sys/aggr.h>
36 #include <libdladm.h>
37 
38 #ifdef	__cplusplus
39 extern "C" {
40 #endif
41 
42 /*
43  * Modification flags sent with the LAIOC_MODIFY ioctl
44  */
45 #define	DLADM_AGGR_MODIFY_POLICY	0x01
46 #define	DLADM_AGGR_MODIFY_MAC		0x02
47 #define	DLADM_AGGR_MODIFY_LACP_MODE	0x04
48 #define	DLADM_AGGR_MODIFY_LACP_TIMER	0x08
49 
50 typedef struct dladm_aggr_port_attr_db {
51 	datalink_id_t	lp_linkid;
52 } dladm_aggr_port_attr_db_t;
53 
54 typedef struct dladm_aggr_port_attr {
55 	datalink_id_t	lp_linkid;
56 	uchar_t		lp_mac[ETHERADDRL];
57 	aggr_port_state_t lp_state;
58 	aggr_lacp_state_t lp_lacp_state;
59 } dladm_aggr_port_attr_t;
60 
61 typedef struct dladm_aggr_grp_attr {
62 	datalink_id_t	lg_linkid;
63 	uint32_t	lg_key;
64 	uint32_t	lg_nports;
65 	dladm_aggr_port_attr_t *lg_ports;
66 	uint32_t	lg_policy;
67 	uchar_t		lg_mac[ETHERADDRL];
68 	boolean_t	lg_mac_fixed;
69 	boolean_t	lg_force;
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(dladm_handle_t, const char *,
75 			    uint16_t, uint32_t, dladm_aggr_port_attr_db_t *,
76 			    uint32_t, boolean_t, const uchar_t *,
77 			    aggr_lacp_mode_t, aggr_lacp_timer_t, uint32_t);
78 extern dladm_status_t	dladm_aggr_delete(dladm_handle_t, datalink_id_t,
79 			    uint32_t);
80 extern dladm_status_t	dladm_aggr_add(dladm_handle_t, datalink_id_t, uint32_t,
81 			    dladm_aggr_port_attr_db_t *, uint32_t);
82 extern dladm_status_t	dladm_aggr_remove(dladm_handle_t, datalink_id_t,
83 			    uint32_t, dladm_aggr_port_attr_db_t *, uint32_t);
84 extern dladm_status_t	dladm_aggr_modify(dladm_handle_t, datalink_id_t,
85 			    uint32_t, uint32_t, boolean_t, const uchar_t *,
86 			    aggr_lacp_mode_t, aggr_lacp_timer_t, uint32_t);
87 extern dladm_status_t	dladm_aggr_up(dladm_handle_t, datalink_id_t);
88 extern dladm_status_t	dladm_aggr_info(dladm_handle_t, datalink_id_t,
89 			    dladm_aggr_grp_attr_t *, 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(const unsigned char *, char *);
96 extern boolean_t	dladm_aggr_str2lacpmode(const char *,
97 			    aggr_lacp_mode_t *);
98 extern const char	*dladm_aggr_lacpmode2str(aggr_lacp_mode_t, char *);
99 extern boolean_t	dladm_aggr_str2lacptimer(const char *,
100 			    aggr_lacp_timer_t *);
101 extern const char	*dladm_aggr_lacptimer2str(aggr_lacp_timer_t, char *);
102 extern const char	*dladm_aggr_portstate2str(aggr_port_state_t, char *);
103 extern dladm_status_t	dladm_key2linkid(dladm_handle_t, uint16_t,
104 			    datalink_id_t *, uint32_t);
105 
106 #ifdef	__cplusplus
107 }
108 #endif
109 
110 #endif	/* _LIBDLAGGR_H */
111