drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c- Extension
.c- Size
- 3133 bytes
- Lines
- 139
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/module.hlinux/io.hlinux/of_net.hdpaa_eth.hmac.h
Detected Declarations
function dpaa_eth_show_addrfunction dpaa_eth_show_fqidsfunction list_for_each_entry_safefunction dpaa_eth_show_bpidsfunction dpaa_eth_sysfs_initfunction dpaa_eth_sysfs_remove
Annotated Snippet
switch (fq->fq_type) {
case FQ_TYPE_RX_DEFAULT:
str = "Rx default";
break;
case FQ_TYPE_RX_ERROR:
str = "Rx error";
break;
case FQ_TYPE_RX_PCD:
str = "Rx PCD";
break;
case FQ_TYPE_TX_CONFIRM:
str = "Tx default confirmation";
break;
case FQ_TYPE_TX_CONF_MQ:
str = "Tx confirmation (mq)";
break;
case FQ_TYPE_TX_ERROR:
str = "Tx error";
break;
case FQ_TYPE_TX:
str = "Tx";
break;
default:
str = "Unknown";
}
if (prev && (abs(fq->fqid - prev->fqid) != 1 ||
str != prevstr)) {
if (last_fqid == first_fqid)
bytes += sprintf(buf + bytes,
"%s: %d\n", prevstr, prev->fqid);
else
bytes += sprintf(buf + bytes,
"%s: %d - %d\n", prevstr,
first_fqid, last_fqid);
}
if (prev && abs(fq->fqid - prev->fqid) == 1 &&
str == prevstr) {
last_fqid = fq->fqid;
} else {
first_fqid = fq->fqid;
last_fqid = fq->fqid;
}
prev = fq;
prevstr = str;
}
if (prev) {
if (last_fqid == first_fqid)
bytes += sprintf(buf + bytes, "%s: %d\n", prevstr,
prev->fqid);
else
bytes += sprintf(buf + bytes, "%s: %d - %d\n", prevstr,
first_fqid, last_fqid);
}
return bytes;
}
static ssize_t dpaa_eth_show_bpids(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct dpaa_priv *priv = netdev_priv(to_net_dev(dev));
ssize_t bytes = 0;
bytes += snprintf(buf + bytes, PAGE_SIZE - bytes, "%u\n",
priv->dpaa_bp->bpid);
return bytes;
}
static struct device_attribute dpaa_eth_attrs[] = {
__ATTR(device_addr, 0444, dpaa_eth_show_addr, NULL),
__ATTR(fqids, 0444, dpaa_eth_show_fqids, NULL),
__ATTR(bpids, 0444, dpaa_eth_show_bpids, NULL),
};
void dpaa_eth_sysfs_init(struct device *dev)
{
int i;
for (i = 0; i < ARRAY_SIZE(dpaa_eth_attrs); i++)
if (device_create_file(dev, &dpaa_eth_attrs[i])) {
dev_err(dev, "Error creating sysfs file\n");
while (i > 0)
device_remove_file(dev, &dpaa_eth_attrs[--i]);
return;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/io.h`, `linux/of_net.h`, `dpaa_eth.h`, `mac.h`.
- Detected declarations: `function dpaa_eth_show_addr`, `function dpaa_eth_show_fqids`, `function list_for_each_entry_safe`, `function dpaa_eth_show_bpids`, `function dpaa_eth_sysfs_init`, `function dpaa_eth_sysfs_remove`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.