common/sfc_efx/base: use EF10 MAC methods for Riverhead
authorAndrew Rybchenko <arybchenko@solarflare.com>
Thu, 24 Sep 2020 12:11:52 +0000 (13:11 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:12 +0000 (19:19 +0200)
There is no difference yet in MAC support on EF10 and Riverhead.
So, it is better to reuse existing methods.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
drivers/common/sfc_efx/base/ef10_mac.c
drivers/common/sfc_efx/base/efx_impl.h
drivers/common/sfc_efx/base/efx_mac.c

index 7e89f34..6fe44f1 100644 (file)
@@ -8,7 +8,7 @@
 #include "efx_impl.h"
 
 
-#if EFX_OPTS_EF10()
+#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10()
 
        __checkReturn   efx_rc_t
 ef10_mac_poll(
@@ -351,7 +351,7 @@ ef10_mac_multicast_list_set(
        const efx_mac_ops_t *emop = epp->ep_emop;
        efx_rc_t rc;
 
-       EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp));
+       EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp));
 
        if ((rc = emop->emo_reconfigure(enp)) != 0)
                goto fail1;
@@ -1039,4 +1039,4 @@ fail1:
 
 #endif /* EFSYS_OPT_MAC_STATS */
 
-#endif /* EFX_OPTS_EF10() */
+#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */
index cc34a05..f2ea08b 100644 (file)
@@ -77,6 +77,7 @@ typedef enum efx_mac_type_e {
        EFX_MAC_HUNTINGTON,
        EFX_MAC_MEDFORD,
        EFX_MAC_MEDFORD2,
+       EFX_MAC_RIVERHEAD,
        EFX_MAC_NTYPES
 } efx_mac_type_t;
 
index ae23aad..36aca67 100644 (file)
@@ -64,6 +64,31 @@ static const efx_mac_ops_t   __efx_mac_ef10_ops = {
 };
 #endif /* EFX_OPTS_EF10() */
 
+#if EFSYS_OPT_RIVERHEAD
+static const efx_mac_ops_t     __efx_mac_rhead_ops = {
+       ef10_mac_poll,                          /* emo_poll */
+       ef10_mac_up,                            /* emo_up */
+       ef10_mac_addr_set,                      /* emo_addr_set */
+       ef10_mac_pdu_set,                       /* emo_pdu_set */
+       ef10_mac_pdu_get,                       /* emo_pdu_get */
+       ef10_mac_reconfigure,                   /* emo_reconfigure */
+       ef10_mac_multicast_list_set,            /* emo_multicast_list_set */
+       ef10_mac_filter_default_rxq_set,        /* emo_filter_default_rxq_set */
+       ef10_mac_filter_default_rxq_clear,
+                                       /* emo_filter_default_rxq_clear */
+#if EFSYS_OPT_LOOPBACK
+       ef10_mac_loopback_set,                  /* emo_loopback_set */
+#endif /* EFSYS_OPT_LOOPBACK */
+#if EFSYS_OPT_MAC_STATS
+       ef10_mac_stats_get_mask,                /* emo_stats_get_mask */
+       efx_mcdi_mac_stats_clear,               /* emo_stats_clear */
+       efx_mcdi_mac_stats_upload,              /* emo_stats_upload */
+       efx_mcdi_mac_stats_periodic,            /* emo_stats_periodic */
+       ef10_mac_stats_update                   /* emo_stats_update */
+#endif /* EFSYS_OPT_MAC_STATS */
+};
+#endif /* EFSYS_OPT_RIVERHEAD */
+
        __checkReturn                   efx_rc_t
 efx_mac_pdu_set(
        __in                            efx_nic_t *enp,
@@ -873,6 +898,13 @@ efx_mac_select(
                break;
 #endif /* EFSYS_OPT_MEDFORD2 */
 
+#if EFSYS_OPT_RIVERHEAD
+       case EFX_FAMILY_RIVERHEAD:
+               emop = &__efx_mac_rhead_ops;
+               type = EFX_MAC_RIVERHEAD;
+               break;
+#endif /* EFSYS_OPT_RIVERHEAD */
+
        default:
                rc = EINVAL;
                goto fail1;