* Wolfgang Taphorn
* Stefan Bader <stefan.bader@de.ibm.com>
* Heiko Carstens <heiko.carstens@de.ibm.com>
- * Andreas Herrmann <aherrman@de.ibm.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
-#define ZFCP_ERP_REVISION "$Revision: 1.85 $"
+/* this drivers version (do not edit !!! generated and updated by cvs) */
+#define ZFCP_ERP_REVISION "$Revision: 1.65 $"
#include "zfcp_ext.h"
-static int zfcp_erp_adisc(struct zfcp_adapter *, fc_id_t);
-static void zfcp_erp_adisc_handler(unsigned long);
+static int zfcp_els(struct zfcp_port *, u8);
+static void zfcp_els_handler(unsigned long);
static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int);
static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *, int);
}
-/**
- * zfcp_erp_adisc - send ADISC ELS command
- * @adapter: adapter structure
- * @d_id: d_id of port where ADISC is sent to
+/*
+ * function: zfcp_els
+ *
+ * purpose: Originator of the ELS commands
+ *
+ * returns: 0 - Operation completed successfuly
+ * -EINVAL - Unknown IOCTL command or invalid sense data record
+ * -ENOMEM - Insufficient memory
+ * -EPERM - Cannot create or queue FSF request
*/
int
-zfcp_erp_adisc(struct zfcp_adapter *adapter, fc_id_t d_id)
+zfcp_els(struct zfcp_port *port, u8 ls_code)
{
struct zfcp_send_els *send_els;
+ struct zfcp_ls_rls *rls;
+ struct zfcp_ls_pdisc *pdisc;
struct zfcp_ls_adisc *adisc;
- void *address = NULL;
+ struct page *page = NULL;
+ void *req;
int retval = 0;
- struct timer_list *timer;
send_els = kmalloc(sizeof(struct zfcp_send_els), GFP_ATOMIC);
if (send_els == NULL)
goto nomem;
- memset(send_els, 0, sizeof(*send_els));
send_els->req = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els->req == NULL)
goto nomem;
- memset(send_els->req, 0, sizeof(*send_els->req));
+ send_els->req_count = 1;
send_els->resp = kmalloc(sizeof(struct scatterlist), GFP_ATOMIC);
if (send_els->resp == NULL)
goto nomem;
- memset(send_els->resp, 0, sizeof(*send_els->resp));
+ send_els->resp_count = 1;
- address = (void *) get_zeroed_page(GFP_ATOMIC);
- if (address == NULL)
+ page = alloc_pages(GFP_ATOMIC, 0);
+ if (page == NULL)
goto nomem;
+ send_els->req->page = page;
+ send_els->resp->page = page;
+ send_els->req->offset = 0;
+ send_els->resp->offset = PAGE_SIZE >> 1;
+
+ send_els->port = port;
+ send_els->ls_code = ls_code;
+ send_els->handler = zfcp_els_handler;
+ send_els->handler_data = (unsigned long)send_els;
+ send_els->completion = NULL;
+
+ req = zfcp_sg_to_address(send_els->req);
+ memset(req, 0, PAGE_SIZE);
+
+ *(u32*)req = 0;
+ *(u8*)req = ls_code;
+
+ switch (ls_code) {
+
+ case ZFCP_LS_RTV:
+ send_els->req->length = sizeof(struct zfcp_ls_rtv);
+ send_els->resp->length = sizeof(struct zfcp_ls_rtv_acc);
+ ZFCP_LOG_INFO("RTV request from s_id 0x%08x to d_id 0x%08x\n",
+ port->adapter->s_id, port->d_id);
+ break;
- zfcp_address_to_sg(address, send_els->req);
- address += PAGE_SIZE >> 1;
- zfcp_address_to_sg(address, send_els->resp);
- send_els->req_count = send_els->resp_count = 1;
-
- send_els->adapter = adapter;
- send_els->d_id = d_id;
- send_els->handler = zfcp_erp_adisc_handler;
- send_els->handler_data = (unsigned long) send_els;
-
- adisc = zfcp_sg_to_address(send_els->req);
- send_els->ls_code = adisc->code = ZFCP_LS_ADISC;
-
- send_els->req->length = sizeof(struct zfcp_ls_adisc);
- send_els->resp->length = sizeof(struct zfcp_ls_adisc_acc);
-
- /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports
- without FC-AL-2 capability, so we don't set it */
- adisc->wwpn = adapter->wwpn;
- adisc->wwnn = adapter->wwnn;
- adisc->nport_id = adapter->s_id;
- ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x "
- "(wwpn=0x%016Lx, wwnn=0x%016Lx, "
- "hard_nport_id=0x%08x, nport_id=0x%08x)\n",
- adapter->s_id, d_id, (wwn_t) adisc->wwpn,
- (wwn_t) adisc->wwnn, adisc->hard_nport_id,
- adisc->nport_id);
-
- timer = kmalloc(sizeof(struct timer_list), GFP_ATOMIC);
- if (!timer)
- goto nomem;
+ case ZFCP_LS_RLS:
+ send_els->req->length = sizeof(struct zfcp_ls_rls);
+ send_els->resp->length = sizeof(struct zfcp_ls_rls_acc);
+ rls = (struct zfcp_ls_rls*)req;
+ rls->port_id = port->adapter->s_id;
+ ZFCP_LOG_INFO("RLS request from s_id 0x%08x to d_id 0x%08x "
+ "(port_id=0x%08x)\n",
+ port->adapter->s_id, port->d_id, rls->port_id);
+ break;
- init_timer(timer);
- timer->function = zfcp_fsf_request_timeout_handler;
- timer->data = (unsigned long) adapter;
- timer->expires = ZFCP_FSF_REQUEST_TIMEOUT;
- send_els->timer = timer;
+ case ZFCP_LS_PDISC:
+ send_els->req->length = sizeof(struct zfcp_ls_pdisc);
+ send_els->resp->length = sizeof(struct zfcp_ls_pdisc_acc);
+ pdisc = (struct zfcp_ls_pdisc*)req;
+ pdisc->wwpn = port->adapter->wwpn;
+ pdisc->wwnn = port->adapter->wwnn;
+ ZFCP_LOG_INFO("PDISC request from s_id 0x%08x to d_id 0x%08x "
+ "(wwpn=0x%016Lx, wwnn=0x%016Lx)\n",
+ port->adapter->s_id, port->d_id,
+ pdisc->wwpn, pdisc->wwnn);
+ break;
+
+ case ZFCP_LS_ADISC:
+ send_els->req->length = sizeof(struct zfcp_ls_adisc);
+ send_els->resp->length = sizeof(struct zfcp_ls_adisc_acc);
+ adisc = (struct zfcp_ls_adisc*)req;
+ adisc->hard_nport_id = port->adapter->s_id;
+ adisc->wwpn = port->adapter->wwpn;
+ adisc->wwnn = port->adapter->wwnn;
+ adisc->nport_id = port->adapter->s_id;
+ ZFCP_LOG_INFO("ADISC request from s_id 0x%08x to d_id 0x%08x "
+ "(wwpn=0x%016Lx, wwnn=0x%016Lx, "
+ "hard_nport_id=0x%08x, nport_id=0x%08x)\n",
+ port->adapter->s_id, port->d_id,
+ adisc->wwpn, adisc->wwnn,
+ adisc->hard_nport_id, adisc->nport_id);
+ break;
+
+ default:
+ ZFCP_LOG_NORMAL("ELS command code 0x%02x is not supported\n",
+ ls_code);
+ retval = -EINVAL;
+ goto invalid_ls_code;
+ }
retval = zfcp_fsf_send_els(send_els);
if (retval != 0) {
ZFCP_LOG_NORMAL("error: initiation of Send ELS failed for port "
- "0x%08x on adapter %s\n", d_id,
- zfcp_get_busid_by_adapter(adapter));
- del_timer_sync(send_els->timer);
- goto freemem;
+ "0x%016Lx on adapter %s\n",
+ port->wwpn, zfcp_get_busid_by_port(port));
+ retval = -EPERM;
}
goto out;
- nomem:
+nomem:
+ ZFCP_LOG_DEBUG("out of memory\n");
retval = -ENOMEM;
- freemem:
- if (address != NULL)
- __free_pages(send_els->req->page, 0);
+
+invalid_ls_code:
+ if (page != NULL)
+ __free_pages(page, 0);
if (send_els != NULL) {
- kfree(send_els->timer);
- kfree(send_els->req);
- kfree(send_els->resp);
+ if (send_els->req != NULL)
+ kfree(send_els->req);
+ if (send_els->resp != NULL)
+ kfree(send_els->resp);
kfree(send_els);
}
- out:
+
+out:
return retval;
}
/**
- * zfcp_erp_adisc_handler - handler for ADISC ELS command
+ * zfcp_els_handler - handler for ELS commands
* @data: pointer to struct zfcp_send_els
- *
- * If ADISC failed (LS_RJT or timed out) forced reopen of the port is triggered.
+ * If ELS failed (LS_RJT or timed out) forced reopen of the port is triggered.
*/
void
-zfcp_erp_adisc_handler(unsigned long data)
+zfcp_els_handler(unsigned long data)
{
- struct zfcp_send_els *send_els;
- struct zfcp_port *port;
- struct zfcp_adapter *adapter;
- fc_id_t d_id;
+ struct zfcp_send_els *send_els = (struct zfcp_send_els*)data;
+ struct zfcp_port *port = send_els->port;
+ struct zfcp_ls_rtv_acc *rtv;
+ struct zfcp_ls_rls_acc *rls;
+ struct zfcp_ls_pdisc_acc *pdisc;
struct zfcp_ls_adisc_acc *adisc;
-
- send_els = (struct zfcp_send_els *) data;
-
- del_timer(send_els->timer);
-
- adapter = send_els->adapter;
- d_id = send_els->d_id;
-
- read_lock(&zfcp_data.config_lock);
- port = zfcp_get_port_by_did(send_els->adapter, send_els->d_id);
- read_unlock(&zfcp_data.config_lock);
-
- BUG_ON(port == NULL);
+ void *req, *resp;
+ u8 req_code;
/* request rejected or timed out */
if (send_els->status != 0) {
- ZFCP_LOG_NORMAL("ELS request rejected/timed out, "
- "force physical port reopen "
- "(adapter %s, port d_id=0x%08x)\n",
- zfcp_get_busid_by_adapter(adapter), d_id);
- debug_text_event(adapter->erp_dbf, 3, "forcreop");
+ ZFCP_LOG_NORMAL("ELS request timed out, force physical port "
+ "reopen of port 0x%016Lx on adapter %s\n",
+ port->wwpn, zfcp_get_busid_by_port(port));
+ debug_text_event(port->adapter->erp_dbf, 3, "forcreop");
if (zfcp_erp_port_forced_reopen(port, 0))
- ZFCP_LOG_NORMAL("failed reopen of port "
- "(adapter %s, wwpn=0x%016Lx)\n",
- zfcp_get_busid_by_port(port),
- port->wwpn);
+ ZFCP_LOG_NORMAL("reopen of remote port 0x%016Lx "
+ "on adapter %s failed\n", port->wwpn,
+ zfcp_get_busid_by_port(port));
goto out;
}
- adisc = zfcp_sg_to_address(send_els->resp);
+ req = zfcp_sg_to_address(send_els->req);
+ resp = zfcp_sg_to_address(send_els->resp);
+ req_code = *(u8*)req;
- ZFCP_LOG_INFO("ADISC response from d_id 0x%08x to s_id "
- "0x%08x (wwpn=0x%016Lx, wwnn=0x%016Lx, "
- "hard_nport_id=0x%08x, nport_id=0x%08x)\n",
- d_id, adapter->s_id, (wwn_t) adisc->wwpn,
- (wwn_t) adisc->wwnn, adisc->hard_nport_id,
- adisc->nport_id);
+ switch (req_code) {
+
+ case ZFCP_LS_RTV:
+ rtv = (struct zfcp_ls_rtv_acc*)resp;
+ ZFCP_LOG_INFO("RTV response from d_id 0x%08x to s_id "
+ "0x%08x (R_A_TOV=%ds E_D_TOV=%d%cs)\n",
+ port->d_id, port->adapter->s_id,
+ rtv->r_a_tov, rtv->e_d_tov,
+ rtv->qualifier &
+ ZFCP_LS_RTV_E_D_TOV_FLAG ? 'n' : 'm');
+ break;
+
+ case ZFCP_LS_RLS:
+ rls = (struct zfcp_ls_rls_acc*)resp;
+ ZFCP_LOG_INFO("RLS response from d_id 0x%08x to s_id "
+ "0x%08x (link_failure_count=%u, "
+ "loss_of_sync_count=%u, "
+ "loss_of_signal_count=%u, "
+ "primitive_sequence_protocol_error=%u, "
+ "invalid_transmition_word=%u, "
+ "invalid_crc_count=%u)\n",
+ port->d_id, port->adapter->s_id,
+ rls->link_failure_count,
+ rls->loss_of_sync_count,
+ rls->loss_of_signal_count,
+ rls->prim_seq_prot_error,
+ rls->invalid_transmition_word,
+ rls->invalid_crc_count);
+ break;
- /* set wwnn for port */
- if (port->wwnn == 0)
- port->wwnn = adisc->wwnn;
+ case ZFCP_LS_PDISC:
+ pdisc = (struct zfcp_ls_pdisc_acc*)resp;
+ ZFCP_LOG_INFO("PDISC response from d_id 0x%08x to s_id "
+ "0x%08x (wwpn=0x%016Lx, wwnn=0x%016Lx, "
+ "vendor='%-16s')\n", port->d_id,
+ port->adapter->s_id, pdisc->wwpn,
+ pdisc->wwnn, pdisc->vendor_version);
+ break;
- if (port->wwpn != adisc->wwpn) {
- ZFCP_LOG_NORMAL("d_id assignment changed, reopening "
- "port (adapter %s, wwpn=0x%016Lx, "
- "adisc_resp_wwpn=0x%016Lx)\n",
- zfcp_get_busid_by_port(port),
- port->wwpn, (wwn_t) adisc->wwpn);
- if (zfcp_erp_port_reopen(port, 0))
- ZFCP_LOG_NORMAL("failed reopen of port "
- "(adapter %s, wwpn=0x%016Lx)\n",
- zfcp_get_busid_by_port(port),
- port->wwpn);
+ case ZFCP_LS_ADISC:
+ adisc = (struct zfcp_ls_adisc_acc*)resp;
+ ZFCP_LOG_INFO("ADISC response from d_id 0x%08x to s_id "
+ "0x%08x (wwpn=0x%016Lx, wwnn=0x%016Lx, "
+ "hard_nport_id=0x%08x, "
+ "nport_id=0x%08x)\n", port->d_id,
+ port->adapter->s_id, adisc->wwpn,
+ adisc->wwnn, adisc->hard_nport_id,
+ adisc->nport_id);
+ /* FIXME: set wwnn in during open port */
+ if (port->wwnn == 0)
+ port->wwnn = adisc->wwnn;
+ break;
}
out:
- zfcp_port_put(port);
__free_pages(send_els->req->page, 0);
- kfree(send_els->timer);
kfree(send_els->req);
kfree(send_els->resp);
kfree(send_els);
}
-/**
- * zfcp_test_link - lightweight link test procedure
- * @port: port to be tested
+/*
+ * function: zfcp_test_link
+ *
+ * purpose: Test a status of a link to a remote port using the ELS command ADISC
*
- * Test status of a link to a remote port using the ELS command ADISC.
+ * returns: 0 - Link is OK
+ * -EPERM - Port forced reopen failed
*/
int
zfcp_test_link(struct zfcp_port *port)
{
int retval;
- zfcp_port_get(port);
- retval = zfcp_erp_adisc(port->adapter, port->d_id);
+ retval = zfcp_els(port, ZFCP_LS_ADISC);
if (retval != 0) {
- zfcp_port_put(port);
ZFCP_LOG_NORMAL("reopen needed for port 0x%016Lx "
"on adapter %s\n ", port->wwpn,
zfcp_get_busid_by_port(port));
zfcp_erp_modify_port_status(port,
ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
- if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
- ZFCP_LOG_NORMAL("port erp failed (adapter %s, "
- "port d_id=0x%08x)\n",
- zfcp_get_busid_by_port(port), port->d_id);
- else
- ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n",
- zfcp_get_busid_by_port(port), port->wwpn);
-
+ ZFCP_LOG_NORMAL("port erp failed on port 0x%016Lx on adapter %s\n",
+ port->wwpn, zfcp_get_busid_by_port(port));
debug_text_event(port->adapter->erp_dbf, 2, "p_pfail");
debug_event(port->adapter->erp_dbf, 2, &port->wwpn, sizeof (wwn_t));
}
!(ZFCP_STATUS_ERP_CLOSE_ONLY & erp_status));
}
+/**
+ * zfcp_erp_scsi_add_device
+ * @data: pointer to a struct zfcp_unit
+ *
+ * Registers a logical unit with the SCSI stack.
+ */
+static void
+zfcp_erp_scsi_add_device(void *data)
+{
+ struct {
+ struct zfcp_unit *unit;
+ struct work_struct work;
+ } *p;
+
+ p = data;
+ scsi_add_device(p->unit->port->adapter->scsi_host,
+ 0, p->unit->port->scsi_id, p->unit->scsi_lun);
+ atomic_set(&p->unit->scsi_add_work, 0);
+ wake_up(&p->unit->scsi_add_wq);
+ zfcp_unit_put(p->unit);
+ kfree(p);
+}
+
+/**
+ * zfcp_erp_schedule_work
+ * @unit: pointer to unit which should be registered with SCSI stack
+ *
+ * Schedules work which registers a unit with the SCSI stack
+ */
+static int
+zfcp_erp_schedule_work(struct zfcp_unit *unit)
+{
+ struct {
+ struct zfcp_unit * unit;
+ struct work_struct work;
+ } *p;
+
+ if (atomic_compare_and_swap(0, 1, &unit->scsi_add_work))
+ return 0;
+
+ if ((p = kmalloc(sizeof(*p), GFP_KERNEL)) == NULL) {
+ ZFCP_LOG_NORMAL("error: registration at SCSI stack failed for "
+ "unit 0x%016Lx on port 0x%016Lx on "
+ "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
+ zfcp_get_busid_by_unit(unit));
+ atomic_set(&unit->scsi_add_work, 0);
+ return -ENOMEM;
+ }
+
+ zfcp_unit_get(unit);
+ memset(p, 0, sizeof(*p));
+ INIT_WORK(&p->work, zfcp_erp_scsi_add_device, p);
+ p->unit = unit;
+ schedule_work(&p->work);
+ return 0;
+}
+
/*
* function:
*
static int
zfcp_erp_strategy_check_queues(struct zfcp_adapter *adapter)
{
+ int retval = 0;
unsigned long flags;
+ struct zfcp_port *nport = adapter->nameserver_port;
read_lock_irqsave(&zfcp_data.config_lock, flags);
read_lock(&adapter->erp_lock);
if (list_empty(&adapter->erp_ready_head) &&
list_empty(&adapter->erp_running_head)) {
+ if (nport
+ && atomic_test_mask(ZFCP_STATUS_COMMON_OPEN,
+ &nport->status)) {
+ debug_text_event(adapter->erp_dbf, 4, "a_cq_nspsd");
+ /* taking down nameserver port */
+ zfcp_erp_port_reopen_internal(nport,
+ ZFCP_STATUS_COMMON_RUNNING |
+ ZFCP_STATUS_COMMON_ERP_FAILED);
+ } else {
debug_text_event(adapter->erp_dbf, 4, "a_cq_wake");
atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING,
&adapter->status);
wake_up(&adapter->erp_done_wqh);
+ }
} else
debug_text_event(adapter->erp_dbf, 5, "a_cq_notempty");
read_unlock(&adapter->erp_lock);
read_unlock_irqrestore(&zfcp_data.config_lock, flags);
- return 0;
+ return retval;
}
/**
/* nameserver port may live again */
atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
&adapter->nameserver_port->status);
- if (zfcp_erp_port_reopen(adapter->nameserver_port, 0)
- >= 0) {
- erp_action->step =
- ZFCP_ERP_STEP_NAMESERVER_OPEN;
+ if (zfcp_erp_port_reopen(adapter->nameserver_port, 0) >= 0) {
+ erp_action->step = ZFCP_ERP_STEP_NAMESERVER_OPEN;
retval = ZFCP_ERP_CONTINUES;
- } else
- retval = ZFCP_ERP_FAILED;
+ } else retval = ZFCP_ERP_FAILED;
break;
}
/* else nameserver port is already open, fall through */
atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING |
ZFCP_STATUS_COMMON_CLOSING |
- ZFCP_STATUS_COMMON_ACCESS_DENIED |
ZFCP_STATUS_PORT_DID_DID |
ZFCP_STATUS_PORT_PHYS_CLOSING |
- ZFCP_STATUS_PORT_INVALID_WWPN,
- &port->status);
+ ZFCP_STATUS_PORT_INVALID_WWPN, &port->status);
return retval;
}
debug_event(adapter->erp_dbf, 5, &unit->fcp_lun, sizeof (fcp_lun_t));
atomic_clear_mask(ZFCP_STATUS_COMMON_OPENING |
- ZFCP_STATUS_COMMON_CLOSING |
- ZFCP_STATUS_COMMON_ACCESS_DENIED |
- ZFCP_STATUS_UNIT_SHARED |
- ZFCP_STATUS_UNIT_READONLY,
- &unit->status);
+ ZFCP_STATUS_COMMON_CLOSING, &unit->status);
return retval;
}
/**
* zfcp_erp_action_cleanup
*
- * Register unit with scsi stack if appropiate and fix reference counts.
- * Note: Temporary units are not registered with scsi stack.
+ * registers unit with scsi stack if appropiate and fixes reference counts
*/
+
static void
zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
struct zfcp_port *port, struct zfcp_unit *unit,
int result)
{
+ if ((action == ZFCP_ERP_ACTION_REOPEN_UNIT)
+ && (result == ZFCP_ERP_SUCCEEDED)
+ && (!unit->device)) {
+ zfcp_erp_schedule_work(unit);
+ }
switch (action) {
case ZFCP_ERP_ACTION_REOPEN_UNIT:
- if ((result == ZFCP_ERP_SUCCEEDED)
- && (!atomic_test_mask(ZFCP_STATUS_UNIT_TEMPORARY,
- &unit->status))
- && (!unit->device))
- scsi_add_device(unit->port->adapter->scsi_host, 0,
- unit->port->scsi_id, unit->scsi_lun);
zfcp_unit_put(unit);
break;
case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
list_move(&erp_action->list, &erp_action->adapter->erp_ready_head);
}
-/*
- * function: zfcp_erp_port_access_denied
- *
- * purpose:
- */
-void
-zfcp_erp_port_access_denied(struct zfcp_port *port)
-{
- struct zfcp_adapter *adapter = port->adapter;
- unsigned long flags;
-
- debug_text_event(adapter->erp_dbf, 3, "p_access_block");
- debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
- read_lock_irqsave(&zfcp_data.config_lock, flags);
- zfcp_erp_modify_port_status(port, ZFCP_STATUS_COMMON_ERP_FAILED |
- ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
- read_unlock_irqrestore(&zfcp_data.config_lock, flags);
-}
-
-/*
- * function: zfcp_erp_unit_access_denied
- *
- * purpose:
- */
-void
-zfcp_erp_unit_access_denied(struct zfcp_unit *unit)
-{
- struct zfcp_adapter *adapter = unit->port->adapter;
-
- debug_text_event(adapter->erp_dbf, 3, "u_access_block");
- debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
- zfcp_erp_modify_unit_status(unit, ZFCP_STATUS_COMMON_ERP_FAILED |
- ZFCP_STATUS_COMMON_ACCESS_DENIED, ZFCP_SET);
-}
-
-/*
- * function: zfcp_erp_adapter_access_changed
- *
- * purpose:
- */
-void
-zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter)
-{
- struct zfcp_port *port;
- unsigned long flags;
-
- debug_text_event(adapter->erp_dbf, 3, "a_access_unblock");
- debug_event(adapter->erp_dbf, 3, &adapter->name, 8);
-
- zfcp_erp_port_access_changed(adapter->nameserver_port);
- read_lock_irqsave(&zfcp_data.config_lock, flags);
- list_for_each_entry(port, &adapter->port_list_head, list)
- if (port != adapter->nameserver_port)
- zfcp_erp_port_access_changed(port);
- read_unlock_irqrestore(&zfcp_data.config_lock, flags);
-}
-
-/*
- * function: zfcp_erp_port_access_changed
- *
- * purpose:
- */
-void
-zfcp_erp_port_access_changed(struct zfcp_port *port)
-{
- struct zfcp_adapter *adapter = port->adapter;
- struct zfcp_unit *unit;
-
- debug_text_event(adapter->erp_dbf, 3, "p_access_unblock");
- debug_event(adapter->erp_dbf, 3, &port->wwpn, sizeof(wwn_t));
-
- if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
- &port->status)) {
- if (!atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
- list_for_each_entry(unit, &port->unit_list_head, list)
- zfcp_erp_unit_access_changed(unit);
- return;
- }
-
- ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s "
- "(due to ACT update)\n",
- port->wwpn, zfcp_get_busid_by_adapter(adapter));
- if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
- ZFCP_LOG_NORMAL("failed reopen of port"
- "(adapter %s, wwpn=0x%016Lx)\n",
- zfcp_get_busid_by_adapter(adapter), port->wwpn);
-}
-
-/*
- * function: zfcp_erp_unit_access_changed
- *
- * purpose:
- */
-void
-zfcp_erp_unit_access_changed(struct zfcp_unit *unit)
-{
- struct zfcp_adapter *adapter = unit->port->adapter;
-
- debug_text_event(adapter->erp_dbf, 3, "u_access_unblock");
- debug_event(adapter->erp_dbf, 3, &unit->fcp_lun, sizeof(fcp_lun_t));
-
- if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, &unit->status))
- return;
-
- ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx "
- " on adapter %s (due to ACT update)\n",
- unit->fcp_lun, unit->port->wwpn,
- zfcp_get_busid_by_adapter(adapter));
- if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED) != 0)
- ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
- "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
- zfcp_get_busid_by_adapter(adapter),
- unit->port->wwpn, unit->fcp_lun);
-}
-
#undef ZFCP_LOG_AREA