34 #include <linux/ctype.h>
62 qib_dev_err(dd,
"attempt to set invalid Heartbeat enable\n");
74 return ret < 0 ? ret :
count;
99 qib_dev_err(dd,
"attempt to set invalid LED override\n");
115 (
unsigned long long) *(ppd->
statusp));
123 static const char *
const qib_status_str[] = {
133 "Fatal_Hardware_Error",
150 for (any = i = 0; s && qib_status_str[
i]; i++) {
178 #define QIB_PORT_ATTR(name, mode, show, store) \
179 static struct qib_port_attr qib_port_attr_##name = \
180 __ATTR(name, mode, show, store)
195 static struct attribute *port_default_attributes[] = {
196 &qib_port_attr_loopback.attr,
197 &qib_port_attr_led_override.attr,
198 &qib_port_attr_hrtbt_enable.attr,
199 &qib_port_attr_status.attr,
200 &qib_port_attr_status_str.attr,
213 char *buf, loff_t
pos,
size_t count)
228 if (count > ret - pos)
234 spin_lock(&ppd->cc_shadow_lock);
236 spin_unlock(&ppd->cc_shadow_lock);
241 static void qib_port_release(
struct kobject *kobj)
246 static struct kobj_type qib_port_cc_ktype = {
247 .release = qib_port_release,
251 .attr = {.name =
"cc_table_bin", .mode = 0444},
252 .read = read_cc_table_bin,
263 char *buf, loff_t pos,
size_t count)
276 if (count > ret - pos)
282 spin_lock(&ppd->cc_shadow_lock);
284 spin_unlock(&ppd->cc_shadow_lock);
290 .attr = {.name =
"cc_settings_bin", .mode = 0444},
291 .read = read_cc_setting_bin,
304 return pattr->
show(ppd, buf);
308 struct attribute *attr,
const char *buf,
size_t len)
315 return pattr->
store(ppd, buf, len);
319 static const struct sysfs_ops qib_port_ops = {
320 .show = qib_portattr_show,
321 .store = qib_portattr_store,
324 static struct kobj_type qib_port_ktype = {
325 .release = qib_port_release,
326 .sysfs_ops = &qib_port_ops,
327 .default_attrs = port_default_attributes
332 #define QIB_SL2VL_ATTR(N) \
333 static struct qib_sl2vl_attr qib_sl2vl_attr_##N = { \
334 .attr = { .name = __stringify(N), .mode = 0444 }, \
360 static struct attribute *sl2vl_default_attributes[] = {
361 &qib_sl2vl_attr_0.attr,
362 &qib_sl2vl_attr_1.attr,
363 &qib_sl2vl_attr_2.attr,
364 &qib_sl2vl_attr_3.attr,
365 &qib_sl2vl_attr_4.attr,
366 &qib_sl2vl_attr_5.attr,
367 &qib_sl2vl_attr_6.attr,
368 &qib_sl2vl_attr_7.attr,
369 &qib_sl2vl_attr_8.attr,
370 &qib_sl2vl_attr_9.attr,
371 &qib_sl2vl_attr_10.attr,
372 &qib_sl2vl_attr_11.attr,
373 &qib_sl2vl_attr_12.attr,
374 &qib_sl2vl_attr_13.attr,
375 &qib_sl2vl_attr_14.attr,
376 &qib_sl2vl_attr_15.attr,
392 static const struct sysfs_ops qib_sl2vl_ops = {
393 .show = sl2vl_attr_show,
396 static struct kobj_type qib_sl2vl_ktype = {
397 .release = qib_port_release,
398 .sysfs_ops = &qib_sl2vl_ops,
399 .default_attrs = sl2vl_default_attributes
406 #define QIB_DIAGC_ATTR(N) \
407 static struct qib_diagc_attr qib_diagc_attr_##N = { \
408 .attr = { .name = __stringify(N), .mode = 0664 }, \
409 .counter = offsetof(struct qib_ibport, n_##N) \
433 static struct attribute *diagc_default_attributes[] = {
434 &qib_diagc_attr_rc_resends.attr,
435 &qib_diagc_attr_rc_acks.attr,
436 &qib_diagc_attr_rc_qacks.attr,
437 &qib_diagc_attr_rc_delayed_comp.attr,
438 &qib_diagc_attr_seq_naks.attr,
439 &qib_diagc_attr_rdma_seq.attr,
440 &qib_diagc_attr_rnr_naks.attr,
441 &qib_diagc_attr_other_naks.attr,
442 &qib_diagc_attr_rc_timeouts.attr,
443 &qib_diagc_attr_loop_pkts.attr,
444 &qib_diagc_attr_pkt_drops.attr,
445 &qib_diagc_attr_dmawait.attr,
446 &qib_diagc_attr_unaligned.attr,
447 &qib_diagc_attr_rc_dupreq.attr,
448 &qib_diagc_attr_rc_seqnak.attr,
465 const char *buf,
size_t size)
475 ret = kstrtou32(buf, 0, &val);
478 *(
u32 *)((
char *) qibp + dattr->
counter) = val;
482 static const struct sysfs_ops qib_diagc_ops = {
483 .show = diagc_attr_show,
484 .store = diagc_attr_store,
487 static struct kobj_type qib_diagc_ktype = {
488 .release = qib_port_release,
489 .sysfs_ops = &qib_diagc_ops,
490 .default_attrs = diagc_default_attributes
507 return sprintf(buf,
"%x\n", dd_from_dev(dev)->minrev);
525 static ssize_t show_version(
struct device *device,
532 static ssize_t show_boardversion(
struct device *device,
544 static ssize_t show_localbus_info(
struct device *device,
556 static ssize_t show_nctxts(
struct device *device,
571 static ssize_t show_nfreectxts(
struct device *device,
582 static ssize_t show_serial(
struct device *device,
589 buf[
sizeof dd->
serial] =
'\0';
595 static ssize_t store_chip_reset(
struct device *device,
611 return ret < 0 ? ret :
count;
614 static ssize_t show_logged_errs(
struct device *device,
630 idx == (QIB_EEP_LOG_CNT - 1) ?
'\n' :
' ');
639 static ssize_t show_tempsense(
struct device *device,
650 for (idx = 0; idx < 8; ++
idx) {
660 *(
signed char *)(regvals),
661 *(
signed char *)(regvals + 1),
662 regvals[2], regvals[3],
663 *(
signed char *)(regvals + 5),
664 *(
signed char *)(regvals + 7));
693 &dev_attr_nfreectxts,
695 &dev_attr_boardversion,
696 &dev_attr_logged_errors,
698 &dev_attr_localbus_info,
699 &dev_attr_chip_reset,
711 "Skipping infiniband class with invalid port %u\n",
716 ppd = &dd->
pport[port_num - 1];
722 "Skipping linkcontrol sysfs info, (err %d) port %u\n",
732 "Skipping sl2vl sysfs info, (err %d) port %u\n",
742 "Skipping diag_counters sysfs info, (err %d) port %u\n",
755 "Skipping Congestion Control sysfs info, (err %d) port %u\n",
763 &cc_setting_bin_attr);
766 "Skipping Congestion Control setting sysfs info, (err %d) port %u\n",
775 "Skipping Congestion Control table sysfs info, (err %d) port %u\n",
777 goto bail_cc_entry_bin;
781 "IB%u: Congestion Control Agent enabled for port %d\n",
830 &cc_setting_bin_attr);