xref: /titanic_41/usr/src/uts/common/sys/fcoe/fcoeio.h (revision d4401b99a36e5170ccaa7defc0d2ac65b23f08c6)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 #ifndef	_FCOEIO_H_
26 #define	_FCOEIO_H_
27 
28 #include <sys/ethernet.h>
29 #include <sys/types.h>
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * ioctl cmd definitions
37  */
38 #define	FCOEIO_CMD			('G'<< 8 | 2009)
39 #define	FCOEIO_SUB_CMD			('X' << 8)
40 
41 /*
42  * fcoe ioctl sub-command
43  */
44 #define	FCOEIO_CREATE_FCOE_PORT			(FCOEIO_SUB_CMD + 0x01)
45 #define	FCOEIO_DELETE_FCOE_PORT			(FCOEIO_SUB_CMD + 0x02)
46 #define	FCOEIO_GET_FCOE_PORT_LIST		(FCOEIO_SUB_CMD + 0x03)
47 
48 /*
49  * define common-used constants
50  */
51 #define	FCOE_MAX_MAC_NAME_LEN	32
52 
53 /*
54  * fcoeio_xfer definitions
55  */
56 #define	FCOEIO_XFER_NONE		0x00
57 #define	FCOEIO_XFER_READ		0x01
58 #define	FCOEIO_XFER_WRITE		0x02
59 #define	FCOEIO_XFER_RW		(FCOEIO_XFER_READ | FCOEIO_XFER_WRITE)
60 
61 /*
62  * fcoeio_errno definitions
63  */
64 typedef enum {
65 	FCOEIOE_INVAL_ARG = 5,
66 	FCOEIOE_BUSY,
67 	FCOEIOE_ALREADY,
68 	FCOEIOE_PWWN_CONFLICTED,
69 	FCOEIOE_NWWN_CONFLICTED,
70 	FCOEIOE_CREATE_MAC,
71 	FCOEIOE_OPEN_MAC,
72 	FCOEIOE_CREATE_PORT,
73 	FCOEIOE_NEED_JUMBO_FRAME,
74 	FCOEIOE_MAC_NOT_FOUND,
75 	FCOEIOE_OFFLINE_FAILURE,
76 	FCOEIOE_MORE_DATA
77 } fcoeio_stat_t;
78 
79 /* Biggest buffer length, can hold up to 1024 port instances */
80 #define	FCOEIO_MAX_BUF_LEN	0x10000
81 
82 typedef struct fcoeio {
83 	uint16_t	fcoeio_xfer;		/* direction */
84 	uint16_t	fcoeio_cmd;		/* sub command */
85 	uint16_t	fcoeio_flags;		/* flags */
86 	uint16_t	fcoeio_cmd_flags;	/* command specific flags */
87 	uint32_t	fcoeio_ilen;		/* Input buffer length */
88 	uint32_t	fcoeio_olen;		/* Output buffer length */
89 	uint32_t	fcoeio_alen;		/* Auxillary buffer length */
90 	fcoeio_stat_t	fcoeio_status;		/* FC internal error status */
91 	uint64_t	fcoeio_ibuf;		/* Input buffer */
92 	uint64_t	fcoeio_obuf;		/* Output buffer */
93 	uint64_t	fcoeio_abuf;		/* Auxillary buffer */
94 } fcoeio_t;
95 
96 /*
97  * Client port type
98  */
99 typedef enum {
100 	FCOE_CLIENT_INITIATOR = 0,
101 	FCOE_CLIENT_TARGET
102 } fcoe_cli_type_t;
103 
104 /*
105  * Command for FCOEIO_CREATE_FCOET_PORT
106  */
107 #define	FCOE_WWN_SIZE		8
108 typedef struct fcoeio_create_port_param {
109 	uchar_t		fcp_pwwn[FCOE_WWN_SIZE];
110 	uchar_t		fcp_nwwn[FCOE_WWN_SIZE];
111 	uint32_t	fcp_nwwn_provided;
112 	uint32_t	fcp_pwwn_provided;
113 	uint32_t	fcp_force_promisc;
114 	fcoe_cli_type_t	fcp_port_type;
115 	datalink_id_t	fcp_mac_linkid;
116 	uint32_t	fcp_rsvd0;
117 } fcoeio_create_port_param_t;
118 
119 typedef struct fcoeio_delete_port_param {
120 	datalink_id_t	fdp_mac_linkid;
121 	uint32_t	fdp_rsvd0;
122 } fcoeio_delete_port_param_t;
123 
124 /*
125  * FCOE port instance
126  */
127 typedef struct fcoe_port_instance {
128 	uchar_t			fpi_pwwn[FCOE_WWN_SIZE];
129 	datalink_id_t		fpi_mac_linkid;
130 	uint32_t		fpi_rsvd0;
131 	uint8_t			fpi_mac_factory_addr[ETHERADDRL];
132 	uint16_t		fpi_mac_promisc;
133 	uint8_t			fpi_mac_current_addr[ETHERADDRL];
134 	uint16_t		fpi_rsvd1;
135 	fcoe_cli_type_t		fpi_port_type;
136 	uint32_t		fpi_mtu_size;
137 } fcoe_port_instance_t;
138 
139 /*
140  * FCOE port instance list
141  */
142 typedef struct fcoe_port_list {
143 	uint64_t		numPorts;
144 	fcoe_port_instance_t	ports[1];
145 } fcoe_port_list_t;
146 
147 #ifdef	__cplusplus
148 }
149 #endif
150 
151 #endif	/* _FCOEIO_H_ */
152