Skip to content

Commit

Permalink
qla2x00t-32gbit, scst_local: Port to Linux kernel v6.10
Browse files Browse the repository at this point in the history
Support for the following scsi layer changes in the Linux kernel v6.10:

- 5b7dfbeff92a ("scsi: core: Add a dma_alignment field to the host and
  host template")
  • Loading branch information
lnocturno committed Jul 8, 2024
1 parent 5f4eee5 commit c3bd33a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions qla2x00t-32gbit/qla_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -2002,8 +2002,10 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
scsi_qla_host_t *vha = shost_priv(sdev->host);
struct req_que *req = vha->req;

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
if (IS_T10_PI_CAPABLE(vha->hw))
blk_queue_update_dma_alignment(sdev->request_queue, 0x7);
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 19, 0)
scsi_adjust_queue_depth(sdev, 0, req->max_q_depth);
Expand Down Expand Up @@ -3637,6 +3639,11 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
QLA_SG_ALL : 128;
}

#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
if (IS_T10_PI_CAPABLE(base_vha->hw))
host->dma_alignment = 0x7;
#endif

ret = scsi_add_host(host, &pdev->dev);
if (ret)
goto probe_failed;
Expand Down
7 changes: 6 additions & 1 deletion scst_local/scst_local.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,12 +1048,14 @@ static int scst_local_slave_alloc(struct scsi_device *sdev)
#endif
#endif

#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 10, 0)
/*
* vdisk_blockio requires that data buffers have block_size alignment
* and supports block sizes from 512 up to 4096. See also
* https://github.com/sahlberg/libiscsi/issues/302.
*/
blk_queue_dma_alignment(q, 4095);
blk_queue_dma_alignment(q, (4096 - 1));
#endif

return 0;
}
Expand Down Expand Up @@ -1379,6 +1381,9 @@ static const struct scsi_host_template scst_lcl_ini_driver_template = {
.name = SCST_LOCAL_NAME,
.queuecommand = scst_local_queuecommand,
.change_queue_depth = scst_local_change_queue_depth,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 10, 0)
.dma_alignment = (4096 - 1),
#endif
.slave_alloc = scst_local_slave_alloc,
.slave_configure = scst_local_slave_configure,
.eh_abort_handler = scst_local_abort,
Expand Down

0 comments on commit c3bd33a

Please sign in to comment.