drivers/net/ethernet/arc/emac.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/arc/emac.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/arc/emac.h- Extension
.h- Size
- 6354 bytes
- Lines
- 226
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/dma-mapping.hlinux/netdevice.hlinux/phy.hlinux/clk.h
Detected Declarations
struct arc_emac_bdstruct buffer_statestruct arc_emac_mdio_bus_datastruct arc_emac_privfunction arc_reg_setfunction arc_reg_getfunction arc_reg_orfunction arc_reg_clr
Annotated Snippet
struct arc_emac_bd {
__le32 info;
dma_addr_t data;
};
/* Number of Rx/Tx BD's */
#define RX_BD_NUM 128
#define TX_BD_NUM 128
#define RX_RING_SZ (RX_BD_NUM * sizeof(struct arc_emac_bd))
#define TX_RING_SZ (TX_BD_NUM * sizeof(struct arc_emac_bd))
/**
* struct buffer_state - Stores Rx/Tx buffer state.
* @sk_buff: Pointer to socket buffer.
* @addr: Start address of DMA-mapped memory region.
* @len: Length of DMA-mapped memory region.
*/
struct buffer_state {
struct sk_buff *skb;
DEFINE_DMA_UNMAP_ADDR(addr);
DEFINE_DMA_UNMAP_LEN(len);
};
struct arc_emac_mdio_bus_data {
struct gpio_desc *reset_gpio;
int msec;
};
/**
* struct arc_emac_priv - Storage of EMAC's private information.
* @dev: Pointer to the current device.
* @phy_dev: Pointer to attached PHY device.
* @bus: Pointer to the current MII bus.
* @regs: Base address of EMAC memory-mapped control registers.
* @napi: Structure for NAPI.
* @rxbd: Pointer to Rx BD ring.
* @txbd: Pointer to Tx BD ring.
* @rxbd_dma: DMA handle for Rx BD ring.
* @txbd_dma: DMA handle for Tx BD ring.
* @rx_buff: Storage for Rx buffers states.
* @tx_buff: Storage for Tx buffers states.
* @txbd_curr: Index of Tx BD to use on the next "ndo_start_xmit".
* @txbd_dirty: Index of Tx BD to free on the next Tx interrupt.
* @last_rx_bd: Index of the last Rx BD we've got from EMAC.
* @link: PHY's last seen link state.
* @duplex: PHY's last set duplex mode.
* @speed: PHY's last set speed.
*/
struct arc_emac_priv {
const char *drv_name;
void (*set_mac_speed)(void *priv, unsigned int speed);
/* Devices */
struct device *dev;
struct mii_bus *bus;
struct arc_emac_mdio_bus_data bus_data;
void __iomem *regs;
struct clk *clk;
struct napi_struct napi;
struct arc_emac_bd *rxbd;
struct arc_emac_bd *txbd;
dma_addr_t rxbd_dma;
dma_addr_t txbd_dma;
struct buffer_state rx_buff[RX_BD_NUM];
struct buffer_state tx_buff[TX_BD_NUM];
unsigned int txbd_curr;
unsigned int txbd_dirty;
unsigned int last_rx_bd;
unsigned int link;
unsigned int duplex;
unsigned int speed;
unsigned int rx_missed_errors;
};
/**
* arc_reg_set - Sets EMAC register with provided value.
* @priv: Pointer to ARC EMAC private data structure.
* @reg: Register offset from base address.
* @value: Value to set in register.
*/
static inline void arc_reg_set(struct arc_emac_priv *priv, int reg, int value)
Annotation
- Immediate include surface: `linux/device.h`, `linux/dma-mapping.h`, `linux/netdevice.h`, `linux/phy.h`, `linux/clk.h`.
- Detected declarations: `struct arc_emac_bd`, `struct buffer_state`, `struct arc_emac_mdio_bus_data`, `struct arc_emac_priv`, `function arc_reg_set`, `function arc_reg_get`, `function arc_reg_or`, `function arc_reg_clr`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.