drivers/media/dvb-core/dvb_net.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-core/dvb_net.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-core/dvb_net.c- Extension
.c- Size
- 43237 bytes
- Lines
- 1668
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/netdevice.hlinux/nospec.hlinux/etherdevice.hlinux/dvb/net.hlinux/uio.hlinux/uaccess.hlinux/crc32.hlinux/mutex.hlinux/sched.hmedia/dvb_demux.hmedia/dvb_net.h
Detected Declarations
struct dvb_net_privstruct dvb_net_ule_handlefunction Copyrightfunction hexdumpfunction dvb_net_eth_type_transfunction ule_test_sndufunction ule_bridged_sndufunction ule_exthdr_paddingfunction handle_one_ule_extensionfunction handle_ule_extensionsfunction reset_ulefunction dvb_net_ule_new_ts_cellfunction dvb_net_ule_ts_pusifunction dvb_net_ule_new_tsfunction cellsfunction fieldfunction dvb_net_ule_should_dropfunction dvb_net_ule_check_crcfunction thefunction dvb_net_ulefunction dvb_net_ts_callbackfunction dvb_net_secfunction dvb_net_sec_callbackfunction dvb_net_txfunction dvb_net_filter_sec_setfunction dvb_net_feed_startfunction dvb_net_feed_stopfunction dvb_set_mc_filterfunction wq_set_multicast_listfunction dvb_net_set_multicast_listfunction wq_restart_net_feedfunction dvb_net_set_macfunction dvb_net_openfunction dvb_net_stopfunction dvb_net_setupfunction get_iffunction dvb_net_add_iffunction dvb_net_remove_iffunction dvb_net_do_ioctlfunction dvb_net_ioctlfunction locked_dvb_net_openfunction dvb_net_closefunction dvb_net_releasefunction dvb_net_initexport dvb_net_releaseexport dvb_net_init
Annotated Snippet
static const struct net_device_ops dvb_netdev_ops = {
.ndo_open = dvb_net_open,
.ndo_stop = dvb_net_stop,
.ndo_start_xmit = dvb_net_tx,
.ndo_set_rx_mode = dvb_net_set_multicast_list,
.ndo_set_mac_address = dvb_net_set_mac,
.ndo_validate_addr = eth_validate_addr,
};
static void dvb_net_setup(struct net_device *dev)
{
ether_setup(dev);
dev->header_ops = &dvb_header_ops;
dev->netdev_ops = &dvb_netdev_ops;
dev->mtu = 4096;
dev->max_mtu = 4096;
dev->flags |= IFF_NOARP;
}
static int get_if(struct dvb_net *dvbnet)
{
int i;
for (i=0; i<DVB_NET_DEVICES_MAX; i++)
if (!dvbnet->state[i])
break;
if (i == DVB_NET_DEVICES_MAX)
return -1;
dvbnet->state[i]=1;
return i;
}
static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid, u8 feedtype)
{
struct net_device *net;
struct dvb_net_priv *priv;
int result;
int if_num;
if (feedtype != DVB_NET_FEEDTYPE_MPE && feedtype != DVB_NET_FEEDTYPE_ULE)
return -EINVAL;
if ((if_num = get_if(dvbnet)) < 0)
return -EINVAL;
net = alloc_netdev(sizeof(struct dvb_net_priv), "dvb",
NET_NAME_UNKNOWN, dvb_net_setup);
if (!net)
return -ENOMEM;
if (dvbnet->dvbdev->id)
snprintf(net->name, IFNAMSIZ, "dvb%d%u%d",
dvbnet->dvbdev->adapter->num, dvbnet->dvbdev->id, if_num);
else
/* compatibility fix to keep dvb0_0 format */
snprintf(net->name, IFNAMSIZ, "dvb%d_%d",
dvbnet->dvbdev->adapter->num, if_num);
net->addr_len = 6;
eth_hw_addr_set(net, dvbnet->dvbdev->adapter->proposed_mac);
dvbnet->device[if_num] = net;
priv = netdev_priv(net);
priv->net = net;
priv->demux = dvbnet->demux;
priv->pid = pid;
priv->rx_mode = RX_MODE_UNI;
priv->need_pusi = 1;
priv->tscc = 0;
priv->feedtype = feedtype;
reset_ule(priv);
INIT_WORK(&priv->set_multicast_list_wq, wq_set_multicast_list);
INIT_WORK(&priv->restart_net_feed_wq, wq_restart_net_feed);
mutex_init(&priv->mutex);
net->base_addr = pid;
if ((result = register_netdev(net)) < 0) {
dvbnet->device[if_num] = NULL;
free_netdev(net);
return result;
}
pr_info("created network interface %s\n", net->name);
return if_num;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/netdevice.h`, `linux/nospec.h`, `linux/etherdevice.h`, `linux/dvb/net.h`, `linux/uio.h`, `linux/uaccess.h`.
- Detected declarations: `struct dvb_net_priv`, `struct dvb_net_ule_handle`, `function Copyright`, `function hexdump`, `function dvb_net_eth_type_trans`, `function ule_test_sndu`, `function ule_bridged_sndu`, `function ule_exthdr_padding`, `function handle_one_ule_extension`, `function handle_ule_extensions`.
- Atlas domain: Driver Families / drivers/media.
- 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.