drivers/infiniband/hw/hfi1/sysfs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/sysfs.c- Extension
.c- Size
- 17968 bytes
- Lines
- 698
- 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.
- 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/ctype.hrdma/ib_sysfs.hhfi.hmad.htrace.h
Detected Declarations
struct hfi1_sc2vl_attrstruct hfi1_sl2sc_attrstruct hfi1_vl2mtu_attrstruct sde_attributefunction Copyrightfunction cc_table_bin_readfunction cc_setting_bin_readfunction cc_prescan_showfunction cc_prescan_storefunction sc2vl_attr_showfunction sl2sc_attr_showfunction vl2mtu_attr_showfunction hw_rev_showfunction board_id_showfunction boardversion_showfunction nctxts_showfunction nfreectxts_showfunction serial_showfunction chip_reset_storefunction integerfunction sde_showfunction sde_storefunction __ATTRfunction sde_store_cpu_to_sde_mapfunction sde_show_vlfunction hfi1_verbs_register_sysfsfunction hfi1_verbs_unregister_sysfs
Annotated Snippet
struct hfi1_sc2vl_attr {
struct ib_port_attribute attr;
int sc;
};
static ssize_t sc2vl_attr_show(struct ib_device *ibdev, u32 port_num,
struct ib_port_attribute *attr, char *buf)
{
struct hfi1_sc2vl_attr *sattr =
container_of(attr, struct hfi1_sc2vl_attr, attr);
struct hfi1_devdata *dd = dd_from_ibdev(ibdev);
return sysfs_emit(buf, "%u\n", *((u8 *)dd->sc2vl + sattr->sc));
}
#define HFI1_SC2VL_ATTR(N) \
static struct hfi1_sc2vl_attr hfi1_sc2vl_attr_##N = { \
.attr = __ATTR(N, 0444, sc2vl_attr_show, NULL), \
.sc = N, \
}
HFI1_SC2VL_ATTR(0);
HFI1_SC2VL_ATTR(1);
HFI1_SC2VL_ATTR(2);
HFI1_SC2VL_ATTR(3);
HFI1_SC2VL_ATTR(4);
HFI1_SC2VL_ATTR(5);
HFI1_SC2VL_ATTR(6);
HFI1_SC2VL_ATTR(7);
HFI1_SC2VL_ATTR(8);
HFI1_SC2VL_ATTR(9);
HFI1_SC2VL_ATTR(10);
HFI1_SC2VL_ATTR(11);
HFI1_SC2VL_ATTR(12);
HFI1_SC2VL_ATTR(13);
HFI1_SC2VL_ATTR(14);
HFI1_SC2VL_ATTR(15);
HFI1_SC2VL_ATTR(16);
HFI1_SC2VL_ATTR(17);
HFI1_SC2VL_ATTR(18);
HFI1_SC2VL_ATTR(19);
HFI1_SC2VL_ATTR(20);
HFI1_SC2VL_ATTR(21);
HFI1_SC2VL_ATTR(22);
HFI1_SC2VL_ATTR(23);
HFI1_SC2VL_ATTR(24);
HFI1_SC2VL_ATTR(25);
HFI1_SC2VL_ATTR(26);
HFI1_SC2VL_ATTR(27);
HFI1_SC2VL_ATTR(28);
HFI1_SC2VL_ATTR(29);
HFI1_SC2VL_ATTR(30);
HFI1_SC2VL_ATTR(31);
static struct attribute *port_sc2vl_attributes[] = {
&hfi1_sc2vl_attr_0.attr.attr,
&hfi1_sc2vl_attr_1.attr.attr,
&hfi1_sc2vl_attr_2.attr.attr,
&hfi1_sc2vl_attr_3.attr.attr,
&hfi1_sc2vl_attr_4.attr.attr,
&hfi1_sc2vl_attr_5.attr.attr,
&hfi1_sc2vl_attr_6.attr.attr,
&hfi1_sc2vl_attr_7.attr.attr,
&hfi1_sc2vl_attr_8.attr.attr,
&hfi1_sc2vl_attr_9.attr.attr,
&hfi1_sc2vl_attr_10.attr.attr,
&hfi1_sc2vl_attr_11.attr.attr,
&hfi1_sc2vl_attr_12.attr.attr,
&hfi1_sc2vl_attr_13.attr.attr,
&hfi1_sc2vl_attr_14.attr.attr,
&hfi1_sc2vl_attr_15.attr.attr,
&hfi1_sc2vl_attr_16.attr.attr,
&hfi1_sc2vl_attr_17.attr.attr,
&hfi1_sc2vl_attr_18.attr.attr,
&hfi1_sc2vl_attr_19.attr.attr,
&hfi1_sc2vl_attr_20.attr.attr,
&hfi1_sc2vl_attr_21.attr.attr,
&hfi1_sc2vl_attr_22.attr.attr,
&hfi1_sc2vl_attr_23.attr.attr,
&hfi1_sc2vl_attr_24.attr.attr,
&hfi1_sc2vl_attr_25.attr.attr,
&hfi1_sc2vl_attr_26.attr.attr,
&hfi1_sc2vl_attr_27.attr.attr,
&hfi1_sc2vl_attr_28.attr.attr,
&hfi1_sc2vl_attr_29.attr.attr,
&hfi1_sc2vl_attr_30.attr.attr,
&hfi1_sc2vl_attr_31.attr.attr,
NULL
};
Annotation
- Immediate include surface: `linux/ctype.h`, `rdma/ib_sysfs.h`, `hfi.h`, `mad.h`, `trace.h`.
- Detected declarations: `struct hfi1_sc2vl_attr`, `struct hfi1_sl2sc_attr`, `struct hfi1_vl2mtu_attr`, `struct sde_attribute`, `function Copyright`, `function cc_table_bin_read`, `function cc_setting_bin_read`, `function cc_prescan_show`, `function cc_prescan_store`, `function sc2vl_attr_show`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source 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.