sparse fixes for nvme/fc
Subsystems (3)
Christoph Hellwig
maintainer[sorry for the double post, the first series got the linux-nvme
address wrong]
This fixes a couple ?parse warnings in the FC code, missing statics, missing endianess annotations and incorrect byte swaps.
Christoph Hellwig
maintainerPATCH 1/7 nvme/fc: mark two symbols static
Found by sparse.
--- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +2 -2
@@ -1183,7 +1183,7 @@ nvme_fc_exit_aen_ops(struct nvme_fc_ctrl *ctrl) } } -void +static void nvme_fc_fcpio_done (struct nvmefc_fcp_req *req) {struct nvme_fc_fcp_op *op =fcp_req_to_fcp_op (req);
@@ -1671,7 +1671,7 @@ __nvme_fc_abort_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_fcp_op *op)return 0 ; } -enum blk_eh_timer_return +static enum blk_eh_timer_return nvme_fc_timeout (struct request *rq,bool reserved) {struct nvme_fc_fcp_op *op =blk_mq_rq_to_pdu (rq);
Signature · 1 line
2.11.0
PATCH 1/7 nvme/fc: mark two symbols static
Quoted 4 lines · Christoph Hellwig
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH 1/7 nvme/fc: mark two symbols static
In reply to Christoph HellwigLooks good
-- james
Christoph Hellwig
maintainerPATCH 2/7 nvme/fc: don't byte swap command_id
In reply to Christoph HellwigThe command ID is a field for host only use and thus always is in native endian.
Found by sparse.
--- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +2 -2
@@ -1274,7 +1274,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) be32_to_cpu(op->rsp_iu.xfrd_len) != freq->transferred_length || op->rsp_iu.status_code || - op->rqno != le16_to_cpu(cqe->command_id))) { + op->rqno != cqe->command_id)) { status =cpu_to_le16 (NVME_SC_FC_TRANSPORT_ERROR <<1 ); goto done; }
@@ -1830,7 +1830,7 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, sqe->rw.dptr.sgl.addr =0 ;/* odd that we set the command_id - should come from nvme-fabrics */ -WARN_ON_ONCE (sqe->common.command_id !=cpu_to_le16 (op->rqno)); +WARN_ON_ONCE (sqe->common.command_id != op->rqno);if (op->rq) {/* skipped on aens */ ret =nvme_fc_map_data (ctrl, op->rq, op);
Signature · 1 line
2.11.0
PATCH 2/7 nvme/fc: don't byte swap command_id
Quoted 7 lines · Christoph Hellwig
The command ID is a field for host only use and thus always is in native endian.
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
PATCH 2/7 nvme/fc: don't byte swap command_id
In reply to Christoph HellwigQuoted 15 lines · Christoph Hellwig
The command ID is a field for host only use and thus always is in native endian.
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>--- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/nvme/host/fc.c +0
-0
drivers/nvme/host/fc.c nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · line 1280
Quoted 8 lines
drivers/nvme/host/fc.c +1
-1@@ -1274,7 +1274,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) be32_to_cpu(op->rsp_iu.xfrd_len) != freq->transferred_length || op->rsp_iu.status_code || - op->rqno != le16_to_cpu(cqe->command_id))) { + op->rqno != cqe->command_id)) { status =cpu_to_le16 (NVME_SC_FC_TRANSPORT_ERROR <<1 ); goto done; }
This check was replaced in the following patch, obsoleting this change:
http://lists.infradead.org/pipermail/linux-nvme/2017-April/009259.html
drivers/nvme/host/fc.c nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, · line 1836
Quoted 9 lines
drivers/nvme/host/fc.c +1
-1@@ -1830,7 +1830,7 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, sqe->rw.dptr.sgl.addr =0 ;/* odd that we set the command_id - should come from nvme-fabrics */ -WARN_ON_ONCE (sqe->common.command_id !=cpu_to_le16 (op->rqno)); +WARN_ON_ONCE (sqe->common.command_id != op->rqno);if (op->rq) {/* skipped on aens */ ret =nvme_fc_map_data (ctrl, op->rq, op);
This line was removed by the following patch, obsoleting this change:
http://lists.infradead.org/pipermail/linux-nvme/2017-April/009260.html
-- james
Christoph Hellwig
maintainerPATCH 2/7 nvme/fc: don't byte swap command_id
Quoted 11 lines · James Smart
Quoted 10 lines · Christoph Hellwig
The command ID is a field for host only use and thus always is in native endian.
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>--- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 16 lines
drivers/nvme/host/fc.c nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · line 1280
Quoted 13 lines
drivers/nvme/host/fc.c +1
-1@@ -1274,7 +1274,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) be32_to_cpu(op->rsp_iu.xfrd_len) != freq->transferred_length || op->rsp_iu.status_code || - op->rqno != le16_to_cpu(cqe->command_id))) { + op->rqno != cqe->command_id)) { status =cpu_to_le16 (NVME_SC_FC_TRANSPORT_ERROR <<1 ); goto done; }This check was replaced in the following patch, obsoleting this change:
http://lists.infradead.org/pipermail/linux-nvme/2017-April/009259.html
Can you please resend this and the two patches related to it? They had non-trivial conflicts with the error status rework.
PATCH 2/7 nvme/fc: don't byte swap command_id
Quoted 27 lines · Christoph Hellwig
Quoted 11 lines · James Smart
Quoted 10 lines · Christoph Hellwig
The command ID is a field for host only use and thus always is in native endian.
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>--- drivers/nvme/host/fc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Quoted 15 lines
drivers/nvme/host/fc.c nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) · line 1280
Quoted 13 lines
drivers/nvme/host/fc.c +1
-1@@ -1274,7 +1274,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req) be32_to_cpu(op->rsp_iu.xfrd_len) != freq->transferred_length || op->rsp_iu.status_code || - op->rqno != le16_to_cpu(cqe->command_id))) { + op->rqno != cqe->command_id)) { status =cpu_to_le16 (NVME_SC_FC_TRANSPORT_ERROR <<1 ); goto done; }This check was replaced in the following patch, obsoleting this change:
http://lists.infradead.org/pipermail/linux-nvme/2017-April/009259.html
Quoted 2 lines
Can you please resend this and the two patches related to it? They had non-trivial conflicts with the error status rework.
Resent: As your patch had been merged, the new patches layer on top.
-- james
Christoph Hellwig
maintainerPATCH 3/7 nvmet/fc: mark nvmet_fc_handle_fcp_rqst static
In reply to Christoph HellwigFound by sparse.
--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fc.c +1 -1
@@ -2055,7 +2055,7 @@ nvmet_fc_fcp_nvme_cmd_done(struct nvmet_req *nvme_req)/* * Actual processing routine for received FC-NVME LS Requests from the LLD */ -void +static void nvmet_fc_handle_fcp_rqst (struct nvmet_fc_tgtport *tgtport,struct nvmet_fc_fcp_iod *fod) {
Signature · 1 line
2.11.0
PATCH 3/7 nvmet/fc: mark nvmet_fc_handle_fcp_rqst static
Quoted 4 lines · Christoph Hellwig
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Christoph Hellwig
maintainerPATCH 4/7 nvmet/fc: fix endianess annoations for nvmet_fc_format_rsp_hdr
In reply to Christoph HellwigThe passed in desc_len is a big endian value, so mark it as such.
Found by sparse.
--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fc.c +1 -1
@@ -1058,7 +1058,7 @@ EXPORT_SYMBOL_GPL(nvmet_fc_unregister_targetport);static void -nvmet_fc_format_rsp_hdr (void *buf,u8 ls_cmd,u32 desc_len,u8 rqst_ls_cmd) +nvmet_fc_format_rsp_hdr (void *buf,u8 ls_cmd,__be32 desc_len,u8 rqst_ls_cmd) {struct fcnvme_ls_acc_hdr *acc = buf;
Signature · 1 line
2.11.0
PATCH 4/7 nvmet/fc: fix endianess annoations for nvmet_fc_format_rsp_hdr
Quoted 6 lines · Christoph Hellwig
The passed in
desc_lenis a big endian value, so mark it as such.Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Christoph Hellwig
maintainerPATCH 5/7 nvmet/fc: mark the sqhd field as __le16
In reply to Christoph HellwigThat's what it's used as.
Found by sparse.
--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fc.c +1 -1
@@ -119,7 +119,7 @@ struct nvmet_fc_tgt_queue {u16 qid;u16 sqsize;u16 ersp_ratio; -u16 sqhd; +__le16 sqhd;int cpu;atomic_t connected;atomic_t sqtail;
Signature · 1 line
2.11.0
PATCH 5/7 nvmet/fc: mark the sqhd field as __le16
Quoted 6 lines · Christoph Hellwig
That's what it's used as.
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
A message that is not in the archive (sent off-list or not yet received): [email protected]
Christoph Hellwig
maintainerPATCH 5/7 nvmet/fc: mark the sqhd field as __le16
Quoted 3 lines · James Smart
This is fine, but this also highlights several different areas where sqhd is referenced and endianness wasn't accounted for. So I'll need to make a complimentary patch.
All the assignments to/from it are already to __le16 values.
Christoph Hellwig
maintainerPATCH 6/7 nvmet/fc: properly endian swap sq_head
In reply to Christoph HellwigFound by sparse.
--- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/target/fc.c +1 -1
@@ -1700,7 +1700,7 @@ nvmet_fc_prep_fcp_rsp(struct nvmet_fc_tgtport *tgtport, xfr_length != fod->total_length || (le16_to_cpu (cqe->status) &0xFFFE ) || cqewd[0 ] || cqewd[1 ] || (sqe->flags & (NVME_CMD_FUSE_FIRST |NVME_CMD_FUSE_SECOND )) || - queue_90percent_full(fod->queue, cqe->sq_head)) + queue_90percent_full(fod->queue, le16_to_cpu(cqe->sq_head))) send_ersp = true;/* re-set the fields */
Signature · 1 line
2.11.0
PATCH 6/7 nvmet/fc: properly endian swap sq_head
Quoted 4 lines · Christoph Hellwig
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Christoph Hellwig
maintainerPATCH 7/7 nvmet/fcloop: mark two symbols static
In reply to Christoph HellwigFound by sparse.
--- drivers/nvme/target/fcloop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/target/fcloop.c +2 -2
@@ -666,7 +666,7 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_SGL_SEGS 256#define FCLOOP_DMABOUND_4G 0xFFFFFFFF -struct nvme_fc_port_template fctemplate = { +static struct nvme_fc_port_template fctemplate = { .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,
@@ -686,7 +686,7 @@ struct nvme_fc_port_template fctemplate = { .fcprqst_priv_sz = sizeof(struct fcloop_ini_fcpreq), }; -struct nvmet_fc_target_template tgttemplate = { +static struct nvmet_fc_target_template tgttemplate = { .targetport_delete = fcloop_targetport_delete, .xmt_ls_rsp = fcloop_xmt_ls_rsp, .fcp_op = fcloop_fcp_op,
Signature · 1 line
2.11.0
PATCH 7/7 nvmet/fcloop: mark two symbols static
Quoted 4 lines · Christoph Hellwig
Found by sparse.
Signed-off-by Christoph Hellwig <hch at lst.de>---
Signature · 6 lines
Johannes Thumshirn Storage jthumshirn at suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg GF: Felix Imend?rffer, Jane Smithard, Graham Norton HRB 21284 (AG N?rnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850