drivers/s390/net/ctcm_main.c
Source file repositories/reference/linux-study-clean/drivers/s390/net/ctcm_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/net/ctcm_main.c- Extension
.c- Size
- 45527 bytes
- Lines
- 1781
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- 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/init.hlinux/kernel.hlinux/slab.hlinux/errno.hlinux/types.hlinux/interrupt.hlinux/timer.hlinux/bitops.hlinux/signal.hlinux/string.hlinux/ip.hlinux/if_arp.hlinux/tcp.hlinux/skbuff.hlinux/ctype.hnet/dst.hlinux/io.hasm/ccwdev.hasm/ccwgroup.hlinux/uaccess.hasm/idals.hctcm_fsms.hctcm_main.h
Detected Declarations
function ctcm_unpack_skbfunction channel_freefunction channel_removefunction ctcm_check_irb_errorfunction ccw_unit_checkfunction ctcm_ch_alloc_bufferfunction ctcm_openfunction ctcm_closefunction ctcm_txfunction ctcmpc_send_sweep_reqfunction ctcmpc_transmit_skbfunction ctcm_txfunction ctcmpc_txfunction ctcm_change_mtufunction ctcm_free_netdevicefunction ctcm_dev_setupfunction ctcm_irq_handlerfunction ctcm_probe_devicefunction add_channelfunction get_channel_typefunction ctcm_new_devicefunction ctcm_shutdown_devicefunction ctcm_remove_devicefunction group_storefunction ctcm_exitfunction print_bannerfunction ctcm_initmodule init ctcm_init
Annotated Snippet
static const struct net_device_ops ctcm_netdev_ops = {
.ndo_open = ctcm_open,
.ndo_stop = ctcm_close,
.ndo_get_stats = ctcm_stats,
.ndo_change_mtu = ctcm_change_mtu,
.ndo_start_xmit = ctcm_tx,
};
static const struct net_device_ops ctcm_mpc_netdev_ops = {
.ndo_open = ctcm_open,
.ndo_stop = ctcm_close,
.ndo_get_stats = ctcm_stats,
.ndo_change_mtu = ctcm_change_mtu,
.ndo_start_xmit = ctcmpc_tx,
};
static void ctcm_dev_setup(struct net_device *dev)
{
dev->type = ARPHRD_SLIP;
dev->tx_queue_len = 100;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
dev->min_mtu = 576;
dev->max_mtu = 65527;
}
/*
* Initialize everything of the net device except the name and the
* channel structs.
*/
static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
{
struct net_device *dev;
struct mpc_group *grp;
if (!priv)
return NULL;
if (IS_MPC(priv))
dev = alloc_netdev(0, MPC_DEVICE_GENE, NET_NAME_UNKNOWN,
ctcm_dev_setup);
else
dev = alloc_netdev(0, CTC_DEVICE_GENE, NET_NAME_UNKNOWN,
ctcm_dev_setup);
if (!dev) {
CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT,
"%s: MEMORY allocation ERROR",
CTCM_FUNTAIL);
return NULL;
}
dev->ml_priv = priv;
priv->fsm = init_fsm("ctcmdev", dev_state_names, dev_event_names,
CTCM_NR_DEV_STATES, CTCM_NR_DEV_EVENTS,
dev_fsm, dev_fsm_len, GFP_KERNEL);
if (priv->fsm == NULL) {
CTCMY_DBF_DEV(SETUP, dev, "init_fsm error");
free_netdev(dev);
return NULL;
}
fsm_newstate(priv->fsm, DEV_STATE_STOPPED);
fsm_settimer(priv->fsm, &priv->restart_timer);
if (IS_MPC(priv)) {
/* MPC Group Initializations */
grp = ctcmpc_init_mpc_group(priv);
if (grp == NULL) {
MPC_DBF_DEV(SETUP, dev, "init_mpc_group error");
free_netdev(dev);
return NULL;
}
tasklet_init(&grp->mpc_tasklet2,
mpc_group_ready, (unsigned long)dev);
dev->mtu = MPC_BUFSIZE_DEFAULT -
TH_HEADER_LENGTH - PDU_HEADER_LENGTH;
dev->netdev_ops = &ctcm_mpc_netdev_ops;
dev->hard_header_len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH;
priv->buffer_size = MPC_BUFSIZE_DEFAULT;
} else {
dev->mtu = CTCM_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
dev->netdev_ops = &ctcm_netdev_ops;
dev->hard_header_len = LL_HEADER_LENGTH + 2;
}
CTCMY_DBF_DEV(SETUP, dev, "finished");
return dev;
}
/*
* Main IRQ handler.
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/slab.h`, `linux/errno.h`, `linux/types.h`, `linux/interrupt.h`, `linux/timer.h`.
- Detected declarations: `function ctcm_unpack_skb`, `function channel_free`, `function channel_remove`, `function ctcm_check_irb_error`, `function ccw_unit_check`, `function ctcm_ch_alloc_buffer`, `function ctcm_open`, `function ctcm_close`, `function ctcm_tx`, `function ctcmpc_send_sweep_req`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: pattern 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.