Пример #1
0
/**
 * zfcp_qdio_reqid_check - checks for valid reqids.
 */
static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter,
				  unsigned long req_id)
{
	struct zfcp_fsf_req *fsf_req;
	unsigned long flags;

	debug_long_event(adapter->erp_dbf, 4, req_id);

	spin_lock_irqsave(&adapter->req_list_lock, flags);
	fsf_req = zfcp_reqlist_find(adapter, req_id);

	if (!fsf_req)
		/*
		 * Unknown request means that we have potentially memory
		 * corruption and must stop the machine immediatly.
		 */
		panic("error: unknown request id (%ld) on adapter %s.\n",
		      req_id, zfcp_get_busid_by_adapter(adapter));

	zfcp_reqlist_remove(adapter, fsf_req);
	atomic_dec(&adapter->reqs_active);
	spin_unlock_irqrestore(&adapter->req_list_lock, flags);

	/* finish the FSF request */
	zfcp_fsf_req_complete(fsf_req);
}
Пример #2
0
/**
 * zfcp_qdio_reqid_check - checks for valid reqids or unsolicited status
 */
static int zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, 
				 unsigned long req_id)
{
	struct zfcp_fsf_req *fsf_req;
	unsigned long flags;

	debug_long_event(adapter->erp_dbf, 4, req_id);

	spin_lock_irqsave(&adapter->req_list_lock, flags);
	fsf_req = zfcp_reqlist_ismember(adapter, req_id);

	if (!fsf_req) {
		spin_unlock_irqrestore(&adapter->req_list_lock, flags);
		ZFCP_LOG_NORMAL("error: unknown request id (%ld).\n", req_id);
		zfcp_erp_adapter_reopen(adapter, 0);
		return -EINVAL;
	}

	zfcp_reqlist_remove(adapter, req_id);
	atomic_dec(&adapter->reqs_active);
	spin_unlock_irqrestore(&adapter->req_list_lock, flags);

	/* finish the FSF request */
	zfcp_fsf_req_complete(fsf_req);

	return 0;
}
Пример #3
0
/*
 * function:	zfcp_qdio_reqid_check
 *
 * purpose:	checks for valid reqids or unsolicited status
 *
 * returns:	0 - valid request id or unsolicited status
 *		!0 - otherwise
 */
int
zfcp_qdio_reqid_check(struct zfcp_adapter *adapter, void *sbale_addr)
{
	struct zfcp_fsf_req *fsf_req;
	int retval = 0;

	/* invalid (per convention used in this driver) */
	if (unlikely(!sbale_addr)) {
		ZFCP_LOG_NORMAL("bug: invalid reqid\n");
		retval = -EINVAL;
		goto out;
	}

	/* valid request id and thus (hopefully :) valid fsf_req address */
	fsf_req = (struct zfcp_fsf_req *) sbale_addr;

	if (unlikely(adapter != fsf_req->adapter)) {
		ZFCP_LOG_NORMAL("bug: invalid reqid (fsf_req=%p, "
				"fsf_req->adapter=%p, adapter=%p)\n",
				fsf_req, fsf_req->adapter, adapter);
		retval = -EINVAL;
		goto out;
	}

	ZFCP_LOG_TRACE("fsf_req at %p, QTCB at %p\n", fsf_req, fsf_req->qtcb);
	if (likely(fsf_req->qtcb)) {
		ZFCP_LOG_TRACE("hex dump of QTCB:\n");
		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, (char *) fsf_req->qtcb,
			      sizeof(struct fsf_qtcb));
	}

	/* finish the FSF request */
	zfcp_fsf_req_complete(fsf_req);
 out:
	return retval;
}
Пример #4
0
static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter,
				  unsigned long req_id, int sbal_idx)
{
	struct zfcp_fsf_req *fsf_req;
	unsigned long flags;

	spin_lock_irqsave(&adapter->req_list_lock, flags);
	fsf_req = zfcp_reqlist_find(adapter, req_id);

	if (!fsf_req)
		/*
		 * Unknown request means that we have potentially memory
		 * corruption and must stop the machine immediatly.
		 */
		panic("error: unknown request id (%lx) on adapter %s.\n",
		      req_id, zfcp_get_busid_by_adapter(adapter));

	zfcp_reqlist_remove(adapter, fsf_req);
	spin_unlock_irqrestore(&adapter->req_list_lock, flags);

	fsf_req->sbal_response = sbal_idx;
	fsf_req->qdio_inb_usage = atomic_read(&adapter->resp_q.count);
	zfcp_fsf_req_complete(fsf_req);
}