Kaynağa Gözat

[efi] Skip cable detection at initialisation where possible

We currently request cable detection in PXE_OPCODE_INITIALIZE to work
around buggy Emulex drivers (see commit c0b61ba ("[efi] Work around
bugs in Emulex NII driver")).

This causes problems with some other NII drivers (e.g. Mellanox),
which may time out if the underlying link is intrinsically slow to
come up.

Attempt to work around both problems simultaneously by requesting
cable detection only if the underlying NII driver does not support
link status reporting via PXE_OPCODE_GET_STATUS.  (This is based on a
potentially incorrect assumption that the buggy Emulex drivers do not
claim to report link status via PXE_OPCODE_GET_STATUS.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 7 yıl önce
ebeveyn
işleme
6324227dca
1 değiştirilmiş dosya ile 19 ekleme ve 23 silme
  1. 19
    23
      src/drivers/net/efi/nii.c

+ 19
- 23
src/drivers/net/efi/nii.c Dosyayı Görüntüle

@@ -632,22 +632,6 @@ static int nii_initialise ( struct nii_nic *nii ) {
632 632
 	return nii_initialise_flags ( nii, flags );
633 633
 }
634 634
 
635
-/**
636
- * Initialise UNDI and detect cable
637
- *
638
- * @v nii		NII NIC
639
- * @ret rc		Return status code
640
- */
641
-static int nii_initialise_and_detect ( struct nii_nic *nii ) {
642
-	unsigned int flags;
643
-
644
-	/* Initialise UNDI and detect cable.  This is required to work
645
-	 * around bugs in some Emulex NII drivers.
646
-	 */
647
-	flags = PXE_OPFLAGS_INITIALIZE_DETECT_CABLE;
648
-	return nii_initialise_flags ( nii, flags );
649
-}
650
-
651 635
 /**
652 636
  * Shut down UNDI
653 637
  *
@@ -968,20 +952,32 @@ static void nii_poll ( struct net_device *netdev ) {
968 952
  */
969 953
 static int nii_open ( struct net_device *netdev ) {
970 954
 	struct nii_nic *nii = netdev->priv;
955
+	unsigned int flags;
971 956
 	int rc;
972 957
 
973 958
 	/* Initialise NIC
959
+	 *
960
+	 * We don't care about link state here, and would prefer to
961
+	 * have the NIC initialise even if no cable is present, to
962
+	 * match the behaviour of all other iPXE drivers.
974 963
 	 *
975 964
 	 * Some Emulex NII drivers have a bug which prevents packets
976 965
 	 * from being sent or received unless we specifically ask it
977
-	 * to detect cable presence during initialisation.  Work
978
-	 * around these buggy drivers by requesting cable detection at
979
-	 * this point, even though we don't care about link state here
980
-	 * (and would prefer to have the NIC initialise even if no
981
-	 * cable is present, to match the behaviour of all other iPXE
982
-	 * drivers).
966
+	 * to detect cable presence during initialisation.
967
+	 *
968
+	 * Unfortunately, some other NII drivers (e.g. Mellanox) may
969
+	 * time out and report failure if asked to detect cable
970
+	 * presence during initialisation on links that are physically
971
+	 * slow to reach link-up.
972
+	 *
973
+	 * Attempt to work around both of these problems by requesting
974
+	 * cable detection at this point if any only if the driver is
975
+	 * not capable of reporting link status changes at runtime via
976
+	 * PXE_OPCODE_GET_STATUS.
983 977
 	 */
984
-	if ( ( rc = nii_initialise_and_detect ( nii ) ) != 0 )
978
+	flags = ( nii->media ? PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE
979
+		  : PXE_OPFLAGS_INITIALIZE_DETECT_CABLE );
980
+	if ( ( rc = nii_initialise_flags ( nii, flags ) ) != 0 )
985 981
 		goto err_initialise;
986 982
 
987 983
 	/* Attempt to set station address */

Loading…
İptal
Kaydet