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 72229A0495 for ; Mon, 10 Jun 2019 09:40:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B83721BEED; Mon, 10 Jun 2019 09:39:21 +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 450D81BE93 for ; Mon, 10 Jun 2019 09:38:56 +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 7D4E64C0058 for ; Mon, 10 Jun 2019 07:38:55 +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 x5A7coHo008836; Mon, 10 Jun 2019 08:38:50 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id F31E91616E0; Mon, 10 Jun 2019 08:38:49 +0100 (BST) From: Andrew Rybchenko To: CC: Gautam Dawar Date: Mon, 10 Jun 2019 08:38:35 +0100 Message-ID: <1560152324-20538-21-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-2.590700-4.000000-10 X-TMASE-MatchedRID: NcDh5W22M00JBlgGfL+ic3F+T3jMctr+3FYvKmZiVnN0FoS1aixTNUJN UlrUTWTS5sErdUkMbqZTvVffeIwvQ8HVNeDWrWSGnFVnNmvv47tLXPA26IG0hN9RlPzeVuQQEZc 2cPY2ad00qDWAe/Ti9gu7NCQvxalU7O9PFKJckb+2HyJ7/YtUleqhuTPUDQDtGlfXMQvierf6Yq ifGBM/xTGijGKO0ukQYmWRWj5+JHRCXIPbCpslEAfC4JY9IggAfS0Ip2eEHnz3IzXlXlpamPoLR 4+zsDTtvG0VHndRxgK61w9PXO9o7R1bCq3seGYIJyrpUWMy+4VgQL833wv+tgirZQdzMpDMhm2W 1tvymR5bbfwZVlP0FOOlsk1jia08/eezb2n5HYjaQLtLC8aUqEPBvsmCWGHWUWQ7Bol0IqAY5tv H9Ry2Nw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.590700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152336-Mxl3ft4JpL3x Subject: [dpdk-dev] [PATCH 20/29] net/sfc/base: add EVB module vSwitch/vPort/vAdaptor ops 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 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 Signed-off-by: Andrew Rybchenko --- 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