drivers/net/ethernet/sfc/siena/farch.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/siena/farch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/siena/farch.c- Extension
.c- Size
- 89682 bytes
- Lines
- 2989
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/delay.hlinux/interrupt.hlinux/pci.hlinux/module.hlinux/seq_file.hlinux/crc32.hnet_driver.hbitfield.hefx.hrx_common.htx_common.hnic.hfarch_regs.hsriov.hsiena_sriov.hio.hworkarounds.h
Detected Declarations
struct efx_farch_filter_specstruct efx_farch_filter_tablestruct efx_farch_filter_stateenum efx_farch_filter_typeenum efx_farch_filter_table_idenum efx_farch_filter_indexfunction efx_write_buf_tblfunction efx_masked_compare_owordfunction efx_farch_test_registersfunction bufferfunction efx_fini_special_bufferfunction efx_alloc_special_bufferfunction efx_free_special_bufferfunction efx_farch_notify_tx_descfunction efx_farch_push_tx_descfunction ringfunction efx_farch_tx_limit_lenfunction efx_farch_tx_probefunction efx_farch_tx_initfunction efx_farch_flush_tx_queuefunction efx_farch_tx_finifunction efx_farch_tx_removefunction efx_farch_build_rx_descfunction efx_farch_rx_writefunction efx_farch_rx_probefunction efx_farch_rx_initfunction efx_farch_flush_rx_queuefunction efx_farch_rx_finifunction efx_farch_rx_removefunction efx_farch_flush_wakefunction efx_check_tx_flush_completefunction efx_for_each_channelfunction efx_farch_do_flushfunction efx_for_each_channelfunction efx_for_each_channel_rx_queuefunction efx_for_each_channelfunction efx_farch_fini_dmaqfunction efx_for_each_channelfunction efx_farch_finish_flrfunction efx_farch_ev_read_ackfunction efx_farch_generate_eventfunction efx_farch_magic_eventfunction efx_farch_handle_tx_eventfunction efx_farch_handle_rx_not_okfunction efx_farch_handle_rx_bad_indexfunction efx_farch_handle_rx_eventfunction unlikelyfunction efx_farch_handle_tx_flush_done
Annotated Snippet
struct efx_farch_filter_spec {
u8 type:4;
u8 priority:4;
u8 flags;
u16 dmaq_id;
u32 data[3];
};
struct efx_farch_filter_table {
enum efx_farch_filter_table_id id;
u32 offset; /* address of table relative to BAR */
unsigned size; /* number of entries */
unsigned step; /* step between entries */
unsigned used; /* number currently used */
unsigned long *used_bitmap;
struct efx_farch_filter_spec *spec;
unsigned search_limit[EFX_FARCH_FILTER_TYPE_COUNT];
};
struct efx_farch_filter_state {
struct rw_semaphore lock; /* Protects table contents */
struct efx_farch_filter_table table[EFX_FARCH_FILTER_TABLE_COUNT];
};
static void
efx_farch_filter_table_clear_entry(struct efx_nic *efx,
struct efx_farch_filter_table *table,
unsigned int filter_idx);
/* The filter hash function is LFSR polynomial x^16 + x^3 + 1 of a 32-bit
* key derived from the n-tuple. The initial LFSR state is 0xffff. */
static u16 efx_farch_filter_hash(u32 key)
{
u16 tmp;
/* First 16 rounds */
tmp = 0x1fff ^ key >> 16;
tmp = tmp ^ tmp >> 3 ^ tmp >> 6;
tmp = tmp ^ tmp >> 9;
/* Last 16 rounds */
tmp = tmp ^ tmp << 13 ^ key;
tmp = tmp ^ tmp >> 3 ^ tmp >> 6;
return tmp ^ tmp >> 9;
}
/* To allow for hash collisions, filter search continues at these
* increments from the first possible entry selected by the hash. */
static u16 efx_farch_filter_increment(u32 key)
{
return key * 2 - 1;
}
static enum efx_farch_filter_table_id
efx_farch_filter_spec_table_id(const struct efx_farch_filter_spec *spec)
{
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_IP !=
(EFX_FARCH_FILTER_TCP_FULL >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_IP !=
(EFX_FARCH_FILTER_TCP_WILD >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_IP !=
(EFX_FARCH_FILTER_UDP_FULL >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_IP !=
(EFX_FARCH_FILTER_UDP_WILD >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_MAC !=
(EFX_FARCH_FILTER_MAC_FULL >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_RX_MAC !=
(EFX_FARCH_FILTER_MAC_WILD >> 2));
BUILD_BUG_ON(EFX_FARCH_FILTER_TABLE_TX_MAC !=
EFX_FARCH_FILTER_TABLE_RX_MAC + 2);
return (spec->type >> 2) + ((spec->flags & EFX_FILTER_FLAG_TX) ? 2 : 0);
}
static void efx_farch_filter_push_rx_config(struct efx_nic *efx)
{
struct efx_farch_filter_state *state = efx->filter_state;
struct efx_farch_filter_table *table;
efx_oword_t filter_ctl;
efx_reado(efx, &filter_ctl, FR_BZ_RX_FILTER_CTL);
table = &state->table[EFX_FARCH_FILTER_TABLE_RX_IP];
EFX_SET_OWORD_FIELD(filter_ctl, FRF_BZ_TCP_FULL_SRCH_LIMIT,
table->search_limit[EFX_FARCH_FILTER_TCP_FULL] +
EFX_FARCH_FILTER_CTL_SRCH_FUDGE_FULL);
EFX_SET_OWORD_FIELD(filter_ctl, FRF_BZ_TCP_WILD_SRCH_LIMIT,
table->search_limit[EFX_FARCH_FILTER_TCP_WILD] +
EFX_FARCH_FILTER_CTL_SRCH_FUDGE_WILD);
EFX_SET_OWORD_FIELD(filter_ctl, FRF_BZ_UDP_FULL_SRCH_LIMIT,
table->search_limit[EFX_FARCH_FILTER_UDP_FULL] +
EFX_FARCH_FILTER_CTL_SRCH_FUDGE_FULL);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/module.h`, `linux/seq_file.h`, `linux/crc32.h`, `net_driver.h`.
- Detected declarations: `struct efx_farch_filter_spec`, `struct efx_farch_filter_table`, `struct efx_farch_filter_state`, `enum efx_farch_filter_type`, `enum efx_farch_filter_table_id`, `enum efx_farch_filter_index`, `function efx_write_buf_tbl`, `function efx_masked_compare_oword`, `function efx_farch_test_registers`, `function buffer`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.