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 D4297A0495 for ; Mon, 10 Jun 2019 09:42:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 02E4E1BF54; Mon, 10 Jun 2019 09:39:45 +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 EBA671BE99 for ; Mon, 10 Jun 2019 09:38:59 +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-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id 0EDD0140058 for ; Mon, 10 Jun 2019 07:38:59 +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 x5A7cois008875; 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 662B21616E0; Mon, 10 Jun 2019 08:38:50 +0100 (BST) From: Andrew Rybchenko To: CC: Gautam Dawar Date: Mon, 10 Jun 2019 08:38:43 +0100 Message-ID: <1560152324-20538-29-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-1.107700-4.000000-10 X-TMASE-MatchedRID: V+rqXAM9eR84qGaEI/i7xrsHVDDM5xAPhVDnkfzD7uYGmHr1eMxt2UAc 6DyoS2rI5SReHH9+PHi8eyLTMf4qypBmKwxzr+uErSAIWhdbeu9HsHbvUttWos1d9QDiCRhgEvf XVFdC2JLCLkwqMvmCLQpTufbcmv1V++XBDev6r0wHwuCWPSIIAMMA9JsxaUa3kQ0JIWWubu/5Cy tuDAVC9WaKoqZyhP1T8UR38pnPatUnLUuBcJS+lX84FZpy/6JVmdrHMkUHHq+RoQLwUmtov6EGK hm9baaNqHpTplhNloZ2bqnSDzZSMvMYwRMm1tm8CNJVimS53fP/3VD/GrQPv5soi2XrUn/Jn6Kd MrRsL14qtq5d3cxkNUEzhJpRnaVK1KXY1PNLRmTXPk0WYFl1ZOcmW/Zu6hH2U1JwDnelq3c2ttR QLnSuVgwsbBhvtMtmLM/EnChBVokXJoJX+hpNUcCGzXCiH+kqOKBkFAm8GOUPoO5ncI6OuehbQ2 QpmASdWPKWiAlNtI7vdCUIFuasqw== X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10-1.107700-4.000000 X-TMASE-Version: SMEX-12.5.0.1300-8.5.1010-24664.003 X-MDID: 1560152339-ROsVD1enHsrp Subject: [dpdk-dev] [PATCH 28/29] net/sfc/base: provide API to fetch vPort statistics 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 Hypervisor should be able to track VF statistics. Signed-off-by: Gautam Dawar Signed-off-by: Andrew Rybchenko --- drivers/net/sfc/base/ef10_evb.c | 13 +++++++++++++ drivers/net/sfc/base/ef10_impl.h | 7 +++++++ drivers/net/sfc/base/efx.h | 8 ++++++++ drivers/net/sfc/base/efx_evb.c | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/net/sfc/base/efx_impl.h | 18 ++++++++++++++++++ drivers/net/sfc/base/efx_mcdi.c | 30 +++++++++++++----------------- 6 files changed, 99 insertions(+), 17 deletions(-) diff --git a/drivers/net/sfc/base/ef10_evb.c b/drivers/net/sfc/base/ef10_evb.c index 6b6d7cc..1788a2c 100644 --- a/drivers/net/sfc/base/ef10_evb.c +++ b/drivers/net/sfc/base/ef10_evb.c @@ -536,5 +536,18 @@ addrp, fn_resetp)); } + __checkReturn efx_rc_t +ef10_evb_vport_stats( + __in efx_nic_t *enp, + __in efx_vswitch_id_t vswitch_id, + __in efx_vport_id_t vport_id, + __in efsys_mem_t *esmp) +{ + _NOTE(ARGUNUSED(vswitch_id)) + + return (efx_mcdi_mac_stats(enp, vport_id, esmp, + EFX_STATS_UPLOAD, 0)); +} + #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 20f2a5c..09f97f8 100644 --- a/drivers/net/sfc/base/ef10_impl.h +++ b/drivers/net/sfc/base/ef10_impl.h @@ -1351,6 +1351,13 @@ extern __checkReturn __success(return != B_FALSE) boolean_t __in_bcount_opt(EFX_MAC_ADDR_LEN) uint8_t *addrp, __out_opt boolean_t *fn_resetp); +extern __checkReturn efx_rc_t +ef10_evb_vport_stats( + __in efx_nic_t *enp, + __in efx_vswitch_id_t vswitch_id, + __in efx_vport_id_t vport_id, + __out efsys_mem_t *esmp); + #endif /* EFSYS_OPT_EVB */ #if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER diff --git a/drivers/net/sfc/base/efx.h b/drivers/net/sfc/base/efx.h index 0e6e842..a43ddd9 100644 --- a/drivers/net/sfc/base/efx.h +++ b/drivers/net/sfc/base/efx.h @@ -3444,6 +3444,14 @@ extern __checkReturn __success(return != B_FALSE) boolean_t __in_bcount(EFX_MAC_ADDR_LEN) uint8_t *addrp, __in uint16_t vid, __out boolean_t *is_fn_resetp); + +extern __checkReturn efx_rc_t +efx_evb_vport_stats( + __in efx_nic_t *enp, + __in efx_vswitch_t *evp, + __in efx_vport_id_t vport_id, + __out efsys_mem_t *stats_bufferp); + #endif /* EFSYS_OPT_EVB */ #if EFSYS_OPT_MCDI_PROXY_AUTH_SERVER diff --git a/drivers/net/sfc/base/efx_evb.c b/drivers/net/sfc/base/efx_evb.c index d48e1d7..dd64bc7 100644 --- a/drivers/net/sfc/base/efx_evb.c +++ b/drivers/net/sfc/base/efx_evb.c @@ -24,6 +24,7 @@ NULL, /* eeo_vadaptor_free */ NULL, /* eeo_vport_assign */ NULL, /* eeo_vport_reconfigure */ + NULL, /* eeo_vport_stats */ }; #endif /* EFSYS_OPT_SIENA */ @@ -41,6 +42,7 @@ 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_HUNTINGTON || EFSYS_OPT_MEDFORD || EFSYS_OPT_MEDFORD2 */ @@ -501,4 +503,42 @@ return (rc); } + __checkReturn efx_rc_t +efx_evb_vport_stats( + __in efx_nic_t *enp, + __in efx_vswitch_t *evp, + __in efx_vport_id_t vport_id, + __out efsys_mem_t *stats_bufferp) +{ + efx_rc_t rc; + const efx_evb_ops_t *eeop = enp->en_eeop; + + EFSYS_ASSERT(enp->en_mod_flags & EFX_MOD_EVB); + + if (eeop->eeo_vport_stats == NULL) { + rc = ENOTSUP; + goto fail1; + } + + if (stats_bufferp == NULL) { + rc = EINVAL; + goto fail2; + } + + rc = eeop->eeo_vport_stats(enp, evp->ev_vswitch_id, + vport_id, stats_bufferp); + if (rc != 0) + goto fail3; + + return (0); + +fail3: + EFSYS_PROBE(fail3); +fail2: + EFSYS_PROBE(fail2); +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + return (rc); +} + #endif diff --git a/drivers/net/sfc/base/efx_impl.h b/drivers/net/sfc/base/efx_impl.h index fd31a6d..3e8b26a 100644 --- a/drivers/net/sfc/base/efx_impl.h +++ b/drivers/net/sfc/base/efx_impl.h @@ -688,6 +688,8 @@ struct efx_vswitch_s { efx_vport_id_t, uint16_t *, uint8_t *, boolean_t *); + efx_rc_t (*eeo_vport_stats)(efx_nic_t *, efx_vswitch_id_t, + efx_vport_id_t, efsys_mem_t *); } efx_evb_ops_t; extern __checkReturn boolean_t @@ -1358,6 +1360,14 @@ struct efx_mac_stats_range { efx_mac_stat_t last; }; +typedef enum efx_stats_action_e { + EFX_STATS_CLEAR, + EFX_STATS_UPLOAD, + EFX_STATS_ENABLE_NOEVENTS, + EFX_STATS_ENABLE_EVENTS, + EFX_STATS_DISABLE, +} efx_stats_action_t; + extern efx_rc_t efx_mac_stats_mask_add_ranges( __inout_bcount(mask_size) uint32_t *maskp, @@ -1365,6 +1375,14 @@ struct efx_mac_stats_range { __in_ecount(rng_count) const struct efx_mac_stats_range *rngp, __in unsigned int rng_count); +extern __checkReturn efx_rc_t +efx_mcdi_mac_stats( + __in efx_nic_t *enp, + __in uint32_t vport_id, + __in_opt efsys_mem_t *esmp, + __in efx_stats_action_t action, + __in uint16_t period_ms); + #endif /* EFSYS_OPT_MAC_STATS */ #ifdef __cplusplus diff --git a/drivers/net/sfc/base/efx_mcdi.c b/drivers/net/sfc/base/efx_mcdi.c index e840401..477b128 100644 --- a/drivers/net/sfc/base/efx_mcdi.c +++ b/drivers/net/sfc/base/efx_mcdi.c @@ -1834,17 +1834,10 @@ #if EFSYS_OPT_MAC_STATS -typedef enum efx_stats_action_e { - EFX_STATS_CLEAR, - EFX_STATS_UPLOAD, - EFX_STATS_ENABLE_NOEVENTS, - EFX_STATS_ENABLE_EVENTS, - EFX_STATS_DISABLE, -} efx_stats_action_t; - -static __checkReturn efx_rc_t + __checkReturn efx_rc_t efx_mcdi_mac_stats( __in efx_nic_t *enp, + __in uint32_t vport_id, __in_opt efsys_mem_t *esmp, __in efx_stats_action_t action, __in uint16_t period_ms) @@ -1910,7 +1903,7 @@ * vadapter has already been deleted. */ MCDI_IN_SET_DWORD(req, MAC_STATS_IN_PORT_ID, - (disable ? EVB_PORT_ID_NULL : enp->en_vport_id)); + (disable ? EVB_PORT_ID_NULL : vport_id)); efx_mcdi_execute(enp, &req); @@ -1943,7 +1936,8 @@ { efx_rc_t rc; - if ((rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_CLEAR, 0)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, + EFX_STATS_CLEAR, 0)) != 0) goto fail1; return (0); @@ -1966,7 +1960,8 @@ * avoid having to pull the statistics buffer into the cache to * maintain cumulative statistics. */ - if ((rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_UPLOAD, 0)) != 0) + if ((rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_UPLOAD, 0)) != 0) goto fail1; return (0); @@ -1994,13 +1989,14 @@ * Medford uses a fixed 1sec period before v6.2.1.1033 firmware. */ if (period_ms == 0) - rc = efx_mcdi_mac_stats(enp, NULL, EFX_STATS_DISABLE, 0); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, NULL, + EFX_STATS_DISABLE, 0); else if (events) - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_EVENTS, - period_ms); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_ENABLE_EVENTS, period_ms); else - rc = efx_mcdi_mac_stats(enp, esmp, EFX_STATS_ENABLE_NOEVENTS, - period_ms); + rc = efx_mcdi_mac_stats(enp, enp->en_vport_id, esmp, + EFX_STATS_ENABLE_NOEVENTS, period_ms); if (rc != 0) goto fail1; -- 1.8.3.1