scsi:spraid: initial commit of Ramaxel spraid driver
Subsystems (2)
PATCH v2 1/1 scsi:spraid: initial commit of Ramaxel spraid driver
This initial commit contains Ramaxel's spraid module.
Changes from V1:
1. Use BSG module to replace with ioctrl
2. Use author's email as MODULE_AUTHOR
3. Remove "default=m" in drivers/scsi/spraid/Kconfig
4. To be changed in the next version:
a. Use get_unaligned_be*() in spraid_setup_rw_cmd(); b. Use pr_debug() instead of introducing dev_log_dbg().
--- Documentation/scsi/spraid.rst | 16 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/spraid/Kconfig | 10 + drivers/scsi/spraid/Makefile | 7 + drivers/scsi/spraid/spraid.h | 693 ++++++ drivers/scsi/spraid/spraid_main.c | 3328 +++++++++++++++++++++++++++++ 8 files changed, 4063 insertions(+) create mode 100644 Documentation/scsi/spraid.rst create mode 100644 drivers/scsi/spraid/Kconfig create mode 100644 drivers/scsi/spraid/Makefile create mode 100644 drivers/scsi/spraid/spraid.h create mode 100644 drivers/scsi/spraid/spraid_main.c
Documentation/scsi/spraid.rst new file +16 -0
@@ -0,0 +1,16 @@ +.. SPDX-License-Identifier: GPL-2.0 + +============================================== +SPRAID - Ramaxel SCSI Raid Controller driver +============================================== + +This file describes the spraid SCSI driver for Ramaxel +raid controllers. The spraid driver is the first generation raid driver for +Ramaxel Corp. + +For Ramaxel spraid controller support, enable the spraid driver +when configuring the kernel. + +Supported devices +================= +<Controller names to be added as they become publicly available.>
MAINTAINERS +7 -0
@@ -17975,6 +17975,13 @@ F: include/dt-bindings/spmi/spmi.h F: include/linux/spmi.h F: include/trace/events/spmi.h +SPRAID SCSI/Raid DRIVERS +M: Yanling Song <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/scsi/spraid.rst +F: drivers/scsi/spraid/ + SPU FILE SYSTEM M: Jeremy Kerr <[email protected]> L: [email protected]
drivers/scsi/Kconfig +1 -0
@@ -501,6 +501,7 @@ source "drivers/scsi/mpt3sas/Kconfig" source "drivers/scsi/mpi3mr/Kconfig" source "drivers/scsi/smartpqi/Kconfig" source "drivers/scsi/ufs/Kconfig" +source "drivers/scsi/spraid/Kconfig" config SCSI_HPTIOP tristate "HighPoint RocketRAID 3xxx/4xxx Controller support"
drivers/scsi/Makefile +1 -0
@@ -96,6 +96,7 @@ obj-$(CONFIG_SCSI_ZALON) += zalon7xx.o obj-$(CONFIG_SCSI_DC395x) += dc395x.o obj-$(CONFIG_SCSI_AM53C974) += esp_scsi.o am53c974.o obj-$(CONFIG_CXLFLASH) += cxlflash/ +obj-$(CONFIG_RAMAXEL_SPRAID) += spraid/ obj-$(CONFIG_MEGARAID_LEGACY) += megaraid.o obj-$(CONFIG_MEGARAID_NEWGEN) += megaraid/ obj-$(CONFIG_MEGARAID_SAS) += megaraid/
drivers/scsi/spraid/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +# +# Ramaxel driver configuration +# + +config RAMAXEL_SPRAID + tristate "Ramaxel spraid Adapter" + depends on PCI && SCSI && BLK_DEV_BSGLIB + depends on ARM64 || X86_64 + help + This driver supports Ramaxel spraid driver.
drivers/scsi/spraid/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Makefile for the Ramaxel device drivers. +# + +obj-$(CONFIG_RAMAXEL_SPRAID) += spraid.o + +spraid-objs := spraid_main.o
drivers/scsi/spraid/spraid.h new file +693 -0
693 lines not on this page · raw message
drivers/scsi/spraid/spraid_main.c new file +3328 -0
2,247 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.27.0
Part of the diff is not shown here. View the raw message.
James Bottomley
maintainerQuoted 3 lines · Yanling Song
This initial commit contains Ramaxel's spraid module.
Signed-off-by Yanling Song <[email protected]>
Please stop. Something in your organization has sent this same email to the list over 20 times now. The headers seem to confirm it's something at your end not vger:
Received: ([email protected]) by vger.kernel.org via listexpand
id S1353875AbhKZOv4 (ORCPT
<rfc822;[email protected]>);
Fri, 26 Nov 2021 09:51:56 -0500Received: from email.unionmem.com ([221.4.138.186]:60920 "EHLO
VLXDG1SPAM1.ramaxel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1353445AbhKZOt4 (ORCPT <rfc822;[email protected]>); Fri, 26 Nov 2021 09:49:56 -0500
Received: from VLXDG1SPAM1.ramaxel.com (localhost [127.0.0.2] (may be
forged)) by VLXDG1SPAM1.ramaxel.com with ESMTP id 1AQ7rqwC023264 for <[email protected]>; Fri, 26 Nov 2021 15:53:52 +0800 (GMT-8) (envelope-from [email protected])
Received: from V12DG1MBS01.ramaxel.local (v12dg1mbs01.ramaxel.local
[172.26.18.31]) by VLXDG1SPAM1.ramaxel.com with ESMTPS id 1AQ7XF7m009870 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 26 Nov 2021 15:33:15 +0800 (GMT-8) (envelope-from [email protected])
Received: from localhost.localdomain (10.64.9.47) by
V12DG1MBS01.ramaxel.local (172.26.18.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Fri, 26 Nov 2021 15:33:15 +0800
From: Yanling Song <[email protected]> To: <[email protected]>, <[email protected]>
CC: <[email protected]>, <[email protected]>,
<[email protected]>
Subject: [PATCH V2] scsi:spraid: initial commit of Ramaxel spraid driver
Date: Fri, 26 Nov 2021 15:33:10 +0800
I'd guess whatever the problem is, it's at your outbound spam filter:
VLXDG1SPAM1.ramaxel.com
We can fix it at our end by blocking email from the ramaxel.com domain but that would be a bit drastic ...
James
Randy Dunlap
reviewerHi--
drivers/scsi/spraid/Kconfig line 7
Quoted 13 lines · Yanling Song
drivers/scsi/spraid/Kconfig new file +7
-0@@ -0,0 +1,10 @@ +# +# Ramaxel driver configuration +# + +config RAMAXEL_SPRAID + tristate "Ramaxel spraid Adapter" + depends on PCI && SCSI && BLK_DEV_BSGLIB
depends on PCI && SCSI select BLK_DEV_BSGLIB
should be OK since all other users of BLK_DEV_BSGLIB select it.
Quoted 3 lines
drivers/scsi/spraid/Kconfig new file +3
-0+ depends on ARM64 || X86_64 + help + This driver supports Ramaxel spraid driver.
Signature · 1 line
~Randy
A message that is not in the archive (sent off-list or not yet received): 20211130113449.45751209@songyl
Quoted 23 lines · Yanling Song
Quoted 20 lines · On Fri, 26 Nov 2021 11:24:10 -0800 Randy Dunlap <[email protected]> wrote:
Hi--
drivers/scsi/spraid/Kconfig line 7
Quoted 13 lines · Yanling Song
(quoted diff) +0
-0b/drivers/scsi/spraid/Kconfig new file mode 100644 index 000000000000..169412ef2299
drivers/scsi/spraid/Kconfig new file +7
-0@@ -0,0 +1,10 @@ +# +# Ramaxel driver configuration +# + +config RAMAXEL_SPRAID + tristate "Ramaxel spraid Adapter" + depends on PCI && SCSI && BLK_DEV_BSGLIBdepends on PCI && SCSI select BLK_DEV_BSGLIB
Quoted 10 lines
Quoted 1 line
should be OK since all other users of
BLK_DEV_BSGLIBselect it.OK, will change to "select" in the next version
Quoted 6 lines
Quoted 4 lines
drivers/scsi/spraid/Kconfig new file +3
-0+ depends on ARM64 || X86_64 + help + This driver supports Ramaxel spraid driver.
Something wrong with my company's email([email protected]), resend with another email account.
Quoted 22 lines · Yanling Song
This initial commit contains Ramaxel's spraid module.
Signed-off-by Yanling Song <[email protected]>Changes from V1:
1. Use BSG module to replace with ioctrl
2. Use author's email asMODULE_AUTHOR
3. Remove "default=m" indrivers/scsi/spraid/Kconfig
4. To be changed in the next version:
a. Use get_unaligned_be*() inspraid_setup_rw_cmd(); b. Usepr_debug()instead of introducingdev_log_dbg().--- Documentation/scsi/spraid.rst | 16 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/spraid/Kconfig | 10 + drivers/scsi/spraid/Makefile | 7 + drivers/scsi/spraid/spraid.h | 693 ++++++ drivers/scsi/spraid/spraid_main.c | 3328 +++++++++++++++++++++++++++++ 8 files changed, 4063 insertions(+)
Quoted 6 lines
create mode 100644
Documentation/scsi/spraid.rstcreate mode 100644drivers/scsi/spraid/Kconfigcreate mode 100644drivers/scsi/spraid/Makefilecreate mode 100644drivers/scsi/spraid/spraid.hcreate mode 100644drivers/scsi/spraid/spraid_main.c
Hmm.
This entire thing looks like an NVMe controller which is made to look like a SCSI controller.
It even uses most of the NVMe structures.
And from what I've seen there is not much SCSI specific in here; I/O and queue setup is pretty much what every NVMe controller does. So why not make it a true NVMe controller?
Yes, you would need to discuss with the NVMe folks on how a RAID controller should look like in NVMe terms. But overall I guess the driver would be far smaller and possibly easier to maintain.
So where's the benefit having it as a SCSI driver (apart from the fact that is allows you to side-step having to discuss the interface with NVMexpress.org ...)? Or, to put it the other way round: Is there anything SCSI specific which would prevent such an approach?
Cheers,
Hannes
Signature · 2 lines
Dr. Hannes Reinecke <[email protected]> <insert signature here>
A message that is not in the archive (sent off-list or not yet received): 20211130113836.1bb8e91c@songyl
Quoted 51 lines · Yanling Song
Quoted 41 lines · On Mon, 29 Nov 2021 14:04:12 +0100 Hannes Reinecke <[email protected]> wrote:
Quoted 21 lines · Yanling Song
This initial commit contains Ramaxel's spraid module.
Signed-off-by Yanling Song <[email protected]>Changes from V1:
1. Use BSG module to replace with ioctrl
2. Use author's email asMODULE_AUTHOR
3. Remove "default=m" indrivers/scsi/spraid/Kconfig
4. To be changed in the next version:
a. Use get_unaligned_be*() inspraid_setup_rw_cmd(); b. Usepr_debug()instead of introducingdev_log_dbg().--- Documentation/scsi/spraid.rst | 16 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/spraid/Kconfig | 10 + drivers/scsi/spraid/Makefile | 7 + drivers/scsi/spraid/spraid.h | 693 ++++++ drivers/scsi/spraid/spraid_main.c | 3328Quoted 7 lines
+++++++++++++++++++++++++++++ 8 files changed, 4063 insertions(+)
create mode 100644Documentation/scsi/spraid.rstcreate mode 100644drivers/scsi/spraid/Kconfig
create mode 100644drivers/scsi/spraid/Makefilecreate mode 100644drivers/scsi/spraid/spraid.hcreate mode 100644drivers/scsi/spraid/spraid_main.cHmm.
This entire thing looks like an NVMe controller which is made to look like a SCSI controller.
It even uses most of the NVMe structures.
And from what I've seen there is not much SCSI specific in here; I/O and queue setup is pretty much what every NVMe controller does. So why not make it a true NVMe controller?
Yes, you would need to discuss with the NVMe folks on how a RAID controller should look like in NVMe terms.
But overall I guess the driver would be far smaller and possibly easier to maintain.Quoted 6 lines
So where's the benefit having it as a SCSI driver (apart from the fact that is allows you to side-step having to discuss the interface with NVMexpress.org ...)?
Or, to put it the other way round: Is there anything SCSI specific which would prevent such an approach?
Quoted 8 lines
Actually it is a SCSI driver, and it does register a
scsi_host_templateand host does send SCSI commands to our raid controller just like other raid controllers. You are right "it looks a lot like NVMe" since we believe the communication mechanism of NVME between host and the end device is good and it was leveraged when we designed the raid controller. That's why it looks like there are some code from NVME because the mechanism is the same.
Thank you, but that was precisely my question.
Seeing that the driver is using the NVMe mechanism to communicate commands between the driver and the hardware, doesn't it make it a NVMe driver?
Especially as you are sending NVMe commands and not SCSI commands, so you always will have to re-write the incoming SCSI commands into NVMe commands, and knowing from experience this is not a good fit.
Hence my question: what exactly is SCSI specific on the hardware side? Wouldn't an implementation as a NVMe driver be a better fit, as then you could leverage all the existing code like setup prps, completion handling etc?
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
Quoted 69 lines · Hannes Reinecke
Quoted 51 lines · Yanling Song
Quoted 41 lines · On Mon, 29 Nov 2021 14:04:12 +0100 Hannes Reinecke <[email protected]> wrote:
Quoted 21 lines · Yanling Song
This initial commit contains Ramaxel's spraid module.
Signed-off-by Yanling Song <[email protected]>Changes from V1:
1. Use BSG module to replace with ioctrl
2. Use author's email asMODULE_AUTHOR
3. Remove "default=m" indrivers/scsi/spraid/Kconfig
4. To be changed in the next version:
a. Use get_unaligned_be*() inspraid_setup_rw_cmd(); b. Usepr_debug()instead of introducingdev_log_dbg().--- Documentation/scsi/spraid.rst | 16 + MAINTAINERS | 7 + drivers/scsi/Kconfig | 1 + drivers/scsi/Makefile | 1 + drivers/scsi/spraid/Kconfig | 10 + drivers/scsi/spraid/Makefile | 7 + drivers/scsi/spraid/spraid.h | 693 ++++++ drivers/scsi/spraid/spraid_main.c | 3328Quoted 7 lines
+++++++++++++++++++++++++++++ 8 files changed, 4063 insertions(+)
create mode 100644Documentation/scsi/spraid.rstcreate mode 100644drivers/scsi/spraid/Kconfig
create mode 100644drivers/scsi/spraid/Makefilecreate mode 100644drivers/scsi/spraid/spraid.hcreate mode 100644drivers/scsi/spraid/spraid_main.cHmm.
This entire thing looks like an NVMe controller which is made to look like a SCSI controller.
It even uses most of the NVMe structures.
And from what I've seen there is not much SCSI specific in here; I/O and queue setup is pretty much what every NVMe controller does. So why not make it a true NVMe controller?
Yes, you would need to discuss with the NVMe folks on how a RAID controller should look like in NVMe terms.
But overall I guess the driver would be far smaller and possibly easier to maintain.Quoted 6 lines
So where's the benefit having it as a SCSI driver (apart from the fact that is allows you to side-step having to discuss the interface with NVMexpress.org ...)?
Or, to put it the other way round: Is there anything SCSI specific which would prevent such an approach?Quoted 8 lines
Actually it is a SCSI driver, and it does register a
scsi_host_templateand host does send SCSI commands to our raid controller just like other raid controllers. You are right "it looks a lot like NVMe" since we believe the communication mechanism of NVME between host and the end device is good and it was leveraged when we designed the raid controller. That's why it looks like there are some code from NVME because the mechanism is the same.Thank you, but that was precisely my question.
Seeing that the driver is using the NVMe mechanism to communicate commands between the driver and the hardware, doesn't it make it a NVMe driver?
Especially as you are sending NVMe commands and not SCSI commands, so you always will have to re-write the incoming SCSI commands into NVMe commands, and knowing from experience this is not a good fit.
Quoted 5 lines
Hence my question: what exactly is SCSI specific on the hardware side? Wouldn't an implementation as a NVMe driver be a better fit, as then you could leverage all the existing code like setup prps, completion handling etc?
Our controller supports both SCSI and NVMe. In current raid mode, it only supports SAS/SATA disks.
and reports SCSI disk to host after creating raid group. In this use case, SCSI is the protocol and the spraid driver is needed.
In another mode, controller can support NVMe disks and works with the NVMe driver in linux kernel.
To reduce the complexity, NVMe mechanism is used as the communication method between driver and controller so that we can use the same interface for both SCSI and NVMe.
Quoted 4 lines
Cheers,
Hannes
Quoted 9 lines · Hannes Reinecke
This entire thing looks like an NVMe controller which is made to look like a SCSI controller.
It even uses most of the NVMe structures.
And from what I've seen there is not much SCSI specific in here; I/O and queue setup is pretty much what every NVMe controller does. So why not make it a true NVMe controller?
Yes, you would need to discuss with the NVMe folks on how a RAID controller should look like in NVMe terms. But overall I guess the driver would be far smaller and possibly easier to maintain.So where's the benefit having it as a SCSI driver (apart from the fact that is allows you to side-step having to discuss the interface with NVMexpress.org ...)? Or, to put it the other way round: Is there anything SCSI specific which would prevent such an approach?
Hi Hannes,
Isn't every driver that defines a struct scsi_host_template by definition a SCSI driver?
If there is enough code that is shared between the spraid driver and the NVMe core one could look into creating a library with the shared code. However, I'm not sure this is worth the effort nor that the NVMe maintainers will agree with this.
Thanks,
Bart.
drivers/scsi/spraid/spraid.h line 224
Quoted 2 lines · Yanling Song
drivers/scsi/spraid/spraid.h new file +2
-0+struct spraid_dev { +struct pci_dev *pdev;
Why a pointer to struct pci_dev instead of embedding struct pci_dev in this structure? The latter approach is more efficient.
drivers/scsi/spraid/spraid.h line 225
Quoted 1 line
drivers/scsi/spraid/spraid.h new file +1
-0+struct device *dev;
What does this pointer represent? There is already a struct device inside struct pci_dev. Can this member be left out?
Quoted 5 lines
drivers/scsi/spraid/spraid.h new file +5
-0+struct spraid_cmd *adm_cmds; +struct list_head adm_cmd_list; +spinlock_t adm_cmd_lock;/* spinlock for lock handling */ + +struct spraid_cmd *ioq_ptcmds;
drivers/scsi/spraid/spraid.h line 262
Quoted 10 lines
drivers/scsi/spraid/spraid.h new file +10
-0+struct list_head ioq_pt_list; +spinlock_t ioq_pt_lock;/* spinlock for lock handling */ + +struct work_struct scan_work; +struct work_struct timesyn_work; +struct work_struct reset_work; + +enum spraid_state state; +spinlock_t state_lock;/* spinlock for lock handling */ +struct request_queue *bsg_queue;
The "spinlock for lock handling" comments are not useful. Please make these comments useful or remove these.
Quoted 1 line
+#include <
linux/version.h>
Upstream drivers should not include this header file.
Quoted 9 lines
drivers/scsi/spraid/spraid_main.c new file +9
-0+static u32 admin_tmout =60 ; +module_param (admin_tmout, uint,0644 ); +MODULE_PARM_DESC (admin_tmout,"admin commands timeout (seconds)" ); + +static u32 scmd_tmout_pt =30 ; +module_param (scmd_tmout_pt, uint,0644 ); +MODULE_PARM_DESC (scmd_tmout_pt,"scsi commands timeout for passthrough(seconds)" ); + +static u32 scmd_tmout_nonpt =180 ;
drivers/scsi/spraid/spraid_main.c line 58
Quoted 10 lines
drivers/scsi/spraid/spraid_main.c new file +10
-0+module_param (scmd_tmout_nonpt, uint,0644 ); +MODULE_PARM_DESC (scmd_tmout_nonpt,"scsi commands timeout for rawdisk&raid(seconds)" ); + +static u32 wait_abl_tmout =3 ; +module_param (wait_abl_tmout, uint,0644 ); +MODULE_PARM_DESC (wait_abl_tmout,"wait abnormal io timeout(seconds)" ); + +static bool use_sgl_force; +module_param (use_sgl_force, bool,0644 ); +MODULE_PARM_DESC (use_sgl_force,"force IO use sgl format, default false" );
Consider leaving out all kernel module parameters. Kernel module parameters are easy to introduce but can't be removed. Is it really necessary that the above parameters can be configured? If so, most of the above parameters probably should be per SCSI host or SCSI device instead of module parameters.
drivers/scsi/spraid/spraid_main.c line 68
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static u32 io_queue_depth =1024 ; +module_param_cb (io_queue_depth, &ioq_depth_ops, &io_queue_depth,0644 ); +MODULE_PARM_DESC (io_queue_depth,"set io queue depth, should >= 2" );
How does this differ from the SCSI sysfs attribute "can_queue"?
drivers/scsi/spraid/spraid_main.c line 89
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static unsigned char log_debug_switch; +module_param_cb (log_debug_switch, &log_debug_switch_ops, &log_debug_switch,0644 ); +MODULE_PARM_DESC (log_debug_switch,"set log state, default non-zero for switch on" );
Can this parameter be left out by using pr_debug()?
drivers/scsi/spraid/spraid_main.c line 115
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static unsigned char small_pool_num =4 ; +module_param_cb (small_pool_num, &small_pool_num_ops, &small_pool_num,0644 ); +MODULE_PARM_DESC (small_pool_num,"set prp small pool num, default 4, MAX 16" );
The description of the above parameter is too cryptic.
Thanks,
Bart.
Quoted 8 lines · Bart Van Assche
Quoted 2 lines · Yanling Song
+struct
spraid_dev{
+ structpci_dev*pdev;Why a pointer to struct
pci_devinstead of embedding structpci_devin this structure? The latter approach is more efficient.
The pointer of pci_dev is from linux driver frame work probe() function, spraid driver does not allocate memory for it, just save the pointer.
Quoted 5 lines
Quoted 1 line
+ struct device *dev;
What does this pointer represent? There is already a struct device inside struct
pci_dev. Can this member be left out?
The pointer of dev is from struct pci_dev. It is saved in struct spraid_dev just for convenience:
so that we do not need to get the dev from pci_dev every time when using dev.
Quoted 10 lines
Quoted 10 lines
+ struct
spraid_cmd*adm_cmds;
+ structlist_headadm_cmd_list;
+spinlock_tadm_cmd_lock; /* spinlock for lock handling */drivers/scsi/spraid/spraid.h new file +7
-0+ +struct spraid_cmd *ioq_ptcmds; +struct list_head ioq_pt_list; +spinlock_t ioq_pt_lock;/* spinlock for lock handling */ + +struct work_struct scan_work; +struct work_struct timesyn_work;
Quoted 9 lines
Quoted 5 lines
+ struct
work_structreset_work;
+
+ enumspraid_statestate;
+spinlock_tstate_lock; /* spinlock for lock handling */
+ structrequest_queue*bsg_queue;The "spinlock for lock handling" comments are not useful. Please make these comments useful or remove these.
Comments will be removed in the next version.
Quoted 4 lines
Quoted 1 line
+#include <
linux/version.h>Upstream drivers should not include this header file.
Ok. Changes will be included in the next version.
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 43
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +4
-0+static u32 admin_tmout =60 ; +module_param (admin_tmout, uint,0644 ); +MODULE_PARM_DESC (admin_tmout,"admin commands timeout (seconds)" ); +
Will be changed to per SCSI host.
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 47
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +4
-0+static u32 scmd_tmout_pt =30 ; +module_param (scmd_tmout_pt, uint,0644 ); +MODULE_PARM_DESC (scmd_tmout_pt,"scsi commands timeout for passthrough(seconds)" ); +
Will be deleted.
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 51
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +4
-0+static u32 scmd_tmout_nonpt =180 ; +module_param (scmd_tmout_nonpt, uint,0644 ); +MODULE_PARM_DESC (scmd_tmout_nonpt,"scsi commands timeout for rawdisk&raid(seconds)" ); +
Will be splitted into two attributes of scsi host:scmd_tmout_rawdisk, scmd_tmout_vd
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 55
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +4
-0+static u32 wait_abl_tmout =3 ; +module_param (wait_abl_tmout, uint,0644 ); +MODULE_PARM_DESC (wait_abl_tmout,"wait abnormal io timeout(seconds)" ); +
Will be deleted.
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 58
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static bool use_sgl_force; +module_param (use_sgl_force, bool,0644 ); +MODULE_PARM_DESC (use_sgl_force,"force IO use sgl format, default false" );
Will be deleted.
Quoted 5 lines
Consider leaving out all kernel module parameters. Kernel module parameters are easy to introduce but can't be removed. Is it really necessary that the above parameters can be configured? If so, most of the above parameters probably should be per SCSI host or SCSI device instead of module parameters.
Comments as the above.
Quoted 6 lines
drivers/scsi/spraid/spraid_main.c line 68
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static u32 io_queue_depth =1024 ; +module_param_cb (io_queue_depth, &ioq_depth_ops, &io_queue_depth,0644 ); +MODULE_PARM_DESC (io_queue_depth,"set io queue depth, should >= 2" );How does this differ from the SCSI sysfs attribute "
can_queue"?
Yes. it is the same as SCSI sysfs attribute "can_queue".
The maximum queue depth supported by hardware is 1024.
The parameter is to change the queue depth for different usages to get the best performance.
Quoted 6 lines
drivers/scsi/spraid/spraid_main.c line 89
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static unsigned char log_debug_switch; +module_param_cb (log_debug_switch, &log_debug_switch_ops, &log_debug_switch,0644 ); +MODULE_PARM_DESC (log_debug_switch,"set log state, default non-zero for switch on" );Can this parameter be left out by using
pr_debug()?
Ye. Will use pr_debug in the next version.
Quoted 6 lines
drivers/scsi/spraid/spraid_main.c line 115
Quoted 3 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static unsigned char small_pool_num =4 ; +module_param_cb (small_pool_num, &small_pool_num_ops, &small_pool_num,0644 ); +MODULE_PARM_DESC (small_pool_num,"set prp small pool num, default 4, MAX 16" );The description of the above parameter is too cryptic.
Will add more comments:
It was found that the spindlock of a single pool conflicts a lot with multiple CPUs. So multiple pools are introduced to reduce the conflictions.
Quoted 3 lines
Thanks,
Bart.
Quoted 64 lines · On Sun, 12 Dec 2021 02:56:01 +0000 [email protected] wrote:
December 10, 2021 7:15 AM, "Bart Van Assche" <[email protected]>
Quoted 8 lines · wrote:
Quoted 2 lines · Yanling Song
+struct
spraid_dev{
+ structpci_dev*pdev;Why a pointer to struct
pci_devinstead of embedding structpci_devin this structure? The latter approach is more efficient.The pointer of
pci_devis from linux driver frame workprobe()function, spraid driver does not allocate memory for it, just save the pointer.Quoted 5 lines
Quoted 1 line
+ struct device *dev;
What does this pointer represent? There is already a struct device inside struct
pci_dev. Can this member be left out?The pointer of dev is from struct
pci_dev. It is saved in structspraid_devjust for convenience: so that we do not need to get the dev frompci_devevery time when using dev.Quoted 10 lines
Quoted 10 lines
+ struct
spraid_cmd*adm_cmds;
+ structlist_headadm_cmd_list;
+spinlock_tadm_cmd_lock; /* spinlock for lock handling */drivers/scsi/spraid/spraid.h new file +7
-0+ +struct spraid_cmd *ioq_ptcmds; +struct list_head ioq_pt_list; +spinlock_t ioq_pt_lock;/* spinlock for lock handling */ + +struct work_struct scan_work; +struct work_struct timesyn_work;Quoted 9 lines
Quoted 5 lines
+ struct
work_structreset_work;
+
+ enumspraid_statestate;
+spinlock_tstate_lock; /* spinlock for lock handling */
+ structrequest_queue*bsg_queue;The "spinlock for lock handling" comments are not useful. Please make these comments useful or remove these.
Comments will be removed in the next version.
Quoted 4 lines
Quoted 1 line
+#include <
linux/version.h>Upstream drivers should not include this header file.
Ok. Changes will be included in the next version.
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c line 43
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +4
-0+static u32 admin_tmout =60 ; +module_param (admin_tmout, uint,0644 ); +MODULE_PARM_DESC (admin_tmout,"admin commands timeout (seconds)" ); +Will be changed to per SCSI host.
Quoted 5 lines
Quoted 5 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static u32 scmd_tmout_pt =30 ; +module_param (scmd_tmout_pt, uint,0644 ); +MODULE_PARM_DESC(scmd_tmout_pt, "scsi commands timeout forpassthrough(seconds)");
+Will be deleted.
Quoted 8 lines
Quoted 5 lines
Quoted 5 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static u32 scmd_tmout_nonpt =180 ; +module_param (scmd_tmout_nonpt, uint,0644 ); +MODULE_PARM_DESC(scmd_tmout_nonpt, "scsi commands timeout forrawdisk&raid(seconds)");
+Will be splitted into two attributes of scsi host:scmd_tmout_rawdisk,
scmd_tmout_vd
After the internal discussion, the two parameters will be removed for now.
Quoted 60 lines
Quoted 5 lines
Quoted 5 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static u32 wait_abl_tmout =3 ; +module_param (wait_abl_tmout, uint,0644 ); +MODULE_PARM_DESC(wait_abl_tmout, "wait abnormal iotimeout(seconds)");
+Will be deleted.
Quoted 5 lines
Quoted 4 lines
drivers/scsi/spraid/spraid_main.c new file +3
-0+static bool use_sgl_force; +module_param (use_sgl_force, bool,0644 ); +MODULE_PARM_DESC(use_sgl_force, "force IO use sgl format, defaultfalse");
Will be deleted.
Quoted 5 lines
Consider leaving out all kernel module parameters. Kernel module parameters are easy to introduce but can't be removed. Is it really necessary that the above parameters can be configured? If so, most of the above parameters probably should be per SCSI host or SCSI device instead of module parameters.
Comments as the above.
Quoted 7 lines
Quoted 4 lines
(quoted diff) +2
-0+static u32 io_queue_depth = 1024; +module_param_cb(io_queue_depth, &ioq_depth_ops, &io_queue_depth,0644); +MODULE_PARM_DESC(io_queue_depth, "set io queue depth, should >= 2");
How does this differ from the SCSI sysfs attribute "
can_queue"?Yes. it is the same as SCSI sysfs attribute "
can_queue". The maximum queue depth supported by hardware is 1024. The parameter is to change the queue depth for different usages to get the best performance.Quoted 7 lines
Quoted 4 lines
(quoted diff) +2
-0+static unsigned char log_debug_switch; +module_param_cb(log_debug_switch, &log_debug_switch_ops,
&log_debug_switch, 0644); +MODULE_PARM_DESC(log_debug_switch, "set log state, default non-zero for switch on");Can this parameter be left out by using
pr_debug()?Ye. Will use
pr_debugin the next version.Quoted 7 lines
Quoted 4 lines
(quoted diff) +2
-0+static unsigned char small_pool_num = 4; +module_param_cb(small_pool_num, &small_pool_num_ops,
&small_pool_num, 0644); +MODULE_PARM_DESC(small_pool_num, "set prp small pool num, default 4, MAX 16");The description of the above parameter is too cryptic.
Will add more comments:
It was found that the spindlock of a single pool conflicts a lot with multiple CPUs. So multiple pools are introduced to reduce the conflictions.Quoted 3 lines
Thanks,
Bart.
drivers/scsi/spraid/Kconfig line 8
Quoted 4 lines · Yanling Song
drivers/scsi/spraid/Kconfig new file +4
-0+config RAMAXEL_SPRAID + tristate "Ramaxel spraid Adapter" + depends on PCI && SCSI && BLK_DEV_BSGLIB + depends on ARM64 || X86_64
Why is this driver restricted to ARM64 and X86_64 systems? What prevents compilation of this driver on other CPU architectures?
drivers/scsi/spraid/Kconfig line 10
Quoted 2 lines
drivers/scsi/spraid/Kconfig new file +2
-0+ help + This driver supports Ramaxel spraid driver.
The help text is too short. Please add one or two sentences about the interface type of this RAID controller (PCIe?) and also about the storage media supported by this RAID controller (SAS? SATA? any other?).
drivers/scsi/spraid/spraid.h line 606
Quoted 8 lines
drivers/scsi/spraid/spraid.h new file +8
-0+struct spraid_bsg_request { +u32 msgcode; +u32 control; +union { +struct spraid_passthru_common_cmd admcmd; +struct spraid_ioq_passthru_cmd ioqcmd; + }; +};
Definitions like the above are required by user space software that uses the BSG interface and hence should be moved into a header file under include/uapi/. See e.g. include/uapi/scsi/scsi_bsg_ufs.h.
Thanks,
Bart.
Quoted 9 lines · Bart Van Assche
Quoted 4 lines · Yanling Song
+config
RAMAXEL_SPRAID
+ tristate "Ramaxel spraid Adapter"
+ depends on PCI && SCSI &&BLK_DEV_BSGLIB
+ depends on ARM64 ||X86_64Why is this driver restricted to ARM64 and
X86_64systems? What prevents compilation of this driver on other CPU architectures?
The target market of spraid controller is ARM and X86.
In theory, spraid driver can also work on other CPU architectures but not tested yet.
Quoted 7 lines
Quoted 2 lines
+ help
+ This driver supports Ramaxel spraid driver.The help text is too short. Please add one or two sentences about the interface type of this RAID controller (PCIe?) and also about the storage media supported by this RAID controller (SAS? SATA? any other?).
More help text will be included in the next version:
This driver supports Ramaxel SPRxxx serial raid controller, which has PCIE Gen4 interface with host
and supports SAS/SATA Hdd/ssd.
Quoted 4 lines
Quoted 4 lines
+struct
spraid_bsg_request{
+ u32 msgcode;
+ u32 control;
+ union {
Quoted 9 lines
Quoted 4 lines
+ struct
spraid_passthru_common_cmdadmcmd; + struct spraid_ioq_passthru_cmd ioqcmd; + };
+};Definitions like the above are required by user space software that uses the BSG interface and hence should be moved into a header file under
include/uapi/. See e.g.include/uapi/scsi/scsi_bsg_ufs.h.
The definitions are for our own private tool and cannot be used by others.
Does it make sense to put it in include/uapi/scsi?
Quoted 3 lines
Thanks,
Bart.
drivers/scsi/spraid/spraid_main.c line 3084
Quoted 7 lines · Yanling Song
drivers/scsi/spraid/spraid_main.c new file +7
-0+/* bsg dispatch user command */ +static int spraid_bsg_host_dispatch (struct bsg_job *job) +{ +struct Scsi_Host *shost =dev_to_shost (job->dev); +struct spraid_dev *hdev =shost_priv (shost); +struct request *rq =blk_mq_rq_from_pdu (job); +struct spraid_bsg_request *bsg_req = (struct spraid_bsg_request *)(job->request);
Since job->request has type 'void *', no cast is necessary when assigning job->request to bsg_req. Hence please leave out the cast.
Thanks,
Bart.
Quoted 12 lines · Bart Van Assche
drivers/scsi/spraid/spraid_main.c line 3084
Quoted 7 lines · Yanling Song
drivers/scsi/spraid/spraid_main.c new file +7
-0+/* bsg dispatch user command */ +static int spraid_bsg_host_dispatch (struct bsg_job *job) +{ + struct Scsi_Host *shost = dev_to_shost(job->dev); + struct spraid_dev *hdev = shost_priv(shost); + struct request *rq = blk_mq_rq_from_pdu(job); + struct spraid_bsg_request *bsg_req = (struct spraid_bsg_request *)(job->request);Since
job->requesthas type 'void *', no cast is necessary when assigningjob->requesttobsg_req. Hence please leave out the cast.
Ok. The cast will be removed in the next verison.
Quoted 3 lines
Thanks,
Bart.