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