12a8164dfSZhong Wang /* 22a8164dfSZhong Wang * CDDL HEADER START 32a8164dfSZhong Wang * 42a8164dfSZhong Wang * The contents of this file are subject to the terms of the 52a8164dfSZhong Wang * Common Development and Distribution License (the "License"). 62a8164dfSZhong Wang * You may not use this file except in compliance with the License. 72a8164dfSZhong Wang * 82a8164dfSZhong Wang * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92a8164dfSZhong Wang * or http://www.opensolaris.org/os/licensing. 102a8164dfSZhong Wang * See the License for the specific language governing permissions 112a8164dfSZhong Wang * and limitations under the License. 122a8164dfSZhong Wang * 132a8164dfSZhong Wang * When distributing Covered Code, include this CDDL HEADER in each 142a8164dfSZhong Wang * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152a8164dfSZhong Wang * If applicable, add the following below this CDDL HEADER, with the 162a8164dfSZhong Wang * fields enclosed by brackets "[]" replaced with your own identifying 172a8164dfSZhong Wang * information: Portions Copyright [yyyy] [name of copyright owner] 182a8164dfSZhong Wang * 192a8164dfSZhong Wang * CDDL HEADER END 202a8164dfSZhong Wang */ 212a8164dfSZhong Wang /* 222a8164dfSZhong Wang * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 232a8164dfSZhong Wang * Use is subject to license terms. 242a8164dfSZhong Wang */ 252a8164dfSZhong Wang #ifndef _FCOEIO_H_ 262a8164dfSZhong Wang #define _FCOEIO_H_ 272a8164dfSZhong Wang 282a8164dfSZhong Wang #include <sys/ethernet.h> 29*d4401b99SKelly Hu #include <sys/types.h> 302a8164dfSZhong Wang 312a8164dfSZhong Wang #ifdef __cplusplus 322a8164dfSZhong Wang extern "C" { 332a8164dfSZhong Wang #endif 342a8164dfSZhong Wang 352a8164dfSZhong Wang /* 362a8164dfSZhong Wang * ioctl cmd definitions 372a8164dfSZhong Wang */ 382a8164dfSZhong Wang #define FCOEIO_CMD ('G'<< 8 | 2009) 392a8164dfSZhong Wang #define FCOEIO_SUB_CMD ('X' << 8) 402a8164dfSZhong Wang 412a8164dfSZhong Wang /* 422a8164dfSZhong Wang * fcoe ioctl sub-command 432a8164dfSZhong Wang */ 442a8164dfSZhong Wang #define FCOEIO_CREATE_FCOE_PORT (FCOEIO_SUB_CMD + 0x01) 452a8164dfSZhong Wang #define FCOEIO_DELETE_FCOE_PORT (FCOEIO_SUB_CMD + 0x02) 462a8164dfSZhong Wang #define FCOEIO_GET_FCOE_PORT_LIST (FCOEIO_SUB_CMD + 0x03) 472a8164dfSZhong Wang 482a8164dfSZhong Wang /* 492a8164dfSZhong Wang * define common-used constants 502a8164dfSZhong Wang */ 512a8164dfSZhong Wang #define FCOE_MAX_MAC_NAME_LEN 32 522a8164dfSZhong Wang 532a8164dfSZhong Wang /* 542a8164dfSZhong Wang * fcoeio_xfer definitions 552a8164dfSZhong Wang */ 562a8164dfSZhong Wang #define FCOEIO_XFER_NONE 0x00 572a8164dfSZhong Wang #define FCOEIO_XFER_READ 0x01 582a8164dfSZhong Wang #define FCOEIO_XFER_WRITE 0x02 592a8164dfSZhong Wang #define FCOEIO_XFER_RW (FCOEIO_XFER_READ | FCOEIO_XFER_WRITE) 602a8164dfSZhong Wang 612a8164dfSZhong Wang /* 622a8164dfSZhong Wang * fcoeio_errno definitions 632a8164dfSZhong Wang */ 642a8164dfSZhong Wang typedef enum { 652a8164dfSZhong Wang FCOEIOE_INVAL_ARG = 5, 662a8164dfSZhong Wang FCOEIOE_BUSY, 672a8164dfSZhong Wang FCOEIOE_ALREADY, 682a8164dfSZhong Wang FCOEIOE_PWWN_CONFLICTED, 692a8164dfSZhong Wang FCOEIOE_NWWN_CONFLICTED, 702a8164dfSZhong Wang FCOEIOE_CREATE_MAC, 712a8164dfSZhong Wang FCOEIOE_OPEN_MAC, 722a8164dfSZhong Wang FCOEIOE_CREATE_PORT, 732a8164dfSZhong Wang FCOEIOE_NEED_JUMBO_FRAME, 742a8164dfSZhong Wang FCOEIOE_MAC_NOT_FOUND, 752a8164dfSZhong Wang FCOEIOE_OFFLINE_FAILURE, 76*d4401b99SKelly Hu FCOEIOE_MORE_DATA 772a8164dfSZhong Wang } fcoeio_stat_t; 782a8164dfSZhong Wang 792a8164dfSZhong Wang /* Biggest buffer length, can hold up to 1024 port instances */ 802a8164dfSZhong Wang #define FCOEIO_MAX_BUF_LEN 0x10000 812a8164dfSZhong Wang 822a8164dfSZhong Wang typedef struct fcoeio { 832a8164dfSZhong Wang uint16_t fcoeio_xfer; /* direction */ 842a8164dfSZhong Wang uint16_t fcoeio_cmd; /* sub command */ 852a8164dfSZhong Wang uint16_t fcoeio_flags; /* flags */ 862a8164dfSZhong Wang uint16_t fcoeio_cmd_flags; /* command specific flags */ 872a8164dfSZhong Wang uint32_t fcoeio_ilen; /* Input buffer length */ 882a8164dfSZhong Wang uint32_t fcoeio_olen; /* Output buffer length */ 892a8164dfSZhong Wang uint32_t fcoeio_alen; /* Auxillary buffer length */ 902a8164dfSZhong Wang fcoeio_stat_t fcoeio_status; /* FC internal error status */ 912a8164dfSZhong Wang uint64_t fcoeio_ibuf; /* Input buffer */ 922a8164dfSZhong Wang uint64_t fcoeio_obuf; /* Output buffer */ 932a8164dfSZhong Wang uint64_t fcoeio_abuf; /* Auxillary buffer */ 942a8164dfSZhong Wang } fcoeio_t; 952a8164dfSZhong Wang 962a8164dfSZhong Wang /* 972a8164dfSZhong Wang * Client port type 982a8164dfSZhong Wang */ 992a8164dfSZhong Wang typedef enum { 1002a8164dfSZhong Wang FCOE_CLIENT_INITIATOR = 0, 1012a8164dfSZhong Wang FCOE_CLIENT_TARGET 1022a8164dfSZhong Wang } fcoe_cli_type_t; 1032a8164dfSZhong Wang 1042a8164dfSZhong Wang /* 1052a8164dfSZhong Wang * Command for FCOEIO_CREATE_FCOET_PORT 1062a8164dfSZhong Wang */ 1072a8164dfSZhong Wang #define FCOE_WWN_SIZE 8 1082a8164dfSZhong Wang typedef struct fcoeio_create_port_param { 1092a8164dfSZhong Wang uchar_t fcp_pwwn[FCOE_WWN_SIZE]; 1102a8164dfSZhong Wang uchar_t fcp_nwwn[FCOE_WWN_SIZE]; 1112a8164dfSZhong Wang uint32_t fcp_nwwn_provided; 1122a8164dfSZhong Wang uint32_t fcp_pwwn_provided; 1132a8164dfSZhong Wang uint32_t fcp_force_promisc; 1142a8164dfSZhong Wang fcoe_cli_type_t fcp_port_type; 115*d4401b99SKelly Hu datalink_id_t fcp_mac_linkid; 116*d4401b99SKelly Hu uint32_t fcp_rsvd0; 1172a8164dfSZhong Wang } fcoeio_create_port_param_t; 1182a8164dfSZhong Wang 119*d4401b99SKelly Hu typedef struct fcoeio_delete_port_param { 120*d4401b99SKelly Hu datalink_id_t fdp_mac_linkid; 121*d4401b99SKelly Hu uint32_t fdp_rsvd0; 122*d4401b99SKelly Hu } fcoeio_delete_port_param_t; 123*d4401b99SKelly Hu 1242a8164dfSZhong Wang /* 1252a8164dfSZhong Wang * FCOE port instance 1262a8164dfSZhong Wang */ 1272a8164dfSZhong Wang typedef struct fcoe_port_instance { 1282a8164dfSZhong Wang uchar_t fpi_pwwn[FCOE_WWN_SIZE]; 129*d4401b99SKelly Hu datalink_id_t fpi_mac_linkid; 130*d4401b99SKelly Hu uint32_t fpi_rsvd0; 1312a8164dfSZhong Wang uint8_t fpi_mac_factory_addr[ETHERADDRL]; 1322a8164dfSZhong Wang uint16_t fpi_mac_promisc; 1332a8164dfSZhong Wang uint8_t fpi_mac_current_addr[ETHERADDRL]; 1342a8164dfSZhong Wang uint16_t fpi_rsvd1; 1352a8164dfSZhong Wang fcoe_cli_type_t fpi_port_type; 1362a8164dfSZhong Wang uint32_t fpi_mtu_size; 1372a8164dfSZhong Wang } fcoe_port_instance_t; 1382a8164dfSZhong Wang 1392a8164dfSZhong Wang /* 1402a8164dfSZhong Wang * FCOE port instance list 1412a8164dfSZhong Wang */ 1422a8164dfSZhong Wang typedef struct fcoe_port_list { 1432a8164dfSZhong Wang uint64_t numPorts; 1442a8164dfSZhong Wang fcoe_port_instance_t ports[1]; 1452a8164dfSZhong Wang } fcoe_port_list_t; 1462a8164dfSZhong Wang 1472a8164dfSZhong Wang #ifdef __cplusplus 1482a8164dfSZhong Wang } 1492a8164dfSZhong Wang #endif 1502a8164dfSZhong Wang 1512a8164dfSZhong Wang #endif /* _FCOEIO_H_ */ 152