drivers/net/ethernet/netronome/nfp/ccm_mbox.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/ccm_mbox.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/ccm_mbox.c- Extension
.c- Size
- 18742 bytes
- Lines
- 744
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/io.hlinux/skbuff.hccm.hnfp_net.h
Detected Declarations
struct nfp_ccm_mbox_cmsg_cbenum nfp_net_mbox_cmsg_statefunction nfp_ccm_mbox_max_msgfunction nfp_ccm_mbox_msg_initfunction nfp_ccm_mbox_maxlenfunction nfp_ccm_mbox_donefunction nfp_ccm_mbox_in_progressfunction nfp_ccm_mbox_set_busyfunction nfp_ccm_mbox_is_postedfunction nfp_ccm_mbox_mark_postedfunction nfp_ccm_mbox_is_firstfunction nfp_ccm_mbox_should_runfunction nfp_ccm_mbox_mark_next_runnerfunction nfp_ccm_mbox_write_tlvfunction nfp_ccm_mbox_copy_infunction nfp_ccm_mbox_find_reqfunction nfp_ccm_mbox_copy_outfunction nfp_ccm_mbox_mark_all_errfunction nfp_ccm_mbox_run_queue_unlockfunction nfp_ccm_mbox_skb_returnfunction nfp_ccm_mbox_unlink_unlockfunction nfp_ccm_mbox_msg_preparefunction nfp_ccm_mbox_msg_enqueuefunction __nfp_ccm_mbox_communicatefunction nfp_ccm_mbox_communicatefunction nfp_ccm_mbox_post_runq_workfunction nfp_ccm_mbox_post_wait_workfunction nfp_ccm_mbox_postfunction nfp_ccm_mbox_msg_allocfunction nfp_ccm_mbox_fitsfunction nfp_ccm_mbox_initfunction nfp_ccm_mbox_cleanfunction nfp_ccm_mbox_allocfunction nfp_ccm_mbox_free
Annotated Snippet
struct nfp_ccm_mbox_cmsg_cb {
enum nfp_net_mbox_cmsg_state state;
int err;
unsigned int max_len;
unsigned int exp_reply;
bool posted;
};
static u32 nfp_ccm_mbox_max_msg(struct nfp_net *nn)
{
return round_down(nn->tlv_caps.mbox_len, 4) -
NFP_NET_CFG_MBOX_SIMPLE_VAL - /* common mbox command header */
4 * 2; /* Msg TLV plus End TLV headers */
}
static void
nfp_ccm_mbox_msg_init(struct sk_buff *skb, unsigned int exp_reply, int max_len)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
cb->state = NFP_NET_MBOX_CMSG_STATE_QUEUED;
cb->err = 0;
cb->max_len = max_len;
cb->exp_reply = exp_reply;
cb->posted = false;
}
static int nfp_ccm_mbox_maxlen(const struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
return cb->max_len;
}
static bool nfp_ccm_mbox_done(struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
return cb->state == NFP_NET_MBOX_CMSG_STATE_DONE;
}
static bool nfp_ccm_mbox_in_progress(struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
return cb->state != NFP_NET_MBOX_CMSG_STATE_QUEUED &&
cb->state != NFP_NET_MBOX_CMSG_STATE_NEXT;
}
static void nfp_ccm_mbox_set_busy(struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
cb->state = NFP_NET_MBOX_CMSG_STATE_BUSY;
}
static bool nfp_ccm_mbox_is_posted(struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
return cb->posted;
}
static void nfp_ccm_mbox_mark_posted(struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
cb->posted = true;
}
static bool nfp_ccm_mbox_is_first(struct nfp_net *nn, struct sk_buff *skb)
{
return skb_queue_is_first(&nn->mbox_cmsg.queue, skb);
}
static bool nfp_ccm_mbox_should_run(struct nfp_net *nn, struct sk_buff *skb)
{
struct nfp_ccm_mbox_cmsg_cb *cb = (void *)skb->cb;
return cb->state == NFP_NET_MBOX_CMSG_STATE_NEXT;
}
static void nfp_ccm_mbox_mark_next_runner(struct nfp_net *nn)
{
struct nfp_ccm_mbox_cmsg_cb *cb;
struct sk_buff *skb;
skb = skb_peek(&nn->mbox_cmsg.queue);
if (!skb)
return;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/io.h`, `linux/skbuff.h`, `ccm.h`, `nfp_net.h`.
- Detected declarations: `struct nfp_ccm_mbox_cmsg_cb`, `enum nfp_net_mbox_cmsg_state`, `function nfp_ccm_mbox_max_msg`, `function nfp_ccm_mbox_msg_init`, `function nfp_ccm_mbox_maxlen`, `function nfp_ccm_mbox_done`, `function nfp_ccm_mbox_in_progress`, `function nfp_ccm_mbox_set_busy`, `function nfp_ccm_mbox_is_posted`, `function nfp_ccm_mbox_mark_posted`.
- 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.
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.