[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0689ba3f-330a-210d-1b73-f2c01d4a2121@solarflare.com>
Date: Wed, 20 Dec 2017 11:14:17 +0000
From: Bert Kenward <bkenward@...arflare.com>
To: Edward Cree <ecree@...arflare.com>,
<linux-net-drivers@...arflare.com>, <davem@...emloft.net>
CC: <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next 4/4] sfc: expose CTPIO stats on NICs that support
them
On 19/12/17 17:06, Edward Cree wrote:
> From: Bert Kenward <bkenward@...arflare.com>
>
> While the Linux driver doesn't use CTPIO ('cut-through programmed I/O'),
> other drivers on the same port might, so if we're responsible for
> reporting per-port stats we need to include the CTPIO stats.
>
Signed-off-by: Bert Kenward <bkenward@...arflare.com>
> Signed-off-by: Edward Cree <ecree@...arflare.com>
> ---
> drivers/net/ethernet/sfc/ef10.c | 50 +++++++++++++++++++++++++++++++++++++++++
> drivers/net/ethernet/sfc/nic.h | 17 ++++++++++++++
> 2 files changed, 67 insertions(+)
>
> diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
> index 352ca43a7395..8ae467db9162 100644
> --- a/drivers/net/ethernet/sfc/ef10.c
> +++ b/drivers/net/ethernet/sfc/ef10.c
> @@ -1649,6 +1649,23 @@ static const struct efx_hw_stat_desc efx_ef10_stat_desc[EF10_STAT_COUNT] = {
> EF10_DMA_STAT(fec_corrected_symbols_lane1, FEC_CORRECTED_SYMBOLS_LANE1),
> EF10_DMA_STAT(fec_corrected_symbols_lane2, FEC_CORRECTED_SYMBOLS_LANE2),
> EF10_DMA_STAT(fec_corrected_symbols_lane3, FEC_CORRECTED_SYMBOLS_LANE3),
> + EF10_DMA_STAT(ctpio_dmabuf_start, CTPIO_DMABUF_START),
> + EF10_DMA_STAT(ctpio_vi_busy_fallback, CTPIO_VI_BUSY_FALLBACK),
> + EF10_DMA_STAT(ctpio_long_write_success, CTPIO_LONG_WRITE_SUCCESS),
> + EF10_DMA_STAT(ctpio_missing_dbell_fail, CTPIO_MISSING_DBELL_FAIL),
> + EF10_DMA_STAT(ctpio_overflow_fail, CTPIO_OVERFLOW_FAIL),
> + EF10_DMA_STAT(ctpio_underflow_fail, CTPIO_UNDERFLOW_FAIL),
> + EF10_DMA_STAT(ctpio_timeout_fail, CTPIO_TIMEOUT_FAIL),
> + EF10_DMA_STAT(ctpio_noncontig_wr_fail, CTPIO_NONCONTIG_WR_FAIL),
> + EF10_DMA_STAT(ctpio_frm_clobber_fail, CTPIO_FRM_CLOBBER_FAIL),
> + EF10_DMA_STAT(ctpio_invalid_wr_fail, CTPIO_INVALID_WR_FAIL),
> + EF10_DMA_STAT(ctpio_vi_clobber_fallback, CTPIO_VI_CLOBBER_FALLBACK),
> + EF10_DMA_STAT(ctpio_unqualified_fallback, CTPIO_UNQUALIFIED_FALLBACK),
> + EF10_DMA_STAT(ctpio_runt_fallback, CTPIO_RUNT_FALLBACK),
> + EF10_DMA_STAT(ctpio_success, CTPIO_SUCCESS),
> + EF10_DMA_STAT(ctpio_fallback, CTPIO_FALLBACK),
> + EF10_DMA_STAT(ctpio_poison, CTPIO_POISON),
> + EF10_DMA_STAT(ctpio_erase, CTPIO_ERASE),
> };
>
> #define HUNT_COMMON_STAT_MASK ((1ULL << EF10_STAT_port_tx_bytes) | \
> @@ -1737,6 +1754,30 @@ static const struct efx_hw_stat_desc efx_ef10_stat_desc[EF10_STAT_COUNT] = {
> (1ULL << (EF10_STAT_fec_corrected_symbols_lane2 - 64)) | \
> (1ULL << (EF10_STAT_fec_corrected_symbols_lane3 - 64)))
>
> +/* These statistics are only provided if the NIC supports MC_CMD_MAC_STATS_V3,
> + * indicated by returning a value >= MC_CMD_MAC_NSTATS_V3 in
> + * MC_CMD_GET_CAPABILITIES_V4_OUT_MAC_STATS_NUM_STATS.
> + * These bits are in the second u64 of the raw mask.
> + */
> +#define EF10_CTPIO_STAT_MASK ( \
> + (1ULL << (EF10_STAT_ctpio_dmabuf_start - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_vi_busy_fallback - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_long_write_success - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_missing_dbell_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_overflow_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_underflow_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_timeout_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_noncontig_wr_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_frm_clobber_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_invalid_wr_fail - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_vi_clobber_fallback - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_unqualified_fallback - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_runt_fallback - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_success - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_fallback - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_poison - 64)) | \
> + (1ULL << (EF10_STAT_ctpio_erase - 64)))
> +
> static u64 efx_ef10_raw_stat_mask(struct efx_nic *efx)
> {
> u64 raw_mask = HUNT_COMMON_STAT_MASK;
> @@ -1783,6 +1824,15 @@ static void efx_ef10_get_stat_mask(struct efx_nic *efx, unsigned long *mask)
> if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2)
> raw_mask[1] |= EF10_FEC_STAT_MASK;
>
> + /* CTPIO stats appear in V3. Only show them on devices that actually
> + * support CTPIO. Although this driver doesn't use CTPIO others might,
> + * and we may be reporting the stats for the underlying port.
> + */
> + if (efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V3 &&
> + (nic_data->datapath_caps2 &
> + (1 << MC_CMD_GET_CAPABILITIES_V4_OUT_CTPIO_LBN)))
> + raw_mask[1] |= EF10_CTPIO_STAT_MASK;
> +
> #if BITS_PER_LONG == 64
> BUILD_BUG_ON(BITS_TO_LONGS(EF10_STAT_COUNT) != 2);
> mask[0] = raw_mask[0];
> diff --git a/drivers/net/ethernet/sfc/nic.h b/drivers/net/ethernet/sfc/nic.h
> index e39e7b399252..763052214525 100644
> --- a/drivers/net/ethernet/sfc/nic.h
> +++ b/drivers/net/ethernet/sfc/nic.h
> @@ -332,6 +332,23 @@ enum {
> EF10_STAT_fec_corrected_symbols_lane1,
> EF10_STAT_fec_corrected_symbols_lane2,
> EF10_STAT_fec_corrected_symbols_lane3,
> + EF10_STAT_ctpio_dmabuf_start,
> + EF10_STAT_ctpio_vi_busy_fallback,
> + EF10_STAT_ctpio_long_write_success,
> + EF10_STAT_ctpio_missing_dbell_fail,
> + EF10_STAT_ctpio_overflow_fail,
> + EF10_STAT_ctpio_underflow_fail,
> + EF10_STAT_ctpio_timeout_fail,
> + EF10_STAT_ctpio_noncontig_wr_fail,
> + EF10_STAT_ctpio_frm_clobber_fail,
> + EF10_STAT_ctpio_invalid_wr_fail,
> + EF10_STAT_ctpio_vi_clobber_fallback,
> + EF10_STAT_ctpio_unqualified_fallback,
> + EF10_STAT_ctpio_runt_fallback,
> + EF10_STAT_ctpio_success,
> + EF10_STAT_ctpio_fallback,
> + EF10_STAT_ctpio_poison,
> + EF10_STAT_ctpio_erase,
> EF10_STAT_COUNT
> };
>
>
Powered by blists - more mailing lists