#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/crc32.h>
#include "net_driver.h"
#include "bitfield.h"
#include "efx.h"
#include "nic.h"
#include "farch_regs.h"
#include "io.h"
#include "workarounds.h"
#define TX_DC_ENTRIES …
#define TX_DC_ENTRIES_ORDER …
#define RX_DC_ENTRIES …
#define RX_DC_ENTRIES_ORDER …
#define EF4_INT_ERROR_EXPIRE …
#define EF4_MAX_INT_ERRORS …
#define EF4_RX_FLUSH_COUNT …
#define _EF4_CHANNEL_MAGIC_TEST …
#define _EF4_CHANNEL_MAGIC_FILL …
#define _EF4_CHANNEL_MAGIC_RX_DRAIN …
#define _EF4_CHANNEL_MAGIC_TX_DRAIN …
#define _EF4_CHANNEL_MAGIC(_code, _data) …
#define _EF4_CHANNEL_MAGIC_CODE(_magic) …
#define EF4_CHANNEL_MAGIC_TEST(_channel) …
#define EF4_CHANNEL_MAGIC_FILL(_rx_queue) …
#define EF4_CHANNEL_MAGIC_RX_DRAIN(_rx_queue) …
#define EF4_CHANNEL_MAGIC_TX_DRAIN(_tx_queue) …
static void ef4_farch_magic_event(struct ef4_channel *channel, u32 magic);
static inline void ef4_write_buf_tbl(struct ef4_nic *efx, ef4_qword_t *value,
unsigned int index)
{ … }
static bool ef4_masked_compare_oword(const ef4_oword_t *a, const ef4_oword_t *b,
const ef4_oword_t *mask)
{ … }
int ef4_farch_test_registers(struct ef4_nic *efx,
const struct ef4_farch_register_test *regs,
size_t n_regs)
{ … }
static void
ef4_init_special_buffer(struct ef4_nic *efx, struct ef4_special_buffer *buffer)
{ … }
static void
ef4_fini_special_buffer(struct ef4_nic *efx, struct ef4_special_buffer *buffer)
{ … }
static int ef4_alloc_special_buffer(struct ef4_nic *efx,
struct ef4_special_buffer *buffer,
unsigned int len)
{ … }
static void
ef4_free_special_buffer(struct ef4_nic *efx, struct ef4_special_buffer *buffer)
{ … }
static inline void ef4_farch_notify_tx_desc(struct ef4_tx_queue *tx_queue)
{ … }
static inline void ef4_farch_push_tx_desc(struct ef4_tx_queue *tx_queue,
const ef4_qword_t *txd)
{ … }
void ef4_farch_tx_write(struct ef4_tx_queue *tx_queue)
{ … }
unsigned int ef4_farch_tx_limit_len(struct ef4_tx_queue *tx_queue,
dma_addr_t dma_addr, unsigned int len)
{ … }
int ef4_farch_tx_probe(struct ef4_tx_queue *tx_queue)
{ … }
void ef4_farch_tx_init(struct ef4_tx_queue *tx_queue)
{ … }
static void ef4_farch_flush_tx_queue(struct ef4_tx_queue *tx_queue)
{ … }
void ef4_farch_tx_fini(struct ef4_tx_queue *tx_queue)
{ … }
void ef4_farch_tx_remove(struct ef4_tx_queue *tx_queue)
{ … }
static inline void
ef4_farch_build_rx_desc(struct ef4_rx_queue *rx_queue, unsigned index)
{ … }
void ef4_farch_rx_write(struct ef4_rx_queue *rx_queue)
{ … }
int ef4_farch_rx_probe(struct ef4_rx_queue *rx_queue)
{ … }
void ef4_farch_rx_init(struct ef4_rx_queue *rx_queue)
{ … }
static void ef4_farch_flush_rx_queue(struct ef4_rx_queue *rx_queue)
{ … }
void ef4_farch_rx_fini(struct ef4_rx_queue *rx_queue)
{ … }
void ef4_farch_rx_remove(struct ef4_rx_queue *rx_queue)
{ … }
static bool ef4_farch_flush_wake(struct ef4_nic *efx)
{ … }
static bool ef4_check_tx_flush_complete(struct ef4_nic *efx)
{ … }
static int ef4_farch_do_flush(struct ef4_nic *efx)
{ … }
int ef4_farch_fini_dmaq(struct ef4_nic *efx)
{ … }
void ef4_farch_finish_flr(struct ef4_nic *efx)
{ … }
void ef4_farch_ev_read_ack(struct ef4_channel *channel)
{ … }
void ef4_farch_generate_event(struct ef4_nic *efx, unsigned int evq,
ef4_qword_t *event)
{ … }
static void ef4_farch_magic_event(struct ef4_channel *channel, u32 magic)
{ … }
static int
ef4_farch_handle_tx_event(struct ef4_channel *channel, ef4_qword_t *event)
{ … }
static u16 ef4_farch_handle_rx_not_ok(struct ef4_rx_queue *rx_queue,
const ef4_qword_t *event)
{ … }
static bool
ef4_farch_handle_rx_bad_index(struct ef4_rx_queue *rx_queue, unsigned index)
{ … }
static void
ef4_farch_handle_rx_event(struct ef4_channel *channel, const ef4_qword_t *event)
{ … }
static void
ef4_farch_handle_tx_flush_done(struct ef4_nic *efx, ef4_qword_t *event)
{ … }
static void
ef4_farch_handle_rx_flush_done(struct ef4_nic *efx, ef4_qword_t *event)
{ … }
static void
ef4_farch_handle_drain_event(struct ef4_channel *channel)
{ … }
static void ef4_farch_handle_generated_event(struct ef4_channel *channel,
ef4_qword_t *event)
{ … }
static void
ef4_farch_handle_driver_event(struct ef4_channel *channel, ef4_qword_t *event)
{ … }
int ef4_farch_ev_process(struct ef4_channel *channel, int budget)
{ … }
int ef4_farch_ev_probe(struct ef4_channel *channel)
{ … }
int ef4_farch_ev_init(struct ef4_channel *channel)
{ … }
void ef4_farch_ev_fini(struct ef4_channel *channel)
{ … }
void ef4_farch_ev_remove(struct ef4_channel *channel)
{ … }
void ef4_farch_ev_test_generate(struct ef4_channel *channel)
{ … }
void ef4_farch_rx_defer_refill(struct ef4_rx_queue *rx_queue)
{ … }
static inline void ef4_farch_interrupts(struct ef4_nic *efx,
bool enabled, bool force)
{ … }
void ef4_farch_irq_enable_master(struct ef4_nic *efx)
{ … }
void ef4_farch_irq_disable_master(struct ef4_nic *efx)
{ … }
int ef4_farch_irq_test_generate(struct ef4_nic *efx)
{ … }
irqreturn_t ef4_farch_fatal_interrupt(struct ef4_nic *efx)
{ … }
irqreturn_t ef4_farch_legacy_interrupt(int irq, void *dev_id)
{ … }
irqreturn_t ef4_farch_msi_interrupt(int irq, void *dev_id)
{ … }
void ef4_farch_rx_push_indir_table(struct ef4_nic *efx)
{ … }
void ef4_farch_dimension_resources(struct ef4_nic *efx, unsigned sram_lim_qw)
{ … }
u32 ef4_farch_fpga_ver(struct ef4_nic *efx)
{ … }
void ef4_farch_init_common(struct ef4_nic *efx)
{ … }
#define EF4_FARCH_FILTER_CTL_SRCH_FUDGE_WILD …
#define EF4_FARCH_FILTER_CTL_SRCH_FUDGE_FULL …
#define EF4_FARCH_FILTER_CTL_SRCH_MAX …
#define EF4_FARCH_FILTER_CTL_SRCH_HINT_MAX …
enum ef4_farch_filter_type { … };
enum ef4_farch_filter_table_id { … };
enum ef4_farch_filter_index { … };
struct ef4_farch_filter_spec { … };
struct ef4_farch_filter_table { … };
struct ef4_farch_filter_state { … };
static void
ef4_farch_filter_table_clear_entry(struct ef4_nic *efx,
struct ef4_farch_filter_table *table,
unsigned int filter_idx);
static u16 ef4_farch_filter_hash(u32 key)
{ … }
static u16 ef4_farch_filter_increment(u32 key)
{ … }
static enum ef4_farch_filter_table_id
ef4_farch_filter_spec_table_id(const struct ef4_farch_filter_spec *spec)
{ … }
static void ef4_farch_filter_push_rx_config(struct ef4_nic *efx)
{ … }
static void ef4_farch_filter_push_tx_limits(struct ef4_nic *efx)
{ … }
static int
ef4_farch_filter_from_gen_spec(struct ef4_farch_filter_spec *spec,
const struct ef4_filter_spec *gen_spec)
{ … }
static void
ef4_farch_filter_to_gen_spec(struct ef4_filter_spec *gen_spec,
const struct ef4_farch_filter_spec *spec)
{ … }
static void
ef4_farch_filter_init_rx_auto(struct ef4_nic *efx,
struct ef4_farch_filter_spec *spec)
{ … }
static u32 ef4_farch_filter_build(ef4_oword_t *filter,
struct ef4_farch_filter_spec *spec)
{ … }
static bool ef4_farch_filter_equal(const struct ef4_farch_filter_spec *left,
const struct ef4_farch_filter_spec *right)
{ … }
#define EF4_FARCH_FILTER_MATCH_PRI_COUNT …
static const u8 ef4_farch_filter_type_match_pri[EF4_FARCH_FILTER_TYPE_COUNT] = …;
static const enum ef4_farch_filter_table_id ef4_farch_filter_range_table[] = …;
#define EF4_FARCH_FILTER_INDEX_WIDTH …
#define EF4_FARCH_FILTER_INDEX_MASK …
static inline u32
ef4_farch_filter_make_id(const struct ef4_farch_filter_spec *spec,
unsigned int index)
{ … }
static inline enum ef4_farch_filter_table_id
ef4_farch_filter_id_table_id(u32 id)
{ … }
static inline unsigned int ef4_farch_filter_id_index(u32 id)
{ … }
u32 ef4_farch_filter_get_rx_id_limit(struct ef4_nic *efx)
{ … }
s32 ef4_farch_filter_insert(struct ef4_nic *efx,
struct ef4_filter_spec *gen_spec,
bool replace_equal)
{ … }
static void
ef4_farch_filter_table_clear_entry(struct ef4_nic *efx,
struct ef4_farch_filter_table *table,
unsigned int filter_idx)
{ … }
static int ef4_farch_filter_remove(struct ef4_nic *efx,
struct ef4_farch_filter_table *table,
unsigned int filter_idx,
enum ef4_filter_priority priority)
{ … }
int ef4_farch_filter_remove_safe(struct ef4_nic *efx,
enum ef4_filter_priority priority,
u32 filter_id)
{ … }
int ef4_farch_filter_get_safe(struct ef4_nic *efx,
enum ef4_filter_priority priority,
u32 filter_id, struct ef4_filter_spec *spec_buf)
{ … }
static void
ef4_farch_filter_table_clear(struct ef4_nic *efx,
enum ef4_farch_filter_table_id table_id,
enum ef4_filter_priority priority)
{ … }
int ef4_farch_filter_clear_rx(struct ef4_nic *efx,
enum ef4_filter_priority priority)
{ … }
u32 ef4_farch_filter_count_rx_used(struct ef4_nic *efx,
enum ef4_filter_priority priority)
{ … }
s32 ef4_farch_filter_get_rx_ids(struct ef4_nic *efx,
enum ef4_filter_priority priority,
u32 *buf, u32 size)
{ … }
void ef4_farch_filter_table_restore(struct ef4_nic *efx)
{ … }
void ef4_farch_filter_table_remove(struct ef4_nic *efx)
{ … }
int ef4_farch_filter_table_probe(struct ef4_nic *efx)
{ … }
void ef4_farch_filter_update_rx_scatter(struct ef4_nic *efx)
{ … }
#ifdef CONFIG_RFS_ACCEL
s32 ef4_farch_filter_rfs_insert(struct ef4_nic *efx,
struct ef4_filter_spec *gen_spec)
{ … }
bool ef4_farch_filter_rfs_expire_one(struct ef4_nic *efx, u32 flow_id,
unsigned int index)
{ … }
#endif
void ef4_farch_filter_sync_rx_mode(struct ef4_nic *efx)
{ … }