Skip to content

Commit 800c0ca

Browse files
Christof SchmittJames Bottomley
authored andcommitted
[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 <[email protected]> Signed-off-by: Christof Schmitt <[email protected]> Signed-off-by: James Bottomley <[email protected]>
1 parent bd0072e commit 800c0ca

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void _zfcp_dbf_hba_fsf_response(const char *tag2, int level,
178178

179179
case FSF_QTCB_SEND_ELS:
180180
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);
182182
response->u.els.ls_code = send_els->ls_code >> 24;
183183
break;
184184

@@ -812,7 +812,7 @@ void zfcp_dbf_san_incoming_els(struct zfcp_fsf_req *fsf_req)
812812
int length = (int)buf->length -
813813
(int)((void *)&buf->payload - (void *)buf);
814814

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),
816816
fc_host_port_id(adapter->scsi_host),
817817
buf->payload.data[0], (void *)buf->payload.data,
818818
length);

drivers/s390/scsi/zfcp_def.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,6 @@
7171
/* timeout value for "default timer" for fsf requests */
7272
#define ZFCP_FSF_REQUEST_TIMEOUT (60*HZ)
7373

74-
/*************** FIBRE CHANNEL PROTOCOL SPECIFIC DEFINES ********************/
75-
76-
#define ZFCP_DID_MASK 0x00FFFFFF
77-
7874
/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
7975

8076
/*

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static void zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *req)
128128
struct fsf_status_read_buffer *sr_buf = req->data;
129129
struct zfcp_adapter *adapter = req->adapter;
130130
struct zfcp_port *port;
131-
int d_id = sr_buf->d_id & ZFCP_DID_MASK;
131+
int d_id = ntoh24(sr_buf->d_id);
132132

133133
read_lock_irqsave(&adapter->port_list_lock, flags);
134134
list_for_each_entry(port, &adapter->port_list, list)
@@ -494,7 +494,7 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
494494

495495
fc_host_port_name(shost) = nsp->fl_wwpn;
496496
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);
498498
fc_host_speed(shost) = bottom->fc_link_speed;
499499
fc_host_supported_classes(shost) = FC_COS_CLASS2 | FC_COS_CLASS3;
500500

@@ -506,7 +506,7 @@ static int zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *req)
506506

507507
switch (bottom->fc_topology) {
508508
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);
510510
adapter->peer_wwpn = plogi->fl_wwpn;
511511
adapter->peer_wwnn = plogi->fl_wwnn;
512512
fc_host_port_type(shost) = FC_PORTTYPE_PTP;
@@ -1216,7 +1216,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
12161216
if (ret)
12171217
goto failed_send;
12181218

1219-
req->qtcb->bottom.support.d_id = els->d_id;
1219+
hton24(req->qtcb->bottom.support.d_id, els->d_id);
12201220
req->handler = zfcp_fsf_send_els_handler;
12211221
req->data = els;
12221222

@@ -1522,7 +1522,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
15221522
sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
15231523

15241524
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);
15261526
req->data = port;
15271527
req->erp_action = erp_action;
15281528
erp_action->fsf_req = req;
@@ -1669,7 +1669,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
16691669
sbale[1].flags |= SBAL_FLAGS_LAST_ENTRY;
16701670

16711671
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);
16731673
req->data = wka_port;
16741674

16751675
zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT);

drivers/s390/scsi/zfcp_fsf.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#include <linux/pfn.h>
1313
#include <linux/scatterlist.h>
14+
#include <scsi/libfc.h>
1415

1516
#define FSF_QTCB_CURRENT_VERSION 0x00000001
1617

@@ -228,7 +229,8 @@ struct fsf_status_read_buffer {
228229
u32 length;
229230
u32 res1;
230231
struct fsf_queue_designator queue_designator;
231-
u32 d_id;
232+
u8 res2;
233+
u8 d_id[3];
232234
u32 class;
233235
u64 fcp_lun;
234236
u8 res3[24];
@@ -327,8 +329,8 @@ struct fsf_qtcb_bottom_io {
327329

328330
struct fsf_qtcb_bottom_support {
329331
u32 operation_subtype;
330-
u8 res1[12];
331-
u32 d_id;
332+
u8 res1[13];
333+
u8 d_id[3];
332334
u32 option;
333335
u64 fcp_lun;
334336
u64 res2;
@@ -357,11 +359,12 @@ struct fsf_qtcb_bottom_config {
357359
u32 fc_topology;
358360
u32 fc_link_speed;
359361
u32 adapter_type;
360-
u32 peer_d_id;
362+
u8 res0;
363+
u8 peer_d_id[3];
361364
u8 res1[2];
362365
u16 timer_interval;
363-
u8 res2[8];
364-
u32 s_id;
366+
u8 res2[9];
367+
u8 s_id[3];
365368
u8 nport_serv_param[128];
366369
u8 res3[8];
367370
u32 adapter_ports;

0 commit comments

Comments
 (0)