|
|
b25a0c |
From 2de005e9ac399f7064968a2611f266dc86a96700 Mon Sep 17 00:00:00 2001
|
|
|
b25a0c |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
b25a0c |
Date: Fri, 24 Jul 2020 19:15:28 +0200
|
|
|
b25a0c |
Subject: [PATCH] [efi] perform cable detection at NII initialization on HPE
|
|
|
b25a0c |
557SFP+
|
|
|
b25a0c |
|
|
|
b25a0c |
Commit c0b61bad99ba ("[efi] Work around bugs in Emulex NII driver",
|
|
|
b25a0c |
2015-08-17) added PXE_OPFLAGS_INITIALIZE_DETECT_CABLE to nii_open() for
|
|
|
b25a0c |
working around Emulex NII driver bugs.
|
|
|
b25a0c |
|
|
|
b25a0c |
That broke some Mellanox drivers, so commit 6324227dcaa8 ("[efi] Skip
|
|
|
b25a0c |
cable detection at initialisation where possible", 2017-03-19) predicated
|
|
|
b25a0c |
PXE_OPFLAGS_INITIALIZE_DETECT_CABLE on the NII driver's *inability* to
|
|
|
b25a0c |
report link status.
|
|
|
b25a0c |
|
|
|
b25a0c |
This in turn breaks the NII driver on (some?) HPE 557SFP+ cards, as those
|
|
|
b25a0c |
drivers are capable of reporting link status, but they still need cable
|
|
|
b25a0c |
detection.
|
|
|
b25a0c |
|
|
|
b25a0c |
So check for this card (through PCI vendor / device / subsys vendor /
|
|
|
b25a0c |
subsys device identifiers), and opt for cable detection regardless of link
|
|
|
b25a0c |
status reporting.
|
|
|
b25a0c |
|
|
|
b25a0c |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1740827
|
|
|
b25a0c |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
b25a0c |
---
|
|
|
b25a0c |
src/drivers/net/efi/nii.c | 43 ++++++++++++++++++++++++++++++++++++---
|
|
|
b25a0c |
1 file changed, 40 insertions(+), 3 deletions(-)
|
|
|
b25a0c |
|
|
|
b25a0c |
diff --git a/src/drivers/net/efi/nii.c b/src/drivers/net/efi/nii.c
|
|
|
b25a0c |
index 2d87e0c63f14..0cf065e0818f 100644
|
|
|
b25a0c |
--- a/src/drivers/net/efi/nii.c
|
|
|
b25a0c |
+++ b/src/drivers/net/efi/nii.c
|
|
|
b25a0c |
@@ -193,6 +193,9 @@ struct nii_nic {
|
|
|
b25a0c |
|
|
|
b25a0c |
/** Mapping list */
|
|
|
b25a0c |
struct list_head mappings;
|
|
|
b25a0c |
+
|
|
|
b25a0c |
+ /** quirk needed for HPE 557SFP+ */
|
|
|
b25a0c |
+ int quirk_hpe557sfpp;
|
|
|
b25a0c |
};
|
|
|
b25a0c |
|
|
|
b25a0c |
/** Maximum number of received packets per poll */
|
|
|
b25a0c |
@@ -219,6 +222,7 @@ static int nii_pci_open ( struct nii_nic *nii ) {
|
|
|
b25a0c |
int bar;
|
|
|
b25a0c |
EFI_STATUS efirc;
|
|
|
b25a0c |
int rc;
|
|
|
b25a0c |
+ uint16_t vid, did, subsys_vid, subsys_did;
|
|
|
b25a0c |
|
|
|
b25a0c |
/* Locate PCI I/O protocol */
|
|
|
b25a0c |
if ( ( rc = efi_locate_device ( device, &efi_pci_io_protocol_guid,
|
|
|
b25a0c |
@@ -255,7 +259,7 @@ static int nii_pci_open ( struct nii_nic *nii ) {
|
|
|
b25a0c |
rc = -EEFI ( efirc );
|
|
|
b25a0c |
DBGC ( nii, "NII %s could not get BAR %d attributes: "
|
|
|
b25a0c |
"%s\n", nii->dev.name, bar, strerror ( rc ) );
|
|
|
b25a0c |
- goto err_get_bar_attributes;
|
|
|
b25a0c |
+ goto err_pci;
|
|
|
b25a0c |
}
|
|
|
b25a0c |
if ( desc.acpi->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM ) {
|
|
|
b25a0c |
nii->mem_bar = bar;
|
|
|
b25a0c |
@@ -276,9 +280,36 @@ static int nii_pci_open ( struct nii_nic *nii ) {
|
|
|
b25a0c |
DBGC ( nii, "no I/O BAR\n" );
|
|
|
b25a0c |
}
|
|
|
b25a0c |
|
|
|
b25a0c |
+ /* Check if HPE 557SFP+ quirk is needed */
|
|
|
b25a0c |
+ if ( ( efirc = nii->pci_io->Pci.Read ( nii->pci_io,
|
|
|
b25a0c |
+ EfiPciIoWidthUint16,
|
|
|
b25a0c |
+ PCI_VENDOR_ID, 1,
|
|
|
b25a0c |
+ &vid ) ) != 0 ||
|
|
|
b25a0c |
+ ( efirc = nii->pci_io->Pci.Read ( nii->pci_io,
|
|
|
b25a0c |
+ EfiPciIoWidthUint16,
|
|
|
b25a0c |
+ PCI_DEVICE_ID, 1,
|
|
|
b25a0c |
+ &did ) ) != 0 ||
|
|
|
b25a0c |
+ ( efirc = nii->pci_io->Pci.Read ( nii->pci_io,
|
|
|
b25a0c |
+ EfiPciIoWidthUint16,
|
|
|
b25a0c |
+ PCI_SUBSYSTEM_VENDOR_ID, 1,
|
|
|
b25a0c |
+ &subsys_vid ) ) != 0 ||
|
|
|
b25a0c |
+ ( efirc = nii->pci_io->Pci.Read ( nii->pci_io,
|
|
|
b25a0c |
+ EfiPciIoWidthUint16,
|
|
|
b25a0c |
+ PCI_SUBSYSTEM_ID, 1,
|
|
|
b25a0c |
+ &subsys_did ) ) != 0 ) {
|
|
|
b25a0c |
+ rc = -EEFI ( efirc );
|
|
|
b25a0c |
+ DBGC ( nii, "NII %s could not read PCI config space: %s\n",
|
|
|
b25a0c |
+ nii->dev.name, strerror ( rc ) );
|
|
|
b25a0c |
+ goto err_pci;
|
|
|
b25a0c |
+ }
|
|
|
b25a0c |
+
|
|
|
b25a0c |
+ nii->quirk_hpe557sfpp = ( vid == 0x10df &&
|
|
|
b25a0c |
+ did == 0x0720 &&
|
|
|
b25a0c |
+ subsys_vid == 0x103c &&
|
|
|
b25a0c |
+ subsys_did == 0x803f );
|
|
|
b25a0c |
return 0;
|
|
|
b25a0c |
|
|
|
b25a0c |
- err_get_bar_attributes:
|
|
|
b25a0c |
+ err_pci:
|
|
|
b25a0c |
bs->CloseProtocol ( pci_device, &efi_pci_io_protocol_guid,
|
|
|
b25a0c |
efi_image_handle, device );
|
|
|
b25a0c |
err_open:
|
|
|
b25a0c |
@@ -1144,8 +1175,14 @@ static int nii_open ( struct net_device *netdev ) {
|
|
|
b25a0c |
* cable detection at this point if any only if the driver is
|
|
|
b25a0c |
* not capable of reporting link status changes at runtime via
|
|
|
b25a0c |
* PXE_OPCODE_GET_STATUS.
|
|
|
b25a0c |
+ *
|
|
|
b25a0c |
+ * HPE 557SFP+ seems to break with
|
|
|
b25a0c |
+ * PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE, but works with
|
|
|
b25a0c |
+ * PXE_OPFLAGS_INITIALIZE_DETECT_CABLE, so ignore link status reporting
|
|
|
b25a0c |
+ * for that NIC, and always request cable detection.
|
|
|
b25a0c |
*/
|
|
|
b25a0c |
- flags = ( nii->media ? PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE
|
|
|
b25a0c |
+ flags = ( ( ! nii->quirk_hpe557sfpp ) && nii->media
|
|
|
b25a0c |
+ ? PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE
|
|
|
b25a0c |
: PXE_OPFLAGS_INITIALIZE_DETECT_CABLE );
|
|
|
b25a0c |
if ( ( rc = nii_initialise_flags ( nii, flags ) ) != 0 )
|
|
|
b25a0c |
goto err_initialise;
|
|
|
b25a0c |
|
|
|
b25a0c |
base-commit: b76052335788d0ad2c4b0bded116c3b02dd4bbc2
|
|
|
b25a0c |
--
|
|
|
b25a0c |
2.19.1.3.g30247aa5d201
|
|
|
b25a0c |
|