xref: /titanic_44/usr/src/lib/libdladm/common/libdlib.h (revision db8b037b5616a366b7dfdc01ef9552f02f9adfdd)
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 (c) 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _LIBDLIB_H
26 #define	_LIBDLIB_H
27 
28 #ifdef	__cplusplus
29 extern "C" {
30 #endif
31 
32 #include <sys/types.h>
33 #include <sys/ib/ib_types.h>
34 
35 #define	MAXPKEYSTRSZ	968
36 #define	MAXPKEYLEN 6
37 #define	IBGUIDSTRLEN 16
38 #define	IBPORTSTRLEN 5
39 
40 #define	DLADM_PART_FORCE_CREATE 0x1
41 
42 typedef struct dladm_ib_attr_s {
43 	datalink_id_t	dia_physlinkid;	/* IB Phys link datalink ID */
44 	datalink_id_t	dia_partlinkid;	/* IB Partition datalink ID */
45 	ib_pkey_t	dia_pkey;	/* IB partitions P_Key */
46 	uint32_t	dia_flags;
47 	uint_t		dia_portnum;	/* IB Phys link's HCA port number */
48 	int		dia_instance;	/* IP over IB driver instance number */
49 	ib_guid_t	dia_hca_guid;	/* IB HCA GUID */
50 	ib_guid_t	dia_port_guid;	/* IB HCA Port GUID */
51 	uint_t		dia_port_pkey_tbl_sz;
52 	ib_pkey_t	*dia_port_pkeys;	/* Ptr to the P_Key table */
53 } dladm_ib_attr_t;
54 
55 typedef struct dladm_ib_attr_s dladm_part_attr_t;
56 
57 typedef enum {
58 	DLADM_PART_UD_MODE = 0,
59 	DLADM_PART_CM_MODE
60 } dladm_part_linkmode_t;
61 
62 extern dladm_status_t dladm_part_create(dladm_handle_t, datalink_id_t,
63     ib_pkey_t, uint32_t, char *, datalink_id_t *, dladm_arg_list_t *);
64 extern dladm_status_t dladm_part_delete(dladm_handle_t, datalink_id_t, int);
65 extern dladm_status_t dladm_part_up(dladm_handle_t, datalink_id_t, uint32_t);
66 extern dladm_status_t dladm_part_info(dladm_handle_t, datalink_id_t,
67     dladm_part_attr_t *, uint32_t);
68 extern dladm_status_t dladm_ib_info(dladm_handle_t, datalink_id_t,
69     dladm_ib_attr_t *, uint32_t);
70 extern void dladm_free_ib_info(dladm_ib_attr_t *);
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif /* _LIBDLIB_H */
77