xref: /titanic_44/usr/src/lib/libdladm/common/libdlib.h (revision f5b8369cda74e0ace2c6b634f8a29c372bac1b79)
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_IBPART_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 	char		*dia_devname;	/* IB Phys link's device name */
48 	char		*dia_pname;	/* IB partition's name */
49 	uint_t		dia_portnum;	/* IB Phys link's HCA port number */
50 	int		dia_instance;	/* IP over IB driver instance number */
51 	ib_guid_t	dia_hca_guid;	/* IB HCA GUID */
52 	ib_guid_t	dia_port_guid;	/* IB HCA Port GUID */
53 	uint_t		dia_port_pkey_tbl_sz;
54 	ib_pkey_t	*dia_port_pkeys;	/* Ptr to the P_Key table */
55 } dladm_ib_attr_t;
56 
57 typedef struct dladm_ib_attr_s dladm_part_attr_t;
58 
59 typedef enum {
60 	DLADM_IBPART_UD_MODE = 0,
61 	DLADM_IBPART_CM_MODE
62 } dladm_ibpart_linkmode_t;
63 
64 extern dladm_status_t dladm_part_create(dladm_handle_t, datalink_id_t,
65     ib_pkey_t, uint32_t, char *, datalink_id_t *, dladm_arg_list_t *);
66 extern dladm_status_t dladm_part_delete(dladm_handle_t, datalink_id_t, int);
67 extern dladm_status_t dladm_part_up(dladm_handle_t, datalink_id_t, uint32_t);
68 extern dladm_status_t dladm_part_info(dladm_handle_t, datalink_id_t,
69     dladm_part_attr_t *, uint32_t);
70 extern dladm_status_t dladm_ib_info(dladm_handle_t, datalink_id_t,
71     dladm_ib_attr_t *, uint32_t);
72 extern void dladm_free_ib_info(dladm_ib_attr_t *);
73 
74 #ifdef	__cplusplus
75 }
76 #endif
77 
78 #endif /* _LIBDLIB_H */
79