Commit 800c0cad962dcf630cabf3efdc5983619e73d4c9
Committed by
James Bottomley
1 parent
bd0072ecc4
Exists in
master
and in
20 other branches
[SCSI] zfcp: Remove ZFCP_DID_MASK
Instead of assigning 4 bytes with the highest byte masked out, use a 3 byte array with the ntoh24 and h24ton helper functions, thus eliminating the need for the ZFCP_DID_MASK. Reviewed-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Showing 4 changed files with 17 additions and 18 deletions Side-by-side Diff
drivers/s390/scsi/zfcp_dbf.c
... | ... | @@ -178,7 +178,7 @@ |
178 | 178 | |
179 | 179 | case FSF_QTCB_SEND_ELS: |
180 | 180 | send_els = (struct zfcp_send_els *)fsf_req->data; |
181 | - response->u.els.d_id = qtcb->bottom.support.d_id; | |
181 | + response->u.els.d_id = ntoh24(qtcb->bottom.support.d_id); | |
182 | 182 | response->u.els.ls_code = send_els->ls_code >> 24; |
183 | 183 | break; |
184 | 184 | |
... | ... | @@ -812,7 +812,7 @@ |
812 | 812 | int length = (int)buf->length - |
813 | 813 | (int)((void *)&buf->payload - (void *)buf); |
814 | 814 | |
815 | - zfcp_dbf_san_els("iels", 1, fsf_req, buf->d_id, | |
815 | + zfcp_dbf_san_els("iels", 1, fsf_req, ntoh24(buf->d_id), | |
816 | 816 | fc_host_port_id(adapter->scsi_host), |
817 | 817 | buf->payload.data[0], (void *)buf->payload.data, |
818 | 818 | length); |
drivers/s390/scsi/zfcp_def.h
... | ... | @@ -71,10 +71,6 @@ |
71 | 71 | /* timeout value for "default timer" for fsf requests */ |
72 | 72 | #define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ) |
73 | 73 | |
74 | -/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/ | |
75 | - | |
76 | -#define ZFCP_DID_MASK 0x00FFFFFF | |
77 | - | |
78 | 74 | /*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ |
79 | 75 | |
80 | 76 | /* |
drivers/s390/scsi/zfcp_fsf.c
... | ... | @@ -128,7 +128,7 @@ |
128 | 128 | struct fsf_status_read_buffer *sr_buf = req->data; |
129 | 129 | struct zfcp_adapter *adapter = req->adapter; |
130 | 130 | struct zfcp_port *port; |
131 | - int d_id = sr_buf->d_id & ZFCP_DID_MASK; | |
131 | + int d_id = ntoh24(sr_buf->d_id); | |
132 | 132 | |
133 | 133 | read_lock_irqsave(&adapter->port_list_lock, flags); |
134 | 134 | list_for_each_entry(port, &adapter->port_list, list) |
... | ... | @@ -494,7 +494,7 @@ |
494 | 494 | |
495 | 495 | fc_host_port_name(shost) = nsp->fl_wwpn; |
496 | 496 | fc_host_node_name(shost) = nsp->fl_wwnn; |
497 | - fc_host_port_id(shost) = bottom->s_id & ZFCP_DID_MASK; | |
497 | + fc_host_port_id(shost) = ntoh24(bottom->s_id); | |
498 | 498 | fc_host_speed(shost) = bottom->fc_link_speed; |
499 | 499 | fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3; |
500 | 500 | |
... | ... | @@ -506,7 +506,7 @@ |
506 | 506 | |
507 | 507 | switch (bottom->fc_topology) { |
508 | 508 | case FSF_TOPO_P2P: |
509 | - adapter->peer_d_id = bottom->peer_d_id & ZFCP_DID_MASK; | |
509 | + adapter->peer_d_id = ntoh24(bottom->peer_d_id); | |
510 | 510 | adapter->peer_wwpn = plogi->fl_wwpn; |
511 | 511 | adapter->peer_wwnn = plogi->fl_wwnn; |
512 | 512 | fc_host_port_type(shost) = FC_PORTTYPE_PTP; |
... | ... | @@ -1216,7 +1216,7 @@ |
1216 | 1216 | if (ret) |
1217 | 1217 | goto failed_send; |
1218 | 1218 | |
1219 | - req->qtcb->bottom.support.d_id = els->d_id; | |
1219 | + hton24(req->qtcb->bottom.support.d_id, els->d_id); | |
1220 | 1220 | req->handler = zfcp_fsf_send_els_handler; |
1221 | 1221 | req->data = els; |
1222 | 1222 | |
... | ... | @@ -1522,7 +1522,7 @@ |
1522 | 1522 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1523 | 1523 | |
1524 | 1524 | req->handler = zfcp_fsf_open_port_handler; |
1525 | - req->qtcb->bottom.support.d_id = port->d_id; | |
1525 | + hton24(req->qtcb->bottom.support.d_id, port->d_id); | |
1526 | 1526 | req->data = port; |
1527 | 1527 | req->erp_action = erp_action; |
1528 | 1528 | erp_action->fsf_req = req; |
... | ... | @@ -1669,7 +1669,7 @@ |
1669 | 1669 | sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY; |
1670 | 1670 | |
1671 | 1671 | req->handler = zfcp_fsf_open_wka_port_handler; |
1672 | - req->qtcb->bottom.support.d_id = wka_port->d_id; | |
1672 | + hton24(req->qtcb->bottom.support.d_id, wka_port->d_id); | |
1673 | 1673 | req->data = wka_port; |
1674 | 1674 | |
1675 | 1675 | zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); |
drivers/s390/scsi/zfcp_fsf.h
... | ... | @@ -11,6 +11,7 @@ |
11 | 11 | |
12 | 12 | #include <linux/pfn.h> |
13 | 13 | #include <linux/scatterlist.h> |
14 | +#include <scsi/libfc.h> | |
14 | 15 | |
15 | 16 | #define FSF_QTCB_CURRENT_VERSION 0x00000001 |
16 | 17 | |
... | ... | @@ -228,7 +229,8 @@ |
228 | 229 | u32 length; |
229 | 230 | u32 res1; |
230 | 231 | struct fsf_queue_designator queue_designator; |
231 | - u32 d_id; | |
232 | + u8 res2; | |
233 | + u8 d_id[3]; | |
232 | 234 | u32 class; |
233 | 235 | u64 fcp_lun; |
234 | 236 | u8 res3[24]; |
... | ... | @@ -327,8 +329,8 @@ |
327 | 329 | |
328 | 330 | struct fsf_qtcb_bottom_support { |
329 | 331 | u32 operation_subtype; |
330 | - u8 res1[12]; | |
331 | - u32 d_id; | |
332 | + u8 res1[13]; | |
333 | + u8 d_id[3]; | |
332 | 334 | u32 option; |
333 | 335 | u64 fcp_lun; |
334 | 336 | u64 res2; |
335 | 337 | |
... | ... | @@ -357,11 +359,12 @@ |
357 | 359 | u32 fc_topology; |
358 | 360 | u32 fc_link_speed; |
359 | 361 | u32 adapter_type; |
360 | - u32 peer_d_id; | |
362 | + u8 res0; | |
363 | + u8 peer_d_id[3]; | |
361 | 364 | u8 res1[2]; |
362 | 365 | u16 timer_interval; |
363 | - u8 res2[8]; | |
364 | - u32 s_id; | |
366 | + u8 res2[9]; | |
367 | + u8 s_id[3]; | |
365 | 368 | u8 nport_serv_param[128]; |
366 | 369 | u8 res3[8]; |
367 | 370 | u32 adapter_ports; |