liquidio: Use pcie_flr() instead of reimplementing it
Subsystems (4)
PATCH 1/1 liquidio: Use pcie_flr() instead of reimplementing it
octeon_mbox_process_cmd() directly writes the PCI_EXP_DEVCTL_BCR_FLR bit, which bypasses timing requirements imposed by the PCIe spec. This patch fixes the function to use the pcie_flr() interface instead.
--- drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +1 -3
@@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,dev_info (&oct->pci_dev->dev,"got a request for FLR from VF that owns DPI ring %u\n" , mbox->q_no); -pcie_capability_set_word ( - oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no], -PCI_EXP_DEVCTL ,PCI_EXP_DEVCTL_BCR_FLR ); +pcie_flr (oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);break ;case OCTEON_PF_CHANGED_VF_MACADDR :
Signature · 1 line
2.21.0
Quoted 14 lines · Denis Efremov
octeon_mbox_process_cmd()directly writes thePCI_EXP_DEVCTL_BCR_FLRbit, which bypasses timing requirements imposed by the PCIe spec. This patch fixes the function to use thepcie_flr()interface instead.Signed-off-by Denis Efremov <[email protected]>--- drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +0
-0
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c static int octeon_mbox_process_cmd(struct octeon_mbox *mbox, · line 264
Quoted 8 lines
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +1
-3@@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,dev_info (&oct->pci_dev->dev,"got a request for FLR from VF that owns DPI ring %u\n" , mbox->q_no); -pcie_capability_set_word ( - oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no], -PCI_EXP_DEVCTL ,PCI_EXP_DEVCTL_BCR_FLR ); +pcie_flr (oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);break ;
It's possible for pcie_flr to fail if the device doesn't become ready soon enough after reset in which case it returns ENOTTY. I think it's OK not to test the return value here though, as pci_dev_wait will print a warning anyway, and I'm not sure what you'd do with it anyway.
Quoted 5 lines
drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +0
-0case OCTEON_PF_CHANGED_VF_MACADDR :Signature · 1 line
2.21.0
Quoted 5 lines · Denis Efremov
octeon_mbox_process_cmd()directly writes thePCI_EXP_DEVCTL_BCR_FLRbit, which bypasses timing requirements imposed by the PCIe spec. This patch fixes the function to use thepcie_flr()interface instead.Signed-off-by Denis Efremov <[email protected]>
Thanks for doing this, Denis. When possible it's better to use a PCI core interface than to fiddle with PCI config space directly from a driver.
Quoted 22 lines
--- drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/net/ethernet/cavium/liquidio/octeon_mailbox.c +1
-3@@ -260,9 +260,7 @@ static int octeon_mbox_process_cmd(struct octeon_mbox *mbox,dev_info (&oct->pci_dev->dev,"got a request for FLR from VF that owns DPI ring %u\n" , mbox->q_no); -pcie_capability_set_word ( - oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no], -PCI_EXP_DEVCTL ,PCI_EXP_DEVCTL_BCR_FLR ); +pcie_flr (oct->sriov_info.dpiring_to_vfpcidev_lut[mbox->q_no]);break ;case OCTEON_PF_CHANGED_VF_MACADDR :Signature · 1 line
2.21.0
From: Denis Efremov <[email protected]>
Date: Thu, 8 Aug 2019 07:57:53 +0300
Quoted 5 lines
octeon_mbox_process_cmd()directly writes thePCI_EXP_DEVCTL_BCR_FLRbit, which bypasses timing requirements imposed by the PCIe spec. This patch fixes the function to use thepcie_flr()interface instead.Signed-off-by Denis Efremov <[email protected]>
Applied to net-next.