drivers/net/ethernet/rocker/rocker_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/rocker/rocker_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/rocker/rocker_main.c- Extension
.c- Size
- 84589 bytes
- Lines
- 3193
- 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/kernel.hlinux/module.hlinux/pci.hlinux/interrupt.hlinux/sched.hlinux/wait.hlinux/spinlock.hlinux/sort.hlinux/random.hlinux/netdevice.hlinux/skbuff.hlinux/socket.hlinux/etherdevice.hlinux/ethtool.hlinux/if_ether.hlinux/if_vlan.hlinux/if_bridge.hlinux/bitops.hlinux/ctype.hlinux/workqueue.hnet/switchdev.hnet/rtnetlink.hnet/netevent.hnet/arp.hnet/fib_rules.hnet/fib_notifier.hlinux/io-64-nonatomic-lo-hi.hrocker_hw.hrocker.hrocker_tlv.h
Detected Declarations
struct rocker_waitstruct port_namestruct rocker_fib_event_workstruct rocker_switchdev_event_workstruct rocker_walk_datafunction rocker_wait_resetfunction rocker_wait_initfunction rocker_wait_destroyfunction rocker_wait_event_timeoutfunction rocker_wait_wake_upfunction rocker_msix_vectorfunction rocker_msix_tx_vectorfunction rocker_msix_rx_vectorfunction rocker_reg_testfunction rocker_dma_test_onefunction rocker_dma_test_offsetfunction rocker_dma_testfunction rocker_test_irq_handlerfunction rocker_basic_hw_testfunction __pos_incfunction rocker_desc_errfunction rocker_desc_gen_clearfunction rocker_desc_genfunction rocker_desc_cookie_ptr_getfunction rocker_desc_cookie_ptr_setfunction rocker_desc_head_getfunction rocker_desc_commitfunction rocker_desc_head_setfunction rocker_desc_tail_getfunction rocker_dma_ring_credits_setfunction rocker_dma_ring_size_fixfunction rocker_dma_ring_createfunction rocker_dma_ring_destroyfunction rocker_dma_ring_pass_to_producerfunction rocker_dma_ring_bufs_allocfunction rocker_dma_ring_bufs_freefunction rocker_dma_cmd_ring_wait_allocfunction rocker_dma_cmd_ring_wait_freefunction rocker_dma_cmd_ring_waits_allocfunction rocker_dma_cmd_ring_waits_freefunction rocker_dma_rings_initfunction rocker_dma_rings_finifunction rocker_dma_rx_ring_skb_mapfunction rocker_port_rx_buf_lenfunction rocker_dma_rx_ring_skb_allocfunction rocker_dma_rx_ring_skb_unmapfunction rocker_dma_rx_ring_skb_freefunction rocker_dma_rx_ring_skbs_alloc
Annotated Snippet
static const struct net_device_ops rocker_port_netdev_ops = {
.ndo_open = rocker_port_open,
.ndo_stop = rocker_port_stop,
.ndo_start_xmit = rocker_port_xmit,
.ndo_set_mac_address = rocker_port_set_mac_address,
.ndo_change_mtu = rocker_port_change_mtu,
.ndo_get_phys_port_name = rocker_port_get_phys_port_name,
.ndo_neigh_destroy = rocker_port_neigh_destroy,
.ndo_get_port_parent_id = rocker_port_get_port_parent_id,
};
/********************
* swdev interface
********************/
static int rocker_port_attr_set(struct net_device *dev,
const struct switchdev_attr *attr)
{
struct rocker_port *rocker_port = netdev_priv(dev);
int err = 0;
switch (attr->id) {
case SWITCHDEV_ATTR_ID_PORT_STP_STATE:
err = rocker_world_port_attr_stp_state_set(rocker_port,
attr->u.stp_state);
break;
case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
err = rocker_world_port_attr_pre_bridge_flags_set(rocker_port,
attr->u.brport_flags);
break;
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
err = rocker_world_port_attr_bridge_flags_set(rocker_port,
attr->u.brport_flags);
break;
case SWITCHDEV_ATTR_ID_BRIDGE_AGEING_TIME:
err = rocker_world_port_attr_bridge_ageing_time_set(rocker_port,
attr->u.ageing_time);
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
static int rocker_port_obj_add(struct net_device *dev,
const struct switchdev_obj *obj)
{
struct rocker_port *rocker_port = netdev_priv(dev);
int err = 0;
switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_world_port_obj_vlan_add(rocker_port,
SWITCHDEV_OBJ_PORT_VLAN(obj));
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
static int rocker_port_obj_del(struct net_device *dev,
const struct switchdev_obj *obj)
{
struct rocker_port *rocker_port = netdev_priv(dev);
int err = 0;
switch (obj->id) {
case SWITCHDEV_OBJ_ID_PORT_VLAN:
err = rocker_world_port_obj_vlan_del(rocker_port,
SWITCHDEV_OBJ_PORT_VLAN(obj));
break;
default:
err = -EOPNOTSUPP;
break;
}
return err;
}
struct rocker_fib_event_work {
struct work_struct work;
union {
struct fib_entry_notifier_info fen_info;
struct fib_rule_notifier_info fr_info;
};
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/sched.h`, `linux/wait.h`, `linux/spinlock.h`, `linux/sort.h`.
- Detected declarations: `struct rocker_wait`, `struct port_name`, `struct rocker_fib_event_work`, `struct rocker_switchdev_event_work`, `struct rocker_walk_data`, `function rocker_wait_reset`, `function rocker_wait_init`, `function rocker_wait_destroy`, `function rocker_wait_event_timeout`, `function rocker_wait_wake_up`.
- 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.