net/sfc/base: introduce EVB module for SR-IOV
Implement the framework for Enterprise Virtual Briding (EVB) module. SR-IOV augments the software virtual switch with NIC capabilities supported from EVB module. Further patches will add APIs to create and destroy EVB switching hierarchy required for SR-IOV and APIs to set vPort properties like MAC, VLAN etc. Signed-off-by: Gautam Dawar <gdawar@solarflare.com> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
This commit is contained in:
parent
5895208db6
commit
4f12e20c85
@ -89,6 +89,7 @@ VPATH += $(SRCDIR)/base
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_bootcfg.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_crc32.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_ev.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_evb.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_filter.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_hash.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += efx_intr.c
|
||||
@ -114,6 +115,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += siena_phy.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += siena_sram.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += siena_vpd.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_ev.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_evb.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_filter.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_intr.c
|
||||
SRCS-$(CONFIG_RTE_LIBRTE_SFC_EFX_PMD) += ef10_image.c
|
||||
|
35
drivers/net/sfc/base/ef10_evb.c
Normal file
35
drivers/net/sfc/base/ef10_evb.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright (c) 2018-2019 Solarflare Communications Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "efx.h"
|
||||
#include "efx_impl.h"
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
|
||||
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
|
||||
|
||||
__checkReturn efx_rc_t
|
||||
ef10_evb_init(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
ef10_evb_fini(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
EFSYS_ASSERT(enp->en_family == EFX_FAMILY_HUNTINGTON ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD ||
|
||||
enp->en_family == EFX_FAMILY_MEDFORD2);
|
||||
}
|
||||
|
||||
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
|
||||
#endif /* EFSYS_OPT_EVB */
|
@ -1262,6 +1262,16 @@ efx_mcdi_set_nic_global(
|
||||
|
||||
#endif /* EFSYS_OPT_FW_SUBVARIANT_AWARE */
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
extern __checkReturn efx_rc_t
|
||||
ef10_evb_init(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern void
|
||||
ef10_evb_fini(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
#endif /* EFSYS_OPT_EVB */
|
||||
|
||||
#if EFSYS_OPT_RX_PACKED_STREAM
|
||||
|
||||
|
@ -3347,6 +3347,18 @@ efx_phy_link_state_get(
|
||||
__out efx_phy_link_state_t *eplsp);
|
||||
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
|
||||
extern __checkReturn efx_rc_t
|
||||
efx_evb_init(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
extern void
|
||||
efx_evb_fini(
|
||||
__in efx_nic_t *enp);
|
||||
|
||||
#endif /* EFSYS_OPT_EVB */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -351,4 +351,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
/* Support enterprise virtual bridging */
|
||||
# if !(EFX_OPTS_EF10())
|
||||
# error "EVB requires EF10 arch"
|
||||
# endif
|
||||
#endif /* EFSYS_OPT_EVB */
|
||||
|
||||
#endif /* _SYS_EFX_CHECK_H */
|
||||
|
110
drivers/net/sfc/base/efx_evb.c
Normal file
110
drivers/net/sfc/base/efx_evb.c
Normal file
@ -0,0 +1,110 @@
|
||||
/* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* Copyright (c) 2018-2019 Solarflare Communications Inc.
|
||||
* All rights reserved.
|
||||
*/
|
||||
|
||||
#include "efx.h"
|
||||
#include "efx_impl.h"
|
||||
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
|
||||
#if EFSYS_OPT_SIENA
|
||||
static const efx_evb_ops_t __efx_evb_dummy_ops = {
|
||||
NULL, /* eeo_init */
|
||||
NULL, /* eeo_fini */
|
||||
};
|
||||
#endif /* EFSYS_OPT_SIENA */
|
||||
|
||||
#if EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2
|
||||
static const efx_evb_ops_t __efx_evb_ef10_ops = {
|
||||
ef10_evb_init, /* eeo_init */
|
||||
ef10_evb_fini, /* eeo_fini */
|
||||
};
|
||||
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
|
||||
|
||||
__checkReturn efx_rc_t
|
||||
efx_evb_init(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
const efx_evb_ops_t *eeop;
|
||||
efx_rc_t rc;
|
||||
efx_nic_cfg_t *encp = &(enp->en_nic_cfg);
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PROBE);
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_EVB));
|
||||
|
||||
switch (enp->en_family) {
|
||||
#if EFSYS_OPT_SIENA
|
||||
case EFX_FAMILY_SIENA:
|
||||
eeop = &__efx_evb_dummy_ops;
|
||||
break;
|
||||
#endif /* EFSYS_OPT_SIENA */
|
||||
|
||||
#if EFSYS_OPT_HUNTINGTON
|
||||
case EFX_FAMILY_HUNTINGTON:
|
||||
eeop = &__efx_evb_ef10_ops;
|
||||
break;
|
||||
#endif /* EFSYS_OPT_HUNTINGTON */
|
||||
|
||||
#if EFSYS_OPT_MEDFORD
|
||||
case EFX_FAMILY_MEDFORD:
|
||||
eeop = &__efx_evb_ef10_ops;
|
||||
break;
|
||||
#endif /* EFSYS_OPT_MEDFORD */
|
||||
|
||||
#if EFSYS_OPT_MEDFORD2
|
||||
case EFX_FAMILY_MEDFORD2:
|
||||
eeop = &__efx_evb_ef10_ops;
|
||||
break;
|
||||
#endif /* EFSYS_OPT_MEDFORD2 */
|
||||
|
||||
default:
|
||||
EFSYS_ASSERT(0);
|
||||
rc = ENOTSUP;
|
||||
goto fail1;
|
||||
}
|
||||
|
||||
if (!encp->enc_datapath_cap_evb || !eeop->eeo_init) {
|
||||
rc = ENOTSUP;
|
||||
goto fail2;
|
||||
}
|
||||
|
||||
if ((rc = eeop->eeo_init(enp)) != 0)
|
||||
goto fail3;
|
||||
|
||||
enp->en_eeop = eeop;
|
||||
enp->en_mod_flags |= EFX_MOD_EVB;
|
||||
return (0);
|
||||
|
||||
fail3:
|
||||
EFSYS_PROBE(fail3);
|
||||
fail2:
|
||||
EFSYS_PROBE(fail2);
|
||||
fail1:
|
||||
EFSYS_PROBE1(fail1, efx_rc_t, rc);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
||||
void
|
||||
efx_evb_fini(
|
||||
__in efx_nic_t *enp)
|
||||
{
|
||||
const efx_evb_ops_t *eeop = enp->en_eeop;
|
||||
|
||||
EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC);
|
||||
EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_PROBE);
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_RX));
|
||||
EFSYS_ASSERT(!(enp->en_mod_flags & EFX_MOD_TX));
|
||||
|
||||
if (eeop && eeop->eeo_fini)
|
||||
eeop->eeo_fini(enp);
|
||||
|
||||
enp->en_eeop = NULL;
|
||||
enp->en_mod_flags &= ~EFX_MOD_EVB;
|
||||
}
|
||||
|
||||
#endif
|
@ -58,6 +58,7 @@ extern "C" {
|
||||
#define EFX_MOD_FILTER 0x00001000
|
||||
#define EFX_MOD_LIC 0x00002000
|
||||
#define EFX_MOD_TUNNEL 0x00004000
|
||||
#define EFX_MOD_EVB 0x00008000
|
||||
|
||||
#define EFX_RESET_PHY 0x00000001
|
||||
#define EFX_RESET_RXQ_ERR 0x00000002
|
||||
@ -649,6 +650,15 @@ typedef struct efx_lic_ops_s {
|
||||
|
||||
#endif
|
||||
|
||||
#if EFSYS_OPT_EVB
|
||||
|
||||
typedef struct efx_evb_ops_s {
|
||||
efx_rc_t (*eeo_init)(efx_nic_t *);
|
||||
void (*eeo_fini)(efx_nic_t *);
|
||||
} efx_evb_ops_t;
|
||||
|
||||
#endif /* EFSYS_OPT_EVB */
|
||||
|
||||
#define EFX_DRV_VER_MAX 20
|
||||
|
||||
typedef struct efx_drv_cfg_s {
|
||||
@ -747,6 +757,9 @@ struct efx_nic_s {
|
||||
} ef10;
|
||||
} en_arch;
|
||||
#endif /* EFX_OPTS_EF10() */
|
||||
#if EFSYS_OPT_EVB
|
||||
const efx_evb_ops_t *en_eeop;
|
||||
#endif /* EFSYS_OPT_EVB */
|
||||
};
|
||||
|
||||
#define EFX_FAMILY_IS_EF10(_enp) \
|
||||
|
@ -8,6 +8,7 @@ sources = [
|
||||
'efx_bootcfg.c',
|
||||
'efx_crc32.c',
|
||||
'efx_ev.c',
|
||||
'efx_evb.c',
|
||||
'efx_filter.c',
|
||||
'efx_hash.c',
|
||||
'efx_intr.c',
|
||||
@ -33,6 +34,7 @@ sources = [
|
||||
'siena_sram.c',
|
||||
'siena_vpd.c',
|
||||
'ef10_ev.c',
|
||||
'ef10_evb.c',
|
||||
'ef10_filter.c',
|
||||
'ef10_image.c',
|
||||
'ef10_intr.c',
|
||||
|
@ -166,6 +166,8 @@ prefetch_read_once(const volatile void *addr)
|
||||
|
||||
#define EFSYS_OPT_FW_SUBVARIANT_AWARE 1
|
||||
|
||||
#define EFSYS_OPT_EVB 0
|
||||
|
||||
/* ID */
|
||||
|
||||
typedef struct __efsys_identifier_s efsys_identifier_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user