]> www.infradead.org Git - nvme.git/commit
nvmet: pci-epf: Do not uselessly write the CSTS register
authorDamien Le Moal <dlemoal@kernel.org>
Thu, 13 Feb 2025 06:52:29 +0000 (15:52 +0900)
committerKeith Busch <kbusch@kernel.org>
Tue, 18 Feb 2025 15:25:15 +0000 (07:25 -0800)
commitffa35567632c0059e7f380ed155e26a07ec4153f
tree56879d77c00adc8f1d74b614e27de63d4c1b09e4
parent68a5c91f01fc9f086567b260cced003ed9fdff3f
nvmet: pci-epf: Do not uselessly write the CSTS register

The function nvmet_pci_epf_poll_cc_work() will do nothing if there are
no changes to the controller configuration (CC) register. However, even
for such case, this function still calls nvmet_update_cc() and uselessly
writes the CSTS register. Avoid this by simply rescheduling the poll_cc
work if the CC register has not changed.

Also reschedule the poll_cc work if the function
nvmet_pci_epf_enable_ctrl() fails to allow the host the chance to try
again enabling the controller.

While at it, since there is no point in trying to handle the CC register
as quickly as possible, change the poll_cc work scheduling interval to
10 ms (from 5ms), to avoid excessive read accesses to that register.

Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/pci-epf.c