Bart Van Assche
4bc26113c6
scsi: ufs: Split the ufshcd.h header file
...
Split the ufshcd.h header file into a header file that defines the
interface used by UFS drivers and another header file with declarations and
data structures only used by the UFS core.
Link: https://lore.kernel.org/r/20220419225811.4127248-27-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
3f06f7800b
scsi: ufs: Minimize #include directives
...
Follow the convention that is used elsewhere in the Linux kernel source
code and only include those headers of which the declarations are used
directly.
Link: https://lore.kernel.org/r/20220419225811.4127248-26-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
cff91daf52
scsi: ufs: Fix kernel-doc syntax in ufshcd.h
...
This patch fixes all the warnings and errors reported by the following
command:
scripts/kernel-doc -none drivers/scsi/ufs/ufshcd.h
Link: https://lore.kernel.org/r/20220419225811.4127248-25-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:04 -04:00
Bart Van Assche
c10d52d73a
scsi: ufs: Remove unnecessary ufshcd-crypto.h include directives
...
ufshcd-crypto.h declares functions that must only be called by the UFS
core. Hence remove the #include "ufshcd-crypto.h" directive from UFS
drivers.
Link: https://lore.kernel.org/r/20220419225811.4127248-24-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Eric Biggers <ebiggers@google.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
bee40dc167
scsi: ufs: qcom: Fix ufs_qcom_resume()
...
Clearing hba->is_sys_suspended if ufs_qcom_resume() succeeds is wrong. That
variable must only be cleared if all actions involved in a resume succeed.
Hence remove the statement that clears hba->is_sys_suspended from
ufs_qcom_resume().
Link: https://lore.kernel.org/r/20220419225811.4127248-23-bvanassche@acm.org
Fixes: 81c0fc51b7 ("ufs-qcom: add support for Qualcomm Technologies Inc platforms")
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
ad8a647e77
scsi: ufs: Introduce ufshcd_clkgate_delay_set()
...
Since the code to modify delay_ms while holding the host lock occurs twice,
introduce a function that performs this action.
Link: https://lore.kernel.org/r/20220419225811.4127248-22-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
3fb20fcd93
scsi: ufs: Remove locking from around single register writes
...
Single register writes are atomic and hence do not need to be surrounded by
locking. Additionally, MMIO writes are typically posted asynchronously.
Hence, there is no guarantee that these have finished by the time the
spin_unlock*() call has finished. See also the nonposted-mmio property of
the Open Firmware tree. See also pci_iomap().
Link: https://lore.kernel.org/r/20220419225811.4127248-21-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
21c2e3418d
scsi: ufs: Remove the TRUE and FALSE definitions
...
In the Linux kernel coding style document
(Documentation/process/coding-style.rst) it is recommended to use the type
'bool' and also the values 'true' and 'false'. Hence this patch that
removes the definitions and uses of TRUE and FALSE from the UFS driver.
Link: https://lore.kernel.org/r/20220419225811.4127248-20-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
d0c1725b1e
scsi: ufs: Remove paths from source code comments
...
Since specifying the path in a source file is redundant, remove the paths
from source code comments.
Link: https://lore.kernel.org/r/20220419225811.4127248-19-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
2b10863f71
scsi: ufs: Use an SPDX license identifier in the Kconfig file
...
As requested in Documentation/process/license-rules.rst, use an SPDX
license identifier.
Link: https://lore.kernel.org/r/20220419225811.4127248-18-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
e2106584d0
scsi: ufs: Rename sdev_ufs_device into ufs_device_wlun
...
The new name reflects the role of this member variable better: a WLUN
through which the power mode of the UFS device is controlled.
Link: https://lore.kernel.org/r/20220419225811.4127248-17-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
b4ade33b0d
scsi: ufs: Remove the driver version
...
The current version number is 0.2. That driver version was assigned more
than nine years ago. A version number that is not updated while the driver
is updated is not useful. Hence remove the driver version number from the
UFS driver. See also commit e0eca63e34 ("[SCSI] ufs: Separate PCI code
into glue driver").
Link: https://lore.kernel.org/r/20220419225811.4127248-16-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
c906e8328d
scsi: ufs: Make the config_scaling_param calls type safe
...
Pass the actual type to config_scaling_param callback as the third argment
instead of a void pointer. Remove a superfluous NULL pointer check from
ufs_qcom_config_scaling_param().
Link: https://lore.kernel.org/r/20220419225811.4127248-15-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:03 -04:00
Bart Van Assche
778d2b0ec6
scsi: ufs: Switch to aggregate initialization
...
Make it easier to verify for humans that ufshcd_init_pwr_dev_param()
initializes all structure members. This patch does not change any
functionality.
Link: https://lore.kernel.org/r/20220419225811.4127248-14-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
9474c64e83
scsi: ufs: Remove unused constants and code
...
Commit 5b44a07b6b ("scsi: ufs: Remove pre-defined initial voltage values
of device power") removed the code that uses the UFS_VREG_VCC* constants
and also the code that sets the min_uV and max_uV member variables. Hence
also remove these constants and that member variable.
Link: https://lore.kernel.org/r/20220419225811.4127248-13-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
acbbfe484f
scsi: ufs: Invert the return value of ufshcd_is_hba_active()
...
It is confusing that ufshcd_is_hba_active() returns 'true' if the HBA is
not active. Clear up this confusion by inverting the return value of
ufshcd_is_hba_active(). This patch does not change any functionality.
Link: https://lore.kernel.org/r/20220419225811.4127248-12-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
aead21f32a
scsi: ufs: Declare the quirks array const
...
Declare the quirks array and also its 'model' member const to make it
explicit that these are not modified.
Link: https://lore.kernel.org/r/20220419225811.4127248-11-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
25eff2f543
scsi: ufs: Rename struct ufs_dev_fix into ufs_dev_quirk
...
Since struct ufs_dev_fix contains quirk information, rename it into struct
ufs_dev_quirk.
Link: https://lore.kernel.org/r/20220419225811.4127248-10-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
dd2cf44ff4
scsi: ufs: Remove the UFS_FIX() and END_FIX() macros
...
Since these two macros reduce code readability, remove them.
Link: https://lore.kernel.org/r/20220419225811.4127248-9-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
9d3ab17e84
scsi: ufs: Use get_unaligned_be16() instead of be16_to_cpup()
...
Use get_unaligned_be16(...) instead of the equivalent but harder to read
be16_to_cpup((__be16 *)...).
Link: https://lore.kernel.org/r/20220419225811.4127248-8-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
1de4378f60
scsi: ufs: Remove ufshcd_lrb.sense_buffer
...
ufshcd_lrb.sense_buffer is NULL if ufshcd_lrb.cmd is NULL and
ufshcd_lrb.sense_buffer points at cmd->sense_buffer if ufshcd_lrb.cmd is
set. In other words, the ufshcd_lrb.sense_buffer member is identical to
cmd->sense_buffer. Hence this patch that removes the
ufshcd_lrb.sense_buffer structure member.
Link: https://lore.kernel.org/r/20220419225811.4127248-7-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
b639b59b44
scsi: ufs: Remove ufshcd_lrb.sense_bufflen
...
ufshcd_lrb.sense_bufflen is set but never read. Hence remove this struct
member.
Link: https://lore.kernel.org/r/20220419225811.4127248-6-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Keoseong Park <keosung.park@samsung.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
a858af9a9e
scsi: ufs: Simplify statements that return a boolean
...
Convert "if (expr) return true; else return false;" into "return expr;" if
either 'expr' is a boolean expression or the return type of the function is
'bool'.
Link: https://lore.kernel.org/r/20220419225811.4127248-5-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org >
Reviewed-by: Keoseong Park <keosung.park@samsung.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
51d1628fc4
scsi: ufs: Remove superfluous boolean conversions
...
Remove "? true : false" if the preceding expression yields a boolean or if
the result of the expression is assigned to a boolean since in these two
cases the "? true : false" part is superfluous.
Link: https://lore.kernel.org/r/20220419225811.4127248-4-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:02 -04:00
Bart Van Assche
59a57bb79e
scsi: ufs: Declare ufshcd_wait_for_register() static
...
Declare this function static since it is only used inside the ufshcd.c
source file.
Link: https://lore.kernel.org/r/20220419225811.4127248-3-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:01 -04:00
Bart Van Assche
2abe580023
scsi: ufs: Fix a spelling error in a source code comment
...
Change one occurrence of "adpater" into "adapter".
Link: https://lore.kernel.org/r/20220419225811.4127248-2-bvanassche@acm.org
Tested-by: Bean Huo <beanhuo@micron.com >
Reviewed-by: Avri Altman <avri.altman@wdc.com >
Reviewed-by: Bean Huo <beanhuo@micron.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:01 -04:00
Konstantin Vyshetsky
a4e6496fca
scsi: ufs: core: Increase fDeviceInit poll frequency
...
UFS devices are expected to clear fDeviceInit flag in single digit
milliseconds. Current values of 5 to 10 millisecond sleep add to increased
latency during the initialization and resume path. This CL lowers the sleep
range to 500 to 1000 microseconds.
Link: https://lore.kernel.org/r/20220421002429.3136933-1-bvanassche@acm.org
Acked-by: Avri Altman <avri.altman@wdc.com >
Signed-off-by: Konstantin Vyshetsky <vkon@google.com >
Signed-off-by: Bart Van Assche <bvanassche@acm.org >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 23:23:01 -04:00
Damien Le Moal
fe413ab32b
scsi: mpt3sas: Fix adapter replyPostRegisterIndex declaration
...
The replyPostRegisterIndex array of struct MPT3SAS_ADAPTER stores iomem
resource addresses. Fix its declaration to annotate it with __iomem to
avoid sparse warnings for writel() calls using the stored addresses.
Link: https://lore.kernel.org/r/20220307234854.148145-6-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:30:05 -04:00
Damien Le Moal
82b4420c28
scsi: mpt3sas: Fix event callback log_code value handling
...
In mpt3sas_scsih_event_callback(), fix a sparse warning when testing the
event log code value by replacing the use of a pointer to the address
storing the event log code with a log code local variable. Doing so,
le32_to_cpu() is used when the log code value is assigned, avoiding a
sparse warning.
Link: https://lore.kernel.org/r/20220307234854.148145-5-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:30:04 -04:00
Damien Le Moal
7ab4d2441b
scsi: mpt3sas: Fix ioc->base_readl() use
...
The functions _base_readl_aero() and _base_readl() used for an adapter
base_readl() method are implemented using a regular readl() call which
internally performs a conversion to CPU endianness (le32_to_cpu()) of
the values read. The users of the ioc base_readl() method should thus
not convert again the values read using le16_to_cpu().
Fixing this removes sparse warnings.
Link: https://lore.kernel.org/r/20220307234854.148145-4-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:30:04 -04:00
Damien Le Moal
b4efbec4c2
scsi: mpt3sas: Fix writel() use
...
writel() internally executes cpu_to_le32() to convert the value being
written to little endian. The caller should thus not use this conversion
function for the value passed to writel(). Remove the cpu_to_le32() calls
in _base_put_smid_scsi_io_atomic(), _base_put_smid_fast_path_atomic(),
_base_put_smid_hi_priority_atomic() _base_put_smid_default_atomic() and
_base_handshake_req_reply_wait().
Link: https://lore.kernel.org/r/20220307234854.148145-3-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:30:04 -04:00
Damien Le Moal
dceaef94a4
scsi: mpt3sas: Fix _ctl_set_task_mid() TaskMID check
...
The TaskMID field of struct Mpi2SCSITaskManagementRequest_t is a 16-bit
little endian value. Fix the search loop in _ctl_set_task_mid() to add a
cpu_to_le16() conversion before checking the value of TaskMID to avoid
sparse warnings. While at it, simplify the search loop code to remove an
unnecessarily complicated if condition.
Link: https://lore.kernel.org/r/20220307234854.148145-2-damien.lemoal@opensource.wdc.com
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:30:04 -04:00
Gleb Chesnokov
ad14649fc5
scsi: qla2xxx: Remove free_sg command flag
...
The use of the free_sg command flag was dropped in commit 2c39b5ca2a
("qla2xxx: Remove SRR code"). Hence remove this flag and its check.
Link: https://lore.kernel.org/r/AS8PR10MB4952747D20B76DC8FE793CCA9DEE9@AS8PR10MB4952.EURPRD10.PROD.OUTLOOK.COM
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com >
Signed-off-by: Gleb Chesnokov <Chesnokov.G@raidix.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-25 22:26:15 -04:00
Sumit Saxena
f9bdac31cf
scsi: core: Increase max device queue_depth to 4096
...
The maximum SCSI device queue depth of 1024 is not sufficient for RAID
volumes configured behind Broadcom RAID controllers. For a 16-drive RAID
volume with a device queue depth limit of 1024, only 64 I/Os (1024/16) can
be issued per drive. That is not sufficient to saturate the device.
Link: https://lore.kernel.org/r/20220414103601.140687-1-sumit.saxena@broadcom.com
Cc: Ming Lei <ming.lei@redhat.com >
Cc: Hannes Reinecke <hare@suse.de >
Cc: Bart Van Assche <bvanassche@acm.org >
Cc: Sumanesh Samanta <sumanesh.samanta@broadcom.com >
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 23:02:47 -04:00
Yihao Han
65db22e505
scsi: fcoe: Simplify if-if to if-else
...
Replace 'if (!is_zero_ether_addr(mac))' with 'else' for simplification and
add curly brackets according to the kernel coding style:
"Do not unnecessarily use braces where a single statement will do."
...
"This does not apply if only one branch of a conditional statement is a
single statement; in the latter case use braces in both branches"
Please refer to:
https://www.kernel.org/doc/html/v5.17-rc8/process/coding-style.html
Link: https://lore.kernel.org/r/20220408081237.14037-1-hanyihao@vivo.com
Signed-off-by: Yihao Han <hanyihao@vivo.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:57:35 -04:00
Jiapeng Chong
21a023ce39
scsi: pmcraid: Remove unneeded semicolon
...
Fix the following coccicheck warning:
./drivers/scsi/pmcraid.c:4593:2-3: Unneeded semicolon.
Link: https://lore.kernel.org/r/20220401030640.28246-1-jiapeng.chong@linux.alibaba.com
Reported-by: Abaci Robot <abaci@linux.alibaba.com >
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:52:34 -04:00
James Smart
66c20a9736
scsi: lpfc: Copyright updates for 14.2.0.2 patches
...
Update copyrights to 2022 for files modified in the 14.2.0.2 patch set.
Link: https://lore.kernel.org/r/20220412222008.126521-27-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:48 -04:00
James Smart
4af4d0e2ea
scsi: lpfc: Update lpfc version to 14.2.0.2
...
Update lpfc version to 14.2.0.2.
Link: https://lore.kernel.org/r/20220412222008.126521-26-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:47 -04:00
James Smart
fd4a0c6da5
scsi: lpfc: Expand setting ELS_ID field in ELS_REQUEST64_WQE
...
ELS_ID field for ELS_REQUEST64_WQE is not filled out when FIP is not
supported by the HBA.
Move setting ELS_ID logic into __lpfc_sli_prep_els_req_rsp_s4(), and remove
ELS_ID FIP dependency logic from lpfc_sli_prep_wqe().
Introduce PLOGI ELS_ID and as a result update wqe_els_id_MASK because PLOGI
ELS_ID = 0x4 occupies up to 3 bits.
While in __lpfc_sli_prep_els_req_rsp_s4() routine, remove SLI3-isms.
Link: https://lore.kernel.org/r/20220412222008.126521-25-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:47 -04:00
James Smart
f4fbf4acaa
scsi: lpfc: Update stat accounting for READ_STATUS mbox command
...
READ_STATUS tx/rx byte count fields are now expanded to 64 bit wide
counters. This patch updates logic for the READ_STATUS mbox command when
displaying tx_word and rx_word statistics in sysfs.
Link: https://lore.kernel.org/r/20220412222008.126521-24-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:47 -04:00
James Smart
1b6f71f7fc
scsi: lpfc: Change FA-PWWN detection methodology
...
Do not rely on vendor version field of the CSPs to determine if we are in a
FA-PWWN environment. Instead, use the following procedure:
First, during HBA initialization, driver does a READ_CONFIG to determine if
FA-PWWN is configured on the HBA. A LPFC_FAWWPN_CONFIG hba_flag is set
accordingly.
Next, when the link comes up before the driver gets a link up event, the
firmware logs into the fabric with FA-PWWN. If the fabric port does not
support FA-PWWN, the driver will get a Misconfigured FA-WWN async event
before the link up. A LPFC_FAWWPN_FABRIC hba_flag will be set accordingly.
Finally, if the fabric supports FA-PWWN, the firmware will replace its CSPs
WWN with the Fabric Assigned ones. Then after link up, the driver will
retrieve the Fabric Assigned WWN when it does a READ_SPARAM mbox command.
Link: https://lore.kernel.org/r/20220412222008.126521-23-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:47 -04:00
James Smart
ef47575fd9
scsi: lpfc: Refactor cleanup of mailbox commands
...
The intention of this patch is to refactor mailbox memory allocation and
cleanup steps in one routine respectively to prevent memory leaks or memory
errors related to mailbox commands. There are trivial localized fixes as
well.
Provide lpfc_mbox_rsrc_prep() - this routine allocates the dmabuf and the
mbuf associated with it. It also catches allocation errors and returns
status.
Provide lpfc_mbox_rsrc_cleanup() - this routine verifies a dmabuf exists
and if so releases the associated mbuf and the dmabuf memory. It then sets
the ctx_buf to NULL and releases the mailbox memory to the mailbox pool.
Link: https://lore.kernel.org/r/20220412222008.126521-22-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:47 -04:00
James Smart
d51cf5bd92
scsi: lpfc: Fix field overload in lpfc_iocbq data structure
...
The lpfc_iocbq data structure has void * pointers that are overloaded to be
as many as 8 different data types and the driver translates the void * by
casting. This patch removes the void * pointers by declaring the specific
types needed by the driver. It also expands the context_un to include more
seldom used pointer types to save structure bytes. It also groups the u8
types together to pack the 8 bytes needed. This work allows the lpfc_iocbq
data structure to be more strongly typed and keeps it from being allocated
from the 512 byte slab.
[mkp: rolled in zeroday fix]
Link: https://lore.kernel.org/r/20220412222008.126521-21-jsmart2021@gmail.com
Reported-by: kernel test robot <lkp@intel.com >
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
1045592fc9
scsi: lpfc: Introduce FC_RSCN_MEMENTO flag for tracking post RSCN completion
...
During an NVMe target reboot, the target may initialize itself as FCP only
during the first RSCN and shortly after trigger a second RSCN claiming NVMe
support. The timing of these RSCNs occur before FCP-PRLI for the first
RSCN completes leading discovery issues over NVMe.
Change RSCN and NVME-PRLI send logic based on a new FC_RSCN_MEMENTO flag
that signals when lpfc_end_rscn() is completed and serves as a memento that
discovery was started from RSCN.
Link: https://lore.kernel.org/r/20220412222008.126521-20-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
6c983d327b
scsi: lpfc: Register for Application Services FC-4 type in Fabric topology
...
Add new FC-4 type 0x60 Application Services for fabric registration when
VMID is enabled.
Modified rft struture to indicate __be format. Removed redundant ipReg
variable as it was not used.
Link: https://lore.kernel.org/r/20220412222008.126521-19-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
6c8a3ce64b
scsi: lpfc: Remove false FDMI NVMe FC-4 support for NPIV ports
...
FDMI FC-4 Active Type for vports mistakenly shows NVMe support.
Add a check to only set the NVMe support bit for the physical port.
Link: https://lore.kernel.org/r/20220412222008.126521-18-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
c364c453d3
scsi: lpfc: Revise FDMI reporting of supported port speed for trunk groups
...
Trunk port FDMI supported port speed shows single port supported speed
rather than the trunked port speed.
Modify supported port speed logic calculation during registration.
Link: https://lore.kernel.org/r/20220412222008.126521-17-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
d6d45f67a1
scsi: lpfc: Fix call trace observed during I/O with CMF enabled
...
The following was seen with CMF enabled:
BUG: using smp_processor_id() in preemptible
code: systemd-udevd/31711
kernel: caller is lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: CPU: 12 PID: 31711 Comm: systemd-udevd
kernel: Call Trace:
kernel: <TASK>
kernel: dump_stack_lvl+0x44/0x57
kernel: check_preemption_disabled+0xbf/0xe0
kernel: lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: lpfc_nvme_fcp_io_submit+0x23b4/0x4df0 [lpfc]
this_cpu_ptr() calls smp_processor_id() in a preemptible context.
Fix by using per_cpu_ptr() with raw_smp_processor_id() instead.
Link: https://lore.kernel.org/r/20220412222008.126521-16-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:46 -04:00
James Smart
5295d19d4f
scsi: lpfc: Correct CRC32 calculation for congestion stats
...
lpfc_cgn_calc_crc32() is returning 32 bits, and lpfc_cgn_update_stat() was
using u16 to store the crc32 value. Correct by redeclaring the local
variable to u32.
Link: https://lore.kernel.org/r/20220412222008.126521-15-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:45 -04:00
James Smart
39a1a86b9d
scsi: lpfc: Move MI module parameter check to handle dynamic disable
...
lpfc_refresh_params() can be called for an async event handler. This could
potentially override the value initialized by lpfc_cmf_setup().
Move module parameter check to lpfc_refresh_params().
Link: https://lore.kernel.org/r/20220412222008.126521-14-jsmart2021@gmail.com
Co-developed-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: Justin Tee <justin.tee@broadcom.com >
Signed-off-by: James Smart <jsmart2021@gmail.com >
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com >
2022-04-18 22:48:45 -04:00