drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c- Extension
.c- Size
- 42735 bytes
- Lines
- 1611
- 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
fm10k.hlinux/vmalloc.hnet/udp_tunnel.hlinux/if_macvlan.h
Detected Declarations
function fm10k_setup_tx_resourcesfunction populatedfunction fm10k_setup_rx_resourcesfunction populatedfunction fm10k_unmap_and_free_tx_resourcefunction fm10k_clean_tx_ringfunction fm10k_free_tx_resourcesfunction fm10k_clean_all_tx_ringsfunction fm10k_free_all_tx_resourcesfunction fm10k_clean_rx_ringfunction fm10k_free_rx_resourcesfunction fm10k_clean_all_rx_ringsfunction fm10k_free_all_rx_resourcesfunction fm10k_request_glort_rangefunction registerfunction fm10k_udp_tunnel_syncfunction systemfunction fm10k_closefunction fm10k_xmit_framefunction fm10k_tx_timeoutfunction fm10k_host_mbx_readyfunction fm10k_queue_vlan_requestfunction fm10k_queue_mac_requestfunction fm10k_clear_macvlan_queuefunction fm10k_uc_vlan_unsyncfunction fm10k_mc_vlan_unsyncfunction fm10k_update_vidfunction fm10k_vlan_rx_add_vidfunction fm10k_vlan_rx_kill_vidfunction fm10k_find_next_vlanfunction fm10k_clear_unused_vlansfunction __fm10k_uc_syncfunction fm10k_uc_syncfunction fm10k_uc_unsyncfunction fm10k_set_macfunction __fm10k_mc_syncfunction fm10k_mc_syncfunction fm10k_mc_unsyncfunction fm10k_set_rx_modefunction fm10k_restore_rx_statefunction fm10k_reset_rx_statefunction fm10k_get_stats64function fm10k_setup_tcfunction __fm10k_setup_tcfunction fm10k_assign_l2_accelfunction fm10k_dfwd_del_stationfunction fm10k_features_check
Annotated Snippet
static const struct net_device_ops fm10k_netdev_ops = {
.ndo_open = fm10k_open,
.ndo_stop = fm10k_close,
.ndo_validate_addr = eth_validate_addr,
.ndo_start_xmit = fm10k_xmit_frame,
.ndo_set_mac_address = fm10k_set_mac,
.ndo_tx_timeout = fm10k_tx_timeout,
.ndo_vlan_rx_add_vid = fm10k_vlan_rx_add_vid,
.ndo_vlan_rx_kill_vid = fm10k_vlan_rx_kill_vid,
.ndo_set_rx_mode = fm10k_set_rx_mode,
.ndo_get_stats64 = fm10k_get_stats64,
.ndo_setup_tc = __fm10k_setup_tc,
.ndo_set_vf_mac = fm10k_ndo_set_vf_mac,
.ndo_set_vf_vlan = fm10k_ndo_set_vf_vlan,
.ndo_set_vf_rate = fm10k_ndo_set_vf_bw,
.ndo_get_vf_config = fm10k_ndo_get_vf_config,
.ndo_get_vf_stats = fm10k_ndo_get_vf_stats,
.ndo_dfwd_add_station = fm10k_dfwd_add_station,
.ndo_dfwd_del_station = fm10k_dfwd_del_station,
.ndo_features_check = fm10k_features_check,
};
#define DEFAULT_DEBUG_LEVEL_SHIFT 3
struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info)
{
netdev_features_t hw_features;
struct fm10k_intfc *interface;
struct net_device *dev;
dev = alloc_etherdev_mq(sizeof(struct fm10k_intfc), MAX_QUEUES);
if (!dev)
return NULL;
/* set net device and ethtool ops */
dev->netdev_ops = &fm10k_netdev_ops;
fm10k_set_ethtool_ops(dev);
/* configure default debug level */
interface = netdev_priv(dev);
interface->msg_enable = BIT(DEFAULT_DEBUG_LEVEL_SHIFT) - 1;
/* configure default features */
dev->features |= NETIF_F_IP_CSUM |
NETIF_F_IPV6_CSUM |
NETIF_F_SG |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_RXHASH |
NETIF_F_RXCSUM;
/* Only the PF can support VXLAN and NVGRE tunnel offloads */
if (info->mac == fm10k_mac_pf) {
dev->hw_enc_features = NETIF_F_IP_CSUM |
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_IPV6_CSUM |
NETIF_F_SG;
dev->features |= NETIF_F_GSO_UDP_TUNNEL;
dev->udp_tunnel_nic_info = &fm10k_udp_tunnels;
}
/* all features defined to this point should be changeable */
hw_features = dev->features;
/* allow user to enable L2 forwarding acceleration */
hw_features |= NETIF_F_HW_L2FW_DOFFLOAD;
/* configure VLAN features */
dev->vlan_features |= dev->features;
/* we want to leave these both on as we cannot disable VLAN tag
* insertion or stripping on the hardware since it is contained
* in the FTAG and not in the frame itself.
*/
dev->features |= NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_VLAN_CTAG_FILTER;
dev->priv_flags |= IFF_UNICAST_FLT;
dev->hw_features |= hw_features;
/* MTU range: 68 - 15342 */
dev->min_mtu = ETH_MIN_MTU;
Annotation
- Immediate include surface: `fm10k.h`, `linux/vmalloc.h`, `net/udp_tunnel.h`, `linux/if_macvlan.h`.
- Detected declarations: `function fm10k_setup_tx_resources`, `function populated`, `function fm10k_setup_rx_resources`, `function populated`, `function fm10k_unmap_and_free_tx_resource`, `function fm10k_clean_tx_ring`, `function fm10k_free_tx_resources`, `function fm10k_clean_all_tx_rings`, `function fm10k_free_all_tx_resources`, `function fm10k_clean_rx_ring`.
- 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.