drivers/net/ethernet/emulex/benet/be_main.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/emulex/benet/be_main.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/emulex/benet/be_main.c- Extension
.c- Size
- 163707 bytes
- Lines
- 6143
- 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/prefetch.hlinux/module.hbe.hbe_cmds.hasm/div64.hlinux/if_bridge.hnet/busy_poll.hnet/vxlan.h
Detected Declarations
function be_queue_freefunction be_queue_allocfunction be_reg_intr_setfunction be_intr_setfunction be_rxq_notifyfunction be_txq_notifyfunction be_eq_notifyfunction be_cq_notifyfunction be_dev_mac_addfunction be_dev_mac_delfunction be_mac_addr_setfunction populate_be_v0_statsfunction populate_be_v1_statsfunction populate_be_v2_statsfunction populate_lancer_statsfunction accumulate_16bit_valfunction populate_erx_statsfunction be_parse_statsfunction for_all_rx_queuesfunction be_get_stats64function for_all_rx_queuesfunction for_all_tx_queuesfunction be_link_status_updatefunction be_gso_hdr_lenfunction be_tx_stats_updatefunction skb_wrb_cntfunction wrb_fillfunction wrb_fill_dummyfunction be_get_tx_vlan_tagfunction skb_inner_ip_protofunction skb_ip_protofunction be_is_txq_fullfunction be_can_txq_wakefunction be_is_tx_compl_pendingfunction be_get_wrb_params_from_skbfunction wrb_fill_hdrfunction unmap_tx_fragfunction be_tx_get_wrb_hdrfunction be_tx_setup_wrb_hdrfunction be_tx_setup_wrb_fragfunction be_xmit_restorefunction be_xmit_enqueuefunction qnq_async_evt_rcvdfunction be_ipv6_exthdr_checkfunction be_vlan_tag_tx_chkfunction be_ipv6_tx_stall_chkfunction skb_vlan_tag_presentfunction skb_vlan_tag_present
Annotated Snippet
static const struct net_device_ops be_netdev_ops = {
.ndo_open = be_open,
.ndo_stop = be_close,
.ndo_start_xmit = be_xmit,
.ndo_set_rx_mode = be_set_rx_mode,
.ndo_set_mac_address = be_mac_addr_set,
.ndo_get_stats64 = be_get_stats64,
.ndo_validate_addr = eth_validate_addr,
.ndo_vlan_rx_add_vid = be_vlan_add_vid,
.ndo_vlan_rx_kill_vid = be_vlan_rem_vid,
.ndo_set_vf_mac = be_set_vf_mac,
.ndo_set_vf_vlan = be_set_vf_vlan,
.ndo_set_vf_rate = be_set_vf_tx_rate,
.ndo_get_vf_config = be_get_vf_config,
.ndo_set_vf_link_state = be_set_vf_link_state,
.ndo_set_vf_spoofchk = be_set_vf_spoofchk,
.ndo_tx_timeout = be_tx_timeout,
#ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = be_netpoll,
#endif
.ndo_bridge_setlink = be_ndo_bridge_setlink,
.ndo_bridge_getlink = be_ndo_bridge_getlink,
.ndo_features_check = be_features_check,
.ndo_get_phys_port_id = be_get_phys_port_id,
};
static void be_netdev_init(struct net_device *netdev)
{
struct be_adapter *adapter = netdev_priv(netdev);
netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX;
if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
netdev->hw_features |= NETIF_F_RXHASH;
netdev->features |= netdev->hw_features |
NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_CTAG_FILTER |
NETIF_F_HIGHDMA;
netdev->vlan_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
netdev->priv_flags |= IFF_UNICAST_FLT;
netdev->flags |= IFF_MULTICAST;
netif_set_tso_max_size(netdev, BE_MAX_GSO_SIZE - ETH_HLEN);
netdev->netdev_ops = &be_netdev_ops;
netdev->ethtool_ops = &be_ethtool_ops;
if (!lancer_chip(adapter) && !BEx_chip(adapter) && !be_is_mc(adapter))
netdev->udp_tunnel_nic_info = &be_udp_tunnels;
/* MTU range: 256 - 9000 */
netdev->min_mtu = BE_MIN_MTU;
netdev->max_mtu = BE_MAX_MTU;
}
static void be_cleanup(struct be_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
rtnl_lock();
netif_device_detach(netdev);
if (netif_running(netdev))
be_close(netdev);
rtnl_unlock();
be_clear(adapter);
}
static int be_resume(struct be_adapter *adapter)
{
struct net_device *netdev = adapter->netdev;
int status;
status = be_setup(adapter);
if (status)
return status;
rtnl_lock();
if (netif_running(netdev))
status = be_open(netdev);
rtnl_unlock();
if (status)
Annotation
- Immediate include surface: `linux/prefetch.h`, `linux/module.h`, `be.h`, `be_cmds.h`, `asm/div64.h`, `linux/if_bridge.h`, `net/busy_poll.h`, `net/vxlan.h`.
- Detected declarations: `function be_queue_free`, `function be_queue_alloc`, `function be_reg_intr_set`, `function be_intr_set`, `function be_rxq_notify`, `function be_txq_notify`, `function be_eq_notify`, `function be_cq_notify`, `function be_dev_mac_add`, `function be_dev_mac_del`.
- 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.