/************************************************************************** * * Generic buffer handling * These buffers are used for interrupt status, MAC stats, etc. *
**************************************************************************/
/* Check whether an event is present in the eventq at the current * read pointer. Only useful for self-test.
*/ bool efx_nic_event_present(struct efx_channel *channel)
{ return efx_event_present(efx_event(channel, channel->eventq_read_ptr));
}
staticconststruct efx_nic_reg efx_nic_regs[] = { /* XX_PRBS_CTL, XX_PRBS_CHK and XX_PRBS_ERR are not used */ /* XX_CORE_STAT is partly RC */
REGISTER_DZ(BIU_HW_REV_ID),
REGISTER_DZ(MC_DB_LWRD),
REGISTER_DZ(MC_DB_HWRD),
};
/** * efx_nic_describe_stats - Describe supported statistics for ethtool * @desc: Array of &struct efx_hw_stat_desc describing the statistics * @count: Length of the @desc array * @mask: Bitmask of which elements of @desc are enabled * @names: Buffer to copy names to, or %NULL. The names are copied * starting at intervals of %ETH_GSTRING_LEN bytes. * * Returns the number of visible statistics, i.e. the number of set * bits in the first @count bits of @mask for which a name is defined.
*/
size_t efx_nic_describe_stats(conststruct efx_hw_stat_desc *desc, size_t count, constunsignedlong *mask, u8 **names)
{
size_t visible = 0;
size_t index;
for_each_set_bit(index, mask, count) { if (desc[index].name) { if (names)
ethtool_puts(names, desc[index].name);
++visible;
}
}
return visible;
}
/** * efx_nic_copy_stats - Copy stats from the DMA buffer in to an * intermediate buffer. This is used to get a consistent * set of stats while the DMA buffer can be written at any time * by the NIC. * @efx: The associated NIC. * @dest: Destination buffer. Must be the same size as the DMA buffer.
*/ int efx_nic_copy_stats(struct efx_nic *efx, __le64 *dest)
{
__le64 *dma_stats = efx->stats_buffer.addr;
__le64 generation_start, generation_end; int rc = 0, retry;
if (!dest) return 0;
if (!dma_stats) goto return_zeroes;
/* If we're unlucky enough to read statistics during the DMA, wait * up to 10ms for it to finish (typically takes <500us)
*/ for (retry = 0; retry < 100; ++retry) {
generation_end = dma_stats[efx->num_mac_stats - 1]; if (generation_end == EFX_MC_STATS_GENERATION_INVALID) goto return_zeroes;
rmb();
memcpy(dest, dma_stats, efx->num_mac_stats * sizeof(__le64));
rmb();
generation_start = dma_stats[MC_CMD_MAC_GENERATION_START]; if (generation_end == generation_start) return 0; /* return good data */
udelay(100);
}
/** * efx_nic_update_stats - Convert statistics DMA buffer to array of u64 * @desc: Array of &struct efx_hw_stat_desc describing the DMA buffer * layout. DMA widths of 0, 16, 32 and 64 are supported; where * the width is specified as 0 the corresponding element of * @stats is not updated. * @count: Length of the @desc array * @mask: Bitmask of which elements of @desc are enabled * @stats: Buffer to update with the converted statistics. The length * of this array must be at least @count. * @dma_buf: DMA buffer containing hardware statistics * @accumulate: If set, the converted values will be added rather than * directly stored to the corresponding elements of @stats
*/ void efx_nic_update_stats(conststruct efx_hw_stat_desc *desc, size_t count, constunsignedlong *mask,
u64 *stats, constvoid *dma_buf, bool accumulate)
{
size_t index;
switch (desc[index].dma_width) { case 16:
val = le16_to_cpup((__le16 *)addr); break; case 32:
val = le32_to_cpup((__le32 *)addr); break; case 64:
val = le64_to_cpup((__le64 *)addr); break; default:
WARN_ON(1);
val = 0; break;
}
void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops)
{ /* if down, or this is the first update after coming up */ if (!(efx->net_dev->flags & IFF_UP) || !efx->rx_nodesc_drops_prev_state)
efx->rx_nodesc_drops_while_down +=
*rx_nodesc_drops - efx->rx_nodesc_drops_total;
efx->rx_nodesc_drops_total = *rx_nodesc_drops;
efx->rx_nodesc_drops_prev_state = !!(efx->net_dev->flags & IFF_UP);
*rx_nodesc_drops -= efx->rx_nodesc_drops_while_down;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.15 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.