drivers/net/ethernet/broadcom/bcmsysport.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/broadcom/bcmsysport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/broadcom/bcmsysport.c- Extension
.c- Size
- 77235 bytes
- Lines
- 2896
- 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
linux/init.hlinux/interrupt.hlinux/module.hlinux/kernel.hlinux/netdevice.hlinux/dsa/brcm.hlinux/etherdevice.hlinux/platform_device.hlinux/of.hlinux/of_net.hlinux/of_mdio.hlinux/phy.hlinux/phy_fixed.hnet/dsa.hlinux/clk.hnet/ip.hnet/ipv6.hbcmsysport.h
Detected Declarations
function Copyrightfunction rdma_writelfunction tdma_control_bitfunction dma_desc_set_addrfunction bcm_sysport_set_rx_csumfunction bcm_sysport_set_tx_csumfunction bcm_sysport_set_featuresfunction bcm_sysport_get_drvinfofunction bcm_sysport_get_msglvlfunction bcm_sysport_set_msglvlfunction bcm_sysport_lite_stat_validfunction bcm_sysport_get_sset_countfunction bcm_sysport_get_stringsfunction bcm_sysport_update_mib_countersfunction bcm_sysport_update_tx_statsfunction bcm_sysport_get_statsfunction bcm_sysport_get_wolfunction bcm_sysport_set_wolfunction bcm_sysport_set_rx_coalescefunction bcm_sysport_set_tx_coalescefunction bcm_sysport_get_coalescefunction bcm_sysport_set_coalescefunction bcm_sysport_free_cbfunction bcm_sysport_alloc_rx_bufsfunction bcm_sysport_desc_rxfunction bcm_sysport_tx_reclaim_onefunction __bcm_sysport_tx_reclaimfunction bcm_sysport_tx_reclaimfunction bcm_sysport_tx_cleanfunction bcm_sysport_tx_pollfunction bcm_sysport_tx_reclaim_allfunction bcm_sysport_pollfunction mpd_enable_setfunction bcm_sysport_resume_from_wolfunction bcm_sysport_dim_workfunction bcm_sysport_rx_isrfunction bcm_sysport_tx_isrfunction bcm_sysport_wol_isrfunction bcm_sysport_poll_controllerfunction bcm_sysport_xmitfunction bcm_sysport_tx_timeoutfunction bcm_sysport_adj_linkfunction bcm_sysport_init_dimfunction bcm_sysport_init_rx_coalescefunction bcm_sysport_init_tx_ringfunction bcm_sysport_fini_tx_ringfunction rdma_enable_setfunction tdma_enable_set
Annotated Snippet
static const struct net_device_ops bcm_sysport_netdev_ops = {
.ndo_start_xmit = bcm_sysport_xmit,
.ndo_tx_timeout = bcm_sysport_tx_timeout,
.ndo_open = bcm_sysport_open,
.ndo_stop = bcm_sysport_stop,
.ndo_set_features = bcm_sysport_set_features,
.ndo_set_rx_mode = bcm_sysport_set_rx_mode,
.ndo_set_mac_address = bcm_sysport_change_mac,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = bcm_sysport_poll_controller,
#endif
.ndo_get_stats64 = bcm_sysport_get_stats64,
.ndo_select_queue = bcm_sysport_select_queue,
};
static int bcm_sysport_map_queues(struct net_device *dev,
struct net_device *slave_dev)
{
struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
/* We can't be setting up queue inspection for non directly attached
* switches
*/
if (dp->ds->index)
return 0;
port = dp->index;
/* On SYSTEMPORT Lite we have twice as less queues, so we cannot do a
* 1:1 mapping, we can only do a 2:1 mapping. By reducing the number of
* per-port (slave_dev) network devices queue, we achieve just that.
* This need to happen now before any slave network device is used such
* it accurately reflects the number of real TX queues.
*/
if (priv->is_lite)
netif_set_real_num_tx_queues(slave_dev,
slave_dev->num_tx_queues / 2);
num_tx_queues = slave_dev->real_num_tx_queues;
if (priv->per_port_num_tx_queues &&
priv->per_port_num_tx_queues != num_tx_queues)
netdev_warn(slave_dev, "asymmetric number of per-port queues\n");
priv->per_port_num_tx_queues = num_tx_queues;
for (q = 0, qp = 0; q < dev->num_tx_queues && qp < num_tx_queues;
q++) {
ring = &priv->tx_rings[q];
if (ring->inspect)
continue;
/* Just remember the mapping actual programming done
* during bcm_sysport_init_tx_ring
*/
ring->switch_queue = qp;
ring->switch_port = port;
ring->inspect = true;
priv->ring_map[qp + port * num_tx_queues] = ring;
qp++;
}
return 0;
}
static int bcm_sysport_unmap_queues(struct net_device *dev,
struct net_device *slave_dev)
{
struct dsa_port *dp = dsa_port_from_netdev(slave_dev);
struct bcm_sysport_priv *priv = netdev_priv(dev);
struct bcm_sysport_tx_ring *ring;
unsigned int num_tx_queues;
unsigned int q, qp, port;
port = dp->index;
num_tx_queues = slave_dev->real_num_tx_queues;
for (q = 0; q < dev->num_tx_queues; q++) {
ring = &priv->tx_rings[q];
if (ring->switch_port != port)
continue;
if (!ring->inspect)
Annotation
- Immediate include surface: `linux/init.h`, `linux/interrupt.h`, `linux/module.h`, `linux/kernel.h`, `linux/netdevice.h`, `linux/dsa/brcm.h`, `linux/etherdevice.h`, `linux/platform_device.h`.
- Detected declarations: `function Copyright`, `function rdma_writel`, `function tdma_control_bit`, `function dma_desc_set_addr`, `function bcm_sysport_set_rx_csum`, `function bcm_sysport_set_tx_csum`, `function bcm_sysport_set_features`, `function bcm_sysport_get_drvinfo`, `function bcm_sysport_get_msglvl`, `function bcm_sysport_set_msglvl`.
- 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.