Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13e1e1f0 authored by Andreas Herrmann's avatar Andreas Herrmann Committed by James Bottomley
Browse files

[SCSI] zfcp: add additional fc_host attributes



this patch adds some fc host attributes and removes its equivalents
from the zfcp_adapter structure and zfcp specific sysfs subtree.

Furthermore it removes superfluous calls to fc_remort_port_delete when
an adapter is set offline because rports will be removed by
fc_remove_host anyway.

Signed-off-by: default avatarAndreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent aef4a983
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -202,19 +202,9 @@ static int
zfcp_ccw_set_offline(struct ccw_device *ccw_device)
{
	struct zfcp_adapter *adapter;
	struct zfcp_port *port;
	struct fc_rport *rport;

	down(&zfcp_data.config_sema);
	adapter = dev_get_drvdata(&ccw_device->dev);
	/* might be racy, but we cannot take config_lock due to the fact that
	   fc_remote_port_delete might sleep */
	list_for_each_entry(port, &adapter->port_list_head, list)
		if (port->rport) {
			rport = port->rport;
			port->rport = NULL;
			fc_remote_port_delete(rport);
		}
	zfcp_erp_adapter_shutdown(adapter, 0);
	zfcp_erp_wait(adapter);
	zfcp_adapter_scsi_unregister(adapter);
+15 −17
Original line number Diff line number Diff line
@@ -486,8 +486,7 @@ struct debug_view zfcp_hba_dbf_view = {

inline void
_zfcp_san_dbf_event_common_ct(const char *tag, struct zfcp_fsf_req *fsf_req,
			      fc_id_t s_id, fc_id_t d_id,
			      void *buffer, int buflen)
			      u32 s_id, u32 d_id, void *buffer, int buflen)
{
	struct zfcp_send_ct *send_ct = (struct zfcp_send_ct *)fsf_req->data;
	struct zfcp_port *port = send_ct->port;
@@ -532,9 +531,9 @@ inline void zfcp_san_dbf_event_ct_request(struct zfcp_fsf_req *fsf_req)
	struct zfcp_port *port = ct->port;
	struct zfcp_adapter *adapter = port->adapter;

	_zfcp_san_dbf_event_common_ct("octc",
				      fsf_req, adapter->s_id, port->d_id,
				      zfcp_sg_to_address(ct->req),
	_zfcp_san_dbf_event_common_ct("octc", fsf_req,
				      fc_host_port_id(adapter->scsi_host),
				      port->d_id, zfcp_sg_to_address(ct->req),
				      ct->req->length);
}

@@ -544,17 +543,16 @@ inline void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
	struct zfcp_port *port = ct->port;
	struct zfcp_adapter *adapter = port->adapter;

	_zfcp_san_dbf_event_common_ct("rctc",
				      fsf_req, port->d_id, adapter->s_id,
	_zfcp_san_dbf_event_common_ct("rctc", fsf_req, port->d_id,
				      fc_host_port_id(adapter->scsi_host),
				      zfcp_sg_to_address(ct->resp),
				      ct->resp->length);
}

static inline void
_zfcp_san_dbf_event_common_els(const char *tag, int level,
			       struct zfcp_fsf_req *fsf_req,
			       fc_id_t s_id, fc_id_t d_id, u8 ls_code,
			       void *buffer, int buflen)
			       struct zfcp_fsf_req *fsf_req, u32 s_id,
			       u32 d_id, u8 ls_code, void *buffer, int buflen)
{
	struct zfcp_adapter *adapter = fsf_req->adapter;
	struct zfcp_san_dbf_record *rec = &adapter->san_dbf_buf;
@@ -597,8 +595,9 @@ inline void zfcp_san_dbf_event_els_request(struct zfcp_fsf_req *fsf_req)
{
	struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data;

	_zfcp_san_dbf_event_common_els("oels", 2,
				       fsf_req, els->adapter->s_id, els->d_id,
	_zfcp_san_dbf_event_common_els("oels", 2, fsf_req,
				       fc_host_port_id(els->adapter->scsi_host),
				       els->d_id,
				       *(u8 *) zfcp_sg_to_address(els->req),
				       zfcp_sg_to_address(els->req),
				       els->req->length);
@@ -608,8 +607,8 @@ inline void zfcp_san_dbf_event_els_response(struct zfcp_fsf_req *fsf_req)
{
	struct zfcp_send_els *els = (struct zfcp_send_els *)fsf_req->data;

	_zfcp_san_dbf_event_common_els("rels", 2,
				       fsf_req, els->d_id, els->adapter->s_id,
	_zfcp_san_dbf_event_common_els("rels", 2, fsf_req, els->d_id,
				       fc_host_port_id(els->adapter->scsi_host),
				       *(u8 *) zfcp_sg_to_address(els->req),
				       zfcp_sg_to_address(els->resp),
				       els->resp->length);
@@ -623,9 +622,8 @@ inline void zfcp_san_dbf_event_incoming_els(struct zfcp_fsf_req *fsf_req)
	int length = (int)status_buffer->length -
	    (int)((void *)&status_buffer->payload - (void *)status_buffer);

	_zfcp_san_dbf_event_common_els("iels", 1,
				       fsf_req, status_buffer->d_id,
				       adapter->s_id,
	_zfcp_san_dbf_event_common_els("iels", 1, fsf_req, status_buffer->d_id,
				       fc_host_port_id(adapter->scsi_host),
				       *(u8 *) status_buffer->payload,
				       (void *)status_buffer->payload, length);
}
+5 −11
Original line number Diff line number Diff line
@@ -165,7 +165,6 @@ typedef u32 scsi_lun_t;
/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/

typedef unsigned long long wwn_t;
typedef unsigned int       fc_id_t;
typedef unsigned long long fcp_lun_t;
/* data length field may be at variable position in FCP-2 FCP_CMND IU */
typedef unsigned int       fcp_dl_t;
@@ -806,7 +805,7 @@ struct ct_iu_gid_pn_req {
/* FS_ACC IU and data unit for GID_PN nameserver request */
struct ct_iu_gid_pn_resp {
	struct ct_hdr header;
	fc_id_t d_id;
	u32 d_id;
} __attribute__ ((packed));

typedef void (*zfcp_send_ct_handler_t)(unsigned long);
@@ -872,7 +871,7 @@ typedef void (*zfcp_send_els_handler_t)(unsigned long);
struct zfcp_send_els {
	struct zfcp_adapter *adapter;
	struct zfcp_port *port;
	fc_id_t d_id;
	u32 d_id;
	struct scatterlist *req;
	struct scatterlist *resp;
	unsigned int req_count;
@@ -915,24 +914,19 @@ struct zfcp_adapter {
	atomic_t                refcount;          /* reference count */
	wait_queue_head_t	remove_wq;         /* can be used to wait for
						      refcount drop to zero */
	wwn_t			wwnn;	           /* WWNN */
	wwn_t			wwpn;	           /* WWPN */
	fc_id_t			s_id;	           /* N_Port ID */
	wwn_t			peer_wwnn;	   /* P2P peer WWNN */
	wwn_t			peer_wwpn;	   /* P2P peer WWPN */
	fc_id_t			peer_d_id;	   /* P2P peer D_ID */
	u32			peer_d_id;	   /* P2P peer D_ID */
	wwn_t			physical_wwpn;     /* WWPN of physical port */
	fc_id_t			physical_s_id;     /* local FC port ID */
	u32			physical_s_id;     /* local FC port ID */
	struct ccw_device       *ccw_device;	   /* S/390 ccw device */
	u8			fc_service_class;
	u32			fc_topology;	   /* FC topology */
	u32			fc_link_speed;	   /* FC interface speed */
	u32			hydra_version;	   /* Hydra version */
	u32			fsf_lic_version;
	u32			adapter_features;  /* FCP channel features */
	u32			connection_features; /* host connection features */
        u32			hardware_version;  /* of FCP channel */
        u8			serial_number[32]; /* of hardware */
	struct Scsi_Host	*scsi_host;	   /* Pointer to mid-layer */
	unsigned short          scsi_host_no;      /* Assigned host number */
	unsigned char		name[9];
@@ -1006,7 +1000,7 @@ struct zfcp_port {
	atomic_t	       status;	       /* status of this remote port */
	wwn_t		       wwnn;	       /* WWNN if known */
	wwn_t		       wwpn;	       /* WWPN */
	fc_id_t		       d_id;	       /* D_ID */
	u32		       d_id;	       /* D_ID */
	u32		       handle;	       /* handle assigned by FSF */
	struct zfcp_erp_action erp_action;     /* pending error recovery */
        atomic_t               erp_counter;
+8 −8
Original line number Diff line number Diff line
@@ -346,13 +346,13 @@ zfcp_erp_adisc(struct zfcp_port *port)

	/* 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;
	adisc->wwpn = fc_host_port_name(adapter->scsi_host);
	adisc->wwnn = fc_host_node_name(adapter->scsi_host);
	adisc->nport_id = fc_host_port_id(adapter->scsi_host);
	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, send_els->d_id, (wwn_t) adisc->wwpn,
		      adisc->nport_id, send_els->d_id, (wwn_t) adisc->wwpn,
		      (wwn_t) adisc->wwnn, adisc->hard_nport_id,
		      adisc->nport_id);

@@ -405,7 +405,7 @@ zfcp_erp_adisc_handler(unsigned long data)
	struct zfcp_send_els *send_els;
	struct zfcp_port *port;
	struct zfcp_adapter *adapter;
	fc_id_t d_id;
	u32 d_id;
	struct zfcp_ls_adisc_acc *adisc;

	send_els = (struct zfcp_send_els *) data;
@@ -436,9 +436,9 @@ zfcp_erp_adisc_handler(unsigned long data)
	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);
		      d_id, fc_host_port_id(adapter->scsi_host),
		      (wwn_t) adisc->wwpn, (wwn_t) adisc->wwnn,
		      adisc->hard_nport_id, adisc->nport_id);

	/* set wwnn for port */
	if (port->wwnn == 0)
+35 −30
Original line number Diff line number Diff line
@@ -1617,7 +1617,7 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
{
	volatile struct qdio_buffer_element *sbale;
	struct zfcp_fsf_req *fsf_req;
	fc_id_t d_id;
	u32 d_id;
	struct zfcp_adapter *adapter;
	unsigned long lock_flags;
        int bytes;
@@ -1740,7 +1740,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
{
	struct zfcp_adapter *adapter;
	struct zfcp_port *port;
	fc_id_t d_id;
	u32 d_id;
	struct fsf_qtcb_header *header;
	struct fsf_qtcb_bottom_support *bottom;
	struct zfcp_send_els *send_els;
@@ -1978,6 +1978,7 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
{
	struct fsf_qtcb_bottom_config *bottom;
	struct zfcp_adapter *adapter = fsf_req->adapter;
	struct Scsi_Host *shost = adapter->scsi_host;

	bottom = &fsf_req->qtcb->bottom.config;
	ZFCP_LOG_DEBUG("low/high QTCB version 0x%x/0x%x of FSF\n",
@@ -1990,22 +1991,23 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
	adapter->peer_d_id = 0;

	if (xchg_ok) {
		adapter->wwnn = bottom->nport_serv_param.wwnn;
		adapter->wwpn = bottom->nport_serv_param.wwpn;
		adapter->s_id = bottom->s_id & ZFCP_DID_MASK;
		fc_host_node_name(shost) = bottom->nport_serv_param.wwnn;
		fc_host_port_name(shost) = bottom->nport_serv_param.wwpn;
		fc_host_port_id(shost) = bottom->s_id & ZFCP_DID_MASK;
		fc_host_speed(shost) = bottom->fc_link_speed;
		fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
		adapter->fc_topology = bottom->fc_topology;
		adapter->fc_link_speed = bottom->fc_link_speed;
		adapter->hydra_version = bottom->adapter_type;
		if (adapter->physical_wwpn == 0)
			adapter->physical_wwpn = adapter->wwpn;
			adapter->physical_wwpn = fc_host_port_name(shost);
		if (adapter->physical_s_id == 0)
			adapter->physical_s_id = adapter->s_id;
			adapter->physical_s_id = fc_host_port_id(shost);
	} else {
		adapter->wwnn = 0;
		adapter->wwpn = 0;
		adapter->s_id = 0;
		fc_host_node_name(shost) = 0;
		fc_host_port_name(shost) = 0;
		fc_host_port_id(shost) = 0;
		fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
		adapter->fc_topology = 0;
		adapter->fc_link_speed = 0;
		adapter->hydra_version = 0;
	}

@@ -2017,8 +2019,10 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)

	if (adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT) {
		adapter->hardware_version = bottom->hardware_version;
		memcpy(adapter->serial_number, bottom->serial_number, 17);
		EBCASC(adapter->serial_number, sizeof(adapter->serial_number));
		memcpy(fc_host_serial_number(shost), bottom->serial_number,
		       min(FC_SERIAL_NUMBER_SIZE, 17));
		EBCASC(fc_host_serial_number(shost),
		       min(FC_SERIAL_NUMBER_SIZE, 17));
	}

	ZFCP_LOG_NORMAL("The adapter %s reported the following characteristics:\n"
@@ -2029,12 +2033,12 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
			"LIC version 0x%x, "
			"FC link speed %d Gb/s\n",
			zfcp_get_busid_by_adapter(adapter),
		      adapter->wwnn,
		      adapter->wwpn,
		      (unsigned int) adapter->s_id,
			(wwn_t) fc_host_node_name(shost),
			(wwn_t) fc_host_port_name(shost),
			fc_host_port_id(shost),
			adapter->hydra_version,
			adapter->fsf_lic_version,
		      adapter->fc_link_speed);
			fc_host_speed(shost));
	if (ZFCP_QTCB_VERSION < bottom->low_qtcb_version) {
		ZFCP_LOG_NORMAL("error: the adapter %s "
				"only supports newer control block "
@@ -2055,7 +2059,6 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
		zfcp_erp_adapter_shutdown(adapter, 0);
		return -EIO;
	}
	zfcp_set_fc_host_attrs(adapter);
	return 0;
}

@@ -2259,6 +2262,7 @@ static void
zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req)
{
	struct zfcp_adapter *adapter = fsf_req->adapter;
	struct Scsi_Host *shost = adapter->scsi_host;
	struct fsf_qtcb *qtcb = fsf_req->qtcb;
	struct fsf_qtcb_bottom_port *bottom, *data;

@@ -2277,9 +2281,10 @@ zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *fsf_req)
			adapter->physical_wwpn = bottom->wwpn;
			adapter->physical_s_id = bottom->fc_port_id;
		} else {
			adapter->physical_wwpn = adapter->wwpn;
			adapter->physical_s_id = adapter->s_id;
			adapter->physical_wwpn = fc_host_port_name(shost);
			adapter->physical_s_id = fc_host_port_id(shost);
		}
		fc_host_maxframe_size(shost) = bottom->maximum_frame_size;
		break;

	case FSF_EXCHANGE_CONFIG_DATA_INCOMPLETE:
Loading