sfxge(4): remove MAC stats size define

Submitted by:   Andy Moreton <amoreton at solarflare.com>
Sponsored by:   Solarflare Communications, Inc.
Differential Revision:  https://reviews.freebsd.org/D18180
This commit is contained in:
Andrew Rybchenko 2018-11-27 14:16:14 +00:00
parent a98c7b04ae
commit 9361c4ad4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=341066
3 changed files with 8 additions and 5 deletions

View File

@ -589,7 +589,6 @@ efx_mac_stats_get_mask(
((_mask)[(_stat) / EFX_MAC_STATS_MASK_BITS_PER_PAGE] & \
(1ULL << ((_stat) & (EFX_MAC_STATS_MASK_BITS_PER_PAGE - 1))))
#define EFX_MAC_STATS_SIZE 0x400
extern __checkReturn efx_rc_t
efx_mac_stats_clear(
@ -598,8 +597,8 @@ efx_mac_stats_clear(
/*
* Upload mac statistics supported by the hardware into the given buffer.
*
* The reference buffer must be at least %EFX_MAC_STATS_SIZE bytes,
* and page aligned.
* The DMA buffer must be 4Kbyte aligned and sized to hold at least
* efx_nic_cfg_t::enc_mac_stats_nstats 64bit counters.
*
* The hardware will only DMA statistics that it understands (of course).
* Drivers should not make any assumptions about which statistics are

View File

@ -463,7 +463,7 @@ siena_mac_stats_update(
SIENA_MAC_STAT_READ(esmp, MC_CMD_MAC_RX_NODESC_DROPS, &value);
EFSYS_STAT_SET_QWORD(&(stat[EFX_MAC_RX_NODESC_DROP_CNT]), &value);
EFSYS_DMA_SYNC_FOR_KERNEL(esmp, 0, EFX_MAC_STATS_SIZE);
EFSYS_DMA_SYNC_FOR_KERNEL(esmp, 0, EFSYS_MEM_SIZE(esmp));
EFSYS_MEM_READ_BARRIER();
SIENA_MAC_STAT_READ(esmp, MC_CMD_MAC_GENERATION_START,
&generation_start);

View File

@ -753,6 +753,8 @@ sfxge_port_init(struct sfxge_softc *sc)
struct sysctl_ctx_list *sysctl_ctx;
struct sysctl_oid *sysctl_tree;
efsys_mem_t *mac_stats_buf, *phy_stats_buf;
uint32_t mac_nstats;
size_t mac_stats_size;
int rc;
port = &sc->port;
@ -792,7 +794,9 @@ sfxge_port_init(struct sfxge_softc *sc)
DBGPRINT(sc->dev, "alloc MAC stats");
port->mac_stats.decode_buf = malloc(EFX_MAC_NSTATS * sizeof(uint64_t),
M_SFXGE, M_WAITOK | M_ZERO);
if ((rc = sfxge_dma_alloc(sc, EFX_MAC_STATS_SIZE, mac_stats_buf)) != 0)
mac_nstats = efx_nic_cfg_get(sc->enp)->enc_mac_stats_nstats;
mac_stats_size = P2ROUNDUP(mac_nstats * sizeof(uint64_t), EFX_BUF_SIZE);
if ((rc = sfxge_dma_alloc(sc, mac_stats_size, mac_stats_buf)) != 0)
goto fail2;
port->stats_update_period_ms = sfxge_port_stats_update_period_ms(sc);
sfxge_mac_stat_init(sc);