* [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap
@ 2017-06-30 16:10 Arnd Bergmann
2017-06-30 16:10 ` [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Arnd Bergmann
2017-06-30 16:41 ` [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap James Bottomley
0 siblings, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-06-30 16:10 UTC (permalink / raw)
To: qla2xxx-upstream, James E.J. Bottomley, Martin K. Petersen
Cc: Arnd Bergmann, Himanshu Madhani, Darren Trapp, Giridhar Malavali,
Duane Grigsby, linux-scsi, linux-kernel
cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
on it will store incorrect data:
drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro 'cpu_to_le32'
cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
This removes the erroneous cpu_to_le32().
Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 1da8fa8f641d..14e25e32e622 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
req->ring_ptr++;
}
cont_pkt = (cont_a64_entry_t *)req->ring_ptr;
- cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
+ cont_pkt->entry_type = CONTINUE_A64_TYPE;
cur_dsd = (uint32_t *)cont_pkt->dseg_0_address;
avail_dsds = 5;
--
2.9.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning
2017-06-30 16:10 [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap Arnd Bergmann
@ 2017-06-30 16:10 ` Arnd Bergmann
2017-06-30 23:54 ` Madhani, Himanshu
2017-07-01 21:15 ` Martin K. Petersen
2017-06-30 16:41 ` [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap James Bottomley
1 sibling, 2 replies; 6+ messages in thread
From: Arnd Bergmann @ 2017-06-30 16:10 UTC (permalink / raw)
To: qla2xxx-upstream, James E.J. Bottomley, Martin K. Petersen
Cc: Arnd Bergmann, Quinn Tran, Himanshu Madhani, Nicholas Bellinger,
Darren Trapp, Anil Gurumurthy, Duane Grigsby, linux-scsi,
linux-kernel
When NVMe support is disabled, we get a couple of harmless warnings:
drivers/scsi/qla2xxx/qla_nvme.c:667:13: error: 'qla_nvme_unregister_remote_port' defined but not used [-Werror=unused-function]
drivers/scsi/qla2xxx/qla_nvme.c:634:13: error: 'qla_nvme_abort_all' defined but not used [-Werror=unused-function]
drivers/scsi/qla2xxx/qla_nvme.c:604:12: error: 'qla_nvme_wait_on_rport_del' defined but not used [-Werror=unused-function]
This replaces the preprocessor checks in the code with equivalent
compiler conditionals, which lets gcc drop the unused functions
without warning, and is nicer to read.
Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/qla2xxx/Kconfig | 1 +
drivers/scsi/qla2xxx/qla_nvme.c | 20 ++++++++++++--------
2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
index de952935b5d2..036cc3f217b1 100644
--- a/drivers/scsi/qla2xxx/Kconfig
+++ b/drivers/scsi/qla2xxx/Kconfig
@@ -2,6 +2,7 @@ config SCSI_QLA_FC
tristate "QLogic QLA2XXX Fibre Channel Support"
depends on PCI && SCSI
depends on SCSI_FC_ATTRS
+ depends on NVME_FC || !NVME_FC
select FW_LOADER
select BTREE
---help---
diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
index 14e25e32e622..9c18d754ac33 100644
--- a/drivers/scsi/qla2xxx/qla_nvme.c
+++ b/drivers/scsi/qla2xxx/qla_nvme.c
@@ -17,10 +17,12 @@ static void qla_nvme_unregister_remote_port(struct work_struct *);
int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport)
{
-#if (IS_ENABLED(CONFIG_NVME_FC))
struct nvme_rport *rport;
int ret;
+ if (!IS_ENABLED(CONFIG_NVME_FC))
+ return 0;
+
if (fcport->nvme_flag & NVME_FLAG_REGISTERED)
return 0;
@@ -78,7 +80,6 @@ int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport)
init_waitqueue_head(&fcport->nvme_waitQ);
rport->fcport = fcport;
list_add_tail(&rport->list, &vha->nvme_rport_list);
-#endif
return 0;
}
@@ -666,11 +667,13 @@ static void qla_nvme_abort_all(fc_port_t *fcport)
static void qla_nvme_unregister_remote_port(struct work_struct *work)
{
-#if (IS_ENABLED(CONFIG_NVME_FC))
struct fc_port *fcport = container_of(work, struct fc_port,
nvme_del_work);
struct nvme_rport *rport, *trport;
+ if (!IS_ENABLED(CONFIG_NVME_FC))
+ return;
+
list_for_each_entry_safe(rport, trport,
&fcport->vha->nvme_rport_list, list) {
if (rport->fcport == fcport) {
@@ -680,16 +683,17 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
fcport->nvme_remote_port);
}
}
-#endif
}
void qla_nvme_delete(scsi_qla_host_t *vha)
{
-#if (IS_ENABLED(CONFIG_NVME_FC))
struct nvme_rport *rport, *trport;
fc_port_t *fcport;
int nv_ret;
+ if (!IS_ENABLED(CONFIG_NVME_FC))
+ return;
+
list_for_each_entry_safe(rport, trport, &vha->nvme_rport_list, list) {
fcport = rport->fcport;
@@ -711,17 +715,18 @@ void qla_nvme_delete(scsi_qla_host_t *vha)
ql_log(ql_log_info, vha, 0x2115,
"Unregister of localport failed\n");
}
-#endif
}
void qla_nvme_register_hba(scsi_qla_host_t *vha)
{
-#if (IS_ENABLED(CONFIG_NVME_FC))
struct nvme_fc_port_template *tmpl;
struct qla_hw_data *ha;
struct nvme_fc_port_info pinfo;
int ret;
+ if (!IS_ENABLED(CONFIG_NVME_FC))
+ return;
+
ha = vha->hw;
tmpl = &qla_nvme_fc_transport;
@@ -752,5 +757,4 @@ void qla_nvme_register_hba(scsi_qla_host_t *vha)
atomic_set(&vha->nvme_ref_count, 1);
vha->nvme_local_port->private = vha;
init_waitqueue_head(&vha->nvme_waitQ);
-#endif
}
--
2.9.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap
2017-06-30 16:10 [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap Arnd Bergmann
2017-06-30 16:10 ` [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Arnd Bergmann
@ 2017-06-30 16:41 ` James Bottomley
2017-06-30 17:00 ` Madhani, Himanshu
1 sibling, 1 reply; 6+ messages in thread
From: James Bottomley @ 2017-06-30 16:41 UTC (permalink / raw)
To: Arnd Bergmann, qla2xxx-upstream, Martin K. Petersen
Cc: Himanshu Madhani, Darren Trapp, Giridhar Malavali, Duane Grigsby,
linux-scsi, linux-kernel
On Fri, 2017-06-30 at 18:10 +0200, Arnd Bergmann wrote:
> cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
> on it will store incorrect data:
>
> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer
> implicitly truncated to unsigned type [-Werror=overflow]
> drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro
> 'cpu_to_le32'
> cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
>
> This removes the erroneous cpu_to_le32().
>
> Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization
> and transport registration")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
> b/drivers/scsi/qla2xxx/qla_nvme.c
> index 1da8fa8f641d..14e25e32e622 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
> req->ring_ptr++;
> }
> cont_pkt = (cont_a64_entry_t *)req-
> >ring_ptr;
> - cont_pkt->entry_type =
> cpu_to_le32(CONTINUE_A64_TYPE);
> + cont_pkt->entry_type = CONTINUE_A64_TYPE;
>
We already have a patch proposed for this, but I think it may be wrong
(it's the same as yours, so yours may be wrong too) see the handling in
qla_iocb.c
James
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap
2017-06-30 16:41 ` [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap James Bottomley
@ 2017-06-30 17:00 ` Madhani, Himanshu
0 siblings, 0 replies; 6+ messages in thread
From: Madhani, Himanshu @ 2017-06-30 17:00 UTC (permalink / raw)
To: James Bottomley
Cc: Arnd Bergmann, Dept-Eng QLA2xxx Upstream, Martin K. Petersen,
Trapp, Darren, Malavali, Giridhar, Grigsby, Duane, linux-scsi,
linux-kernel
> On Jun 30, 2017, at 9:41 AM, James Bottomley <jejb@linux.vnet.ibm.com> wrote:
>
> On Fri, 2017-06-30 at 18:10 +0200, Arnd Bergmann wrote:
>> cont_pkt->entry_type is an 8-bit field, so doing a 32-bit byteswap
>> on it will store incorrect data:
>>
>> drivers/scsi/qla2xxx/qla_nvme.c: In function 'qla2x00_start_nvme_mq':
>> include/uapi/linux/byteorder/big_endian.h:32:26: error: large integer
>> implicitly truncated to unsigned type [-Werror=overflow]
>> drivers/scsi/qla2xxx/qla_nvme.c:444:27: note: in expansion of macro
>> 'cpu_to_le32'
>> cont_pkt->entry_type = cpu_to_le32(CONTINUE_A64_TYPE);
>>
>> This removes the erroneous cpu_to_le32().
>>
>> Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization
>> and transport registration")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c
>> b/drivers/scsi/qla2xxx/qla_nvme.c
>> index 1da8fa8f641d..14e25e32e622 100644
>> --- a/drivers/scsi/qla2xxx/qla_nvme.c
>> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
>> @@ -441,7 +441,7 @@ static int qla2x00_start_nvme_mq(srb_t *sp)
>> req->ring_ptr++;
>> }
>> cont_pkt = (cont_a64_entry_t *)req-
>>> ring_ptr;
>> - cont_pkt->entry_type =
>> cpu_to_le32(CONTINUE_A64_TYPE);
>> + cont_pkt->entry_type = CONTINUE_A64_TYPE;
>>
>
> We already have a patch proposed for this, but I think it may be wrong
> (it's the same as yours, so yours may be wrong too) see the handling in
> qla_iocb.c
>
> James
I will send patch which has correct usage in qla_iocb.c shortly.
Thanks,
- Himanshu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning
2017-06-30 16:10 ` [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Arnd Bergmann
@ 2017-06-30 23:54 ` Madhani, Himanshu
2017-07-01 21:15 ` Martin K. Petersen
1 sibling, 0 replies; 6+ messages in thread
From: Madhani, Himanshu @ 2017-06-30 23:54 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Dept-Eng QLA2xxx Upstream, James E.J. Bottomley,
Martin K. Petersen, Tran, Quinn, Nicholas Bellinger, Trapp,
Darren, Anil Gurumurthy, Grigsby, Duane, Linux SCSI Mailinglist,
linux-kernel
> On Jun 30, 2017, at 9:10 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>
> When NVMe support is disabled, we get a couple of harmless warnings:
>
> drivers/scsi/qla2xxx/qla_nvme.c:667:13: error: 'qla_nvme_unregister_remote_port' defined but not used [-Werror=unused-function]
> drivers/scsi/qla2xxx/qla_nvme.c:634:13: error: 'qla_nvme_abort_all' defined but not used [-Werror=unused-function]
> drivers/scsi/qla2xxx/qla_nvme.c:604:12: error: 'qla_nvme_wait_on_rport_del' defined but not used [-Werror=unused-function]
>
> This replaces the preprocessor checks in the code with equivalent
> compiler conditionals, which lets gcc drop the unused functions
> without warning, and is nicer to read.
>
> Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/scsi/qla2xxx/Kconfig | 1 +
> drivers/scsi/qla2xxx/qla_nvme.c | 20 ++++++++++++--------
> 2 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
> index de952935b5d2..036cc3f217b1 100644
> --- a/drivers/scsi/qla2xxx/Kconfig
> +++ b/drivers/scsi/qla2xxx/Kconfig
> @@ -2,6 +2,7 @@ config SCSI_QLA_FC
> tristate "QLogic QLA2XXX Fibre Channel Support"
> depends on PCI && SCSI
> depends on SCSI_FC_ATTRS
> + depends on NVME_FC || !NVME_FC
> select FW_LOADER
> select BTREE
> ---help---
> diff --git a/drivers/scsi/qla2xxx/qla_nvme.c b/drivers/scsi/qla2xxx/qla_nvme.c
> index 14e25e32e622..9c18d754ac33 100644
> --- a/drivers/scsi/qla2xxx/qla_nvme.c
> +++ b/drivers/scsi/qla2xxx/qla_nvme.c
> @@ -17,10 +17,12 @@ static void qla_nvme_unregister_remote_port(struct work_struct *);
>
> int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport)
> {
> -#if (IS_ENABLED(CONFIG_NVME_FC))
> struct nvme_rport *rport;
> int ret;
>
> + if (!IS_ENABLED(CONFIG_NVME_FC))
> + return 0;
> +
> if (fcport->nvme_flag & NVME_FLAG_REGISTERED)
> return 0;
>
> @@ -78,7 +80,6 @@ int qla_nvme_register_remote(scsi_qla_host_t *vha, fc_port_t *fcport)
> init_waitqueue_head(&fcport->nvme_waitQ);
> rport->fcport = fcport;
> list_add_tail(&rport->list, &vha->nvme_rport_list);
> -#endif
> return 0;
> }
>
> @@ -666,11 +667,13 @@ static void qla_nvme_abort_all(fc_port_t *fcport)
>
> static void qla_nvme_unregister_remote_port(struct work_struct *work)
> {
> -#if (IS_ENABLED(CONFIG_NVME_FC))
> struct fc_port *fcport = container_of(work, struct fc_port,
> nvme_del_work);
> struct nvme_rport *rport, *trport;
>
> + if (!IS_ENABLED(CONFIG_NVME_FC))
> + return;
> +
> list_for_each_entry_safe(rport, trport,
> &fcport->vha->nvme_rport_list, list) {
> if (rport->fcport == fcport) {
> @@ -680,16 +683,17 @@ static void qla_nvme_unregister_remote_port(struct work_struct *work)
> fcport->nvme_remote_port);
> }
> }
> -#endif
> }
>
> void qla_nvme_delete(scsi_qla_host_t *vha)
> {
> -#if (IS_ENABLED(CONFIG_NVME_FC))
> struct nvme_rport *rport, *trport;
> fc_port_t *fcport;
> int nv_ret;
>
> + if (!IS_ENABLED(CONFIG_NVME_FC))
> + return;
> +
> list_for_each_entry_safe(rport, trport, &vha->nvme_rport_list, list) {
> fcport = rport->fcport;
>
> @@ -711,17 +715,18 @@ void qla_nvme_delete(scsi_qla_host_t *vha)
> ql_log(ql_log_info, vha, 0x2115,
> "Unregister of localport failed\n");
> }
> -#endif
> }
>
> void qla_nvme_register_hba(scsi_qla_host_t *vha)
> {
> -#if (IS_ENABLED(CONFIG_NVME_FC))
> struct nvme_fc_port_template *tmpl;
> struct qla_hw_data *ha;
> struct nvme_fc_port_info pinfo;
> int ret;
>
> + if (!IS_ENABLED(CONFIG_NVME_FC))
> + return;
> +
> ha = vha->hw;
> tmpl = &qla_nvme_fc_transport;
>
> @@ -752,5 +757,4 @@ void qla_nvme_register_hba(scsi_qla_host_t *vha)
> atomic_set(&vha->nvme_ref_count, 1);
> vha->nvme_local_port->private = vha;
> init_waitqueue_head(&vha->nvme_waitQ);
> -#endif
> }
> --
> 2.9.0
>
Looks Good.
Acked-By: Himanshu Madhani <himanshu.madhani@cavium.com>
Thanks,
- Himanshu
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning
2017-06-30 16:10 ` [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Arnd Bergmann
2017-06-30 23:54 ` Madhani, Himanshu
@ 2017-07-01 21:15 ` Martin K. Petersen
1 sibling, 0 replies; 6+ messages in thread
From: Martin K. Petersen @ 2017-07-01 21:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: qla2xxx-upstream, James E.J. Bottomley, Martin K. Petersen,
Quinn Tran, Himanshu Madhani, Nicholas Bellinger, Darren Trapp,
Anil Gurumurthy, Duane Grigsby, linux-scsi, linux-kernel
Arnd,
> When NVMe support is disabled, we get a couple of harmless warnings:
>
> drivers/scsi/qla2xxx/qla_nvme.c:667:13: error: 'qla_nvme_unregister_remote_port' defined but not used [-Werror=unused-function]
> drivers/scsi/qla2xxx/qla_nvme.c:634:13: error: 'qla_nvme_abort_all' defined but not used [-Werror=unused-function]
> drivers/scsi/qla2xxx/qla_nvme.c:604:12: error: 'qla_nvme_wait_on_rport_del' defined but not used [-Werror=unused-function]
>
> This replaces the preprocessor checks in the code with equivalent
> compiler conditionals, which lets gcc drop the unused functions
> without warning, and is nicer to read.
Applied to 4.13/scsi-queue.
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-07-01 21:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 16:10 [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap Arnd Bergmann
2017-06-30 16:10 ` [PATCH 2/2] scsi: qla2xxx: avoid unused-function warning Arnd Bergmann
2017-06-30 23:54 ` Madhani, Himanshu
2017-07-01 21:15 ` Martin K. Petersen
2017-06-30 16:41 ` [PATCH 1/2] scsi: qla2xxx: remove incorrect byte swap James Bottomley
2017-06-30 17:00 ` Madhani, Himanshu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).