Skip to content

Commit 75bfc28

Browse files
Ralph WuerthnerJames Bottomley
authored andcommitted
[SCSI] zfcp: evaluate plogi payload to set maxframe_size, supported_classes of rports
Signed-off-by: Ralph Wuerthner <rwuerthn@de.ibm.com> Signed-off-by: Andreas Herrmann <aherrman@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent b7a52fa commit 75bfc28

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

drivers/s390/scsi/zfcp_aux.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1748,4 +1748,25 @@ zfcp_handle_els_rjt(u32 sq, struct zfcp_ls_rjt_par *rjt_par)
17481748
return ret;
17491749
}
17501750

1751+
/**
1752+
* zfcp_plogi_evaluate - evaluate PLOGI playload and copy important fields
1753+
* into zfcp_port structure
1754+
* @port: zfcp_port structure
1755+
* @plogi: plogi payload
1756+
*/
1757+
void
1758+
zfcp_plogi_evaluate(struct zfcp_port *port, struct fsf_plogi *plogi)
1759+
{
1760+
port->maxframe_size = plogi->serv_param.common_serv_param[7] |
1761+
((plogi->serv_param.common_serv_param[6] & 0x0F) << 8);
1762+
if (plogi->serv_param.class1_serv_param[0] & 0x80)
1763+
port->supported_classes |= FC_COS_CLASS1;
1764+
if (plogi->serv_param.class2_serv_param[0] & 0x80)
1765+
port->supported_classes |= FC_COS_CLASS2;
1766+
if (plogi->serv_param.class3_serv_param[0] & 0x80)
1767+
port->supported_classes |= FC_COS_CLASS3;
1768+
if (plogi->serv_param.class4_serv_param[0] & 0x80)
1769+
port->supported_classes |= FC_COS_CLASS4;
1770+
}
1771+
17511772
#undef ZFCP_LOG_AREA

drivers/s390/scsi/zfcp_def.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,8 @@ struct zfcp_port {
959959
u32 handle; /* handle assigned by FSF */
960960
struct zfcp_erp_action erp_action; /* pending error recovery */
961961
atomic_t erp_counter;
962+
u32 maxframe_size;
963+
u32 supported_classes;
962964
};
963965

964966
/* the struct device sysfs_device must be at the beginning of this structure.

drivers/s390/scsi/zfcp_erp.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3257,8 +3257,12 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
32573257
"(adapter %s, wwpn=0x%016Lx)\n",
32583258
zfcp_get_busid_by_port(port),
32593259
port->wwpn);
3260-
else
3260+
else {
32613261
scsi_flush_work(adapter->scsi_host);
3262+
port->rport->maxframe_size = port->maxframe_size;
3263+
port->rport->supported_classes =
3264+
port->supported_classes;
3265+
}
32623266
}
32633267
zfcp_port_put(port);
32643268
break;

drivers/s390/scsi/zfcp_ext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ extern int zfcp_nameserver_enqueue(struct zfcp_adapter *);
115115
extern int zfcp_ns_gid_pn_request(struct zfcp_erp_action *);
116116
extern int zfcp_check_ct_response(struct ct_hdr *);
117117
extern int zfcp_handle_els_rjt(u32, struct zfcp_ls_rjt_par *);
118+
extern void zfcp_plogi_evaluate(struct zfcp_port *, struct fsf_plogi *);
118119

119120
/******************************* SCSI ****************************************/
120121
extern int zfcp_adapter_scsi_register(struct zfcp_adapter *);

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2560,8 +2560,7 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
25602560
if (!atomic_test_mask(ZFCP_STATUS_PORT_NO_WWPN, &port->status))
25612561
{
25622562
if (fsf_req->qtcb->bottom.support.els1_length <
2563-
((((unsigned long) &plogi->serv_param.wwpn) -
2564-
((unsigned long) plogi)) + sizeof (u64))) {
2563+
sizeof (struct fsf_plogi)) {
25652564
ZFCP_LOG_INFO(
25662565
"warning: insufficient length of "
25672566
"PLOGI payload (%i)\n",
@@ -2580,8 +2579,10 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
25802579
atomic_clear_mask(
25812580
ZFCP_STATUS_PORT_DID_DID,
25822581
&port->status);
2583-
} else
2582+
} else {
25842583
port->wwnn = plogi->serv_param.wwnn;
2584+
zfcp_plogi_evaluate(port, plogi);
2585+
}
25852586
}
25862587
}
25872588
break;

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,7 @@ struct fc_function_template zfcp_transport_functions = {
805805
.show_starget_port_name = 1,
806806
.show_starget_node_name = 1,
807807
.show_rport_supported_classes = 1,
808+
.show_rport_maxframe_size = 1,
808809
.show_host_node_name = 1,
809810
.show_host_port_name = 1,
810811
.show_host_permanent_port_name = 1,

0 commit comments

Comments
 (0)