Lines Matching refs:attr
50 struct ib_port_attribute attr; member
77 struct device_attribute attr; member
86 struct ib_port_attribute attr; member
106 struct attribute *attr, char *buf) in port_attr_show() argument
109 container_of(attr, struct ib_port_attribute, attr); in port_attr_show()
119 struct attribute *attr, in port_attr_store() argument
123 container_of(attr, struct ib_port_attribute, attr); in port_attr_store()
147 struct device_attribute *attr, char *buf) in hw_stat_device_show() argument
150 container_of(attr, struct hw_stats_device_attribute, attr); in hw_stat_device_show()
158 struct device_attribute *attr, in hw_stat_device_store() argument
162 container_of(attr, struct hw_stats_device_attribute, attr); in hw_stat_device_store()
171 struct ib_port_attribute *attr, char *buf) in hw_stat_port_show() argument
174 container_of(attr, struct hw_stats_port_attribute, attr); in hw_stat_port_show()
183 struct ib_port_attribute *attr, in hw_stat_port_store() argument
187 container_of(attr, struct hw_stats_port_attribute, attr); in hw_stat_port_store()
196 struct attribute *attr, char *buf) in gid_attr_show() argument
199 container_of(attr, struct ib_port_attribute, attr); in gid_attr_show()
216 struct ib_port_attr attr; in state_show() local
228 ret = ib_query_port(ibdev, port_num, &attr); in state_show()
232 return sysfs_emit(buf, "%d: %s\n", attr.state, in state_show()
233 attr.state >= 0 && in state_show()
234 attr.state < ARRAY_SIZE(state_name) ? in state_show()
235 state_name[attr.state] : in state_show()
242 struct ib_port_attr attr; in lid_show() local
245 ret = ib_query_port(ibdev, port_num, &attr); in lid_show()
249 return sysfs_emit(buf, "0x%x\n", attr.lid); in lid_show()
255 struct ib_port_attr attr; in lid_mask_count_show() local
258 ret = ib_query_port(ibdev, port_num, &attr); in lid_mask_count_show()
262 return sysfs_emit(buf, "%u\n", attr.lmc); in lid_mask_count_show()
268 struct ib_port_attr attr; in sm_lid_show() local
271 ret = ib_query_port(ibdev, port_num, &attr); in sm_lid_show()
275 return sysfs_emit(buf, "0x%x\n", attr.sm_lid); in sm_lid_show()
281 struct ib_port_attr attr; in sm_sl_show() local
284 ret = ib_query_port(ibdev, port_num, &attr); in sm_sl_show()
288 return sysfs_emit(buf, "%u\n", attr.sm_sl); in sm_sl_show()
294 struct ib_port_attr attr; in cap_mask_show() local
297 ret = ib_query_port(ibdev, port_num, &attr); in cap_mask_show()
301 return sysfs_emit(buf, "0x%08x\n", attr.port_cap_flags); in cap_mask_show()
307 struct ib_port_attr attr; in rate_show() local
312 ret = ib_query_port(ibdev, port_num, &attr); in rate_show()
316 switch (attr.active_speed) { in rate_show()
352 rate *= ib_width_enum_to_int(attr.active_width); in rate_show()
358 ib_width_enum_to_int(attr.active_width), speed); in rate_show()
382 struct ib_port_attr attr; in phys_state_show() local
386 ret = ib_query_port(ibdev, port_num, &attr); in phys_state_show()
390 return sysfs_emit(buf, "%u: %s\n", attr.phys_state, in phys_state_show()
391 phys_state_to_str(attr.phys_state)); in phys_state_show()
425 &ib_port_attr_state.attr,
426 &ib_port_attr_lid.attr,
427 &ib_port_attr_lid_mask_count.attr,
428 &ib_port_attr_sm_lid.attr,
429 &ib_port_attr_sm_sl.attr,
430 &ib_port_attr_cap_mask.attr,
431 &ib_port_attr_rate.attr,
432 &ib_port_attr_phys_state.attr,
433 &ib_port_attr_link_layer.attr,
458 struct ib_device *ibdev, u32 port_num, struct ib_port_attribute *attr, in _show_port_gid_attr() argument
463 container_of(attr, struct port_table_attribute, attr); in _show_port_gid_attr()
478 struct ib_port_attribute *attr, char *buf) in show_port_gid() argument
481 container_of(attr, struct port_table_attribute, attr); in show_port_gid()
507 struct ib_port_attribute *attr, in show_port_gid_attr_ndev() argument
510 return _show_port_gid_attr(ibdev, port_num, attr, buf, print_ndev); in show_port_gid_attr_ndev()
515 struct ib_port_attribute *attr, in show_port_gid_attr_gid_type() argument
518 return _show_port_gid_attr(ibdev, port_num, attr, buf, print_gid_type); in show_port_gid_attr_gid_type()
522 struct ib_port_attribute *attr, char *buf) in show_port_pkey() argument
525 container_of(attr, struct port_table_attribute, attr); in show_port_pkey()
538 .attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \
545 .attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \
554 static int get_perf_mad(struct ib_device *dev, int port_num, __be16 attr, in get_perf_mad() argument
577 in_mad->mad_hdr.attr_id = attr; in get_perf_mad()
579 if (attr != IB_PMA_CLASS_PORT_INFO) in get_perf_mad()
599 struct ib_port_attribute *attr, char *buf) in show_pma_counter() argument
602 container_of(attr, struct port_table_attribute, attr); in show_pma_counter()
670 &port_pma_attr_symbol_error.attr.attr,
671 &port_pma_attr_link_error_recovery.attr.attr,
672 &port_pma_attr_link_downed.attr.attr,
673 &port_pma_attr_port_rcv_errors.attr.attr,
674 &port_pma_attr_port_rcv_remote_physical_errors.attr.attr,
675 &port_pma_attr_port_rcv_switch_relay_errors.attr.attr,
676 &port_pma_attr_port_xmit_discards.attr.attr,
677 &port_pma_attr_port_xmit_constraint_errors.attr.attr,
678 &port_pma_attr_port_rcv_constraint_errors.attr.attr,
679 &port_pma_attr_local_link_integrity_errors.attr.attr,
680 &port_pma_attr_excessive_buffer_overrun_errors.attr.attr,
681 &port_pma_attr_VL15_dropped.attr.attr,
682 &port_pma_attr_port_xmit_data.attr.attr,
683 &port_pma_attr_port_rcv_data.attr.attr,
684 &port_pma_attr_port_xmit_packets.attr.attr,
685 &port_pma_attr_port_rcv_packets.attr.attr,
686 &port_pma_attr_port_xmit_wait.attr.attr,
691 &port_pma_attr_symbol_error.attr.attr,
692 &port_pma_attr_link_error_recovery.attr.attr,
693 &port_pma_attr_link_downed.attr.attr,
694 &port_pma_attr_port_rcv_errors.attr.attr,
695 &port_pma_attr_port_rcv_remote_physical_errors.attr.attr,
696 &port_pma_attr_port_rcv_switch_relay_errors.attr.attr,
697 &port_pma_attr_port_xmit_discards.attr.attr,
698 &port_pma_attr_port_xmit_constraint_errors.attr.attr,
699 &port_pma_attr_port_rcv_constraint_errors.attr.attr,
700 &port_pma_attr_local_link_integrity_errors.attr.attr,
701 &port_pma_attr_excessive_buffer_overrun_errors.attr.attr,
702 &port_pma_attr_VL15_dropped.attr.attr,
703 &port_pma_attr_ext_port_xmit_data.attr.attr,
704 &port_pma_attr_ext_port_rcv_data.attr.attr,
705 &port_pma_attr_ext_port_xmit_packets.attr.attr,
706 &port_pma_attr_port_xmit_wait.attr.attr,
707 &port_pma_attr_ext_port_rcv_packets.attr.attr,
708 &port_pma_attr_ext_unicast_rcv_packets.attr.attr,
709 &port_pma_attr_ext_unicast_xmit_packets.attr.attr,
710 &port_pma_attr_ext_multicast_rcv_packets.attr.attr,
711 &port_pma_attr_ext_multicast_xmit_packets.attr.attr,
716 &port_pma_attr_symbol_error.attr.attr,
717 &port_pma_attr_link_error_recovery.attr.attr,
718 &port_pma_attr_link_downed.attr.attr,
719 &port_pma_attr_port_rcv_errors.attr.attr,
720 &port_pma_attr_port_rcv_remote_physical_errors.attr.attr,
721 &port_pma_attr_port_rcv_switch_relay_errors.attr.attr,
722 &port_pma_attr_port_xmit_discards.attr.attr,
723 &port_pma_attr_port_xmit_constraint_errors.attr.attr,
724 &port_pma_attr_port_rcv_constraint_errors.attr.attr,
725 &port_pma_attr_local_link_integrity_errors.attr.attr,
726 &port_pma_attr_excessive_buffer_overrun_errors.attr.attr,
727 &port_pma_attr_VL15_dropped.attr.attr,
728 &port_pma_attr_ext_port_xmit_data.attr.attr,
729 &port_pma_attr_ext_port_rcv_data.attr.attr,
730 &port_pma_attr_ext_port_xmit_packets.attr.attr,
731 &port_pma_attr_ext_port_rcv_packets.attr.attr,
732 &port_pma_attr_port_xmit_wait.attr.attr,
935 struct hw_stats_device_attribute *attr; in ib_setup_device_attrs() local
965 attr = &data->attrs[pos]; in ib_setup_device_attrs()
966 sysfs_attr_init(&attr->attr.attr); in ib_setup_device_attrs()
967 attr->attr.attr.name = data->stats->descs[i].name; in ib_setup_device_attrs()
968 attr->attr.attr.mode = 0444; in ib_setup_device_attrs()
969 attr->attr.show = hw_stat_device_show; in ib_setup_device_attrs()
970 attr->show = show_hw_stats; in ib_setup_device_attrs()
971 data->group.attrs[pos] = &attr->attr.attr; in ib_setup_device_attrs()
975 attr = &data->attrs[pos]; in ib_setup_device_attrs()
976 sysfs_attr_init(&attr->attr.attr); in ib_setup_device_attrs()
977 attr->attr.attr.name = "lifespan"; in ib_setup_device_attrs()
978 attr->attr.attr.mode = 0644; in ib_setup_device_attrs()
979 attr->attr.show = hw_stat_device_show; in ib_setup_device_attrs()
980 attr->show = show_stats_lifespan; in ib_setup_device_attrs()
981 attr->attr.store = hw_stat_device_store; in ib_setup_device_attrs()
982 attr->store = set_stats_lifespan; in ib_setup_device_attrs()
983 data->group.attrs[pos] = &attr->attr.attr; in ib_setup_device_attrs()
1035 struct hw_stats_port_attribute *attr; in setup_hw_port_stats() local
1062 attr = &data->attrs[pos]; in setup_hw_port_stats()
1063 sysfs_attr_init(&attr->attr.attr); in setup_hw_port_stats()
1064 attr->attr.attr.name = data->stats->descs[i].name; in setup_hw_port_stats()
1065 attr->attr.attr.mode = 0444; in setup_hw_port_stats()
1066 attr->attr.show = hw_stat_port_show; in setup_hw_port_stats()
1067 attr->show = show_hw_stats; in setup_hw_port_stats()
1068 group->attrs[pos] = &attr->attr.attr; in setup_hw_port_stats()
1072 attr = &data->attrs[pos]; in setup_hw_port_stats()
1073 sysfs_attr_init(&attr->attr.attr); in setup_hw_port_stats()
1074 attr->attr.attr.name = "lifespan"; in setup_hw_port_stats()
1075 attr->attr.attr.mode = 0644; in setup_hw_port_stats()
1076 attr->attr.show = hw_stat_port_show; in setup_hw_port_stats()
1077 attr->show = show_stats_lifespan; in setup_hw_port_stats()
1078 attr->attr.store = hw_stat_port_store; in setup_hw_port_stats()
1079 attr->store = set_stats_lifespan; in setup_hw_port_stats()
1080 group->attrs[pos] = &attr->attr.attr; in setup_hw_port_stats()
1115 sysfs_attr_init(&element->attr.attr); in alloc_port_table_group()
1116 element->attr.attr.name = element->name; in alloc_port_table_group()
1117 element->attr.attr.mode = 0444; in alloc_port_table_group()
1118 element->attr.show = show; in alloc_port_table_group()
1121 attr_list[i] = &element->attr.attr; in alloc_port_table_group()
1137 const struct ib_port_attr *attr) in setup_gid_attrs() argument
1143 size_mul(attr->gid_tbl_len, 2)), in setup_gid_attrs()
1152 attr->gid_tbl_len, in setup_gid_attrs()
1160 gid_attr_group->attrs_list + attr->gid_tbl_len, in setup_gid_attrs()
1161 attr->gid_tbl_len, show_port_gid_attr_gid_type); in setup_gid_attrs()
1199 const struct ib_port_attr *attr) in setup_port() argument
1208 size_add(attr->gid_tbl_len, attr->pkey_tbl_len)), in setup_port()
1221 attr->gid_tbl_len, show_port_gid); in setup_port()
1226 if (attr->pkey_tbl_len) { in setup_port()
1228 p->attrs_list + attr->gid_tbl_len, in setup_port()
1229 attr->pkey_tbl_len, show_port_pkey); in setup_port()
1317 struct device_attribute *attr, char *buf) in node_type_show() argument
1341 struct device_attribute *attr, char *buf) in node_guid_show() argument
1355 struct device_attribute *attr, char *buf) in node_desc_show() argument
1363 struct device_attribute *attr, in node_desc_store() argument
1382 static ssize_t fw_ver_show(struct device *device, struct device_attribute *attr, in fw_ver_show() argument
1395 &dev_attr_node_type.attr,
1396 &dev_attr_node_guid.attr,
1397 &dev_attr_sys_image_guid.attr,
1398 &dev_attr_fw_ver.attr,
1399 &dev_attr_node_desc.attr,
1433 struct ib_port_attr attr; in ib_setup_port_attrs() local
1436 ret = ib_query_port(device, port_num, &attr); in ib_setup_port_attrs()
1440 port = setup_port(coredev, port_num, &attr); in ib_setup_port_attrs()
1446 ret = setup_gid_attrs(port, &attr); in ib_setup_port_attrs()