From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Gautam Dawar <gdawar@solarflare.com>
Subject: [dpdk-dev] [PATCH 20/29] net/sfc/base: add EVB module vSwitch/vPort/vAdaptor ops
Date: Mon, 10 Jun 2019 08:38:35 +0100 [thread overview]
Message-ID: <1560152324-20538-21-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1560152324-20538-1-git-send-email-arybchenko@solarflare.com>
From: Gautam Dawar <gdawar@solarflare.com>
Implement functions to allocate and free vSwitch, vPort and vAdaptor.
Also, implement functions to add and delete vPort MAC address and EVB
port assign.
Most of the efx_evb_ops_t functions take vSwitch ID as a parameter for
future enhancements. Currently, firmware doesn't implement vSwitch
identifier and hence this paramter is unused for EF10 architecture
implementation.
Signed-off-by: Gautam Dawar <gdawar@solarflare.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
drivers/net/sfc/base/ef10_evb.c | 147 +++++++++++++++++++++++++++++++++++----
drivers/net/sfc/base/ef10_impl.h | 73 ++++++++++++++++++-
drivers/net/sfc/base/ef10_nic.c | 4 +-
drivers/net/sfc/base/efx.h | 6 +-
drivers/net/sfc/base/efx_evb.c | 24 ++++++-
drivers/net/sfc/base/efx_impl.h | 17 +++++
6 files changed, 251 insertions(+), 20 deletions(-)
diff --git a/drivers/net/sfc/base/ef10_evb.c b/drivers/net/sfc/base/ef10_evb.c
index 18cecc2..aaa97f6 100644
--- a/drivers/net/sfc/base/ef10_evb.c
+++ b/drivers/net/sfc/base/ef10_evb.c
@@ -163,12 +163,12 @@
(vid != EFX_FILTER_VID_UNSPEC));
MCDI_IN_POPULATE_DWORD_2(req, VPORT_ALLOC_IN_FLAGS,
- VPORT_ALLOC_IN_FLAG_AUTO_PORT, 0,
- VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT, vlan_restrict);
+ VPORT_ALLOC_IN_FLAG_AUTO_PORT, 0,
+ VPORT_ALLOC_IN_FLAG_VLAN_RESTRICT, vlan_restrict);
if (vid != EFX_FILTER_VID_UNSPEC)
MCDI_IN_POPULATE_DWORD_1(req, VPORT_ALLOC_IN_VLAN_TAGS,
- VPORT_ALLOC_IN_VLAN_TAG_0, vid);
+ VPORT_ALLOC_IN_VLAN_TAG_0, vid);
efx_mcdi_execute(enp, &req);
@@ -223,11 +223,11 @@
return (rc);
}
- __checkReturn efx_rc_t
+ __checkReturn efx_rc_t
efx_mcdi_vport_mac_addr_add(
- __in efx_nic_t *enp,
- __in efx_vport_id_t vport_id,
- __in_ecount(6) uint8_t *addrp)
+ __in efx_nic_t *enp,
+ __in efx_vport_id_t vport_id,
+ __in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp)
{
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VPORT_ADD_MAC_ADDRESS_IN_LEN,
MC_CMD_VPORT_ADD_MAC_ADDRESS_OUT_LEN);
@@ -258,11 +258,11 @@
return (rc);
}
- __checkReturn efx_rc_t
+ __checkReturn efx_rc_t
efx_mcdi_vport_mac_addr_del(
- __in efx_nic_t *enp,
- __in efx_vport_id_t vport_id,
- __in_ecount(6) uint8_t *addrp)
+ __in efx_nic_t *enp,
+ __in efx_vport_id_t vport_id,
+ __in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp)
{
EFX_MCDI_DECLARE_BUF(payload, MC_CMD_VPORT_DEL_MAC_ADDRESS_IN_LEN,
MC_CMD_VPORT_DEL_MAC_ADDRESS_OUT_LEN);
@@ -323,12 +323,135 @@
goto fail1;
}
- return 0;
+ return (0);
fail1:
EFSYS_PROBE1(fail1, efx_rc_t, rc);
return (rc);
}
+ __checkReturn efx_rc_t
+ef10_evb_vswitch_alloc(
+ __in efx_nic_t *enp,
+ __out efx_vswitch_id_t *vswitch_idp)
+{
+ efx_rc_t rc;
+ if (vswitch_idp == NULL) {
+ rc = EINVAL;
+ goto fail1;
+ }
+
+ if ((rc = efx_mcdi_vswitch_alloc(enp, EVB_PORT_ID_ASSIGNED,
+ EFX_VSWITCH_TYPE_VEB)) != 0) {
+ goto fail2;
+ }
+
+ *vswitch_idp = EFX_DEFAULT_VSWITCH_ID;
+ return (0);
+
+fail2:
+ EFSYS_PROBE(fail2);
+fail1:
+ EFSYS_PROBE1(fail1, efx_rc_t, rc);
+ return (rc);
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vswitch_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_vswitch_free(enp));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vport_alloc(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_type_t vport_type,
+ __in uint16_t vid,
+ __in boolean_t vlan_restrict,
+ __out efx_vport_id_t *vport_idp)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_vport_alloc(enp,
+ vport_type, vid,
+ vlan_restrict, vport_idp));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vport_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_vport_free(enp, vport_id));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vport_mac_addr_add(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+ EFSYS_ASSERT(addrp != NULL);
+
+ return (efx_mcdi_vport_mac_addr_add(enp, vport_id, addrp));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vport_mac_addr_del(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+ EFSYS_ASSERT(addrp != NULL);
+
+ return (efx_mcdi_vport_mac_addr_del(enp, vport_id, addrp));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vadaptor_alloc(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_vadaptor_alloc(enp, vport_id));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vadaptor_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_vadaptor_free(enp, vport_id));
+}
+
+ __checkReturn efx_rc_t
+ef10_evb_vport_assign(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in uint32_t vf_index)
+{
+ _NOTE(ARGUNUSED(vswitch_id))
+
+ return (efx_mcdi_port_assign(enp, vport_id, vf_index));
+}
+
#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 26242a1..e261487 100644
--- a/drivers/net/sfc/base/ef10_impl.h
+++ b/drivers/net/sfc/base/ef10_impl.h
@@ -195,6 +195,16 @@
/* NIC */
extern __checkReturn efx_rc_t
+efx_mcdi_vadaptor_alloc(
+ __in efx_nic_t *enp,
+ __in uint32_t port_id);
+
+extern __checkReturn efx_rc_t
+efx_mcdi_vadaptor_free(
+ __in efx_nic_t *enp,
+ __in uint32_t port_id);
+
+extern __checkReturn efx_rc_t
ef10_nic_probe(
__in efx_nic_t *enp);
@@ -1267,10 +1277,71 @@ extern __checkReturn __success(return != B_FALSE) boolean_t
ef10_evb_init(
__in efx_nic_t *enp);
-extern void
+extern void
ef10_evb_fini(
__in efx_nic_t *enp);
+extern __checkReturn efx_rc_t
+ef10_evb_vswitch_alloc(
+ __in efx_nic_t *enp,
+ __out efx_vswitch_id_t *vswitch_idp);
+
+
+extern __checkReturn efx_rc_t
+ef10_evb_vswitch_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id);
+
+extern __checkReturn efx_rc_t
+ef10_evb_vport_alloc(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_type_t vport_type,
+ __in uint16_t vid,
+ __in boolean_t vlan_restrict,
+ __out efx_vport_id_t *vport_idp);
+
+
+extern __checkReturn efx_rc_t
+ef10_evb_vport_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id);
+
+extern __checkReturn efx_rc_t
+ef10_evb_vport_mac_addr_add(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in_ecount(6) uint8_t *addrp);
+
+extern __checkReturn efx_rc_t
+ef10_evb_vport_mac_addr_del(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in_ecount(6) uint8_t *addrp);
+
+extern __checkReturn efx_rc_t
+ef10_evb_vadaptor_alloc(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id);
+
+
+extern __checkReturn efx_rc_t
+ef10_evb_vadaptor_free(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id);
+
+extern __checkReturn efx_rc_t
+ef10_evb_vport_assign(
+ __in efx_nic_t *enp,
+ __in efx_vswitch_id_t vswitch_id,
+ __in efx_vport_id_t vport_id,
+ __in uint32_t vf_index);
+
#endif /* EFSYS_OPT_EVB */
#if EFSYS_OPT_RX_PACKED_STREAM
diff --git a/drivers/net/sfc/base/ef10_nic.c b/drivers/net/sfc/base/ef10_nic.c
index 8ee8047..7eada57 100644
--- a/drivers/net/sfc/base/ef10_nic.c
+++ b/drivers/net/sfc/base/ef10_nic.c
@@ -223,7 +223,7 @@
return (rc);
}
-static __checkReturn efx_rc_t
+ __checkReturn efx_rc_t
efx_mcdi_vadaptor_alloc(
__in efx_nic_t *enp,
__in uint32_t port_id)
@@ -261,7 +261,7 @@
return (rc);
}
-static __checkReturn efx_rc_t
+ __checkReturn efx_rc_t
efx_mcdi_vadaptor_free(
__in efx_nic_t *enp,
__in uint32_t port_id)
diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h
index 1287505..664efc8 100644
--- a/drivers/net/sfc/base/efx.h
+++ b/drivers/net/sfc/base/efx.h
@@ -3349,6 +3349,7 @@ extern __checkReturn __success(return != B_FALSE) boolean_t
#if EFSYS_OPT_EVB
+typedef uint32_t efx_vswitch_id_t;
typedef uint32_t efx_vport_id_t;
typedef enum efx_vswitch_type_e {
@@ -3366,12 +3367,13 @@ extern __checkReturn __success(return != B_FALSE) boolean_t
/* Unspecified VLAN ID to support disabling of VLAN filtering */
#define EFX_FILTER_VID_UNSPEC 0xffff
+#define EFX_DEFAULT_VSWITCH_ID 1
-extern __checkReturn efx_rc_t
+extern __checkReturn efx_rc_t
efx_evb_init(
__in efx_nic_t *enp);
-extern void
+extern void
efx_evb_fini(
__in efx_nic_t *enp);
diff --git a/drivers/net/sfc/base/efx_evb.c b/drivers/net/sfc/base/efx_evb.c
index f235252..ff240f9 100644
--- a/drivers/net/sfc/base/efx_evb.c
+++ b/drivers/net/sfc/base/efx_evb.c
@@ -14,13 +14,31 @@
static const efx_evb_ops_t __efx_evb_dummy_ops = {
NULL, /* eeo_init */
NULL, /* eeo_fini */
+ NULL, /* eeo_vswitch_alloc */
+ NULL, /* eeo_vswitch_free */
+ NULL, /* eeo_vport_alloc */
+ NULL, /* eeo_vport_free */
+ NULL, /* eeo_vport_mac_addr_add */
+ NULL, /* eeo_vport_mac_addr_del */
+ NULL, /* eeo_vadaptor_alloc */
+ NULL, /* eeo_vadaptor_free */
+ NULL, /* eeo_vport_assign */
};
#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 */
+ 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 */
};
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */
@@ -89,7 +107,7 @@
return (rc);
}
- void
+ void
efx_evb_fini(
__in efx_nic_t *enp)
{
diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h
index 00f88c8..ef6a97a 100644
--- a/drivers/net/sfc/base/efx_impl.h
+++ b/drivers/net/sfc/base/efx_impl.h
@@ -655,6 +655,23 @@
typedef struct efx_evb_ops_s {
efx_rc_t (*eeo_init)(efx_nic_t *);
void (*eeo_fini)(efx_nic_t *);
+ efx_rc_t (*eeo_vswitch_alloc)(efx_nic_t *, efx_vswitch_id_t *);
+ efx_rc_t (*eeo_vswitch_free)(efx_nic_t *, efx_vswitch_id_t);
+ efx_rc_t (*eeo_vport_alloc)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_type_t, uint16_t,
+ boolean_t, efx_vport_id_t *);
+ efx_rc_t (*eeo_vport_free)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t);
+ efx_rc_t (*eeo_vport_mac_addr_add)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t, uint8_t *);
+ efx_rc_t (*eeo_vport_mac_addr_del)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t, uint8_t *);
+ efx_rc_t (*eeo_vadaptor_alloc)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t);
+ efx_rc_t (*eeo_vadaptor_free)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t);
+ efx_rc_t (*eeo_vport_assign)(efx_nic_t *, efx_vswitch_id_t,
+ efx_vport_id_t, uint32_t);
} efx_evb_ops_t;
#endif /* EFSYS_OPT_EVB */
--
1.8.3.1
next prev parent reply other threads:[~2019-06-10 7:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-10 7:38 [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 01/29] net/sfc/base: enable chained multicast on all EF10 cards Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 02/29] net/sfc/base: fix signed/unsigned mismatch errors Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 03/29] net/sfc/base: fix shift by more bits than field width Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 04/29] net/sfc/base: improve code style in sensors decoding Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 05/29] net/sfc/base: do not rely on indirect header inclusion Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 06/29] net/sfc/base: add driver version string registration Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 07/29] net/sfc/base: add capabilities for bundle partition support Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 08/29] net/sfc/base: add extensible NVRAM info function Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 09/29] net/sfc/base: add NVRAM info to API Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 10/29] net/sfc/base: update MCDI headers Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 11/29] net/sfc/base: add firmware ID header Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 12/29] net/sfc/base: support direct FW update for bundle partitions Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 13/29] net/sfc/base: transition to the extensible NVRAM info API Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 14/29] net/sfc/base: add background mode firmware updating Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 15/29] net/sfc/base: add definition of bundle metadata partition Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 16/29] net/sfc/base: add definition of OEM TLV Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 17/29] net/sfc/base: export the zero-based MCDI port number Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 18/29] net/sfc/base: introduce of EVB module for SR-IOV support Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 19/29] net/sfc/base: add MCDI wrappers for vPort and vSwitch in EVB Andrew Rybchenko
2019-06-10 7:38 ` Andrew Rybchenko [this message]
2019-06-10 7:38 ` [dpdk-dev] [PATCH 21/29] net/sfc/base: implement vSwitch create/destroy Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 22/29] net/sfc/base: factor out upstream port vAdaptor allocation Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 23/29] net/sfc/base: support data path with EVB module Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 24/29] net/sfc/base: support proxy auth operations for SR-IOV Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 25/29] net/sfc/base: implement proxy auth MCDI event handling Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 26/29] net/sfc/base: provide proxy APIs to client drivers Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 27/29] net/sfc/base: provide APIs to configure and reset vPort Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 28/29] net/sfc/base: provide API to fetch vPort statistics Andrew Rybchenko
2019-06-10 7:38 ` [dpdk-dev] [PATCH 29/29] net/sfc/base: add APIs for PTP privilege configuration Andrew Rybchenko
2019-06-18 7:52 ` [dpdk-dev] [PATCH 00/29] net/sfc/base: update base driver Ferruh Yigit
2019-06-23 22:37 ` Thomas Monjalon
2019-06-24 7:53 ` Andrew Rybchenko
2019-06-24 11:17 ` Ferruh Yigit
2019-06-24 13:07 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560152324-20538-21-git-send-email-arybchenko@solarflare.com \
--to=arybchenko@solarflare.com \
--cc=dev@dpdk.org \
--cc=gdawar@solarflare.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).