drivers/net/ipa/ipa_sysfs.c
Source file repositories/reference/linux-study-clean/drivers/net/ipa/ipa_sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ipa/ipa_sysfs.c- Extension
.c- Size
- 4437 bytes
- Lines
- 177
- 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/device.hlinux/sysfs.hlinux/types.hipa.hipa_sysfs.hipa_version.h
Detected Declarations
function version_showfunction rx_offload_showfunction tx_offload_showfunction ipa_endpoint_id_is_visiblefunction endpoint_id_attr_show
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/* Copyright (C) 2021-2024 Linaro Ltd. */
#include <linux/device.h>
#include <linux/sysfs.h>
#include <linux/types.h>
#include "ipa.h"
#include "ipa_sysfs.h"
#include "ipa_version.h"
static const char *ipa_version_string(struct ipa *ipa)
{
switch (ipa->version) {
case IPA_VERSION_3_0:
return "3.0";
case IPA_VERSION_3_1:
return "3.1";
case IPA_VERSION_3_5:
return "3.5";
case IPA_VERSION_3_5_1:
return "3.5.1";
case IPA_VERSION_4_0:
return "4.0";
case IPA_VERSION_4_1:
return "4.1";
case IPA_VERSION_4_2:
return "4.2";
case IPA_VERSION_4_5:
return "4.5";
case IPA_VERSION_4_7:
return "4.7";
case IPA_VERSION_4_9:
return "4.9";
case IPA_VERSION_4_11:
return "4.11";
case IPA_VERSION_5_0:
return "5.0";
case IPA_VERSION_5_1:
return "5.1";
case IPA_VERSION_5_2:
return "5.2";
case IPA_VERSION_5_5:
return "5.5";
default:
return "0.0"; /* Should not happen */
}
}
static ssize_t
version_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct ipa *ipa = dev_get_drvdata(dev);
return sysfs_emit(buf, "%s\n", ipa_version_string(ipa));
}
static DEVICE_ATTR_RO(version);
static struct attribute *ipa_attrs[] = {
&dev_attr_version.attr,
NULL
};
const struct attribute_group ipa_attribute_group = {
.attrs = ipa_attrs,
};
static const char *ipa_offload_string(struct ipa *ipa)
{
return ipa->version < IPA_VERSION_4_5 ? "MAPv4" : "MAPv5";
}
static ssize_t rx_offload_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ipa *ipa = dev_get_drvdata(dev);
return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
}
static DEVICE_ATTR_RO(rx_offload);
static ssize_t tx_offload_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct ipa *ipa = dev_get_drvdata(dev);
return sysfs_emit(buf, "%s\n", ipa_offload_string(ipa));
Annotation
- Immediate include surface: `linux/device.h`, `linux/sysfs.h`, `linux/types.h`, `ipa.h`, `ipa_sysfs.h`, `ipa_version.h`.
- Detected declarations: `function version_show`, `function rx_offload_show`, `function tx_offload_show`, `function ipa_endpoint_id_is_visible`, `function endpoint_id_attr_show`.
- 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.