34 #include <linux/ctype.h>
35 #include <linux/stat.h>
107 static const char *ipath_status_str[] = {
117 "Fatal_Hardware_Error",
137 for (any = i = 0; s && ipath_status_str[
i]; i++) {
143 if (
strlcat(buf, ipath_status_str[i],
290 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
291 guid[0], guid[1], guid[2], guid[3],
292 guid[4], guid[5], guid[6], guid[7]);
302 unsigned short guid[8];
307 if (
sscanf(buf,
"%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx",
308 &guid[0], &guid[1], &guid[2], &guid[3],
309 &guid[4], &guid[5], &guid[6], &guid[7]) != 8)
312 ng = (
u8 *) &new_guid;
314 for (i = 0; i < 8; i++) {
326 dd->
verbs_dev->ibdev.node_guid = new_guid;
433 #define DEVICE_COUNTER(name, attr) \
434 static ssize_t show_counter_##name(struct device *dev, \
435 struct device_attribute *attr, \
438 struct ipath_devdata *dd = dev_get_drvdata(dev); \
440 buf, PAGE_SIZE, "%llu\n", (unsigned long long) \
442 dd, offsetof(struct infinipath_counters, \
443 attr) / sizeof(u64))); \
445 static DEVICE_ATTR(name, S_IRUGO, show_counter_##name, NULL);
489 static struct attribute *dev_counter_attributes[] = {
490 &dev_attr_ib_link_downeds.attr,
491 &dev_attr_ib_link_err_recoveries.attr,
492 &dev_attr_ib_status_changes.attr,
493 &dev_attr_ib_symbol_errs.attr,
494 &dev_attr_lb_flow_stalls.attr,
495 &dev_attr_lb_ints.attr,
496 &dev_attr_rx_bad_formats.attr,
497 &dev_attr_rx_buf_ovfls.attr,
498 &dev_attr_rx_data_pkts.attr,
499 &dev_attr_rx_dropped_pkts.attr,
500 &dev_attr_rx_dwords.attr,
501 &dev_attr_rx_ebps.attr,
502 &dev_attr_rx_flow_ctrl_errs.attr,
503 &dev_attr_rx_flow_pkts.attr,
504 &dev_attr_rx_icrc_errs.attr,
505 &dev_attr_rx_len_errs.attr,
506 &dev_attr_rx_link_problems.attr,
507 &dev_attr_rx_lpcrc_errs.attr,
508 &dev_attr_rx_max_min_len_errs.attr,
509 &dev_attr_rx_p0_hdr_egr_ovfls.attr,
510 &dev_attr_rx_p1_hdr_egr_ovfls.attr,
511 &dev_attr_rx_p2_hdr_egr_ovfls.attr,
512 &dev_attr_rx_p3_hdr_egr_ovfls.attr,
513 &dev_attr_rx_p4_hdr_egr_ovfls.attr,
514 &dev_attr_rx_p5_hdr_egr_ovfls.attr,
515 &dev_attr_rx_p6_hdr_egr_ovfls.attr,
516 &dev_attr_rx_p7_hdr_egr_ovfls.attr,
517 &dev_attr_rx_p8_hdr_egr_ovfls.attr,
518 &dev_attr_rx_pkey_mismatches.attr,
519 &dev_attr_rx_tid_full_errs.attr,
520 &dev_attr_rx_tid_valid_errs.attr,
521 &dev_attr_rx_vcrc_errs.attr,
522 &dev_attr_tx_data_pkts.attr,
523 &dev_attr_tx_dropped_pkts.attr,
524 &dev_attr_tx_dwords.attr,
525 &dev_attr_tx_flow_pkts.attr,
526 &dev_attr_tx_flow_stalls.attr,
527 &dev_attr_tx_len_errs.attr,
528 &dev_attr_tx_max_min_len_errs.attr,
529 &dev_attr_tx_underruns.attr,
530 &dev_attr_tx_unsup_vl_errs.attr,
536 .attrs = dev_counter_attributes
547 if (count < 5 ||
memcmp(buf,
"reset", 5)) {
558 dev_info(dev,
"Unit %d is disabled, can't reset\n",
565 return ret<0 ? ret :
count;
698 ipath_dev_err(dd,
"attempt to set invalid Rx Polarity invert\n");
735 idx == (IPATH_EEP_LOG_CNT - 1) ?
'\n' :
' ');
770 if (ret >= 0 && val > 3)
773 ipath_dev_err(dd,
"attempt to set invalid Heartbeat enable\n");
823 if (ret >= 0 && (val == 0 || val > 3))
827 "attempt to set invalid Link Width (enable)\n");
884 "attempt to set invalid Link Speed (enable)\n");
936 if (ret >= 0 && val > 1) {
938 "attempt to set invalid Rx Polarity (enable)\n");
977 if (ret >= 0 && val > 1) {
980 "attempt to set invalid Lane reversal (enable)\n");
995 static struct attribute *driver_attributes[] = {
996 &driver_attr_num_units.attr,
997 &driver_attr_version.attr,
1002 .attrs = driver_attributes
1016 ipath_dev_err(dd,
"attempt to set invalid tempsense config\n");
1056 for (idx = 0; idx < 8; ++
idx) {
1066 *(
signed char *)(regvals),
1067 *(
signed char *)(regvals + 1),
1068 regvals[2], regvals[3],
1069 *(
signed char *)(regvals + 5),
1070 *(
signed char *)(regvals + 7));
1099 show_jint_max_packets, store_jint_max_packets);
1101 show_jint_idle_ticks, store_jint_idle_ticks);
1103 show_tempsense, store_tempsense);
1105 static struct attribute *dev_attributes[] = {
1106 &dev_attr_guid.attr,
1109 &dev_attr_link_state.attr,
1110 &dev_attr_mlid.attr,
1112 &dev_attr_nguid.attr,
1113 &dev_attr_nports.attr,
1114 &dev_attr_serial.attr,
1115 &dev_attr_status.attr,
1116 &dev_attr_status_str.attr,
1117 &dev_attr_boardversion.attr,
1118 &dev_attr_unit.attr,
1119 &dev_attr_enabled.attr,
1120 &dev_attr_rx_pol_inv.attr,
1121 &dev_attr_led_override.attr,
1122 &dev_attr_logged_errors.attr,
1123 &dev_attr_tempsense.attr,
1124 &dev_attr_localbus_info.attr,
1129 .attrs = dev_attributes
1141 store_rx_polinv_enb);
1145 static struct attribute *dev_ibcfg_attributes[] = {
1146 &dev_attr_hrtbt_enable.attr,
1147 &dev_attr_link_width_enable.attr,
1148 &dev_attr_link_width.attr,
1149 &dev_attr_link_speed_enable.attr,
1150 &dev_attr_link_speed.attr,
1151 &dev_attr_rx_pol_inv_enable.attr,
1152 &dev_attr_rx_lane_rev_enable.attr,
1157 .attrs = dev_ibcfg_attributes