Theoretically, adaptor firmware may not support new netport API. Currently,
efx_np_supported() assumes Medford4 always supports the API, however, this
can be improved in the future by checking some capability bit during probe.

If efx_np_supported() returns B_FALSE, then one should not invoke Medford4
PHY and MAC methods that are inherently dependent on new netport API. Pick
EF10-generic PHY and MAC methods in this case to maintain legacy behaviour.

Fixes: 8dac31d073af ("common/sfc_efx/base: introduce Medford4 stub for MAC 
methods")
Fixes: d65a7129c413 ("common/sfc_efx/base: introduce Medford4 stub for PHY 
methods")
Cc: sta...@dpdk.org

Signed-off-by: Ivan Malov <ivan.ma...@arknetworks.am>
Reviewed-by: Andy Moreton <andy.more...@amd.com>
---
 drivers/common/sfc_efx/base/efx_mac.c | 6 +++++-
 drivers/common/sfc_efx/base/efx_phy.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/common/sfc_efx/base/efx_mac.c 
b/drivers/common/sfc_efx/base/efx_mac.c
index 69f053ce44..9dc1eb23b9 100644
--- a/drivers/common/sfc_efx/base/efx_mac.c
+++ b/drivers/common/sfc_efx/base/efx_mac.c
@@ -1000,7 +1000,11 @@ efx_mac_select(
 
 #if EFSYS_OPT_MEDFORD4
        case EFX_FAMILY_MEDFORD4:
-               emop = &__efx_mac_medford4_ops;
+               if (efx_np_supported(enp) != B_FALSE)
+                       emop = &__efx_mac_medford4_ops;
+               else
+                       emop = &__efx_mac_ef10_ops;
+
                type = EFX_MAC_MEDFORD4;
                break;
 #endif /* EFSYS_OPT_MEDFORD4 */
diff --git a/drivers/common/sfc_efx/base/efx_phy.c 
b/drivers/common/sfc_efx/base/efx_phy.c
index 1f99c72e62..6e5521db20 100644
--- a/drivers/common/sfc_efx/base/efx_phy.c
+++ b/drivers/common/sfc_efx/base/efx_phy.c
@@ -136,7 +136,10 @@ efx_phy_probe(
 
 #if EFSYS_OPT_MEDFORD4
        case EFX_FAMILY_MEDFORD4:
-               epop = &__efx_phy_medford4_ops;
+               if (efx_np_supported(enp) != B_FALSE)
+                       epop = &__efx_phy_medford4_ops;
+               else
+                       epop = &__efx_phy_ef10_ops;
        break;
 #endif /* EFSYS_OPT_MEDFORD4 */
 
-- 
2.17.1

Reply via email to