2 * Copyright (c) 2006 PathScale, Inc. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #include <linux/ctype.h>
34 #include <linux/pci.h>
36 #include "ipath_kernel.h"
37 #include "ips_common.h"
38 #include "ipath_layer.h"
41 * ipath_parse_ushort - parse an unsigned short value in an arbitrary base
42 * @str: the string containing the number
43 * @valp: where to put the result
45 * returns the number of bytes consumed, or negative value on error
47 int ipath_parse_ushort(const char *str, unsigned short *valp)
53 if (!isdigit(str[0])) {
58 val = simple_strtoul(str, &end, 0);
75 static ssize_t show_version(struct device_driver *dev, char *buf)
77 /* The string printed here is already newline-terminated. */
78 return scnprintf(buf, PAGE_SIZE, "%s", ipath_core_version);
81 static ssize_t show_num_units(struct device_driver *dev, char *buf)
83 return scnprintf(buf, PAGE_SIZE, "%d\n",
84 ipath_count_units(NULL, NULL, NULL));
87 #define DRIVER_STAT(name, attr) \
88 static ssize_t show_stat_##name(struct device_driver *dev, \
92 buf, PAGE_SIZE, "%llu\n", \
93 (unsigned long long) ipath_stats.sps_ ##attr); \
95 static DRIVER_ATTR(name, S_IRUGO, show_stat_##name, NULL)
97 DRIVER_STAT(intrs, ints);
98 DRIVER_STAT(err_intrs, errints);
99 DRIVER_STAT(errs, errs);
100 DRIVER_STAT(pkt_errs, pkterrs);
101 DRIVER_STAT(crc_errs, crcerrs);
102 DRIVER_STAT(hw_errs, hwerrs);
103 DRIVER_STAT(ib_link, iblink);
104 DRIVER_STAT(port0_pkts, port0pkts);
105 DRIVER_STAT(ether_spkts, ether_spkts);
106 DRIVER_STAT(ether_rpkts, ether_rpkts);
107 DRIVER_STAT(sma_spkts, sma_spkts);
108 DRIVER_STAT(sma_rpkts, sma_rpkts);
109 DRIVER_STAT(hdrq_full, hdrqfull);
110 DRIVER_STAT(etid_full, etidfull);
111 DRIVER_STAT(no_piobufs, nopiobufs);
112 DRIVER_STAT(ports, ports);
113 DRIVER_STAT(pkey0, pkeys[0]);
114 DRIVER_STAT(pkey1, pkeys[1]);
115 DRIVER_STAT(pkey2, pkeys[2]);
116 DRIVER_STAT(pkey3, pkeys[3]);
117 /* XXX fix the following when dynamic table of devices used */
118 DRIVER_STAT(lid0, lid[0]);
119 DRIVER_STAT(lid1, lid[1]);
120 DRIVER_STAT(lid2, lid[2]);
121 DRIVER_STAT(lid3, lid[3]);
123 DRIVER_STAT(nports, nports);
124 DRIVER_STAT(null_intr, nullintr);
125 DRIVER_STAT(max_pkts_call, maxpkts_call);
126 DRIVER_STAT(avg_pkts_call, avgpkts_call);
127 DRIVER_STAT(page_locks, pagelocks);
128 DRIVER_STAT(page_unlocks, pageunlocks);
129 DRIVER_STAT(krdrops, krdrops);
130 /* XXX fix the following when dynamic table of devices used */
131 DRIVER_STAT(mlid0, mlid[0]);
132 DRIVER_STAT(mlid1, mlid[1]);
133 DRIVER_STAT(mlid2, mlid[2]);
134 DRIVER_STAT(mlid3, mlid[3]);
136 static struct attribute *driver_stat_attributes[] = {
137 &driver_attr_intrs.attr,
138 &driver_attr_err_intrs.attr,
139 &driver_attr_errs.attr,
140 &driver_attr_pkt_errs.attr,
141 &driver_attr_crc_errs.attr,
142 &driver_attr_hw_errs.attr,
143 &driver_attr_ib_link.attr,
144 &driver_attr_port0_pkts.attr,
145 &driver_attr_ether_spkts.attr,
146 &driver_attr_ether_rpkts.attr,
147 &driver_attr_sma_spkts.attr,
148 &driver_attr_sma_rpkts.attr,
149 &driver_attr_hdrq_full.attr,
150 &driver_attr_etid_full.attr,
151 &driver_attr_no_piobufs.attr,
152 &driver_attr_ports.attr,
153 &driver_attr_pkey0.attr,
154 &driver_attr_pkey1.attr,
155 &driver_attr_pkey2.attr,
156 &driver_attr_pkey3.attr,
157 &driver_attr_lid0.attr,
158 &driver_attr_lid1.attr,
159 &driver_attr_lid2.attr,
160 &driver_attr_lid3.attr,
161 &driver_attr_nports.attr,
162 &driver_attr_null_intr.attr,
163 &driver_attr_max_pkts_call.attr,
164 &driver_attr_avg_pkts_call.attr,
165 &driver_attr_page_locks.attr,
166 &driver_attr_page_unlocks.attr,
167 &driver_attr_krdrops.attr,
168 &driver_attr_mlid0.attr,
169 &driver_attr_mlid1.attr,
170 &driver_attr_mlid2.attr,
171 &driver_attr_mlid3.attr,
175 static struct attribute_group driver_stat_attr_group = {
177 .attrs = driver_stat_attributes
180 static ssize_t show_status(struct device *dev,
181 struct device_attribute *attr,
184 struct ipath_devdata *dd = dev_get_drvdata(dev);
187 if (!dd->ipath_statusp) {
192 ret = scnprintf(buf, PAGE_SIZE, "0x%llx\n",
193 (unsigned long long) *(dd->ipath_statusp));
199 static const char *ipath_status_str[] = {
209 "Fatal_Hardware_Error",
213 static ssize_t show_status_str(struct device *dev,
214 struct device_attribute *attr,
217 struct ipath_devdata *dd = dev_get_drvdata(dev);
222 if (!dd->ipath_statusp) {
227 s = *(dd->ipath_statusp);
229 for (any = i = 0; s && ipath_status_str[i]; i++) {
231 if (any && strlcat(buf, " ", PAGE_SIZE) >=
235 if (strlcat(buf, ipath_status_str[i],
236 PAGE_SIZE) >= PAGE_SIZE)
243 strlcat(buf, "\n", PAGE_SIZE);
251 static ssize_t show_boardversion(struct device *dev,
252 struct device_attribute *attr,
255 struct ipath_devdata *dd = dev_get_drvdata(dev);
256 /* The string printed here is already newline-terminated. */
257 return scnprintf(buf, PAGE_SIZE, "%s", dd->ipath_boardversion);
260 static ssize_t show_lid(struct device *dev,
261 struct device_attribute *attr,
264 struct ipath_devdata *dd = dev_get_drvdata(dev);
266 return scnprintf(buf, PAGE_SIZE, "0x%x\n", dd->ipath_lid);
269 static ssize_t store_lid(struct device *dev,
270 struct device_attribute *attr,
274 struct ipath_devdata *dd = dev_get_drvdata(dev);
278 ret = ipath_parse_ushort(buf, &lid);
282 if (lid == 0 || lid >= 0xc000) {
287 ipath_set_sps_lid(dd, lid, 0);
291 ipath_dev_err(dd, "attempt to set invalid LID\n");
296 static ssize_t show_mlid(struct device *dev,
297 struct device_attribute *attr,
300 struct ipath_devdata *dd = dev_get_drvdata(dev);
302 return scnprintf(buf, PAGE_SIZE, "0x%x\n", dd->ipath_mlid);
305 static ssize_t store_mlid(struct device *dev,
306 struct device_attribute *attr,
310 struct ipath_devdata *dd = dev_get_drvdata(dev);
315 ret = ipath_parse_ushort(buf, &mlid);
319 unit = dd->ipath_unit;
321 dd->ipath_mlid = mlid;
322 ipath_stats.sps_mlid[unit] = mlid;
323 ipath_layer_intr(dd, IPATH_LAYER_INT_BCAST);
327 ipath_dev_err(dd, "attempt to set invalid MLID\n");
332 static ssize_t show_guid(struct device *dev,
333 struct device_attribute *attr,
336 struct ipath_devdata *dd = dev_get_drvdata(dev);
339 guid = (u8 *) & (dd->ipath_guid);
341 return scnprintf(buf, PAGE_SIZE,
342 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
343 guid[0], guid[1], guid[2], guid[3],
344 guid[4], guid[5], guid[6], guid[7]);
347 static ssize_t store_guid(struct device *dev,
348 struct device_attribute *attr,
352 struct ipath_devdata *dd = dev_get_drvdata(dev);
354 unsigned short guid[8];
359 if (sscanf(buf, "%hx:%hx:%hx:%hx:%hx:%hx:%hx:%hx",
360 &guid[0], &guid[1], &guid[2], &guid[3],
361 &guid[4], &guid[5], &guid[6], &guid[7]) != 8)
366 for (i = 0; i < 8; i++) {
372 dd->ipath_guid = nguid;
379 ipath_dev_err(dd, "attempt to set invalid GUID\n");
386 static ssize_t show_nguid(struct device *dev,
387 struct device_attribute *attr,
390 struct ipath_devdata *dd = dev_get_drvdata(dev);
392 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->ipath_nguid);
395 static ssize_t show_serial(struct device *dev,
396 struct device_attribute *attr,
399 struct ipath_devdata *dd = dev_get_drvdata(dev);
401 buf[sizeof dd->ipath_serial] = '\0';
402 memcpy(buf, dd->ipath_serial, sizeof dd->ipath_serial);
407 static ssize_t show_unit(struct device *dev,
408 struct device_attribute *attr,
411 struct ipath_devdata *dd = dev_get_drvdata(dev);
413 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->ipath_unit);
416 #define DEVICE_COUNTER(name, attr) \
417 static ssize_t show_counter_##name(struct device *dev, \
418 struct device_attribute *attr, \
421 struct ipath_devdata *dd = dev_get_drvdata(dev); \
423 buf, PAGE_SIZE, "%llu\n", (unsigned long long) \
425 dd, offsetof(struct infinipath_counters, \
426 attr) / sizeof(u64))); \
428 static DEVICE_ATTR(name, S_IRUGO, show_counter_##name, NULL);
430 DEVICE_COUNTER(ib_link_downeds, IBLinkDownedCnt);
431 DEVICE_COUNTER(ib_link_err_recoveries, IBLinkErrRecoveryCnt);
432 DEVICE_COUNTER(ib_status_changes, IBStatusChangeCnt);
433 DEVICE_COUNTER(ib_symbol_errs, IBSymbolErrCnt);
434 DEVICE_COUNTER(lb_flow_stalls, LBFlowStallCnt);
435 DEVICE_COUNTER(lb_ints, LBIntCnt);
436 DEVICE_COUNTER(rx_bad_formats, RxBadFormatCnt);
437 DEVICE_COUNTER(rx_buf_ovfls, RxBufOvflCnt);
438 DEVICE_COUNTER(rx_data_pkts, RxDataPktCnt);
439 DEVICE_COUNTER(rx_dropped_pkts, RxDroppedPktCnt);
440 DEVICE_COUNTER(rx_dwords, RxDwordCnt);
441 DEVICE_COUNTER(rx_ebps, RxEBPCnt);
442 DEVICE_COUNTER(rx_flow_ctrl_errs, RxFlowCtrlErrCnt);
443 DEVICE_COUNTER(rx_flow_pkts, RxFlowPktCnt);
444 DEVICE_COUNTER(rx_icrc_errs, RxICRCErrCnt);
445 DEVICE_COUNTER(rx_len_errs, RxLenErrCnt);
446 DEVICE_COUNTER(rx_link_problems, RxLinkProblemCnt);
447 DEVICE_COUNTER(rx_lpcrc_errs, RxLPCRCErrCnt);
448 DEVICE_COUNTER(rx_max_min_len_errs, RxMaxMinLenErrCnt);
449 DEVICE_COUNTER(rx_p0_hdr_egr_ovfls, RxP0HdrEgrOvflCnt);
450 DEVICE_COUNTER(rx_p1_hdr_egr_ovfls, RxP1HdrEgrOvflCnt);
451 DEVICE_COUNTER(rx_p2_hdr_egr_ovfls, RxP2HdrEgrOvflCnt);
452 DEVICE_COUNTER(rx_p3_hdr_egr_ovfls, RxP3HdrEgrOvflCnt);
453 DEVICE_COUNTER(rx_p4_hdr_egr_ovfls, RxP4HdrEgrOvflCnt);
454 DEVICE_COUNTER(rx_p5_hdr_egr_ovfls, RxP5HdrEgrOvflCnt);
455 DEVICE_COUNTER(rx_p6_hdr_egr_ovfls, RxP6HdrEgrOvflCnt);
456 DEVICE_COUNTER(rx_p7_hdr_egr_ovfls, RxP7HdrEgrOvflCnt);
457 DEVICE_COUNTER(rx_p8_hdr_egr_ovfls, RxP8HdrEgrOvflCnt);
458 DEVICE_COUNTER(rx_pkey_mismatches, RxPKeyMismatchCnt);
459 DEVICE_COUNTER(rx_tid_full_errs, RxTIDFullErrCnt);
460 DEVICE_COUNTER(rx_tid_valid_errs, RxTIDValidErrCnt);
461 DEVICE_COUNTER(rx_vcrc_errs, RxVCRCErrCnt);
462 DEVICE_COUNTER(tx_data_pkts, TxDataPktCnt);
463 DEVICE_COUNTER(tx_dropped_pkts, TxDroppedPktCnt);
464 DEVICE_COUNTER(tx_dwords, TxDwordCnt);
465 DEVICE_COUNTER(tx_flow_pkts, TxFlowPktCnt);
466 DEVICE_COUNTER(tx_flow_stalls, TxFlowStallCnt);
467 DEVICE_COUNTER(tx_len_errs, TxLenErrCnt);
468 DEVICE_COUNTER(tx_max_min_len_errs, TxMaxMinLenErrCnt);
469 DEVICE_COUNTER(tx_underruns, TxUnderrunCnt);
470 DEVICE_COUNTER(tx_unsup_vl_errs, TxUnsupVLErrCnt);
472 static struct attribute *dev_counter_attributes[] = {
473 &dev_attr_ib_link_downeds.attr,
474 &dev_attr_ib_link_err_recoveries.attr,
475 &dev_attr_ib_status_changes.attr,
476 &dev_attr_ib_symbol_errs.attr,
477 &dev_attr_lb_flow_stalls.attr,
478 &dev_attr_lb_ints.attr,
479 &dev_attr_rx_bad_formats.attr,
480 &dev_attr_rx_buf_ovfls.attr,
481 &dev_attr_rx_data_pkts.attr,
482 &dev_attr_rx_dropped_pkts.attr,
483 &dev_attr_rx_dwords.attr,
484 &dev_attr_rx_ebps.attr,
485 &dev_attr_rx_flow_ctrl_errs.attr,
486 &dev_attr_rx_flow_pkts.attr,
487 &dev_attr_rx_icrc_errs.attr,
488 &dev_attr_rx_len_errs.attr,
489 &dev_attr_rx_link_problems.attr,
490 &dev_attr_rx_lpcrc_errs.attr,
491 &dev_attr_rx_max_min_len_errs.attr,
492 &dev_attr_rx_p0_hdr_egr_ovfls.attr,
493 &dev_attr_rx_p1_hdr_egr_ovfls.attr,
494 &dev_attr_rx_p2_hdr_egr_ovfls.attr,
495 &dev_attr_rx_p3_hdr_egr_ovfls.attr,
496 &dev_attr_rx_p4_hdr_egr_ovfls.attr,
497 &dev_attr_rx_p5_hdr_egr_ovfls.attr,
498 &dev_attr_rx_p6_hdr_egr_ovfls.attr,
499 &dev_attr_rx_p7_hdr_egr_ovfls.attr,
500 &dev_attr_rx_p8_hdr_egr_ovfls.attr,
501 &dev_attr_rx_pkey_mismatches.attr,
502 &dev_attr_rx_tid_full_errs.attr,
503 &dev_attr_rx_tid_valid_errs.attr,
504 &dev_attr_rx_vcrc_errs.attr,
505 &dev_attr_tx_data_pkts.attr,
506 &dev_attr_tx_dropped_pkts.attr,
507 &dev_attr_tx_dwords.attr,
508 &dev_attr_tx_flow_pkts.attr,
509 &dev_attr_tx_flow_stalls.attr,
510 &dev_attr_tx_len_errs.attr,
511 &dev_attr_tx_max_min_len_errs.attr,
512 &dev_attr_tx_underruns.attr,
513 &dev_attr_tx_unsup_vl_errs.attr,
517 static struct attribute_group dev_counter_attr_group = {
519 .attrs = dev_counter_attributes
522 static ssize_t store_reset(struct device *dev,
523 struct device_attribute *attr,
527 struct ipath_devdata *dd = dev_get_drvdata(dev);
530 if (count < 5 || memcmp(buf, "reset", 5)) {
535 if (dd->ipath_flags & IPATH_DISABLED) {
537 * post-reset init would re-enable interrupts, etc.
538 * so don't allow reset on disabled devices. Not
539 * perfect error, but about the best choice.
541 dev_info(dev,"Unit %d is disabled, can't reset\n",
545 ret = ipath_reset_device(dd->ipath_unit);
547 return ret<0 ? ret : count;
550 static ssize_t store_link_state(struct device *dev,
551 struct device_attribute *attr,
555 struct ipath_devdata *dd = dev_get_drvdata(dev);
559 ret = ipath_parse_ushort(buf, &state);
563 r = ipath_layer_set_linkstate(dd, state);
571 ipath_dev_err(dd, "attempt to set invalid link state\n");
576 static ssize_t show_mtu(struct device *dev,
577 struct device_attribute *attr,
580 struct ipath_devdata *dd = dev_get_drvdata(dev);
581 return scnprintf(buf, PAGE_SIZE, "%u\n", dd->ipath_ibmtu);
584 static ssize_t store_mtu(struct device *dev,
585 struct device_attribute *attr,
589 struct ipath_devdata *dd = dev_get_drvdata(dev);
594 ret = ipath_parse_ushort(buf, &mtu);
598 r = ipath_layer_set_mtu(dd, mtu);
604 ipath_dev_err(dd, "attempt to set invalid MTU\n");
609 static ssize_t show_enabled(struct device *dev,
610 struct device_attribute *attr,
613 struct ipath_devdata *dd = dev_get_drvdata(dev);
614 return scnprintf(buf, PAGE_SIZE, "%u\n",
615 (dd->ipath_flags & IPATH_DISABLED) ? 0 : 1);
618 static ssize_t store_enabled(struct device *dev,
619 struct device_attribute *attr,
623 struct ipath_devdata *dd = dev_get_drvdata(dev);
627 ret = ipath_parse_ushort(buf, &enable);
629 ipath_dev_err(dd, "attempt to use non-numeric on enable\n");
634 if (!(dd->ipath_flags & IPATH_DISABLED))
637 dev_info(dev, "Enabling unit %d\n", dd->ipath_unit);
638 /* same as post-reset */
639 ret = ipath_init_chip(dd, 1);
641 ipath_dev_err(dd, "Failed to enable unit %d\n",
644 dd->ipath_flags &= ~IPATH_DISABLED;
645 *dd->ipath_statusp &= ~IPATH_STATUS_ADMIN_DISABLED;
648 else if (!(dd->ipath_flags & IPATH_DISABLED)) {
649 dev_info(dev, "Disabling unit %d\n", dd->ipath_unit);
650 ipath_shutdown_device(dd);
651 dd->ipath_flags |= IPATH_DISABLED;
652 *dd->ipath_statusp |= IPATH_STATUS_ADMIN_DISABLED;
659 static DRIVER_ATTR(num_units, S_IRUGO, show_num_units, NULL);
660 static DRIVER_ATTR(version, S_IRUGO, show_version, NULL);
662 static struct attribute *driver_attributes[] = {
663 &driver_attr_num_units.attr,
664 &driver_attr_version.attr,
668 static struct attribute_group driver_attr_group = {
669 .attrs = driver_attributes
672 static DEVICE_ATTR(guid, S_IWUSR | S_IRUGO, show_guid, store_guid);
673 static DEVICE_ATTR(lid, S_IWUSR | S_IRUGO, show_lid, store_lid);
674 static DEVICE_ATTR(link_state, S_IWUSR, NULL, store_link_state);
675 static DEVICE_ATTR(mlid, S_IWUSR | S_IRUGO, show_mlid, store_mlid);
676 static DEVICE_ATTR(mtu, S_IWUSR | S_IRUGO, show_mtu, store_mtu);
677 static DEVICE_ATTR(enabled, S_IWUSR | S_IRUGO, show_enabled, store_enabled);
678 static DEVICE_ATTR(nguid, S_IRUGO, show_nguid, NULL);
679 static DEVICE_ATTR(reset, S_IWUSR, NULL, store_reset);
680 static DEVICE_ATTR(serial, S_IRUGO, show_serial, NULL);
681 static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
682 static DEVICE_ATTR(status_str, S_IRUGO, show_status_str, NULL);
683 static DEVICE_ATTR(boardversion, S_IRUGO, show_boardversion, NULL);
684 static DEVICE_ATTR(unit, S_IRUGO, show_unit, NULL);
686 static struct attribute *dev_attributes[] = {
689 &dev_attr_link_state.attr,
692 &dev_attr_nguid.attr,
693 &dev_attr_serial.attr,
694 &dev_attr_status.attr,
695 &dev_attr_status_str.attr,
696 &dev_attr_boardversion.attr,
698 &dev_attr_enabled.attr,
702 static struct attribute_group dev_attr_group = {
703 .attrs = dev_attributes
707 * ipath_expose_reset - create a device reset file
708 * @dev: the device structure
710 * Only expose a file that lets us reset the device after someone
711 * enters diag mode. A device reset is quite likely to crash the
712 * machine entirely, so we don't want to normally make it
715 * Called with ipath_mutex held.
717 int ipath_expose_reset(struct device *dev)
723 ret = device_create_file(dev, &dev_attr_reset);
732 int ipath_driver_create_group(struct device_driver *drv)
736 ret = sysfs_create_group(&drv->kobj, &driver_attr_group);
740 ret = sysfs_create_group(&drv->kobj, &driver_stat_attr_group);
742 sysfs_remove_group(&drv->kobj, &driver_attr_group);
748 void ipath_driver_remove_group(struct device_driver *drv)
750 sysfs_remove_group(&drv->kobj, &driver_stat_attr_group);
751 sysfs_remove_group(&drv->kobj, &driver_attr_group);
754 int ipath_device_create_group(struct device *dev, struct ipath_devdata *dd)
759 ret = sysfs_create_group(&dev->kobj, &dev_attr_group);
763 ret = sysfs_create_group(&dev->kobj, &dev_counter_attr_group);
767 snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
768 ret = sysfs_create_link(&dev->driver->kobj, &dev->kobj, unit);
772 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
774 sysfs_remove_group(&dev->kobj, &dev_attr_group);
779 void ipath_device_remove_group(struct device *dev, struct ipath_devdata *dd)
783 snprintf(unit, sizeof(unit), "%02d", dd->ipath_unit);
784 sysfs_remove_link(&dev->driver->kobj, unit);
786 sysfs_remove_group(&dev->kobj, &dev_counter_attr_group);
787 sysfs_remove_group(&dev->kobj, &dev_attr_group);
789 device_remove_file(dev, &dev_attr_reset);