drivers/net/ethernet/netronome/nfp/nfp_net_common.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/netronome/nfp/nfp_net_common.c- Extension
.c- Size
- 78519 bytes
- Lines
- 2953
- 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
linux/bitfield.hlinux/bpf.hlinux/module.hlinux/kernel.hlinux/init.hlinux/fs.hlinux/netdevice.hlinux/etherdevice.hlinux/interrupt.hlinux/ip.hlinux/ipv6.hlinux/mm.hlinux/overflow.hlinux/page_ref.hlinux/pci.hlinux/pci_regs.hlinux/ethtool.hlinux/log2.hlinux/if_vlan.hlinux/if_bridge.hlinux/random.hlinux/vmalloc.hlinux/ktime.hnet/tls.hnet/vxlan.hnet/xdp_sock_drv.hnet/xfrm.hnfpcore/nfp_dev.hnfpcore/nfp_nsp.hccm.hnfp_app.hnfp_net_ctrl.h
Detected Declarations
function nfp_net_get_fw_versionfunction nfp_qcp_queue_offsetfunction asynchronousfunction nfp_net_reconfig_start_asyncfunction nfp_net_reconfig_check_donefunction __nfp_net_reconfig_waitfunction nfp_net_reconfig_waitfunction nfp_net_reconfig_timerfunction nfp_net_reconfig_postfunction nfp_net_reconfig_sync_enterfunction nfp_net_reconfig_wait_postedfunction __nfp_net_reconfigfunction nfp_net_reconfigfunction nfp_net_mbox_lockfunction nfp_net_mbox_reconfigfunction nfp_net_mbox_reconfig_postfunction nfp_net_mbox_reconfig_wait_postedfunction nfp_net_mbox_reconfig_and_unlockfunction nfp_net_irqs_allocfunction nfp_net_irqs_assignfunction nfp_net_irqs_disablefunction nfp_net_irq_rxtxfunction nfp_ctrl_irq_rxtxfunction nfp_net_read_link_statusfunction nfp_net_irq_lscfunction nfp_net_irq_exnfunction nfp_net_aux_irq_requestfunction nfp_net_aux_irq_freefunction nfp_net_tls_txfunction nfp_net_tls_tx_undofunction nfp_net_tx_timeoutfunction nfp_net_calc_fl_bufsz_datafunction nfp_net_calc_fl_bufszfunction nfp_net_calc_fl_bufsz_xskfunction nfp_net_vecs_initfunction nfp_net_napi_addfunction nfp_net_napi_delfunction nfp_net_vector_assign_ringsfunction nfp_net_prepare_vectorfunction nfp_net_cleanup_vectorfunction nfp_net_rss_write_itblfunction nfp_net_rss_write_keyfunction nfp_net_coalesce_write_cfgfunction nfp_net_write_mac_addrfunction nfp_net_clear_config_and_disablefunction nfp_net_set_config_and_enablefunction nfp_net_close_stackfunction nfp_net_close_free_all
Annotated Snippet
const struct net_device_ops nfp_nfd3_netdev_ops = {
.ndo_init = nfp_app_ndo_init,
.ndo_uninit = nfp_app_ndo_uninit,
.ndo_open = nfp_net_netdev_open,
.ndo_stop = nfp_net_netdev_close,
.ndo_start_xmit = nfp_net_tx,
.ndo_get_stats64 = nfp_net_stat64,
.ndo_vlan_rx_add_vid = nfp_net_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = nfp_net_vlan_rx_kill_vid,
.ndo_set_vf_mac = nfp_app_set_vf_mac,
.ndo_set_vf_vlan = nfp_app_set_vf_vlan,
.ndo_set_vf_rate = nfp_app_set_vf_rate,
.ndo_set_vf_spoofchk = nfp_app_set_vf_spoofchk,
.ndo_set_vf_trust = nfp_app_set_vf_trust,
.ndo_get_vf_config = nfp_app_get_vf_config,
.ndo_set_vf_link_state = nfp_app_set_vf_link_state,
.ndo_setup_tc = nfp_port_setup_tc,
.ndo_tx_timeout = nfp_net_tx_timeout,
.ndo_set_rx_mode = nfp_net_set_rx_mode,
.ndo_change_mtu = nfp_net_change_mtu,
.ndo_set_mac_address = nfp_net_set_mac_address,
.ndo_set_features = nfp_net_set_features,
.ndo_fix_features = nfp_net_fix_features,
.ndo_features_check = nfp_net_features_check,
.ndo_get_phys_port_name = nfp_net_get_phys_port_name,
.ndo_bpf = nfp_net_xdp,
.ndo_xsk_wakeup = nfp_net_xsk_wakeup,
.ndo_bridge_getlink = nfp_net_bridge_getlink,
.ndo_bridge_setlink = nfp_net_bridge_setlink,
};
const struct net_device_ops nfp_nfdk_netdev_ops = {
.ndo_init = nfp_app_ndo_init,
.ndo_uninit = nfp_app_ndo_uninit,
.ndo_open = nfp_net_netdev_open,
.ndo_stop = nfp_net_netdev_close,
.ndo_start_xmit = nfp_net_tx,
.ndo_get_stats64 = nfp_net_stat64,
.ndo_vlan_rx_add_vid = nfp_net_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = nfp_net_vlan_rx_kill_vid,
.ndo_set_vf_mac = nfp_app_set_vf_mac,
.ndo_set_vf_vlan = nfp_app_set_vf_vlan,
.ndo_set_vf_rate = nfp_app_set_vf_rate,
.ndo_set_vf_spoofchk = nfp_app_set_vf_spoofchk,
.ndo_set_vf_trust = nfp_app_set_vf_trust,
.ndo_get_vf_config = nfp_app_get_vf_config,
.ndo_set_vf_link_state = nfp_app_set_vf_link_state,
.ndo_setup_tc = nfp_port_setup_tc,
.ndo_tx_timeout = nfp_net_tx_timeout,
.ndo_set_rx_mode = nfp_net_set_rx_mode,
.ndo_change_mtu = nfp_net_change_mtu,
.ndo_set_mac_address = nfp_net_set_mac_address,
.ndo_set_features = nfp_net_set_features,
.ndo_fix_features = nfp_net_fix_features,
.ndo_features_check = nfp_net_features_check,
.ndo_get_phys_port_name = nfp_net_get_phys_port_name,
.ndo_bpf = nfp_net_xdp,
.ndo_bridge_getlink = nfp_net_bridge_getlink,
.ndo_bridge_setlink = nfp_net_bridge_setlink,
};
static int nfp_udp_tunnel_sync(struct net_device *netdev, unsigned int table)
{
struct nfp_net *nn = netdev_priv(netdev);
int i;
BUILD_BUG_ON(NFP_NET_N_VXLAN_PORTS & 1);
for (i = 0; i < NFP_NET_N_VXLAN_PORTS; i += 2) {
struct udp_tunnel_info ti0, ti1;
udp_tunnel_nic_get_port(netdev, table, i, &ti0);
udp_tunnel_nic_get_port(netdev, table, i + 1, &ti1);
nn_writel(nn, NFP_NET_CFG_VXLAN_PORT + i * sizeof(ti0.port),
be16_to_cpu(ti1.port) << 16 | be16_to_cpu(ti0.port));
}
return nfp_net_reconfig(nn, NFP_NET_CFG_UPDATE_VXLAN);
}
static const struct udp_tunnel_nic_info nfp_udp_tunnels = {
.sync_table = nfp_udp_tunnel_sync,
.flags = UDP_TUNNEL_NIC_INFO_OPEN_ONLY,
.tables = {
{
.n_entries = NFP_NET_N_VXLAN_PORTS,
.tunnel_types = UDP_TUNNEL_TYPE_VXLAN,
},
},
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bpf.h`, `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/fs.h`, `linux/netdevice.h`, `linux/etherdevice.h`.
- Detected declarations: `function nfp_net_get_fw_version`, `function nfp_qcp_queue_offset`, `function asynchronous`, `function nfp_net_reconfig_start_async`, `function nfp_net_reconfig_check_done`, `function __nfp_net_reconfig_wait`, `function nfp_net_reconfig_wait`, `function nfp_net_reconfig_timer`, `function nfp_net_reconfig_post`, `function nfp_net_reconfig_sync_enter`.
- 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.