fcoe.c revision 1a5e258f5471356ca102c7176637cdce45bac147
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CDDL HEADER START
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The contents of this file are subject to the terms of the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Common Development and Distribution License (the "License").
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * You may not use this file except in compliance with the License.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * See the License for the specific language governing permissions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * and limitations under the License.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * When distributing Covered Code, include this CDDL HEADER in each
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * If applicable, add the following below this CDDL HEADER, with the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * fields enclosed by brackets "[]" replaced with your own identifying
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * information: Portions Copyright [yyyy] [name of copyright owner]
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * CDDL HEADER END
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Use is subject to license terms.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * The following notice accompanied the original version of this file:
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * BSD LICENSE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Copyright(c) 2007 Intel Corporation. All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * All rights reserved.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Redistribution and use in source and binary forms, with or without
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * modification, are permitted provided that the following conditions
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * * Redistributions of source code must retain the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * * Redistributions in binary form must reproduce the above copyright
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * notice, this list of conditions and the following disclaimer in
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * the documentation and/or other materials provided with the
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * distribution.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * * Neither the name of Intel Corporation nor the names of its
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * contributors may be used to endorse or promote products derived
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * from this software without specific prior written permission.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * Common FCoE interface interacts with MAC and FCoE clients, managing
4fd606d1f5abe38e1f42c38de1d2e895166bd0f4vboxsync * FCoE ports, doing MAC address discovery/managment, and FC frame
#include <fcoe.h>
#include <fcoe_fc.h>
#include <fcoe_eth.h>
void *obuf);
static void fcoe_worker_init();
static int fcoe_worker_fini();
static void fcoe_worker_frame();
&fcoe_ops,
static int fcoe_trace_buf_curndx = 0;
volatile int fcoe_nworkers;
_init(void)
int ret;
if (ret == 0) {
if (ret != 0) {
KM_SLEEP);
return (ret);
_fini(void)
int ret;
if (ret == 0) {
if (ret == 0) {
return (ret);
int fcoe_ret;
int instance;
switch (cmd) {
case DDI_ATTACH:
return (ret);
case DDI_RESUME:
return (ret);
int fcoe_ret;
int instance;
return (ret);
switch (cmd) {
case DDI_DETACH:
case DDI_SUSPEND:
return (ret);
int ret;
switch (op) {
case DDI_CTLOPS_REPORTDEV:
case DDI_CTLOPS_IOMIN:
case DDI_CTLOPS_INITCHILD:
case DDI_CTLOPS_UNINITCHILD:
return (ret);
int rval;
return (DDI_FAILURE);
return (DDI_SUCCESS);
return (DDI_SUCCESS);
int instance;
return (EINVAL);
return (EPERM);
return (ENXIO);
return (EBUSY);
return (EBUSY);
int instance;
return (EINVAL);
return (ENXIO);
return (ENODEV);
int ret = 0;
return (EPERM);
return (ENXIO);
return (ENXIO);
switch (cmd) {
case FCOEIO_CMD:
return (ret);
int ret = 0;
goto copyin_iocdata_fail;
goto copyin_iocdata_fail;
goto copyin_iocdata_fail;
goto copyin_iocdata_fail;
return (ret);
if (*abuf) {
if (*ibuf) {
return (ret);
return (EFAULT);
return (EFAULT);
int ret;
if (ret != 0) {
goto fcoeiocmd_release_buf;
goto fcoeiocmd_release_buf;
case FCOEIO_CREATE_FCOE_PORT: {
int cmpwwn = 0;
sizeof (fcoeio_create_port_param_t) ||
if (ret != 0) {
if (cmpwwn != 0) {
if (ret == 0) {
if (ret != 0) {
case FCOEIO_DELETE_FCOE_PORT: {
case FCOEIO_GET_FCOE_PORT_LIST: {
int count;
return (ENOTTY);
if (ret == 0) {
return (ret);
return (FCOE_FAILURE);
return (FCOE_FAILURE);
return (FCOE_SUCCESS);
int ret;
return (FCOE_FAILURE);
return (ret);
return (FCOE_SUCCESS);
return (mac);
return (NULL);
static boolean_t
return (B_TRUE);
return (B_FALSE);
static fcoe_mac_t *
linkid);
return (mac);
return (mac);
mblk_t *
int err;
return (NULL);
sizeof (fcoe_fc_frame_header_t));
return (mp);
uint32_t i;
for (i = 0; i < fcoe_nworkers; i++) {
w, DDI_SLEEP);
uint32_t i;
for (i = 0; i < fcoe_nworkers; i++) {
while (fcoe_nworkers_running != 0) {
return (FCOE_SUCCESS);
int ret;
w->worker_ntasks--;
fcoe_worker_t *w;
w->worker_ntasks++;
int len;
if (fcoe_trace_on == 0) {
if (i < count) {