drivers/net/ethernet/freescale/enetc/enetc_vf.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc_vf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/enetc/enetc_vf.c- Extension
.c- Size
- 10638 bytes
- Lines
- 419
- 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.
- 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/iopoll.hlinux/module.henetc.h
Detected Declarations
function enetc_msg_fill_common_hdrfunction enetc_msg_vsi_write_msgfunction enetc_msg_dma_freefunction enetc_msg_vsi_sendfunction enetc_msg_vsi_set_primary_mac_addrfunction enetc_vf_get_ip_minor_revisionfunction enetc_vf_set_mac_addrfunction enetc_vf_set_featuresfunction enetc_vf_setup_tcfunction enetc_vf_get_revisionfunction enetc_vf_netdev_setupfunction enetc_vf_probefunction enetc_vf_remove
Annotated Snippet
static const struct net_device_ops enetc_ndev_ops = {
.ndo_open = enetc_open,
.ndo_stop = enetc_close,
.ndo_start_xmit = enetc_xmit,
.ndo_get_stats = enetc_get_stats,
.ndo_set_mac_address = enetc_vf_set_mac_addr,
.ndo_set_features = enetc_vf_set_features,
.ndo_eth_ioctl = enetc_ioctl,
.ndo_setup_tc = enetc_vf_setup_tc,
.ndo_hwtstamp_get = enetc_hwtstamp_get,
.ndo_hwtstamp_set = enetc_hwtstamp_set,
};
static void enetc_vf_get_revision(struct enetc_si *si)
{
int ip_mn;
if (is_enetc_rev1(si)) {
si->revision = ENETC_REV_1_0;
return;
}
ip_mn = enetc_vf_get_ip_minor_revision(si);
if (ip_mn >= 0) {
si->revision = (si->pdev->revision << 8) | ip_mn;
return;
}
si->revision = ENETC_REV_4_1;
dev_info(&si->pdev->dev,
"Failed to get revision, use compatible revision: 0x%04x\n",
si->revision);
}
static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
const struct net_device_ops *ndev_ops)
{
struct enetc_ndev_priv *priv = netdev_priv(ndev);
SET_NETDEV_DEV(ndev, &si->pdev->dev);
priv->ndev = ndev;
priv->si = si;
priv->dev = &si->pdev->dev;
si->ndev = ndev;
priv->msg_enable = (NETIF_MSG_IFUP << 1) - 1;
priv->sysclk_freq = si->drvdata->sysclk_freq;
priv->max_frags = si->drvdata->max_frags;
ndev->netdev_ops = ndev_ops;
enetc_set_ethtool_ops(ndev);
ndev->watchdog_timeo = 5 * HZ;
ndev->max_mtu = ENETC_MAX_MTU;
ndev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
ndev->features = NETIF_F_HIGHDMA | NETIF_F_SG | NETIF_F_RXCSUM |
NETIF_F_HW_VLAN_CTAG_TX |
NETIF_F_HW_VLAN_CTAG_RX |
NETIF_F_HW_CSUM | NETIF_F_TSO | NETIF_F_TSO6 |
NETIF_F_GSO_UDP_L4;
ndev->vlan_features = NETIF_F_SG | NETIF_F_HW_CSUM |
NETIF_F_TSO | NETIF_F_TSO6;
if (si->num_rss) {
ndev->hw_features |= NETIF_F_RXHASH;
ndev->features |= NETIF_F_RXHASH;
}
/* pick up primary MAC address from SI */
enetc_load_primary_mac_addr(&si->hw, ndev);
}
static const struct enetc_si_ops enetc_vsi_ops = {
.get_rss_table = enetc_get_rss_table,
.set_rss_table = enetc_set_rss_table,
.setup_cbdr = enetc_setup_cbdr,
.teardown_cbdr = enetc_teardown_cbdr,
};
static int enetc_vf_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
struct enetc_ndev_priv *priv;
struct enetc_msg_swbd msg;
struct net_device *ndev;
struct enetc_si *si;
int err;
Annotation
- Immediate include surface: `linux/iopoll.h`, `linux/module.h`, `enetc.h`.
- Detected declarations: `function enetc_msg_fill_common_hdr`, `function enetc_msg_vsi_write_msg`, `function enetc_msg_dma_free`, `function enetc_msg_vsi_send`, `function enetc_msg_vsi_set_primary_mac_addr`, `function enetc_vf_get_ip_minor_revision`, `function enetc_vf_set_mac_addr`, `function enetc_vf_set_features`, `function enetc_vf_setup_tc`, `function enetc_vf_get_revision`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- 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.