From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 9E175A0495 for ; Mon, 10 Jun 2019 09:41:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1380A1BF1E; Mon, 10 Jun 2019 09:39:31 +0200 (CEST) Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [67.231.154.164]) by dpdk.org (Postfix) with ESMTP id 6A77E1BE95 for ; Mon, 10 Jun 2019 09:38:57 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mx1-us5.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 6A1CF4C0058 for ; Mon, 10 Jun 2019 07:38:56 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 10 Jun 2019 00:38:51 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1395.4 via Frontend Transport; Mon, 10 Jun 2019 00:38:51 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id x5A7cnTk008827; Mon, 10 Jun 2019 08:38:49 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id D98691616E0; Mon, 10 Jun 2019 08:38:49 +0100 (BST) From: Andrew Rybchenko To: CC: Gautam Dawar Date: Mon, 10 Jun 2019 08:38:33 +0100 Message-ID: <1560152324-20538-19-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> References: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-12.5.0.1300-8.5.1010-24664.003 X-TM-AS-Result: No-3.901900-4.000000-10 X-TMASE-MatchedRID: NeIHNncfwiQkPTn0hc/8PachFrOB9kanELbqrOgWzyfbspKx4YOD3Rkh PVvMB7dGULqNWfM8FP/kQn4vWhwGYaKgpS1QMZdluwdUMMznEA80aXTlOdj8k99zZd3pUn7KTBJ 5VCdJL8X9Ktxj1mXhOo9CL1e45ag4Ev/Xa9jWN3cHwuCWPSIIAEKJ5iyNYGPpfkiy7TTogYYVLG IPVP4OQb/YkCk00rZtveK5U82BdTZjoEmvICQo2Ct4VwAzFx+tjs/yyyVHGh4UBqkSoRN84L5BE qXwSs2UWajyFMxEGbgqLyHEiMnNTTZCT0GsTWyEQ24lJ40XAphQ2v2cnMDdZBpX1zEL4nq3Jzlo WWMvKh0P/MiosmZn5GbdLeyZyidEDr5e1hYSJgvHmyDJSEsI27u8KtEfOJPfmyiLZetSf8mfop0 ytGwvXiq2rl3dzGQ1R9Zhy3GxKcXKNXxDkAnnMXG+CSzGE1W/tGdcWmcQJo6WDIxzRFH+HaJK1+ wtELSaKdy5KiHckHroaJuZ/obnZ9GTSIcT2nFRVfZdajPCHA44oGQUCbwY5Q+g7mdwjo656FtDZ CmYBJ3KTLw/lNgw8g== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--3.901900-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152337-TLwUfXRkO7Yv Subject: [dpdk-dev] [PATCH 18/29] net/sfc/base: introduce of EVB module for SR-IOV support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Gautam Dawar Implement the framework for Enterprise Virtual Briding (EVB) module. SR-IOV augments the software virtual switch with NIC capbilities 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 Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/Makefile | 2 + drivers/net/sfc/base/ef10_evb.c | 35 +++++++++++++ drivers/net/sfc/base/ef10_impl.h | 10 ++++ drivers/net/sfc/base/efx.h | 12 +++++ drivers/net/sfc/base/efx_check.h | 7 +++ drivers/net/sfc/base/efx_evb.c | 110 +++++++++++++++++++++++++++++++++++++++ drivers/net/sfc/base/efx_impl.h | 13 +++++ drivers/net/sfc/base/meson.build | 2 + drivers/net/sfc/efsys.h | 2 + 9 files changed, 193 insertions(+) create mode 100644 drivers/net/sfc/base/ef10_evb.c create mode 100644 drivers/net/sfc/base/efx_evb.c diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile index 3bb41a0..7149afd 100644 --- a/drivers/net/sfc/Makefile +++ b/drivers/net/sfc/Makefile @@ -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 diff --git a/drivers/net/sfc/base/ef10_evb.c b/drivers/net/sfc/base/ef10_evb.c new file mode 100644 index 0000000..03ac19a --- /dev/null +++ b/drivers/net/sfc/base/ef10_evb.c @@ -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 */ diff --git a/drivers/net/sfc/base/ef10_impl.h b/drivers/net/sfc/base/ef10_impl.h index 0cfbf59..26242a1 100644 --- a/drivers/net/sfc/base/ef10_impl.h +++ b/drivers/net/sfc/base/ef10_impl.h @@ -1262,6 +1262,16 @@ extern __checkReturn __success(return != B_FALSE) boolean_t #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 diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index 40308ff..ca8a399 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -3347,6 +3347,18 @@ extern __checkReturn __success(return != B_FALSE) boolean_t __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 diff --git a/drivers/net/sfc/base/efx_check.h b/drivers/net/sfc/base/efx_check.h index 4800f77..85edaef 100644 --- a/drivers/net/sfc/base/efx_check.h +++ b/drivers/net/sfc/base/efx_check.h @@ -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 */ diff --git a/drivers/net/sfc/base/efx_evb.c b/drivers/net/sfc/base/efx_evb.c new file mode 100644 index 0000000..f235252 --- /dev/null +++ b/drivers/net/sfc/base/efx_evb.c @@ -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 diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index 067cec3..00f88c8 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -58,6 +58,7 @@ #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 @@ #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) \ diff --git a/drivers/net/sfc/base/meson.build b/drivers/net/sfc/base/meson.build index ab66f32..6fa7948 100644 --- a/drivers/net/sfc/base/meson.build +++ b/drivers/net/sfc/base/meson.build @@ -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', diff --git a/drivers/net/sfc/efsys.h b/drivers/net/sfc/efsys.h index f7bcc74..24f3769 100644 --- a/drivers/net/sfc/efsys.h +++ b/drivers/net/sfc/efsys.h @@ -166,6 +166,8 @@ #define EFSYS_OPT_FW_SUBVARIANT_AWARE 1 +#define EFSYS_OPT_EVB 0 + /* ID */ typedef struct __efsys_identifier_s efsys_identifier_t; -- 1.8.3.1