drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c- Extension
.c- Size
- 13327 bytes
- Lines
- 513
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- 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
rtrs-pri.hrtrs-clt.hrtrs-log.h
Detected Declarations
function Copyrightfunction rtrs_clt_path_stats_releasefunction max_reconnect_attempts_showfunction max_reconnect_attempts_storefunction mpath_policy_showfunction mpath_policy_storefunction add_path_showfunction add_path_storefunction rtrs_clt_state_showfunction rtrs_clt_reconnect_showfunction rtrs_clt_reconnect_storefunction rtrs_clt_disconnect_showfunction rtrs_clt_disconnect_storefunction rtrs_clt_remove_path_showfunction rtrs_clt_remove_path_storefunction rtrs_clt_hca_port_showfunction rtrs_clt_hca_name_showfunction rtrs_clt_cur_latency_showfunction rtrs_clt_src_addr_showfunction rtrs_clt_dst_addr_showfunction rtrs_clt_create_path_filesfunction rtrs_clt_destroy_path_filesfunction rtrs_clt_create_sysfs_root_filesfunction rtrs_clt_destroy_sysfs_root
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* RDMA Transport Layer
*
* Copyright (c) 2014 - 2018 ProfitBricks GmbH. All rights reserved.
* Copyright (c) 2018 - 2019 1&1 IONOS Cloud GmbH. All rights reserved.
* Copyright (c) 2019 - 2020 1&1 IONOS SE. All rights reserved.
*/
#undef pr_fmt
#define pr_fmt(fmt) KBUILD_MODNAME " L" __stringify(__LINE__) ": " fmt
#include "rtrs-pri.h"
#include "rtrs-clt.h"
#include "rtrs-log.h"
#define MIN_MAX_RECONN_ATT -1
#define MAX_MAX_RECONN_ATT 9999
static void rtrs_clt_path_release(struct kobject *kobj)
{
struct rtrs_clt_path *clt_path;
clt_path = container_of(kobj, struct rtrs_clt_path, kobj);
free_path(clt_path);
}
static struct kobj_type ktype_sess = {
.sysfs_ops = &kobj_sysfs_ops,
.release = rtrs_clt_path_release
};
static void rtrs_clt_path_stats_release(struct kobject *kobj)
{
struct rtrs_clt_stats *stats;
stats = container_of(kobj, struct rtrs_clt_stats, kobj_stats);
free_percpu(stats->pcpu_stats);
}
static struct kobj_type ktype_stats = {
.sysfs_ops = &kobj_sysfs_ops,
.release = rtrs_clt_path_stats_release,
};
static ssize_t max_reconnect_attempts_show(struct device *dev,
struct device_attribute *attr,
char *page)
{
struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
return sysfs_emit(page, "%d\n",
rtrs_clt_get_max_reconnect_attempts(clt));
}
static ssize_t max_reconnect_attempts_store(struct device *dev,
struct device_attribute *attr,
const char *buf,
size_t count)
{
int value;
int ret;
struct rtrs_clt_sess *clt = container_of(dev, struct rtrs_clt_sess,
dev);
ret = kstrtoint(buf, 10, &value);
if (ret) {
rtrs_err(clt, "%s: failed to convert string '%s' to int\n",
attr->attr.name, buf);
return ret;
}
if (value > MAX_MAX_RECONN_ATT ||
value < MIN_MAX_RECONN_ATT) {
rtrs_err(clt,
"%s: invalid range (provided: '%s', accepted: min: %d, max: %d)\n",
attr->attr.name, buf, MIN_MAX_RECONN_ATT,
MAX_MAX_RECONN_ATT);
return -EINVAL;
}
rtrs_clt_set_max_reconnect_attempts(clt, value);
return count;
}
static DEVICE_ATTR_RW(max_reconnect_attempts);
static ssize_t mpath_policy_show(struct device *dev,
struct device_attribute *attr,
Annotation
- Immediate include surface: `rtrs-pri.h`, `rtrs-clt.h`, `rtrs-log.h`.
- Detected declarations: `function Copyright`, `function rtrs_clt_path_stats_release`, `function max_reconnect_attempts_show`, `function max_reconnect_attempts_store`, `function mpath_policy_show`, `function mpath_policy_store`, `function add_path_show`, `function add_path_store`, `function rtrs_clt_state_show`, `function rtrs_clt_reconnect_show`.
- Atlas domain: Driver Families / drivers/infiniband.
- 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.