qla2x00t, qla2x00t-32gbit, scst_local: Port to Linux kernel v6.14

Support for the following scsi layer changes in the Linux kernel v6.14:

- ed638918f4df ("scsi: Rename .slave_alloc() and .slave_destroy()")
- 49515b7fe50c ("scsi: Convert SCSI drivers to .sdev_configure()")
- c9a71ca13f71 ("scsi: Constify struct pci_device_id")
- bd326a5ad639 ("scsi: replace blk_mq_pci_map_queues with blk_mq_map_hw_queues")
This commit is contained in:
Gleb Chesnokov
2025-03-25 12:48:40 +03:00
parent 1f40850809
commit a2c1c2d8b2
5 changed files with 70 additions and 10 deletions

View File

@@ -354,7 +354,7 @@ chap_calc_digest_af_alg(char *alg, char chap_id,
int datafd;
ssize_t bytes;
char buffer[1024];
int res = 0;
ssize_t res = 0;
datafd = af_alg_init(alg);
if (datafd < 0) {

View File

@@ -13,7 +13,9 @@
#include <linux/delay.h>
#include <linux/nvme.h>
#include <linux/nvme-fc.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
#include <linux/blk-mq-pci.h>
#endif
#include <linux/blk-mq.h>
static struct nvme_fc_port_template qla_nvme_fc_transport;
@@ -867,7 +869,11 @@ static void qla_nvme_map_queues(struct nvme_fc_local_port *lport,
{
struct scsi_qla_host *vha = lport->private;
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
blk_mq_pci_map_queues(map, vha->hw->pdev, vha->irq_offset);
#else
blk_mq_map_hw_queues(map, &vha->hw->pdev->dev, vha->irq_offset);
#endif
}
#endif

View File

@@ -14,7 +14,8 @@
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0) && \
LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
#include <linux/blk-mq-pci.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
@@ -1979,7 +1980,11 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
}
static int
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_alloc(struct scsi_device *sdev)
#else
qla2xxx_sdev_init(struct scsi_device *sdev)
#endif
{
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
@@ -1992,7 +1997,11 @@ qla2xxx_slave_alloc(struct scsi_device *sdev)
}
static int
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_configure(struct scsi_device *sdev)
#else
qla2xxx_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
#endif
{
scsi_qla_host_t *vha = shost_priv(sdev->host);
struct req_que *req = vha->req;
@@ -2011,7 +2020,11 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
}
static void
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_destroy(struct scsi_device *sdev)
#else
qla2xxx_sdev_destroy(struct scsi_device *sdev)
#endif
{
sdev->hostdata = NULL;
}
@@ -8174,7 +8187,12 @@ static MAP_QUEUES_RET qla2xxx_map_queues(struct Scsi_Host *shost)
if (USER_CTRL_IRQ(vha->hw) || !vha->hw->mqiobase)
blk_mq_map_queues(qmap);
else
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
blk_mq_pci_map_queues(qmap, vha->hw->pdev, vha->irq_offset);
#else
blk_mq_map_hw_queues(qmap, &vha->hw->pdev->dev,
vha->irq_offset);
#endif
#else
if (USER_CTRL_IRQ(vha->hw))
blk_mq_map_queues(&shost->tag_set);
@@ -8216,10 +8234,15 @@ struct scsi_host_template qla2xxx_driver_template = {
.eh_bus_reset_handler = qla2xxx_eh_bus_reset,
.eh_host_reset_handler = qla2xxx_eh_host_reset,
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
.slave_configure = qla2xxx_slave_configure,
.slave_alloc = qla2xxx_slave_alloc,
.slave_destroy = qla2xxx_slave_destroy,
#else
.sdev_configure = qla2xxx_sdev_configure,
.sdev_init = qla2xxx_sdev_init,
.sdev_destroy = qla2xxx_sdev_destroy,
#endif
.scan_finished = qla2xxx_scan_finished,
.scan_start = qla2xxx_scan_start,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
@@ -8275,7 +8298,7 @@ static const struct pci_error_handlers qla2xxx_err_handler = {
#endif
};
static struct pci_device_id qla2xxx_pci_tbl[] = {
static const struct pci_device_id qla2xxx_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2200) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2300) },

View File

@@ -243,11 +243,17 @@ MODULE_PARM_DESC(ql2xmdenable,
/*
* SCSI host template entry points
*/
static int qla2xxx_slave_configure(struct scsi_device *device);
static int qla2xxx_slave_alloc(struct scsi_device *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
static int qla2xxx_slave_configure(struct scsi_device *sdev);
static int qla2xxx_slave_alloc(struct scsi_device *sdev);
static void qla2xxx_slave_destroy(struct scsi_device *sdev);
#else
static int qla2xxx_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim);
static int qla2xxx_sdev_init(struct scsi_device *sdev);
static void qla2xxx_sdev_destroy(struct scsi_device *sdev);
#endif
static int qla2xxx_scan_finished(struct Scsi_Host *, unsigned long time);
static void qla2xxx_scan_start(struct Scsi_Host *);
static void qla2xxx_slave_destroy(struct scsi_device *);
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
static int qla2xxx_queuecommand_lck(struct scsi_cmnd *cmd,
void (*fn)(struct scsi_cmnd *));
@@ -277,10 +283,15 @@ struct scsi_host_template qla2xxx_driver_template = {
.eh_bus_reset_handler = qla2xxx_eh_bus_reset,
.eh_host_reset_handler = qla2xxx_eh_host_reset,
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
.slave_configure = qla2xxx_slave_configure,
.slave_alloc = qla2xxx_slave_alloc,
.slave_destroy = qla2xxx_slave_destroy,
#else
.sdev_configure = qla2xxx_sdev_configure,
.sdev_init = qla2xxx_sdev_init,
.sdev_destroy = qla2xxx_sdev_destroy,
#endif
.scan_finished = qla2xxx_scan_finished,
.scan_start = qla2xxx_scan_start,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
@@ -1389,7 +1400,11 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
}
static int
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_alloc(struct scsi_device *sdev)
#else
qla2xxx_sdev_init(struct scsi_device *sdev)
#endif
{
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
@@ -1402,7 +1417,11 @@ qla2xxx_slave_alloc(struct scsi_device *sdev)
}
static int
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_configure(struct scsi_device *sdev)
#else
qla2xxx_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
#endif
{
scsi_qla_host_t *vha = shost_priv(sdev->host);
struct qla_hw_data *ha = vha->hw;
@@ -1424,7 +1443,11 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
}
static void
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
qla2xxx_slave_destroy(struct scsi_device *sdev)
#else
qla2xxx_sdev_destroy(struct scsi_device *sdev)
#endif
{
sdev->hostdata = NULL;
}
@@ -4732,7 +4755,7 @@ static struct pci_error_handlers qla2xxx_err_handler = {
.resume = qla2xxx_pci_resume,
};
static struct pci_device_id qla2xxx_pci_tbl[] = {
static const struct pci_device_id qla2xxx_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2100) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2200) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISP2300) },

View File

@@ -1050,7 +1050,11 @@ static int scst_local_slave_alloc(struct scsi_device *sdev)
}
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
static int scst_local_slave_configure(struct scsi_device *sdev)
#else
static int scst_local_sdev_configure(struct scsi_device *sdev, struct queue_limits *lim)
#endif
{
int mqd;
@@ -1370,7 +1374,11 @@ static const struct scsi_host_template scst_lcl_ini_driver_template = {
#else
.dma_alignment = (4096 - 1),
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 14, 0)
.slave_configure = scst_local_slave_configure,
#else
.sdev_configure = scst_local_sdev_configure,
#endif
.eh_abort_handler = scst_local_abort,
.eh_device_reset_handler = scst_local_device_reset,
.eh_target_reset_handler = scst_local_target_reset,
@@ -1382,7 +1390,7 @@ static const struct scsi_host_template scst_lcl_ini_driver_template = {
/*
* Set it low for the "Drop back to untagged" case in
* scsi_track_queue_full(). We are adjusting it to a better
* default in slave_configure()
* default in sdev_configure()
*/
.cmd_per_lun = 3,
.this_id = -1,