net/ncsi/ncsi-manage.c
Source file repositories/reference/linux-study-clean/net/ncsi/ncsi-manage.c
File Facts
- System
- Linux kernel
- Corpus path
net/ncsi/ncsi-manage.c- Extension
.c- Size
- 48550 bytes
- Lines
- 1975
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/module.hlinux/kernel.hlinux/init.hlinux/netdevice.hlinux/skbuff.hlinux/of.hlinux/platform_device.hnet/ncsi.hnet/net_namespace.hnet/sock.hnet/addrconf.hnet/ipv6.hnet/genetlink.hinternal.hncsi-pkt.hncsi-netlink.h
Detected Declarations
function ncsi_channel_has_linkfunction ncsi_channel_is_lastfunction NCSI_FOR_EACH_PACKAGEfunction ncsi_report_linkfunction NCSI_FOR_EACH_CHANNELfunction ncsi_channel_monitorfunction ncsi_start_channel_monitorfunction ncsi_stop_channel_monitorfunction NCSI_FOR_EACH_CHANNELfunction ncsi_remove_channelfunction NCSI_FOR_EACH_PACKAGEfunction ncsi_remove_packagefunction ncsi_find_package_and_channelfunction ncsi_free_requestfunction NCSI_FOR_EACH_DEVfunction ncsi_request_timeoutfunction ncsi_suspend_channelfunction NCSI_FOR_EACH_CHANNELfunction clear_one_vidfunction set_one_vidfunction ncsi_oem_keep_phy_intelfunction ncsi_oem_gma_handler_bcmfunction ncsi_oem_gma_handler_mlxfunction ncsi_oem_smaf_mlxfunction ncsi_oem_gma_handler_intelfunction ncsi_gma_handlerfunction ncsi_channel_is_txfunction NCSI_FOR_EACH_CHANNELfunction ncsi_update_tx_channelfunction NCSI_FOR_EACH_CHANNELfunction NCSI_FOR_EACH_CHANNELfunction ncsi_configure_channelfunction ncsi_choose_active_channelfunction NCSI_FOR_EACH_CHANNELfunction ncsi_check_hwafunction NCSI_FOR_EACH_CHANNELfunction ncsi_probe_channelfunction ncsi_dev_workfunction ncsi_process_next_channelfunction ncsi_kick_channelsfunction NCSI_FOR_EACH_PACKAGEfunction ncsi_vlan_rx_add_vidfunction ncsi_vlan_rx_kill_vidfunction voidfunction ncsi_start_devfunction ncsi_stop_devfunction ncsi_start_devfunction ncsi_reset_dev
Annotated Snippet
NCSI_FOR_EACH_CHANNEL(np, nc) {
if (nc == channel)
continue;
if (nc->state == NCSI_CHANNEL_ACTIVE &&
ncsi_channel_has_link(nc))
return false;
}
return true;
}
static void ncsi_report_link(struct ncsi_dev_priv *ndp, bool force_down)
{
struct ncsi_dev *nd = &ndp->ndev;
struct ncsi_package *np;
struct ncsi_channel *nc;
unsigned long flags;
nd->state = ncsi_dev_state_functional;
if (force_down) {
nd->link_up = 0;
goto report;
}
nd->link_up = 0;
NCSI_FOR_EACH_PACKAGE(ndp, np) {
NCSI_FOR_EACH_CHANNEL(np, nc) {
spin_lock_irqsave(&nc->lock, flags);
if (!list_empty(&nc->link) ||
nc->state != NCSI_CHANNEL_ACTIVE) {
spin_unlock_irqrestore(&nc->lock, flags);
continue;
}
if (ncsi_channel_has_link(nc)) {
spin_unlock_irqrestore(&nc->lock, flags);
nd->link_up = 1;
goto report;
}
spin_unlock_irqrestore(&nc->lock, flags);
}
}
report:
nd->handler(nd);
}
static void ncsi_channel_monitor(struct timer_list *t)
{
struct ncsi_channel *nc = timer_container_of(nc, t, monitor.timer);
struct ncsi_package *np = nc->package;
struct ncsi_dev_priv *ndp = np->ndp;
struct ncsi_channel_mode *ncm;
struct ncsi_cmd_arg nca;
bool enabled, chained;
unsigned int monitor_state;
unsigned long flags;
int state, ret;
spin_lock_irqsave(&nc->lock, flags);
state = nc->state;
chained = !list_empty(&nc->link);
enabled = nc->monitor.enabled;
monitor_state = nc->monitor.state;
spin_unlock_irqrestore(&nc->lock, flags);
if (!enabled)
return; /* expected race disabling timer */
if (WARN_ON_ONCE(chained))
goto bad_state;
if (state != NCSI_CHANNEL_INACTIVE &&
state != NCSI_CHANNEL_ACTIVE) {
bad_state:
netdev_warn(ndp->ndev.dev,
"Bad NCSI monitor state channel %d 0x%x %s queue\n",
nc->id, state, chained ? "on" : "off");
spin_lock_irqsave(&nc->lock, flags);
nc->monitor.enabled = false;
spin_unlock_irqrestore(&nc->lock, flags);
return;
}
switch (monitor_state) {
case NCSI_CHANNEL_MONITOR_START:
case NCSI_CHANNEL_MONITOR_RETRY:
nca.ndp = ndp;
nca.package = np->id;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/netdevice.h`, `linux/skbuff.h`, `linux/of.h`, `linux/platform_device.h`, `net/ncsi.h`.
- Detected declarations: `function ncsi_channel_has_link`, `function ncsi_channel_is_last`, `function NCSI_FOR_EACH_PACKAGE`, `function ncsi_report_link`, `function NCSI_FOR_EACH_CHANNEL`, `function ncsi_channel_monitor`, `function ncsi_start_channel_monitor`, `function ncsi_stop_channel_monitor`, `function NCSI_FOR_EACH_CHANNEL`, `function ncsi_remove_channel`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.