drivers/net/ethernet/microsoft/mana/mana_en.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/microsoft/mana/mana_en.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/microsoft/mana/mana_en.c- Extension
.c- Size
- 102780 bytes
- Lines
- 4027
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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 an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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
uapi/linux/bpf.hlinux/debugfs.hlinux/inetdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/filter.hlinux/mm.hlinux/pci.hlinux/export.hlinux/skbuff.hnet/checksum.hnet/ip6_checksum.hnet/netdev_lock.hnet/page_pool/helpers.hnet/xdp.hnet/mana/mana.hnet/mana/mana_auxiliary.hnet/mana/hw_channel.h
Detected Declarations
function mana_adev_idx_allocfunction mana_adev_idx_freefunction mana_dbg_q_readfunction mana_en_need_logfunction mana_put_rx_pagefunction mana_openfunction mana_closefunction mana_link_state_handlefunction mana_can_txfunction mana_checksum_infofunction mana_add_sgefunction mana_map_skbfunction mana_fix_skb_headfunction mana_get_gso_hsfunction mana_per_port_queue_reset_work_handlerfunction mana_start_xmitfunction skb_shinfofunction mana_features_checkfunction mana_get_stats64function mana_get_tx_queuefunction mana_select_queuefunction mana_pre_dealloc_rxbufsfunction mana_get_rxbuf_cfgfunction mana_pre_alloc_rxbufsfunction mana_change_mtufunction mana_tx_timeoutfunction mana_shaper_setfunction mana_shaper_delfunction mana_shaper_capfunction mana_cleanup_port_contextfunction mana_cleanup_indir_tablefunction mana_init_port_contextfunction gdma_mana_send_requestfunction mana_send_requestfunction mana_verify_resp_hdrfunction mana_pf_register_hw_vportfunction mana_pf_deregister_hw_vportfunction mana_pf_register_filterfunction mana_pf_deregister_filterfunction mana_gd_query_device_cfgfunction mana_query_vport_cfgfunction mana_uncfg_vportfunction mana_cfg_vportfunction mana_cfg_vport_steeringfunction mana_query_link_cfgfunction mana_set_bw_clampfunction mana_create_wq_objfunction mana_destroy_wq_obj
Annotated Snippet
static const struct file_operations mana_dbg_q_fops = {
.owner = THIS_MODULE,
.open = simple_open,
.read = mana_dbg_q_read,
};
static bool mana_en_need_log(struct mana_port_context *apc, int err)
{
if (apc && apc->ac && apc->ac->gdma_dev &&
apc->ac->gdma_dev->gdma_context)
return mana_need_log(apc->ac->gdma_dev->gdma_context, err);
else
return true;
}
static void mana_put_rx_page(struct mana_rxq *rxq, struct page *page,
bool from_pool)
{
if (from_pool)
page_pool_put_full_page(rxq->page_pool, page, false);
else
put_page(page);
}
/* Microsoft Azure Network Adapter (MANA) functions */
static int mana_open(struct net_device *ndev)
{
struct mana_port_context *apc = netdev_priv(ndev);
int err;
err = mana_alloc_queues(ndev);
if (err) {
netdev_err(ndev, "%s failed to allocate queues: %d\n", __func__, err);
return err;
}
apc->port_is_up = true;
/* Ensure port state updated before txq state */
smp_wmb();
netif_tx_wake_all_queues(ndev);
netdev_dbg(ndev, "%s successful\n", __func__);
return 0;
}
static int mana_close(struct net_device *ndev)
{
struct mana_port_context *apc = netdev_priv(ndev);
if (!apc->port_is_up)
return 0;
return mana_detach(ndev, true);
}
static void mana_link_state_handle(struct work_struct *w)
{
struct mana_context *ac;
struct net_device *ndev;
u32 link_event;
bool link_up;
int i;
ac = container_of(w, struct mana_context, link_change_work);
rtnl_lock();
link_event = READ_ONCE(ac->link_event);
if (link_event == HWC_DATA_HW_LINK_CONNECT)
link_up = true;
else if (link_event == HWC_DATA_HW_LINK_DISCONNECT)
link_up = false;
else
goto out;
/* Process all ports */
for (i = 0; i < ac->num_ports; i++) {
ndev = ac->ports[i];
if (!ndev)
continue;
if (link_up) {
netif_carrier_on(ndev);
__netdev_notify_peers(ndev);
} else {
netif_carrier_off(ndev);
Annotation
- Immediate include surface: `uapi/linux/bpf.h`, `linux/debugfs.h`, `linux/inetdevice.h`, `linux/etherdevice.h`, `linux/ethtool.h`, `linux/filter.h`, `linux/mm.h`, `linux/pci.h`.
- Detected declarations: `function mana_adev_idx_alloc`, `function mana_adev_idx_free`, `function mana_dbg_q_read`, `function mana_en_need_log`, `function mana_put_rx_page`, `function mana_open`, `function mana_close`, `function mana_link_state_handle`, `function mana_can_tx`, `function mana_checksum_info`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern 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.