drivers/net/ethernet/emulex/benet/be.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/emulex/benet/be.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/emulex/benet/be.h- Extension
.h- Size
- 27523 bytes
- Lines
- 986
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pci.hlinux/etherdevice.hlinux/delay.hnet/tcp.hnet/ip.hnet/ipv6.hlinux/if_vlan.hlinux/workqueue.hlinux/interrupt.hlinux/firmware.hlinux/slab.hlinux/u64_stats_sync.hlinux/cpumask.hlinux/hwmon.hlinux/hwmon-sysfs.hbe_hw.hbe_roce.h
Detected Declarations
struct be_dma_memstruct be_queue_infostruct be_eq_objstruct be_aic_objstruct be_mcc_objstruct be_tx_statsstruct be_tx_compl_infostruct be_tx_objstruct be_rx_page_infostruct be_rx_statsstruct be_rx_compl_infostruct be_rx_objstruct be_drv_statsstruct be_vf_cfgstruct phy_infostruct be_resourcesstruct be_port_resourcesstruct rss_infostruct be_hwmonstruct be_wrb_paramsstruct be_eth_addrstruct be_error_recoverystruct be_vxlan_portstruct be_adapterstruct be_cmd_workenum vf_statefunction MODULOfunction index_advfunction index_incfunction queue_head_incfunction index_decfunction queue_tail_incfunction be_max_rx_irqsfunction be_max_tx_irqsfunction be_max_qp_irqsfunction be_max_any_irqsfunction amap_maskfunction amap_setfunction amap_setfunction amap_getfunction is_tcp_pktfunction is_udp_pktfunction is_ipv4_pktfunction is_ipv6_ext_hdrfunction be_check_errorfunction be_set_errorfunction be_clear_errorfunction be_multi_rxq
Annotated Snippet
struct be_dma_mem {
void *va;
dma_addr_t dma;
u32 size;
};
struct be_queue_info {
u32 len;
u32 entry_size; /* Size of an element in the queue */
u32 tail, head;
atomic_t used; /* Number of valid elements in the queue */
u32 id;
struct be_dma_mem dma_mem;
bool created;
};
static inline u32 MODULO(u32 val, u32 limit)
{
BUG_ON(limit & (limit - 1));
return val & (limit - 1);
}
static inline void index_adv(u32 *index, u32 val, u32 limit)
{
*index = MODULO((*index + val), limit);
}
static inline void index_inc(u32 *index, u32 limit)
{
*index = MODULO((*index + 1), limit);
}
static inline void *queue_head_node(struct be_queue_info *q)
{
return q->dma_mem.va + q->head * q->entry_size;
}
static inline void *queue_tail_node(struct be_queue_info *q)
{
return q->dma_mem.va + q->tail * q->entry_size;
}
static inline void *queue_index_node(struct be_queue_info *q, u16 index)
{
return q->dma_mem.va + index * q->entry_size;
}
static inline void queue_head_inc(struct be_queue_info *q)
{
index_inc(&q->head, q->len);
}
static inline void index_dec(u32 *index, u32 limit)
{
*index = MODULO((*index - 1), limit);
}
static inline void queue_tail_inc(struct be_queue_info *q)
{
index_inc(&q->tail, q->len);
}
struct be_eq_obj {
struct be_queue_info q;
char desc[32];
struct be_adapter *adapter;
struct napi_struct napi;
u8 idx; /* array index */
u8 msix_idx;
u16 spurious_intr;
cpumask_var_t affinity_mask;
} ____cacheline_aligned_in_smp;
struct be_aic_obj { /* Adaptive interrupt coalescing (AIC) info */
u32 min_eqd; /* in usecs */
u32 max_eqd; /* in usecs */
u32 prev_eqd; /* in usecs */
u32 et_eqd; /* configured val when aic is off */
ulong jiffies;
u64 rx_pkts_prev; /* Used to calculate RX pps */
u64 tx_reqs_prev; /* Used to calculate TX pps */
};
struct be_mcc_obj {
struct be_queue_info q;
struct be_queue_info cq;
bool rearm_cq;
};
Annotation
- Immediate include surface: `linux/pci.h`, `linux/etherdevice.h`, `linux/delay.h`, `net/tcp.h`, `net/ip.h`, `net/ipv6.h`, `linux/if_vlan.h`, `linux/workqueue.h`.
- Detected declarations: `struct be_dma_mem`, `struct be_queue_info`, `struct be_eq_obj`, `struct be_aic_obj`, `struct be_mcc_obj`, `struct be_tx_stats`, `struct be_tx_compl_info`, `struct be_tx_obj`, `struct be_rx_page_info`, `struct be_rx_stats`.
- 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.