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 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 /* 35 * ioctl cmd definitions 36 */ 37 #define FCOEIO_CMD ('G'<< 8 | 2009) 38 #define FCOEIO_SUB_CMD ('X' << 8) 39 40 /* 41 * fcoe ioctl sub-command 42 */ 43 #define FCOEIO_CREATE_FCOE_PORT (FCOEIO_SUB_CMD + 0x01) 44 #define FCOEIO_DELETE_FCOE_PORT (FCOEIO_SUB_CMD + 0x02) 45 #define FCOEIO_GET_FCOE_PORT_LIST (FCOEIO_SUB_CMD + 0x03) 46 47 /* 48 * define common-used constants 49 */ 50 #define FCOE_MAX_MAC_NAME_LEN 32 51 52 /* 53 * fcoeio_xfer definitions 54 */ 55 #define FCOEIO_XFER_NONE 0x00 56 #define FCOEIO_XFER_READ 0x01 57 #define FCOEIO_XFER_WRITE 0x02 58 #define FCOEIO_XFER_RW (FCOEIO_XFER_READ | FCOEIO_XFER_WRITE) 59 60 /* 61 * fcoeio_errno definitions 62 */ 63 typedef enum { 64 FCOEIOE_INVAL_ARG = 5, 65 FCOEIOE_BUSY, 66 FCOEIOE_ALREADY, 67 FCOEIOE_PWWN_CONFLICTED, 68 FCOEIOE_NWWN_CONFLICTED, 69 FCOEIOE_CREATE_MAC, 70 FCOEIOE_OPEN_MAC, 71 FCOEIOE_CREATE_PORT, 72 FCOEIOE_NEED_JUMBO_FRAME, 73 FCOEIOE_MAC_NOT_FOUND, 74 FCOEIOE_OFFLINE_FAILURE, 75 FCOEIOE_MORE_DATA, 76 FCOEIOE_VNIC_UNSUPPORT 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 uchar_t fcp_mac_name[MAXLINKNAMELEN]; 116 } fcoeio_create_port_param_t; 117 118 /* 119 * FCOE port instance 120 */ 121 typedef struct fcoe_port_instance { 122 uchar_t fpi_pwwn[FCOE_WWN_SIZE]; 123 uchar_t fpi_mac_link_name[MAXLINKNAMELEN]; 124 uint8_t fpi_mac_factory_addr[ETHERADDRL]; 125 uint16_t fpi_mac_promisc; 126 uint8_t fpi_mac_current_addr[ETHERADDRL]; 127 uint16_t fpi_rsvd1; 128 fcoe_cli_type_t fpi_port_type; 129 uint32_t fpi_mtu_size; 130 } fcoe_port_instance_t; 131 132 /* 133 * FCOE port instance list 134 */ 135 typedef struct fcoe_port_list { 136 uint64_t numPorts; 137 fcoe_port_instance_t ports[1]; 138 } fcoe_port_list_t; 139 140 #ifdef __cplusplus 141 } 142 #endif 143 144 #endif /* _FCOEIO_H_ */ 145