From 62d6aaa1a58df4622e98e95dc24914cccaa84b46 Mon Sep 17 00:00:00 2001 From: Andrew Rybchenko Date: Thu, 24 Sep 2020 13:12:27 +0100 Subject: [PATCH] common/sfc_efx/base: use EF10 EVB methods for Riverhead There is no difference yet in EVB support on EF10 and Riverhead. So, it is better to reuse existing methods. Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/common/sfc_efx/base/ef10_evb.c | 8 ++++---- drivers/common/sfc_efx/base/efx_check.h | 4 ++-- drivers/common/sfc_efx/base/efx_evb.c | 24 ++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/drivers/common/sfc_efx/base/ef10_evb.c b/drivers/common/sfc_efx/base/ef10_evb.c index aeeaa5189f..089d791543 100644 --- a/drivers/common/sfc_efx/base/ef10_evb.c +++ b/drivers/common/sfc_efx/base/ef10_evb.c @@ -9,13 +9,13 @@ #if EFSYS_OPT_EVB -#if EFX_OPTS_EF10() +#if EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() __checkReturn efx_rc_t ef10_evb_init( __in efx_nic_t *enp) { - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); return (0); } @@ -24,7 +24,7 @@ ef10_evb_init( ef10_evb_fini( __in efx_nic_t *enp) { - EFSYS_ASSERT(EFX_FAMILY_IS_EF10(enp)); + EFSYS_ASSERT(EFX_FAMILY_IS_EF100(enp) || EFX_FAMILY_IS_EF10(enp)); } static __checkReturn efx_rc_t @@ -545,5 +545,5 @@ ef10_evb_vport_stats( EFX_STATS_UPLOAD, 0)); } -#endif /* EFX_OPTS_EF10() */ +#endif /* EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10() */ #endif /* EFSYS_OPT_EVB */ diff --git a/drivers/common/sfc_efx/base/efx_check.h b/drivers/common/sfc_efx/base/efx_check.h index af90a4c373..f9f97946e5 100644 --- a/drivers/common/sfc_efx/base/efx_check.h +++ b/drivers/common/sfc_efx/base/efx_check.h @@ -373,8 +373,8 @@ #if EFSYS_OPT_EVB /* Support enterprise virtual bridging */ -# if !(EFX_OPTS_EF10()) -# error "EVB requires EF10 arch" +# if !(EFSYS_OPT_RIVERHEAD || EFX_OPTS_EF10()) +# error "EVB requires RIVERHEAD or EF10 arch" # endif #endif /* EFSYS_OPT_EVB */ diff --git a/drivers/common/sfc_efx/base/efx_evb.c b/drivers/common/sfc_efx/base/efx_evb.c index 17318b7e11..b6c9b88fc2 100644 --- a/drivers/common/sfc_efx/base/efx_evb.c +++ b/drivers/common/sfc_efx/base/efx_evb.c @@ -46,6 +46,24 @@ static const efx_evb_ops_t __efx_evb_ef10_ops = { }; #endif /* EFX_OPTS_EF10() */ +#if EFSYS_OPT_RIVERHEAD +static const efx_evb_ops_t __efx_evb_rhead_ops = { + ef10_evb_init, /* eeo_init */ + ef10_evb_fini, /* eeo_fini */ + ef10_evb_vswitch_alloc, /* eeo_vswitch_alloc */ + ef10_evb_vswitch_free, /* eeo_vswitch_free */ + ef10_evb_vport_alloc, /* eeo_vport_alloc */ + ef10_evb_vport_free, /* eeo_vport_free */ + ef10_evb_vport_mac_addr_add, /* eeo_vport_mac_addr_add */ + ef10_evb_vport_mac_addr_del, /* eeo_vport_mac_addr_del */ + ef10_evb_vadaptor_alloc, /* eeo_vadaptor_alloc */ + ef10_evb_vadaptor_free, /* eeo_vadaptor_free */ + ef10_evb_vport_assign, /* eeo_vport_assign */ + ef10_evb_vport_reconfigure, /* eeo_vport_reconfigure */ + ef10_evb_vport_stats, /* eeo_vport_stats */ +}; +#endif /* EFSYS_OPT_RIVERHEAD */ + __checkReturn efx_rc_t efx_evb_init( __in efx_nic_t *enp) @@ -83,6 +101,12 @@ efx_evb_init( break; #endif /* EFSYS_OPT_MEDFORD2 */ +#if EFSYS_OPT_RIVERHEAD + case EFX_FAMILY_RIVERHEAD: + eeop = &__efx_evb_rhead_ops; + break; +#endif /* EFSYS_OPT_RIVERHEAD */ + default: EFSYS_ASSERT(0); rc = ENOTSUP; -- 2.20.1