1*7ff83669SZhong Wang /*
2*7ff83669SZhong Wang * CDDL HEADER START
3*7ff83669SZhong Wang *
4*7ff83669SZhong Wang * The contents of this file are subject to the terms of the
5*7ff83669SZhong Wang * Common Development and Distribution License (the "License").
6*7ff83669SZhong Wang * You may not use this file except in compliance with the License.
7*7ff83669SZhong Wang *
8*7ff83669SZhong Wang * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*7ff83669SZhong Wang * or http://www.opensolaris.org/os/licensing.
10*7ff83669SZhong Wang * See the License for the specific language governing permissions
11*7ff83669SZhong Wang * and limitations under the License.
12*7ff83669SZhong Wang *
13*7ff83669SZhong Wang * When distributing Covered Code, include this CDDL HEADER in each
14*7ff83669SZhong Wang * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*7ff83669SZhong Wang * If applicable, add the following below this CDDL HEADER, with the
16*7ff83669SZhong Wang * fields enclosed by brackets "[]" replaced with your own identifying
17*7ff83669SZhong Wang * information: Portions Copyright [yyyy] [name of copyright owner]
18*7ff83669SZhong Wang *
19*7ff83669SZhong Wang * CDDL HEADER END
20*7ff83669SZhong Wang */
21*7ff83669SZhong Wang /*
22*7ff83669SZhong Wang * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23*7ff83669SZhong Wang * Use is subject to license terms.
24*7ff83669SZhong Wang */
25*7ff83669SZhong Wang
26*7ff83669SZhong Wang #include <libfcoe.h>
27*7ff83669SZhong Wang #include <locale.h>
28*7ff83669SZhong Wang
29*7ff83669SZhong Wang int
main()30*7ff83669SZhong Wang main()
31*7ff83669SZhong Wang {
32*7ff83669SZhong Wang FCOE_STATUS status;
33*7ff83669SZhong Wang PFCOE_SMF_PORT_LIST portlist = NULL;
34*7ff83669SZhong Wang PFCOE_SMF_PORT_INSTANCE port = NULL;
35*7ff83669SZhong Wang int i;
36*7ff83669SZhong Wang int ret;
37*7ff83669SZhong Wang
38*7ff83669SZhong Wang (void) setlocale(LC_ALL, "");
39*7ff83669SZhong Wang
40*7ff83669SZhong Wang status = FCOE_LoadConfig(FCOE_PORTTYPE_INITIATOR, &portlist);
41*7ff83669SZhong Wang
42*7ff83669SZhong Wang if (status != FCOE_STATUS_OK) {
43*7ff83669SZhong Wang ret = 1;
44*7ff83669SZhong Wang } else if (portlist == NULL) {
45*7ff83669SZhong Wang return (0);
46*7ff83669SZhong Wang } else {
47*7ff83669SZhong Wang for (i = 0; i < portlist->port_num; i++) {
48*7ff83669SZhong Wang port = &portlist->ports[i];
49*7ff83669SZhong Wang if (port->port_type == FCOE_PORTTYPE_INITIATOR) {
50*7ff83669SZhong Wang (void) FCOE_CreatePort(port->mac_link_name,
51*7ff83669SZhong Wang port->port_type,
52*7ff83669SZhong Wang port->port_pwwn,
53*7ff83669SZhong Wang port->port_nwwn,
54*7ff83669SZhong Wang port->mac_promisc);
55*7ff83669SZhong Wang }
56*7ff83669SZhong Wang }
57*7ff83669SZhong Wang ret = 0;
58*7ff83669SZhong Wang }
59*7ff83669SZhong Wang
60*7ff83669SZhong Wang if (portlist != NULL) {
61*7ff83669SZhong Wang free(portlist);
62*7ff83669SZhong Wang }
63*7ff83669SZhong Wang return (ret);
64*7ff83669SZhong Wang } /* end main */
65