drivers/net/ethernet/microchip/fdma/fdma_api.h
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microchip/fdma/fdma_api.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microchip/fdma/fdma_api.h- Extension
.h- Size
- 6597 bytes
- Lines
- 244
- 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.
- 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/bits.hlinux/etherdevice.hlinux/types.h
Detected Declarations
struct fdmastruct fdma_dbstruct fdma_dcbstruct fdma_opsstruct fdmafunction fdma_dcb_advancefunction fdma_db_advancefunction fdma_db_resetfunction fdma_dcb_is_reusablefunction fdma_db_is_donefunction fdma_db_len_getfunction fdma_dcb_len_setfunction fdma_has_framesfunction fdma_nextptr_cbfunction fdma_dataptr_get_contiguousfunction fdma_is_last
Annotated Snippet
struct fdma_db {
u64 dataptr;
u64 status;
};
struct fdma_dcb {
u64 nextptr;
u64 info;
struct fdma_db db[FDMA_DB_MAX];
};
struct fdma_ops {
/* User-provided callback to set the dataptr */
int (*dataptr_cb)(struct fdma *fdma, int dcb_idx, int db_idx, u64 *ptr);
/* User-provided callback to set the nextptr */
int (*nextptr_cb)(struct fdma *fdma, int dcb_idx, u64 *ptr);
};
struct fdma {
void *priv;
/* Virtual addresses */
struct fdma_dcb *dcbs;
struct fdma_dcb *last_dcb;
/* DMA address */
dma_addr_t dma;
/* Size of DCB + DB memory */
int size;
/* Indexes used to access the next-to-be-used DCB or DB */
int db_index;
int dcb_index;
/* Number of DCB's and DB's */
u32 n_dcbs;
u32 n_dbs;
/* Size of DB's */
u32 db_size;
/* Channel id this FDMA object operates on */
u32 channel_id;
struct fdma_ops ops;
};
/* Advance the DCB index and wrap if required. */
static inline void fdma_dcb_advance(struct fdma *fdma)
{
fdma->dcb_index++;
if (fdma->dcb_index >= fdma->n_dcbs)
fdma->dcb_index = 0;
}
/* Advance the DB index. */
static inline void fdma_db_advance(struct fdma *fdma)
{
fdma->db_index++;
}
/* Reset the db index to zero. */
static inline void fdma_db_reset(struct fdma *fdma)
{
fdma->db_index = 0;
}
/* Check if a DCB can be reused in case of multiple DB's per DCB. */
static inline bool fdma_dcb_is_reusable(struct fdma *fdma)
{
return fdma->db_index != fdma->n_dbs;
}
/* Check if the FDMA has marked this DB as done. */
static inline bool fdma_db_is_done(struct fdma_db *db)
{
return db->status & FDMA_DCB_STATUS_DONE;
}
/* Get the length of a DB. */
static inline int fdma_db_len_get(struct fdma_db *db)
{
return FDMA_DCB_STATUS_BLOCKL(db->status);
}
/* Set the length of a DB. */
static inline void fdma_dcb_len_set(struct fdma_dcb *dcb, u32 len)
{
dcb->info = FDMA_DCB_INFO_DATAL(len);
Annotation
- Immediate include surface: `linux/bits.h`, `linux/etherdevice.h`, `linux/types.h`.
- Detected declarations: `struct fdma`, `struct fdma_db`, `struct fdma_dcb`, `struct fdma_ops`, `struct fdma`, `function fdma_dcb_advance`, `function fdma_db_advance`, `function fdma_db_reset`, `function fdma_dcb_is_reusable`, `function fdma_db_is_done`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- 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.