]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ata: libata-scsi: do not needlessly defer commands when using PMP with FBS
authorNiklas Cassel <cassel@kernel.org>
Thu, 14 May 2026 07:39:02 +0000 (09:39 +0200)
committerNiklas Cassel <cassel@kernel.org>
Mon, 18 May 2026 10:26:51 +0000 (12:26 +0200)
commit759e8756da00aa115d504a18155b1d1ee1cc12e8
treee2538e1930408251bcf26b71deb9c442c78eb1a9
parentf233124fb36cd57ef09f96d517a38ab4b902e15e
ata: libata-scsi: do not needlessly defer commands when using PMP with FBS

The ACS specification does not allow a non-NCQ command to be issued while
an NCQ command is outstanding.

Commit 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
introduced a feature where a deferred non-NCQ command gets issued from a
workqueue. The design stores a single non-NCQ command per port.

However, when using Port Multipliers (PMPs), specifically PMPs that
support FIS-Based Switching (FBS), non-NCQ and NCQ commands can be mixed
on the same port, just not for the same link, see e.g. ata_std_qc_defer()
which is, and always has operated on a per-link basis.

Therefore, move the deferred_qc from struct ata_port to struct ata_link.
This way, when using a PMP with FBS, we will not needlessly defer commands
to all other links, just because one link issued a non-NCQ command while
having an NCQ command outstanding. Only commands for that specific link
will be deferred. This is in line with how PMPs with FBS worked before
commit 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation").

Fixes: 0ea84089dbf6 ("ata: libata-scsi: avoid Non-NCQ command starvation")
Tested-by: Tommy Kelly <linux@tkel.ly>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
include/linux/libata.h