// SPDX-License-Identifier: GPL-2.0-only /**************************************************************************** * Driver for Solarflare network controllers and boards * Copyright 2005-2006 Fen Systems Ltd. * Copyright 2006-2013 Solarflare Communications Inc. */ #include <linux/bitops.h> #include <linux/delay.h> #include <linux/interrupt.h> #include <linux/pci.h> #include <linux/module.h> #include <linux/seq_file.h> #include <linux/cpu_rmap.h> #include "net_driver.h" #include "bitfield.h" #include "efx.h" #include "nic.h" #include "ef10_regs.h" #include "io.h" #include "workarounds.h" #include "mcdi_pcol.h" /************************************************************************** * * Generic buffer handling * These buffers are used for interrupt status, MAC stats, etc. * **************************************************************************/ int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer, unsigned int len, gfp_t gfp_flags) { … } void efx_nic_free_buffer(struct efx_nic *efx, struct efx_buffer *buffer) { … } /* 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) { … } void efx_nic_event_test_start(struct efx_channel *channel) { … } int efx_nic_irq_test_start(struct efx_nic *efx) { … } /* Hook interrupt handler(s) * Try MSI and then legacy interrupts. */ int efx_nic_init_interrupt(struct efx_nic *efx) { … } void efx_nic_fini_interrupt(struct efx_nic *efx) { … } /* Register dump */ #define REGISTER_REVISION_ED … #define REGISTER_REVISION_EZ … struct efx_nic_reg { … }; #define REGISTER(name, arch, min_rev, max_rev) … #define REGISTER_DZ(name) … static const struct efx_nic_reg efx_nic_regs[] = …; struct efx_nic_reg_table { … }; #define REGISTER_TABLE_DIMENSIONS(_, offset, arch, min_rev, max_rev, step, rows) … #define REGISTER_TABLE(name, arch, min_rev, max_rev) … #define REGISTER_TABLE_DZ(name) … static const struct efx_nic_reg_table efx_nic_reg_tables[] = …; size_t efx_nic_get_regs_len(struct efx_nic *efx) { … } void efx_nic_get_regs(struct efx_nic *efx, void *buf) { … } /** * 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(const struct efx_hw_stat_desc *desc, size_t count, const unsigned long *mask, u8 *names) { … } /** * 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) { … } /** * 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(const struct efx_hw_stat_desc *desc, size_t count, const unsigned long *mask, u64 *stats, const void *dma_buf, bool accumulate) { … } void efx_nic_fix_nodesc_drop_stat(struct efx_nic *efx, u64 *rx_nodesc_drops) { … }