Commit 75bfc283 authored by Ralph Wuerthner's avatar Ralph Wuerthner Committed by James Bottomley

[SCSI] zfcp: evaluate plogi payload to set maxframe_size, supported_classes of rports

Signed-off-by: default avatarRalph Wuerthner <rwuerthn@de.ibm.com>
Signed-off-by: default avatarAndreas Herrmann <aherrman@de.ibm.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b7a52fa7
...@@ -1748,4 +1748,25 @@ zfcp_handle_els_rjt(u32 sq, struct zfcp_ls_rjt_par *rjt_par) ...@@ -1748,4 +1748,25 @@ zfcp_handle_els_rjt(u32 sq, struct zfcp_ls_rjt_par *rjt_par)
return ret; return ret;
} }
/**
* zfcp_plogi_evaluate - evaluate PLOGI playload and copy important fields
* into zfcp_port structure
* @port: zfcp_port structure
* @plogi: plogi payload
*/
void
zfcp_plogi_evaluate(struct zfcp_port *port, struct fsf_plogi *plogi)
{
port->maxframe_size = plogi->serv_param.common_serv_param[7] |
((plogi->serv_param.common_serv_param[6] & 0x0F) << 8);
if (plogi->serv_param.class1_serv_param[0] & 0x80)
port->supported_classes |= FC_COS_CLASS1;
if (plogi->serv_param.class2_serv_param[0] & 0x80)
port->supported_classes |= FC_COS_CLASS2;
if (plogi->serv_param.class3_serv_param[0] & 0x80)
port->supported_classes |= FC_COS_CLASS3;
if (plogi->serv_param.class4_serv_param[0] & 0x80)
port->supported_classes |= FC_COS_CLASS4;
}
#undef ZFCP_LOG_AREA #undef ZFCP_LOG_AREA
...@@ -959,6 +959,8 @@ struct zfcp_port { ...@@ -959,6 +959,8 @@ struct zfcp_port {
u32 handle; /* handle assigned by FSF */ u32 handle; /* handle assigned by FSF */
struct zfcp_erp_action erp_action; /* pending error recovery */ struct zfcp_erp_action erp_action; /* pending error recovery */
atomic_t erp_counter; atomic_t erp_counter;
u32 maxframe_size;
u32 supported_classes;
}; };
/* the struct device sysfs_device must be at the beginning of this structure. /* the struct device sysfs_device must be at the beginning of this structure.
......
...@@ -3257,8 +3257,12 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter, ...@@ -3257,8 +3257,12 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
"(adapter %s, wwpn=0x%016Lx)\n", "(adapter %s, wwpn=0x%016Lx)\n",
zfcp_get_busid_by_port(port), zfcp_get_busid_by_port(port),
port->wwpn); port->wwpn);
else else {
scsi_flush_work(adapter->scsi_host); scsi_flush_work(adapter->scsi_host);
port->rport->maxframe_size = port->maxframe_size;
port->rport->supported_classes =
port->supported_classes;
}
} }
zfcp_port_put(port); zfcp_port_put(port);
break; break;
......
...@@ -115,6 +115,7 @@ extern int zfcp_nameserver_enqueue(struct zfcp_adapter *); ...@@ -115,6 +115,7 @@ extern int zfcp_nameserver_enqueue(struct zfcp_adapter *);
extern int zfcp_ns_gid_pn_request(struct zfcp_erp_action *); extern int zfcp_ns_gid_pn_request(struct zfcp_erp_action *);
extern int zfcp_check_ct_response(struct ct_hdr *); extern int zfcp_check_ct_response(struct ct_hdr *);
extern int zfcp_handle_els_rjt(u32, struct zfcp_ls_rjt_par *); extern int zfcp_handle_els_rjt(u32, struct zfcp_ls_rjt_par *);
extern void zfcp_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
/******************************* SCSI ****************************************/ /******************************* SCSI ****************************************/
extern int zfcp_adapter_scsi_register(struct zfcp_adapter *); extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);
......
...@@ -2560,8 +2560,7 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) ...@@ -2560,8 +2560,7 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
if (!atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN, &port->status)) if (!atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN, &port->status))
{ {
if (fsf_req->qtcb->bottom.support.els1_length < if (fsf_req->qtcb->bottom.support.els1_length <
((((unsigned long) &plogi->serv_param.wwpn) - sizeof (struct fsf_plogi)) {
((unsigned long) plogi)) + sizeof (u64))) {
ZFCP_LOG_INFO( ZFCP_LOG_INFO(
"warning: insufficient length of " "warning: insufficient length of "
"PLOGI payload (%i)\n", "PLOGI payload (%i)\n",
...@@ -2580,8 +2579,10 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req) ...@@ -2580,8 +2579,10 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
atomic_clear_mask( atomic_clear_mask(
ZFCP_STATUS_PORT_DID_DID, ZFCP_STATUS_PORT_DID_DID,
&port->status); &port->status);
} else } else {
port->wwnn = plogi->serv_param.wwnn; port->wwnn = plogi->serv_param.wwnn;
zfcp_plogi_evaluate(port, plogi);
}
} }
} }
break; break;
......
...@@ -805,6 +805,7 @@ struct fc_function_template zfcp_transport_functions = { ...@@ -805,6 +805,7 @@ struct fc_function_template zfcp_transport_functions = {
.show_starget_port_name = 1, .show_starget_port_name = 1,
.show_starget_node_name = 1, .show_starget_node_name = 1,
.show_rport_supported_classes = 1, .show_rport_supported_classes = 1,
.show_rport_maxframe_size = 1,
.show_host_node_name = 1, .show_host_node_name = 1,
.show_host_port_name = 1, .show_host_port_name = 1,
.show_host_permanent_port_name = 1, .show_host_permanent_port_name = 1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment