drivers/net/ethernet/sfc/ef100_rep.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/ef100_rep.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/ef100_rep.c- Extension
.c- Size
- 13671 bytes
- Lines
- 500
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/rhashtable.hef100_rep.hef100_netdev.hef100_nic.hmae.hrx_common.htc_bindings.hefx_devlink.h
Detected Declarations
function efx_ef100_rep_init_structfunction efx_ef100_rep_openfunction efx_ef100_rep_closefunction efx_ef100_rep_xmitfunction efx_ef100_rep_get_port_parent_idfunction efx_ef100_rep_get_phys_port_namefunction efx_ef100_rep_setup_tcfunction efx_ef100_rep_get_stats64function efx_ef100_rep_get_drvinfofunction efx_ef100_rep_ethtool_get_msglevelfunction efx_ef100_rep_ethtool_set_msglevelfunction efx_ef100_rep_ethtool_get_ringparamfunction efx_ef100_rep_ethtool_set_ringparamfunction efx_ef100_configure_repfunction efx_ef100_deconfigure_repfunction efx_ef100_rep_destroy_netdevfunction efx_ef100_vfrep_createfunction efx_ef100_vfrep_destroyfunction efx_ef100_fini_vfrepsfunction ef100_mport_is_pcie_vnicfunction ef100_mport_on_local_intffunction ef100_mport_is_vffunction efx_ef100_init_repsfunction efx_ef100_fini_repsfunction efx_ef100_rep_pollfunction efx_ef100_rep_rx_packet
Annotated Snippet
const struct net_device_ops efx_ef100_rep_netdev_ops = {
.ndo_open = efx_ef100_rep_open,
.ndo_stop = efx_ef100_rep_close,
.ndo_start_xmit = efx_ef100_rep_xmit,
.ndo_get_port_parent_id = efx_ef100_rep_get_port_parent_id,
.ndo_get_phys_port_name = efx_ef100_rep_get_phys_port_name,
.ndo_get_stats64 = efx_ef100_rep_get_stats64,
.ndo_setup_tc = efx_ef100_rep_setup_tc,
};
static void efx_ef100_rep_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *drvinfo)
{
strscpy(drvinfo->driver, EFX_EF100_REP_DRIVER, sizeof(drvinfo->driver));
}
static u32 efx_ef100_rep_ethtool_get_msglevel(struct net_device *net_dev)
{
struct efx_rep *efv = netdev_priv(net_dev);
return efv->msg_enable;
}
static void efx_ef100_rep_ethtool_set_msglevel(struct net_device *net_dev,
u32 msg_enable)
{
struct efx_rep *efv = netdev_priv(net_dev);
efv->msg_enable = msg_enable;
}
static void efx_ef100_rep_ethtool_get_ringparam(struct net_device *net_dev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kring,
struct netlink_ext_ack *ext_ack)
{
struct efx_rep *efv = netdev_priv(net_dev);
ring->rx_max_pending = U32_MAX;
ring->rx_pending = efv->rx_pring_size;
}
static int efx_ef100_rep_ethtool_set_ringparam(struct net_device *net_dev,
struct ethtool_ringparam *ring,
struct kernel_ethtool_ringparam *kring,
struct netlink_ext_ack *ext_ack)
{
struct efx_rep *efv = netdev_priv(net_dev);
if (ring->rx_mini_pending || ring->rx_jumbo_pending || ring->tx_pending)
return -EINVAL;
efv->rx_pring_size = ring->rx_pending;
return 0;
}
static const struct ethtool_ops efx_ef100_rep_ethtool_ops = {
.get_drvinfo = efx_ef100_rep_get_drvinfo,
.get_msglevel = efx_ef100_rep_ethtool_get_msglevel,
.set_msglevel = efx_ef100_rep_ethtool_set_msglevel,
.get_ringparam = efx_ef100_rep_ethtool_get_ringparam,
.set_ringparam = efx_ef100_rep_ethtool_set_ringparam,
};
static struct efx_rep *efx_ef100_rep_create_netdev(struct efx_nic *efx,
unsigned int i)
{
struct net_device *net_dev;
struct efx_rep *efv;
int rc;
net_dev = alloc_etherdev_mq(sizeof(*efv), 1);
if (!net_dev)
return ERR_PTR(-ENOMEM);
efv = netdev_priv(net_dev);
rc = efx_ef100_rep_init_struct(efx, efv, i);
if (rc)
goto fail1;
efv->net_dev = net_dev;
rtnl_lock();
spin_lock_bh(&efx->vf_reps_lock);
list_add_tail(&efv->list, &efx->vf_reps);
spin_unlock_bh(&efx->vf_reps_lock);
if (netif_running(efx->net_dev) && efx->state == STATE_NET_UP) {
netif_device_attach(net_dev);
netif_carrier_on(net_dev);
} else {
netif_carrier_off(net_dev);
netif_tx_stop_all_queues(net_dev);
Annotation
- Immediate include surface: `linux/rhashtable.h`, `ef100_rep.h`, `ef100_netdev.h`, `ef100_nic.h`, `mae.h`, `rx_common.h`, `tc_bindings.h`, `efx_devlink.h`.
- Detected declarations: `function efx_ef100_rep_init_struct`, `function efx_ef100_rep_open`, `function efx_ef100_rep_close`, `function efx_ef100_rep_xmit`, `function efx_ef100_rep_get_port_parent_id`, `function efx_ef100_rep_get_phys_port_name`, `function efx_ef100_rep_setup_tc`, `function efx_ef100_rep_get_stats64`, `function efx_ef100_rep_get_drvinfo`, `function efx_ef100_rep_ethtool_get_msglevel`.
- 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.
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.