Skip to content

Commit 3ab0181

Browse files
Benjamin-Blockmartinkpetersen
authored andcommitted
scsi: zfcp: Change the type of all fsf request id fields and variables to u64
We use different integer types throughout zfcp to store the FSF request ID and related values; some places use 'unsigned long' and others 'u64'. On s390x these are effectively the same type, but this might cause confusions and is generally inconsistent. The specification for the used hardware specifies this value as a 64-bit number, and ultimately we use this value to communicate with the hardware, so it makes sense to change the type of all these variables to 'u64' where we can. The only exception being when we store it in the 'host_scribble' field of a 'struct scsi_cmnd'; for this case we add a build time check to make sure they are compatible. Link: https://lore.kernel.org/r/9c9cbe5acc2b419a22dce2fed847e3db91b60201.1677000450.git.bblock@linux.ibm.com Signed-off-by: Benjamin Block <[email protected]> Reviewed-by: Steffen Maier <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 79f9abd commit 3ab0181

File tree

6 files changed

+18
-17
lines changed

6 files changed

+18
-17
lines changed

drivers/s390/scsi/zfcp_dbf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ void zfcp_dbf_scsi_common(char *tag, int level, struct scsi_device *sdev,
649649
rec->scsi_id = sc->device->id;
650650
rec->scsi_lun = (u32)sc->device->lun;
651651
rec->scsi_lun_64_hi = (u32)(sc->device->lun >> 32);
652-
rec->host_scribble = (unsigned long)sc->host_scribble;
652+
rec->host_scribble = (u64)sc->host_scribble;
653653

654654
memcpy(rec->scsi_opcode, sc->cmnd,
655655
min_t(int, sc->cmd_len, ZFCP_DBF_SCSI_OPCODE));

drivers/s390/scsi/zfcp_def.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ struct zfcp_erp_action {
129129
struct scsi_device *sdev;
130130
u32 status; /* recovery status */
131131
enum zfcp_erp_steps step; /* active step of this erp action */
132-
unsigned long fsf_req_id;
132+
u64 fsf_req_id;
133133
struct timer_list timer;
134134
};
135135

@@ -163,7 +163,7 @@ struct zfcp_adapter {
163163
struct Scsi_Host *scsi_host; /* Pointer to mid-layer */
164164
struct list_head port_list; /* remote port list */
165165
rwlock_t port_list_lock; /* port list lock */
166-
unsigned long req_no; /* unique FSF req number */
166+
u64 req_no; /* unique FSF req number */
167167
struct zfcp_reqlist *req_list;
168168
u32 fsf_req_seq_no; /* FSF cmnd seq number */
169169
rwlock_t abort_lock; /* Protects against SCSI
@@ -325,7 +325,7 @@ static inline u64 zfcp_scsi_dev_lun(struct scsi_device *sdev)
325325
*/
326326
struct zfcp_fsf_req {
327327
struct list_head list;
328-
unsigned long req_id;
328+
u64 req_id;
329329
struct zfcp_adapter *adapter;
330330
struct zfcp_qdio_req qdio_req;
331331
struct completion completion;

drivers/s390/scsi/zfcp_fsf.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *req)
884884
const bool is_srb = zfcp_fsf_req_is_status_read_buffer(req);
885885
struct zfcp_adapter *adapter = req->adapter;
886886
struct zfcp_qdio *qdio = adapter->qdio;
887-
unsigned long req_id = req->req_id;
887+
u64 req_id = req->req_id;
888888

889889
zfcp_reqlist_add(adapter->req_list, req);
890890

@@ -1042,7 +1042,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
10421042
struct scsi_device *sdev = scmnd->device;
10431043
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
10441044
struct zfcp_qdio *qdio = zfcp_sdev->port->adapter->qdio;
1045-
unsigned long old_req_id = (unsigned long) scmnd->host_scribble;
1045+
u64 old_req_id = (u64) scmnd->host_scribble;
10461046

10471047
spin_lock_irq(&qdio->req_q_lock);
10481048
if (zfcp_qdio_sbal_get(qdio))
@@ -1065,7 +1065,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_cmnd(struct scsi_cmnd *scmnd)
10651065
req->handler = zfcp_fsf_abort_fcp_command_handler;
10661066
req->qtcb->header.lun_handle = zfcp_sdev->lun_handle;
10671067
req->qtcb->header.port_handle = zfcp_sdev->port->handle;
1068-
req->qtcb->bottom.support.req_handle = (u64) old_req_id;
1068+
req->qtcb->bottom.support.req_handle = old_req_id;
10691069

10701070
zfcp_fsf_start_timer(req, ZFCP_FSF_SCSI_ER_TIMEOUT);
10711071
if (!zfcp_fsf_req_send(req)) {
@@ -1919,7 +1919,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port)
19191919
{
19201920
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
19211921
struct zfcp_fsf_req *req;
1922-
unsigned long req_id = 0;
1922+
u64 req_id = 0;
19231923
int retval = -EIO;
19241924

19251925
spin_lock_irq(&qdio->req_q_lock);
@@ -1978,7 +1978,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port)
19781978
{
19791979
struct zfcp_qdio *qdio = wka_port->adapter->qdio;
19801980
struct zfcp_fsf_req *req;
1981-
unsigned long req_id = 0;
1981+
u64 req_id = 0;
19821982
int retval = -EIO;
19831983

19841984
spin_lock_irq(&qdio->req_q_lock);
@@ -2587,6 +2587,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd)
25872587
goto out;
25882588
}
25892589

2590+
BUILD_BUG_ON(sizeof(scsi_cmnd->host_scribble) < sizeof(req->req_id));
25902591
scsi_cmnd->host_scribble = (unsigned char *) req->req_id;
25912592

25922593
io = &req->qtcb->bottom.io;
@@ -2732,7 +2733,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
27322733
struct qdio_buffer *sbal = qdio->res_q[sbal_idx];
27332734
struct qdio_buffer_element *sbale;
27342735
struct zfcp_fsf_req *fsf_req;
2735-
unsigned long req_id;
2736+
u64 req_id;
27362737
int idx;
27372738

27382739
for (idx = 0; idx < QDIO_MAX_ELEMENTS_PER_BUFFER; idx++) {
@@ -2747,7 +2748,7 @@ void zfcp_fsf_reqid_check(struct zfcp_qdio *qdio, int sbal_idx)
27472748
* corruption and must stop the machine immediately.
27482749
*/
27492750
zfcp_qdio_siosl(adapter);
2750-
panic("error: unknown req_id (%lx) on adapter %s.\n",
2751+
panic("error: unknown req_id (%llx) on adapter %s.\n",
27512752
req_id, dev_name(&adapter->ccw_device->dev));
27522753
}
27532754

drivers/s390/scsi/zfcp_qdio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ zfcp_qdio_sbale_curr(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req)
115115
*/
116116
static inline
117117
void zfcp_qdio_req_init(struct zfcp_qdio *qdio, struct zfcp_qdio_req *q_req,
118-
unsigned long req_id, u8 sbtype, void *data, u32 len)
118+
u64 req_id, u8 sbtype, void *data, u32 len)
119119
{
120120
struct qdio_buffer_element *sbale;
121121
int count = min(atomic_read(&qdio->req_q_free),

drivers/s390/scsi/zfcp_reqlist.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct zfcp_reqlist {
2626
struct list_head buckets[ZFCP_REQ_LIST_BUCKETS];
2727
};
2828

29-
static inline size_t zfcp_reqlist_hash(unsigned long req_id)
29+
static inline size_t zfcp_reqlist_hash(u64 req_id)
3030
{
3131
return req_id % ZFCP_REQ_LIST_BUCKETS;
3232
}
@@ -83,7 +83,7 @@ static inline void zfcp_reqlist_free(struct zfcp_reqlist *rl)
8383
}
8484

8585
static inline struct zfcp_fsf_req *
86-
_zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
86+
_zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
8787
{
8888
struct zfcp_fsf_req *req;
8989
size_t i;
@@ -104,7 +104,7 @@ _zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
104104
* or NULL if there is no known FSF request with this id.
105105
*/
106106
static inline struct zfcp_fsf_req *
107-
zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
107+
zfcp_reqlist_find(struct zfcp_reqlist *rl, u64 req_id)
108108
{
109109
unsigned long flags;
110110
struct zfcp_fsf_req *req;
@@ -129,7 +129,7 @@ zfcp_reqlist_find(struct zfcp_reqlist *rl, unsigned long req_id)
129129
* NULL if it has not been found.
130130
*/
131131
static inline struct zfcp_fsf_req *
132-
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, unsigned long req_id)
132+
zfcp_reqlist_find_rm(struct zfcp_reqlist *rl, u64 req_id)
133133
{
134134
unsigned long flags;
135135
struct zfcp_fsf_req *req;

drivers/s390/scsi/zfcp_scsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
170170
(struct zfcp_adapter *) scsi_host->hostdata[0];
171171
struct zfcp_fsf_req *old_req, *abrt_req;
172172
unsigned long flags;
173-
unsigned long old_reqid = (unsigned long) scpnt->host_scribble;
173+
u64 old_reqid = (u64) scpnt->host_scribble;
174174
int retval = SUCCESS, ret;
175175
int retry = 3;
176176
char *dbf_tag;

0 commit comments

Comments
 (0)