Date: Fri, 23 Nov 2018 07:26:37 +0000 (UTC) From: Andrew Rybchenko <arybchik@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340794 - head/sys/dev/sfxge/common Message-ID: <201811230726.wAN7Qbmr044136@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arybchik Date: Fri Nov 23 07:26:37 2018 New Revision: 340794 URL: https://svnweb.freebsd.org/changeset/base/340794 Log: sfxge(4): add MCDI agnostic wrapper for MAC stats clear If a libefx-based driver needs some way to clear port statistics, then an MCDI agnostic method is required. Submitted by: Ivan Malov <ivan.malov at oktetlabs.ru> Sponsored by: Solarflare Communications, Inc. Differential Revision: https://reviews.freebsd.org/D18064 Modified: head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_impl.h head/sys/dev/sfxge/common/efx_mac.c Modified: head/sys/dev/sfxge/common/efx.h ============================================================================== --- head/sys/dev/sfxge/common/efx.h Fri Nov 23 04:38:50 2018 (r340793) +++ head/sys/dev/sfxge/common/efx.h Fri Nov 23 07:26:37 2018 (r340794) @@ -566,6 +566,10 @@ efx_mac_stats_get_mask( #define EFX_MAC_STATS_SIZE 0x400 +extern __checkReturn efx_rc_t +efx_mac_stats_clear( + __in efx_nic_t *enp); + /* * Upload mac statistics supported by the hardware into the given buffer. * Modified: head/sys/dev/sfxge/common/efx_impl.h ============================================================================== --- head/sys/dev/sfxge/common/efx_impl.h Fri Nov 23 04:38:50 2018 (r340793) +++ head/sys/dev/sfxge/common/efx_impl.h Fri Nov 23 07:26:37 2018 (r340794) @@ -202,6 +202,7 @@ typedef struct efx_mac_ops_s { #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS efx_rc_t (*emo_stats_get_mask)(efx_nic_t *, uint32_t *, size_t); + efx_rc_t (*emo_stats_clear)(efx_nic_t *); efx_rc_t (*emo_stats_upload)(efx_nic_t *, efsys_mem_t *); efx_rc_t (*emo_stats_periodic)(efx_nic_t *, efsys_mem_t *, uint16_t, boolean_t); Modified: head/sys/dev/sfxge/common/efx_mac.c ============================================================================== --- head/sys/dev/sfxge/common/efx_mac.c Fri Nov 23 04:38:50 2018 (r340793) +++ head/sys/dev/sfxge/common/efx_mac.c Fri Nov 23 07:26:37 2018 (r340794) @@ -60,6 +60,7 @@ static const efx_mac_ops_t __efx_siena_mac_ops = { #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS siena_mac_stats_get_mask, /* emo_stats_get_mask */ + efx_mcdi_mac_stats_clear, /* emo_stats_clear */ efx_mcdi_mac_stats_upload, /* emo_stats_upload */ efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ siena_mac_stats_update /* emo_stats_update */ @@ -84,6 +85,7 @@ static const efx_mac_ops_t __efx_ef10_mac_ops = { #endif /* EFSYS_OPT_LOOPBACK */ #if EFSYS_OPT_MAC_STATS ef10_mac_stats_get_mask, /* emo_stats_get_mask */ + efx_mcdi_mac_stats_clear, /* emo_stats_clear */ efx_mcdi_mac_stats_upload, /* emo_stats_upload */ efx_mcdi_mac_stats_periodic, /* emo_stats_periodic */ ef10_mac_stats_update /* emo_stats_update */ @@ -708,6 +710,29 @@ efx_mac_stats_get_mask( (void) memset(maskp, 0, mask_size); if ((rc = emop->emo_stats_get_mask(enp, maskp, mask_size)) != 0) + goto fail1; + + return (0); + +fail1: + EFSYS_PROBE1(fail1, efx_rc_t, rc); + + return (rc); +} + + __checkReturn efx_rc_t +efx_mac_stats_clear( + __in efx_nic_t *enp) +{ + efx_port_t *epp = &(enp->en_port); + const efx_mac_ops_t *emop = epp->ep_emop; + efx_rc_t rc; + + EFSYS_ASSERT3U(enp->en_magic, ==, EFX_NIC_MAGIC); + EFSYS_ASSERT3U(enp->en_mod_flags, &, EFX_MOD_PORT); + EFSYS_ASSERT(emop != NULL); + + if ((rc = emop->emo_stats_clear(enp)) != 0) goto fail1; return (0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201811230726.wAN7Qbmr044136>