summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorKelly Hu <kelly.hu@Sun.COM>2009-04-08 10:38:35 +0800
committerKelly Hu <kelly.hu@Sun.COM>2009-04-08 10:38:35 +0800
commitd4401b99a36e5170ccaa7defc0d2ac65b23f08c6 (patch)
tree64b7c3709e24edccb52363542527eb5af089737e /usr/src
parent45e46d060213105b5301d64e637dfdba4ddfba4e (diff)
downloadillumos-joyent-d4401b99a36e5170ccaa7defc0d2ac65b23f08c6.tar.gz
6815792 fcoe need to consider link name changes on the fly
6815799 Remove mac_is_vnic() and move the check for vnic to libfcoe
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/fcinfo/fcinfo.h1
-rw-r--r--usr/src/cmd/fcinfo/fcoeadm.c17
-rw-r--r--usr/src/lib/libfcoe/Makefile.com2
-rw-r--r--usr/src/lib/libfcoe/common/libfcoe.c97
-rw-r--r--usr/src/lib/libfcoe/common/libfcoe.h3
-rw-r--r--usr/src/uts/common/io/comstar/port/fcoet/fcoet.c18
-rw-r--r--usr/src/uts/common/io/fcoe/fcoe.c39
-rw-r--r--usr/src/uts/common/io/fcoe/fcoe.h4
-rw-r--r--usr/src/uts/common/io/fcoe/fcoe_eth.c38
-rw-r--r--usr/src/uts/common/io/fcoe/fcoe_fc.c24
-rw-r--r--usr/src/uts/common/io/fcoe/fcoe_fc.h2
-rw-r--r--usr/src/uts/common/sys/fcoe/fcoe_common.h2
-rw-r--r--usr/src/uts/common/sys/fcoe/fcoeio.h15
13 files changed, 159 insertions, 103 deletions
diff --git a/usr/src/cmd/fcinfo/fcinfo.h b/usr/src/cmd/fcinfo/fcinfo.h
index 4047ccaf4b..00e61c28b5 100644
--- a/usr/src/cmd/fcinfo/fcinfo.h
+++ b/usr/src/cmd/fcinfo/fcinfo.h
@@ -119,7 +119,6 @@ extern "C" {
#define TARGET_MODE 0x00000010
/* FCOE */
-#define FCOE_MAX_MAC_NAME_LEN 32
#define FCOE_USER_RAW_FRAME_SIZE 224
typedef struct _tgtPortWWNList {
diff --git a/usr/src/cmd/fcinfo/fcoeadm.c b/usr/src/cmd/fcinfo/fcoeadm.c
index 340d33dfa9..7b92f76673 100644
--- a/usr/src/cmd/fcinfo/fcoeadm.c
+++ b/usr/src/cmd/fcinfo/fcoeadm.c
@@ -621,9 +621,16 @@ fcoe_adm_create_port(int objects, char *argv[],
"port on the specified MAC link\n"));
break;
- case FCOE_STATUS_ERROR_VNIC_UNSUPPORT:
+ case FCOE_STATUS_ERROR_CLASS_UNSUPPORT:
fprintf(stderr,
- gettext("Error: VNIC is not supported\n"));
+ gettext("Error: Link class other than physical "
+ "link is not supported\n"));
+ break;
+
+ case FCOE_STATUS_ERROR_GET_LINKINFO:
+ fprintf(stderr,
+ gettext("Error: Failed to get link infomation "
+ "for %s\n"), macLinkName);
break;
case FCOE_STATUS_ERROR:
@@ -702,6 +709,12 @@ fcoe_adm_delete_port(int objects, char *argv[])
"the FCoE target first\n"));
break;
+ case FCOE_STATUS_ERROR_GET_LINKINFO:
+ fprintf(stderr,
+ gettext("Error: Failed to get link information "
+ "for %s\n"), macLinkName);
+ break;
+
case FCOE_STATUS_ERROR:
default:
fprintf(stderr,
diff --git a/usr/src/lib/libfcoe/Makefile.com b/usr/src/lib/libfcoe/Makefile.com
index 8fd5bfd695..8c6c4c64dc 100644
--- a/usr/src/lib/libfcoe/Makefile.com
+++ b/usr/src/lib/libfcoe/Makefile.com
@@ -37,7 +37,7 @@ SRCDIR = ../common
INCS += -I$(SRCDIR)
INCS += -I$(SRC)/uts/common/sys/fcoe
-LDLIBS += -lc
+LDLIBS += -lc -ldladm
C99MODE= -xc99=%all
C99LMODE= -Xc99=%all
CPPFLAGS += $(INCS) -D_REENTRANT
diff --git a/usr/src/lib/libfcoe/common/libfcoe.c b/usr/src/lib/libfcoe/common/libfcoe.c
index f06a620f26..a71c217a70 100644
--- a/usr/src/lib/libfcoe/common/libfcoe.c
+++ b/usr/src/lib/libfcoe/common/libfcoe.c
@@ -37,6 +37,7 @@
#include <assert.h>
#include <syslog.h>
#include <libfcoe.h>
+#include <libdllink.h>
#include <fcoeio.h>
#define FCOE_DEV_PATH "/devices/fcoe:admin"
@@ -92,10 +93,13 @@ FCOE_CreatePort(
FCOE_PORT_WWN nwwn,
FCOE_UINT8 promiscuous)
{
- FCOE_STATUS status = FCOE_STATUS_OK;
- int fcoe_fd;
- fcoeio_t fcoeio;
+ FCOE_STATUS status = FCOE_STATUS_OK;
+ int fcoe_fd;
+ fcoeio_t fcoeio;
fcoeio_create_port_param_t param;
+ dladm_handle_t handle;
+ datalink_id_t linkid;
+ datalink_class_t class;
bzero(&param, sizeof (fcoeio_create_port_param_t));
@@ -103,6 +107,25 @@ FCOE_CreatePort(
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
+ if (strlen((char *)macLinkName) > MAXLINKNAMELEN-1) {
+ return (FCOE_STATUS_ERROR_MAC_LEN);
+ }
+
+ if (dladm_open(&handle) != DLADM_STATUS_OK) {
+ return (FCOE_STATUS_ERROR);
+ }
+
+ if (dladm_name2info(handle, (const char *)macLinkName,
+ &linkid, NULL, &class, NULL) != DLADM_STATUS_OK) {
+ dladm_close(handle);
+ return (FCOE_STATUS_ERROR_GET_LINKINFO);
+ }
+ dladm_close(handle);
+
+ if (class != DATALINK_CLASS_PHYS) {
+ return (FCOE_STATUS_ERROR_CLASS_UNSUPPORT);
+ }
+
if (portType != FCOE_PORTTYPE_INITIATOR &&
portType != FCOE_PORTTYPE_TARGET) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
@@ -124,12 +147,8 @@ FCOE_CreatePort(
return (FCOE_STATUS_ERROR_WWN_SAME);
}
- if (strlen((char *)macLinkName) > FCOE_MAX_MAC_NAME_LEN-1) {
- return (FCOE_STATUS_ERROR_MAC_LEN);
- }
-
param.fcp_force_promisc = promiscuous;
- (void) strcpy((char *)param.fcp_mac_name, (char *)macLinkName);
+ param.fcp_mac_linkid = linkid;
param.fcp_port_type = (fcoe_cli_type_t)portType;
if ((status = openFcoe(OPEN_FCOE, &fcoe_fd)) != FCOE_STATUS_OK) {
@@ -181,10 +200,6 @@ FCOE_CreatePort(
status = FCOE_STATUS_ERROR_NEED_JUMBO_FRAME;
break;
- case FCOEIOE_VNIC_UNSUPPORT:
- status = FCOE_STATUS_ERROR_VNIC_UNSUPPORT;
- break;
-
default:
status = FCOE_STATUS_ERROR;
}
@@ -201,25 +216,41 @@ FCOE_DeletePort(const FCOE_UINT8 *macLinkName)
FCOE_STATUS status = FCOE_STATUS_OK;
int fcoe_fd;
fcoeio_t fcoeio;
+ dladm_handle_t handle;
+ datalink_id_t linkid;
+ fcoeio_delete_port_param_t fc_del_port;
if (macLinkName == NULL) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
}
- if (strlen((char *)macLinkName) > FCOE_MAX_MAC_NAME_LEN-1) {
+ if (strlen((char *)macLinkName) > MAXLINKNAMELEN-1) {
return (FCOE_STATUS_ERROR_MAC_LEN);
}
+ if (dladm_open(&handle) != DLADM_STATUS_OK) {
+ return (FCOE_STATUS_ERROR);
+ }
+
+ if (dladm_name2info(handle, (const char *)macLinkName,
+ &linkid, NULL, NULL, NULL) != DLADM_STATUS_OK) {
+ dladm_close(handle);
+ return (FCOE_STATUS_ERROR_GET_LINKINFO);
+ }
+ dladm_close(handle);
if ((status = openFcoe(OPEN_FCOE, &fcoe_fd)) != FCOE_STATUS_OK) {
return (status);
}
+ fc_del_port.fdp_mac_linkid = linkid;
+
(void) memset(&fcoeio, 0, sizeof (fcoeio));
fcoeio.fcoeio_cmd = FCOEIO_DELETE_FCOE_PORT;
- fcoeio.fcoeio_ilen = strlen((char *)macLinkName)+1;
+ /* only 4 bytes here, need to change */
+ fcoeio.fcoeio_ilen = sizeof (fcoeio_delete_port_param_t);
fcoeio.fcoeio_xfer = FCOEIO_XFER_WRITE;
- fcoeio.fcoeio_ibuf = (uintptr_t)macLinkName;
+ fcoeio.fcoeio_ibuf = (uintptr_t)&fc_del_port;
if (ioctl(fcoe_fd, FCOEIO_CMD, &fcoeio) != 0) {
switch (fcoeio.fcoeio_status) {
@@ -259,14 +290,16 @@ FCOE_GetPortList(
FCOE_PORT_ATTRIBUTE **portlist)
{
FCOE_STATUS status = FCOE_STATUS_OK;
- int fcoe_fd;
+ int fcoe_fd;
fcoeio_t fcoeio;
- fcoe_port_list_t *inportlist = NULL;
+ fcoe_port_list_t *inportlist = NULL;
FCOE_PORT_ATTRIBUTE *outportlist = NULL;
- int i;
- int size = 64; /* default first attempt */
- int retry = 0;
- int bufsize;
+ int i;
+ int size = 64; /* default first attempt */
+ int retry = 0;
+ int bufsize;
+ dladm_handle_t handle;
+ char mac_name[MAXLINKNAMELEN];
if (port_num == NULL || portlist == NULL) {
return (FCOE_STATUS_ERROR_INVAL_ARG);
@@ -318,7 +351,11 @@ FCOE_GetPortList(
}
} while (retry <= 3 && status != FCOE_STATUS_OK);
- if (status == FCOE_STATUS_OK) {
+ if (status == FCOE_STATUS_OK && inportlist->numPorts > 0) {
+ if (dladm_open(&handle) != DLADM_STATUS_OK) {
+ handle = NULL;
+ }
+
outportlist = (PFCOE_PORT_ATTRIBUTE)
malloc(sizeof (FCOE_PORT_ATTRIBUTE) * inportlist->numPorts);
@@ -326,7 +363,17 @@ FCOE_GetPortList(
fcoe_port_instance_t *pi = &inportlist->ports[i];
FCOE_PORT_ATTRIBUTE *po = &outportlist[i];
bcopy(pi->fpi_pwwn, &po->port_wwn, 8);
- bcopy(pi->fpi_mac_link_name, po->mac_link_name, 32);
+
+ if (handle == NULL ||
+ dladm_datalink_id2info(handle, pi->fpi_mac_linkid,
+ NULL, NULL, NULL, mac_name, sizeof (mac_name))
+ != DLADM_STATUS_OK) {
+ (void) strcpy((char *)po->mac_link_name,
+ "<unknown>");
+ } else {
+ (void) strcpy((char *)po->mac_link_name,
+ mac_name);
+ }
bcopy(pi->fpi_mac_factory_addr,
po->mac_factory_addr, 6);
bcopy(pi->fpi_mac_current_addr,
@@ -335,6 +382,10 @@ FCOE_GetPortList(
po->mtu_size = pi->fpi_mtu_size;
po->mac_promisc = pi->fpi_mac_promisc;
}
+
+ if (handle != NULL) {
+ dladm_close(handle);
+ }
*port_num = inportlist->numPorts;
*portlist = outportlist;
free(inportlist);
diff --git a/usr/src/lib/libfcoe/common/libfcoe.h b/usr/src/lib/libfcoe/common/libfcoe.h
index 30570205a7..871022011c 100644
--- a/usr/src/lib/libfcoe/common/libfcoe.h
+++ b/usr/src/lib/libfcoe/common/libfcoe.h
@@ -70,7 +70,8 @@ typedef unsigned int FCOE_STATUS;
#define FCOE_STATUS_ERROR_MAC_NOT_FOUND 15
#define FCOE_STATUS_ERROR_OFFLINE_DEV 16
#define FCOE_STATUS_ERROR_MORE_DATA 17
-#define FCOE_STATUS_ERROR_VNIC_UNSUPPORT 18
+#define FCOE_STATUS_ERROR_CLASS_UNSUPPORT 18
+#define FCOE_STATUS_ERROR_GET_LINKINFO 19
typedef struct fcoe_port_wwn {
uchar_t wwn[8];
diff --git a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c
index 2a22709bb6..def426da0b 100644
--- a/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c
+++ b/usr/src/uts/common/io/comstar/port/fcoet/fcoet.c
@@ -437,7 +437,6 @@ fcoet_attach_init(fcoet_soft_state_t *ss)
fcoe_port_t *eport;
fct_local_port_t *port;
fct_dbuf_store_t *fds;
- char *mac_name;
char taskq_name[32];
int ret;
@@ -453,19 +452,16 @@ fcoet_attach_init(fcoet_soft_state_t *ss)
client_fcoet.ect_port_event = fcoet_port_event;
client_fcoet.ect_release_sol_frame = fcoet_release_sol_frame;
client_fcoet.ect_client_port_struct = ss;
- ret = ddi_prop_lookup_string(DDI_DEV_T_ANY, ss->ss_dip,
- DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "mac_name", &mac_name);
- if (ret != DDI_PROP_SUCCESS) {
- FCOET_LOG("fcoet_attach_init", "lookup_string failed");
+ ret = ddi_prop_get_int(DDI_DEV_T_ANY, ss->ss_dip,
+ DDI_PROP_DONTPASS | DDI_PROP_NOTPROM, "mac_id", -1);
+ if (ret == -1) {
+ FCOET_LOG("fcoet_attach_init", "get mac_id failed");
return (DDI_FAILURE);
} else {
- bcopy(mac_name, client_fcoet.ect_channel_name,
- strlen(mac_name));
- client_fcoet.ect_channel_name[strlen(mac_name)] = 0;
- ddi_prop_free(mac_name);
+ client_fcoet.ect_channelid = ret;
}
- FCOET_LOG("fcoet_attach_init", "channel_name is %s",
- client_fcoet.ect_channel_name);
+ FCOET_LOG("fcoet_attach_init", "channel_id is %d",
+ client_fcoet.ect_channelid);
/*
* It's FCoE's responsiblity to initialize eport's all elements
diff --git a/usr/src/uts/common/io/fcoe/fcoe.c b/usr/src/uts/common/io/fcoe/fcoe.c
index e2dbe02921..94a23219ce 100644
--- a/usr/src/uts/common/io/fcoe/fcoe.c
+++ b/usr/src/uts/common/io/fcoe/fcoe.c
@@ -116,7 +116,7 @@ static int fcoe_initchild(dev_info_t *fcoe_dip, dev_info_t *client_dip);
static int fcoe_uninitchild(dev_info_t *fcoe_dip, dev_info_t *client_dip);
static void fcoe_init_wwn_from_mac(uint8_t *wwn, uint8_t *mac,
int is_pwwn, uint8_t idx);
-static fcoe_mac_t *fcoe_create_mac_by_name(uint8_t *name);
+static fcoe_mac_t *fcoe_create_mac_by_id(datalink_id_t linkid);
static int fcoe_cmp_wwn(fcoe_mac_t *checkedmac);
static void fcoe_watchdog(void *arg);
static void fcoe_worker_init();
@@ -682,7 +682,7 @@ fcoe_iocmd(fcoe_soft_state_t *ss, intptr_t data, int mode)
}
mutex_enter(&ss->ss_ioctl_mutex);
- fcoe_mac = fcoe_create_mac_by_name(param->fcp_mac_name);
+ fcoe_mac = fcoe_create_mac_by_id(param->fcp_mac_linkid);
if (fcoe_mac == NULL) {
mutex_exit(&ss->ss_ioctl_mutex);
fcoeio->fcoeio_status = FCOEIOE_CREATE_MAC;
@@ -762,9 +762,10 @@ fcoe_iocmd(fcoe_soft_state_t *ss, intptr_t data, int mode)
}
case FCOEIO_DELETE_FCOE_PORT: {
- uint8_t *mac_name = (uint8_t *)ibuf;
+ fcoeio_delete_port_param_t *del_port_param =
+ (fcoeio_delete_port_param_t *)ibuf;
- if (fcoeio->fcoeio_ilen > FCOE_MAX_MAC_NAME_LEN ||
+ if (fcoeio->fcoeio_ilen < sizeof (fcoeio_delete_port_param_t) ||
fcoeio->fcoeio_xfer != FCOEIO_XFER_WRITE) {
fcoeio->fcoeio_status = FCOEIOE_INVAL_ARG;
ret = EINVAL;
@@ -772,7 +773,8 @@ fcoe_iocmd(fcoe_soft_state_t *ss, intptr_t data, int mode)
}
mutex_enter(&ss->ss_ioctl_mutex);
- ret = fcoe_delete_port(ss->ss_dip, fcoeio, mac_name);
+ ret = fcoe_delete_port(ss->ss_dip, fcoeio,
+ del_port_param->fdp_mac_linkid);
if (ret != 0) {
FCOE_LOG("fcoe",
"fcoe_delete_port failed: %d", ret);
@@ -935,14 +937,14 @@ fcoe_detach_uninit(fcoe_soft_state_t *ss)
* Return mac instance if it exist, or else return NULL.
*/
fcoe_mac_t *
-fcoe_lookup_mac_by_name(uint8_t *name)
+fcoe_lookup_mac_by_id(datalink_id_t linkid)
{
fcoe_mac_t *mac = NULL;
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
for (mac = list_head(&fcoe_global_ss->ss_mac_list); mac;
mac = list_next(&fcoe_global_ss->ss_mac_list, mac)) {
- if (strcmp((char *)name, mac->fm_link_name)) {
+ if (linkid != mac->fm_linkid) {
continue;
}
return (mac);
@@ -967,24 +969,24 @@ fcoe_init_wwn_from_mac(uint8_t *wwn, uint8_t *mac, int is_pwwn, uint8_t idx)
* Return fcoe_mac if it exists, otherwise create a new one
*/
static fcoe_mac_t *
-fcoe_create_mac_by_name(uint8_t *name)
+fcoe_create_mac_by_id(datalink_id_t linkid)
{
fcoe_mac_t *mac = NULL;
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
- mac = fcoe_lookup_mac_by_name(name);
+ mac = fcoe_lookup_mac_by_id(linkid);
if (mac != NULL) {
- FCOE_LOG("fcoe", "fcoe_create_mac_by_name found one mac %s",
- name);
+ FCOE_LOG("fcoe", "fcoe_create_mac_by_id found one mac %d",
+ linkid);
return (mac);
}
mac = kmem_zalloc(sizeof (fcoe_mac_t), KM_SLEEP);
- bcopy(name, mac->fm_link_name, strlen((char *)name) + 1);
+ mac->fm_linkid = linkid;
mac->fm_flags = 0;
mac->fm_ss = fcoe_global_ss;
list_insert_tail(&mac->fm_ss->ss_mac_list, mac);
- FCOE_LOG("fcoe", "fcoe_create_mac_by_name created one mac %s", name);
+ FCOE_LOG("fcoe", "fcoe_create_mac_by_id created one mac %d", linkid);
return (mac);
}
@@ -1232,7 +1234,7 @@ fcoe_cmp_wwn(fcoe_mac_t *checkedmac)
cnwwn = checkedmac->fm_eport.eport_nodewwn;
cpwwn = checkedmac->fm_eport.eport_portwwn;
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
for (mac = list_head(&fcoe_global_ss->ss_mac_list); mac;
mac = list_next(&fcoe_global_ss->ss_mac_list, mac)) {
@@ -1260,15 +1262,14 @@ fcoe_get_port_list(fcoe_port_instance_t *ports, int count)
int i = 0;
ASSERT(ports != NULL);
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
for (mac = list_head(&fcoe_global_ss->ss_mac_list); mac;
mac = list_next(&fcoe_global_ss->ss_mac_list, mac)) {
if (i < count) {
bcopy(mac->fm_eport.eport_portwwn,
ports[i].fpi_pwwn, 8);
- bcopy(mac->fm_link_name,
- ports[i].fpi_mac_link_name, MAXLINKNAMELEN);
+ ports[i].fpi_mac_linkid = mac->fm_linkid;
bcopy(mac->fm_current_addr,
ports[i].fpi_mac_current_addr, ETHERADDRL);
bcopy(mac->fm_primary_addr,
diff --git a/usr/src/uts/common/io/fcoe/fcoe.h b/usr/src/uts/common/io/fcoe/fcoe.h
index 222a29bf12..38a1a05cf8 100644
--- a/usr/src/uts/common/io/fcoe/fcoe.h
+++ b/usr/src/uts/common/io/fcoe/fcoe.h
@@ -123,7 +123,7 @@ typedef struct fcoe_soft_state {
typedef struct fcoe_mac
{
list_node_t fm_ss_node;
- char fm_link_name[MAXLINKNAMELEN];
+ datalink_id_t fm_linkid;
uint32_t fm_flags;
fcoe_soft_state_t *fm_ss;
@@ -235,7 +235,7 @@ typedef struct fcoe_worker {
/*
* fcoe driver common functions
*/
-extern fcoe_mac_t *fcoe_lookup_mac_by_name(uint8_t *);
+extern fcoe_mac_t *fcoe_lookup_mac_by_id(datalink_id_t);
extern void fcoe_destroy_mac(fcoe_mac_t *);
extern mblk_t *fcoe_get_mblk(fcoe_mac_t *, uint32_t);
extern void fcoe_post_frame(fcoe_frame_t *);
diff --git a/usr/src/uts/common/io/fcoe/fcoe_eth.c b/usr/src/uts/common/io/fcoe/fcoe_eth.c
index 91b4aa2032..7f2763c5cd 100644
--- a/usr/src/uts/common/io/fcoe/fcoe_eth.c
+++ b/usr/src/uts/common/io/fcoe/fcoe_eth.c
@@ -70,22 +70,14 @@ fcoe_open_mac(fcoe_mac_t *mac, int force_promisc, fcoeio_stat_t *err_detail)
/*
* Open MAC interface
*/
- ret = mac_open_by_linkname(mac->fm_link_name, &mac->fm_handle);
+ ret = mac_open_by_linkid(mac->fm_linkid, &mac->fm_handle);
if (ret != 0) {
- cmn_err(CE_WARN, "Open network interface %s failed",
- mac->fm_link_name);
- FCOE_LOG("fcoe", "mac_open_by_linkname %s failed %x",
- mac->fm_link_name, ret);
+ FCOE_LOG("fcoe", "mac_open_by_linkname %d failed %x",
+ mac->fm_linkid, ret);
return (FCOE_FAILURE);
}
- if (mac_is_vnic(mac->fm_handle)) {
- (void) mac_close(mac->fm_handle);
- *err_detail = FCOEIOE_VNIC_UNSUPPORT;
- return (FCOE_FAILURE);
- }
-
- (void) sprintf(cli_name, "%s-%s", mac->fm_link_name, "fcoe");
+ (void) sprintf(cli_name, "%s-%d", "fcoe", mac->fm_linkid);
ret = mac_client_open(mac->fm_handle,
&mac->fm_cli_handle, cli_name, fm_open_flag);
@@ -194,10 +186,8 @@ fcoe_enable_callback(fcoe_mac_t *mac)
&mac->fm_promisc_handle,
MAC_PROMISC_FLAGS_NO_TX_LOOP);
if (ret != 0) {
- cmn_err(CE_WARN, "Enable promisc mode on %s failed",
- mac->fm_link_name);
- FCOE_LOG("foce", "mac_promisc_add on %s failed %x",
- mac->fm_link_name, ret);
+ FCOE_LOG("foce", "mac_promisc_add on %d failed %x",
+ mac->fm_linkid, ret);
return (FCOE_FAILURE);
}
} else {
@@ -308,16 +298,18 @@ fcoe_mac_notify(void *arg, mac_notify_type_t type)
mac->fm_eport.eport_efh_dst);
mac->fm_link_state = FCOE_MAC_LINK_STATE_UP;
- FCOE_LOG(mac->fm_link_name,
- "fcoe_mac_notify: arg/%p LINK up", arg, type);
+ FCOE_LOG(NULL,
+ "fcoe_mac_notify: link/%d arg/%p LINK up",
+ mac->fm_linkid, arg, type);
fcoe_mac_notify_link_up(mac);
} else {
if (mac->fm_link_state == FCOE_MAC_LINK_STATE_DOWN) {
break;
}
mac->fm_link_state = FCOE_MAC_LINK_STATE_DOWN;
- FCOE_LOG(mac->fm_link_name,
- "fcoe_mac_notify: arg/%p LINK down", arg, type);
+ FCOE_LOG(NULL,
+ "fcoe_mac_notify: link/%d arg/%p LINK down",
+ mac->fm_linkid, arg, type);
fcoe_mac_notify_link_down(mac);
}
break;
@@ -355,10 +347,8 @@ fcoe_mac_set_address(fcoe_port_t *eport, uint8_t *addr, boolean_t fc_assigned)
ret = mac_unicast_primary_set(mac->fm_handle, addr);
if (ret != 0) {
mutex_exit(&mac->fm_mutex);
- cmn_err(CE_WARN, "Set primary unicast address on %s "
- "failed", mac->fm_link_name);
- FCOE_LOG("fcoe", "mac_unicast_primary_set on %s "
- "failed %x", mac->fm_link_name, ret);
+ FCOE_LOG("fcoe", "mac_unicast_primary_set on %d "
+ "failed %x", mac->fm_linkid, ret);
return (FCOE_FAILURE);
}
}
diff --git a/usr/src/uts/common/io/fcoe/fcoe_fc.c b/usr/src/uts/common/io/fcoe/fcoe_fc.c
index e1cb5e3bad..68ec016134 100644
--- a/usr/src/uts/common/io/fcoe/fcoe_fc.c
+++ b/usr/src/uts/common/io/fcoe/fcoe_fc.c
@@ -72,7 +72,7 @@ fcoe_register_client(fcoe_client_t *client)
fcoe_mac_t *mac;
fcoe_port_t *eport;
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
/*
* We will not come here, when someone is changing ss_mac_list,
@@ -80,8 +80,7 @@ fcoe_register_client(fcoe_client_t *client)
*/
for (mac = list_head(&fcoe_global_ss->ss_mac_list); mac;
mac = list_next(&fcoe_global_ss->ss_mac_list, mac)) {
- if (strcmp(client->ect_channel_name, mac->fm_link_name)
- == 0) {
+ if (client->ect_channelid == mac->fm_linkid) {
break;
}
}
@@ -132,7 +131,7 @@ fcoe_deregister_client(fcoe_port_t *eport)
{
fcoe_mac_t *mac = EPORT2MAC(eport);
- ASSERT(mutex_owned(&fcoe_global_ss->ss_ioctl_mutex));
+ ASSERT(MUTEX_HELD(&fcoe_global_ss->ss_ioctl_mutex));
/*
* Wait for all the related frame to be freed, this should be fast
@@ -425,7 +424,6 @@ fcoe_create_port(dev_info_t *parent, fcoe_mac_t *mac, int is_target)
{
int rval = 0;
dev_info_t *child = NULL;
- char *mac_name = mac->fm_link_name;
char *devname = is_target ? FCOET_DRIVER_NAME : FCOEI_DRIVER_NAME;
ndi_devi_alloc_sleep(parent, devname, DEVI_PSEUDO_NODEID, &child);
@@ -434,19 +432,19 @@ fcoe_create_port(dev_info_t *parent, fcoe_mac_t *mac, int is_target)
return (NDI_FAILURE);
}
- if (ddi_prop_update_string(DDI_DEV_T_NONE, child,
- "mac_name", mac_name) != DDI_PROP_SUCCESS) {
+ if (ddi_prop_update_int(DDI_DEV_T_NONE, child,
+ "mac_id", mac->fm_linkid) != DDI_PROP_SUCCESS) {
FCOE_LOG("fcoe",
- "fcoe%d: prop_update port mac name failed for mac %s",
- ddi_get_instance(parent), mac_name);
+ "fcoe%d: prop_update port mac id failed for mac %d",
+ ddi_get_instance(parent), mac->fm_linkid);
(void) ndi_devi_free(child);
return (NDI_FAILURE);
}
rval = ndi_devi_online(child, NDI_ONLINE_ATTACH);
if (rval != NDI_SUCCESS) {
- FCOE_LOG("fcoe", "fcoe%d: online_driver failed for mac %s",
- ddi_get_instance(parent), mac->fm_link_name);
+ FCOE_LOG("fcoe", "fcoe%d: online_driver failed for mac %d",
+ ddi_get_instance(parent), mac->fm_linkid);
return (NDI_FAILURE);
}
mac->fm_client_dev = child;
@@ -455,12 +453,12 @@ fcoe_create_port(dev_info_t *parent, fcoe_mac_t *mac, int is_target)
}
int
-fcoe_delete_port(dev_info_t *parent, fcoeio_t *fcoeio, uint8_t *mac_name)
+fcoe_delete_port(dev_info_t *parent, fcoeio_t *fcoeio, datalink_id_t linkid)
{
int rval = 0;
fcoe_mac_t *mac;
- mac = fcoe_lookup_mac_by_name(mac_name);
+ mac = fcoe_lookup_mac_by_id(linkid);
if (mac == NULL) {
fcoeio->fcoeio_status = FCOEIOE_MAC_NOT_FOUND;
return (EINVAL);
diff --git a/usr/src/uts/common/io/fcoe/fcoe_fc.h b/usr/src/uts/common/io/fcoe/fcoe_fc.h
index 8fbbe52936..51ee375130 100644
--- a/usr/src/uts/common/io/fcoe/fcoe_fc.h
+++ b/usr/src/uts/common/io/fcoe/fcoe_fc.h
@@ -36,7 +36,7 @@ extern fcoe_frame_t *fcoe_allocate_frame(fcoe_port_t *, uint32_t, void *);
extern void fcoe_mac_notify_link_up(void *);
extern void fcoe_mac_notify_link_down(void *);
extern int fcoe_create_port(dev_info_t *, fcoe_mac_t *, int);
-extern int fcoe_delete_port(dev_info_t *, fcoeio_t *, uint8_t *);
+extern int fcoe_delete_port(dev_info_t *, fcoeio_t *, datalink_id_t);
#endif /* _KERNEL */
diff --git a/usr/src/uts/common/sys/fcoe/fcoe_common.h b/usr/src/uts/common/sys/fcoe/fcoe_common.h
index bad3c5a133..c59554c2e7 100644
--- a/usr/src/uts/common/sys/fcoe/fcoe_common.h
+++ b/usr/src/uts/common/sys/fcoe/fcoe_common.h
@@ -156,7 +156,7 @@ typedef struct fcoe_client {
uint32_t ect_eport_flags;
uint32_t ect_max_fc_frame_size;
uint32_t ect_private_frame_struct_size;
- char ect_channel_name[32];
+ uint32_t ect_channelid;
void *ect_client_port_struct;
void (*ect_rx_frame)(fcoe_frame_t *frame);
void (*ect_port_event)(fcoe_port_t *eport, uint32_t event);
diff --git a/usr/src/uts/common/sys/fcoe/fcoeio.h b/usr/src/uts/common/sys/fcoe/fcoeio.h
index 6d24a2673f..0167164058 100644
--- a/usr/src/uts/common/sys/fcoe/fcoeio.h
+++ b/usr/src/uts/common/sys/fcoe/fcoeio.h
@@ -26,6 +26,7 @@
#define _FCOEIO_H_
#include <sys/ethernet.h>
+#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
@@ -72,8 +73,7 @@ typedef enum {
FCOEIOE_NEED_JUMBO_FRAME,
FCOEIOE_MAC_NOT_FOUND,
FCOEIOE_OFFLINE_FAILURE,
- FCOEIOE_MORE_DATA,
- FCOEIOE_VNIC_UNSUPPORT
+ FCOEIOE_MORE_DATA
} fcoeio_stat_t;
/* Biggest buffer length, can hold up to 1024 port instances */
@@ -112,15 +112,22 @@ typedef struct fcoeio_create_port_param {
uint32_t fcp_pwwn_provided;
uint32_t fcp_force_promisc;
fcoe_cli_type_t fcp_port_type;
- uchar_t fcp_mac_name[MAXLINKNAMELEN];
+ datalink_id_t fcp_mac_linkid;
+ uint32_t fcp_rsvd0;
} fcoeio_create_port_param_t;
+typedef struct fcoeio_delete_port_param {
+ datalink_id_t fdp_mac_linkid;
+ uint32_t fdp_rsvd0;
+} fcoeio_delete_port_param_t;
+
/*
* FCOE port instance
*/
typedef struct fcoe_port_instance {
uchar_t fpi_pwwn[FCOE_WWN_SIZE];
- uchar_t fpi_mac_link_name[MAXLINKNAMELEN];
+ datalink_id_t fpi_mac_linkid;
+ uint32_t fpi_rsvd0;
uint8_t fpi_mac_factory_addr[ETHERADDRL];
uint16_t fpi_mac_promisc;
uint8_t fpi_mac_current_addr[ETHERADDRL];