drivers/infiniband/ulp/ipoib/ipoib_main.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/ipoib/ipoib_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/ulp/ipoib/ipoib_main.c- Extension
.c- Size
- 71428 bytes
- Lines
- 2807
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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
ipoib.hlinux/module.hlinux/init.hlinux/slab.hlinux/kernel.hlinux/vmalloc.hlinux/if_arp.hlinux/ip.hlinux/in.hlinux/jhash.hnet/arp.hnet/addrconf.hnet/netdev_lock.hnet/pkt_sched.hlinux/inetdevice.hrdma/ib_cache.h
Detected Declarations
struct ipoib_path_iterstruct ipoib_ifupdown_workstruct ipoib_walk_datafunction ipoib_netdev_eventfunction ipoib_ifupdown_taskfunction ipoib_schedule_ifupdown_taskfunction ipoib_openfunction ipoib_stopfunction ipoib_fix_featuresfunction ipoib_change_mtufunction ipoib_get_statsfunction ipoib_is_dev_match_addr_rcufunction existsfunction ipoib_upper_walkfunction ipoib_match_gid_pkey_addrfunction __ipoib_get_net_dev_by_paramsfunction list_for_each_entryfunction ipoib_set_modefunction __path_addfunction path_freefunction ipoib_path_iter_nextfunction ipoib_path_iter_readfunction ipoib_mark_paths_invalidfunction list_for_each_entry_safefunction push_pseudo_headerfunction ipoib_flush_pathsfunction list_for_each_entry_safefunction path_rec_completionfunction list_for_each_entry_safefunction init_path_recfunction path_rec_startfunction neigh_refresh_pathfunction unicast_arp_sendfunction ipoib_start_xmitfunction ipoib_timeoutfunction ipoib_ib_tx_timeout_workfunction ipoib_hard_headerfunction ipoib_set_rx_mode_asyncfunction ipoib_get_iflinkfunction ipoib_addr_hashfunction __ipoib_reap_neighfunction ipoib_reap_neighfunction lockdep_is_heldfunction ipoib_neigh_dtorfunction ipoib_neigh_reclaimfunction ipoib_neigh_freefunction lockdep_is_heldfunction ipoib_neigh_hash_init
Annotated Snippet
static const struct net_device_ops ipoib_netdev_ops_pf = {
.ndo_init = ipoib_ndo_init,
.ndo_uninit = ipoib_ndo_uninit,
.ndo_open = ipoib_open,
.ndo_stop = ipoib_stop,
.ndo_change_mtu = ipoib_change_mtu,
.ndo_fix_features = ipoib_fix_features,
.ndo_start_xmit = ipoib_start_xmit,
.ndo_tx_timeout = ipoib_timeout,
.ndo_set_rx_mode_async = ipoib_set_rx_mode_async,
.ndo_get_iflink = ipoib_get_iflink,
.ndo_set_vf_link_state = ipoib_set_vf_link_state,
.ndo_get_vf_config = ipoib_get_vf_config,
.ndo_get_vf_stats = ipoib_get_vf_stats,
.ndo_get_vf_guid = ipoib_get_vf_guid,
.ndo_set_vf_guid = ipoib_set_vf_guid,
.ndo_set_mac_address = ipoib_set_mac,
.ndo_get_stats64 = ipoib_get_stats,
.ndo_eth_ioctl = ipoib_ioctl,
.ndo_hwtstamp_get = ipoib_hwtstamp_get,
.ndo_hwtstamp_set = ipoib_hwtstamp_set,
};
static const struct net_device_ops ipoib_netdev_ops_vf = {
.ndo_init = ipoib_ndo_init,
.ndo_uninit = ipoib_ndo_uninit,
.ndo_open = ipoib_open,
.ndo_stop = ipoib_stop,
.ndo_change_mtu = ipoib_change_mtu,
.ndo_fix_features = ipoib_fix_features,
.ndo_start_xmit = ipoib_start_xmit,
.ndo_tx_timeout = ipoib_timeout,
.ndo_set_rx_mode_async = ipoib_set_rx_mode_async,
.ndo_get_iflink = ipoib_get_iflink,
.ndo_get_stats64 = ipoib_get_stats,
.ndo_eth_ioctl = ipoib_ioctl,
.ndo_hwtstamp_get = ipoib_hwtstamp_get,
.ndo_hwtstamp_set = ipoib_hwtstamp_set,
};
static const struct net_device_ops ipoib_netdev_default_pf = {
.ndo_init = ipoib_dev_init_default,
.ndo_uninit = ipoib_dev_uninit_default,
.ndo_open = ipoib_ib_dev_open_default,
.ndo_stop = ipoib_ib_dev_stop_default,
};
void ipoib_setup_common(struct net_device *dev)
{
dev->header_ops = &ipoib_header_ops;
dev->netdev_ops = &ipoib_netdev_default_pf;
ipoib_set_ethtool_ops(dev);
dev->watchdog_timeo = 10 * HZ;
dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
dev->hard_header_len = IPOIB_HARD_LEN;
dev->addr_len = INFINIBAND_ALEN;
dev->type = ARPHRD_INFINIBAND;
dev->tx_queue_len = DEFAULT_TX_QUEUE_LEN;
dev->features = (NETIF_F_VLAN_CHALLENGED |
NETIF_F_HIGHDMA);
netif_keep_dst(dev);
memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN);
/*
* unregister_netdev always frees the netdev, we use this mode
* consistently to unify all the various unregister paths, including
* those connected to rtnl_link_ops which require it.
*/
dev->needs_free_netdev = true;
}
static void ipoib_build_priv(struct net_device *dev)
{
struct ipoib_dev_priv *priv = ipoib_priv(dev);
priv->dev = dev;
spin_lock_init(&priv->lock);
mutex_init(&priv->mcast_mutex);
INIT_LIST_HEAD(&priv->path_list);
INIT_LIST_HEAD(&priv->child_intfs);
INIT_LIST_HEAD(&priv->dead_ahs);
INIT_LIST_HEAD(&priv->multicast_list);
INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
Annotation
- Immediate include surface: `ipoib.h`, `linux/module.h`, `linux/init.h`, `linux/slab.h`, `linux/kernel.h`, `linux/vmalloc.h`, `linux/if_arp.h`, `linux/ip.h`.
- Detected declarations: `struct ipoib_path_iter`, `struct ipoib_ifupdown_work`, `struct ipoib_walk_data`, `function ipoib_netdev_event`, `function ipoib_ifupdown_task`, `function ipoib_schedule_ifupdown_task`, `function ipoib_open`, `function ipoib_stop`, `function ipoib_fix_features`, `function ipoib_change_mtu`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.