xref: /openbmc/linux/drivers/s390/net/qeth_core_sys.c (revision b8d312aa)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  *    Copyright IBM Corp. 2007
4  *    Author(s): Utz Bacher <utz.bacher@de.ibm.com>,
5  *		 Frank Pavlic <fpavlic@de.ibm.com>,
6  *		 Thomas Spatzier <tspat@de.ibm.com>,
7  *		 Frank Blaschka <frank.blaschka@de.ibm.com>
8  */
9 
10 #define KMSG_COMPONENT "qeth"
11 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 
13 #include <linux/list.h>
14 #include <linux/rwsem.h>
15 #include <asm/ebcdic.h>
16 
17 #include "qeth_core.h"
18 
19 static ssize_t qeth_dev_state_show(struct device *dev,
20 				struct device_attribute *attr, char *buf)
21 {
22 	struct qeth_card *card = dev_get_drvdata(dev);
23 	if (!card)
24 		return -EINVAL;
25 
26 	switch (card->state) {
27 	case CARD_STATE_DOWN:
28 		return sprintf(buf, "DOWN\n");
29 	case CARD_STATE_HARDSETUP:
30 		return sprintf(buf, "HARDSETUP\n");
31 	case CARD_STATE_SOFTSETUP:
32 		if (card->dev->flags & IFF_UP)
33 			return sprintf(buf, "UP (LAN %s)\n",
34 				       netif_carrier_ok(card->dev) ? "ONLINE" :
35 								     "OFFLINE");
36 		return sprintf(buf, "SOFTSETUP\n");
37 	default:
38 		return sprintf(buf, "UNKNOWN\n");
39 	}
40 }
41 
42 static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL);
43 
44 static ssize_t qeth_dev_chpid_show(struct device *dev,
45 				struct device_attribute *attr, char *buf)
46 {
47 	struct qeth_card *card = dev_get_drvdata(dev);
48 	if (!card)
49 		return -EINVAL;
50 
51 	return sprintf(buf, "%02X\n", card->info.chpid);
52 }
53 
54 static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL);
55 
56 static ssize_t qeth_dev_if_name_show(struct device *dev,
57 				struct device_attribute *attr, char *buf)
58 {
59 	struct qeth_card *card = dev_get_drvdata(dev);
60 	if (!card)
61 		return -EINVAL;
62 	return sprintf(buf, "%s\n", QETH_CARD_IFNAME(card));
63 }
64 
65 static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL);
66 
67 static ssize_t qeth_dev_card_type_show(struct device *dev,
68 				struct device_attribute *attr, char *buf)
69 {
70 	struct qeth_card *card = dev_get_drvdata(dev);
71 	if (!card)
72 		return -EINVAL;
73 
74 	return sprintf(buf, "%s\n", qeth_get_cardname_short(card));
75 }
76 
77 static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL);
78 
79 static const char *qeth_get_bufsize_str(struct qeth_card *card)
80 {
81 	if (card->qdio.in_buf_size == 16384)
82 		return "16k";
83 	else if (card->qdio.in_buf_size == 24576)
84 		return "24k";
85 	else if (card->qdio.in_buf_size == 32768)
86 		return "32k";
87 	else if (card->qdio.in_buf_size == 40960)
88 		return "40k";
89 	else
90 		return "64k";
91 }
92 
93 static ssize_t qeth_dev_inbuf_size_show(struct device *dev,
94 				struct device_attribute *attr, char *buf)
95 {
96 	struct qeth_card *card = dev_get_drvdata(dev);
97 	if (!card)
98 		return -EINVAL;
99 
100 	return sprintf(buf, "%s\n", qeth_get_bufsize_str(card));
101 }
102 
103 static DEVICE_ATTR(inbuf_size, 0444, qeth_dev_inbuf_size_show, NULL);
104 
105 static ssize_t qeth_dev_portno_show(struct device *dev,
106 			struct device_attribute *attr, char *buf)
107 {
108 	struct qeth_card *card = dev_get_drvdata(dev);
109 	if (!card)
110 		return -EINVAL;
111 
112 	return sprintf(buf, "%i\n", card->dev->dev_port);
113 }
114 
115 static ssize_t qeth_dev_portno_store(struct device *dev,
116 		struct device_attribute *attr, const char *buf, size_t count)
117 {
118 	struct qeth_card *card = dev_get_drvdata(dev);
119 	char *tmp;
120 	unsigned int portno, limit;
121 	int rc = 0;
122 
123 	if (!card)
124 		return -EINVAL;
125 
126 	mutex_lock(&card->conf_mutex);
127 	if (card->state != CARD_STATE_DOWN) {
128 		rc = -EPERM;
129 		goto out;
130 	}
131 
132 	portno = simple_strtoul(buf, &tmp, 16);
133 	if (portno > QETH_MAX_PORTNO) {
134 		rc = -EINVAL;
135 		goto out;
136 	}
137 	limit = (card->ssqd.pcnt ? card->ssqd.pcnt - 1 : card->ssqd.pcnt);
138 	if (portno > limit) {
139 		rc = -EINVAL;
140 		goto out;
141 	}
142 	card->dev->dev_port = portno;
143 out:
144 	mutex_unlock(&card->conf_mutex);
145 	return rc ? rc : count;
146 }
147 
148 static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store);
149 
150 static ssize_t qeth_dev_portname_show(struct device *dev,
151 				struct device_attribute *attr, char *buf)
152 {
153 	return sprintf(buf, "no portname required\n");
154 }
155 
156 static ssize_t qeth_dev_portname_store(struct device *dev,
157 		struct device_attribute *attr, const char *buf, size_t count)
158 {
159 	struct qeth_card *card = dev_get_drvdata(dev);
160 
161 	dev_warn_once(&card->gdev->dev,
162 		      "portname is deprecated and is ignored\n");
163 	return count;
164 }
165 
166 static DEVICE_ATTR(portname, 0644, qeth_dev_portname_show,
167 		qeth_dev_portname_store);
168 
169 static ssize_t qeth_dev_prioqing_show(struct device *dev,
170 				struct device_attribute *attr, char *buf)
171 {
172 	struct qeth_card *card = dev_get_drvdata(dev);
173 
174 	if (!card)
175 		return -EINVAL;
176 
177 	switch (card->qdio.do_prio_queueing) {
178 	case QETH_PRIO_Q_ING_PREC:
179 		return sprintf(buf, "%s\n", "by precedence");
180 	case QETH_PRIO_Q_ING_TOS:
181 		return sprintf(buf, "%s\n", "by type of service");
182 	case QETH_PRIO_Q_ING_SKB:
183 		return sprintf(buf, "%s\n", "by skb-priority");
184 	case QETH_PRIO_Q_ING_VLAN:
185 		return sprintf(buf, "%s\n", "by VLAN headers");
186 	default:
187 		return sprintf(buf, "always queue %i\n",
188 			       card->qdio.default_out_queue);
189 	}
190 }
191 
192 static ssize_t qeth_dev_prioqing_store(struct device *dev,
193 		struct device_attribute *attr, const char *buf, size_t count)
194 {
195 	struct qeth_card *card = dev_get_drvdata(dev);
196 	int rc = 0;
197 
198 	if (!card)
199 		return -EINVAL;
200 
201 	if (IS_IQD(card))
202 		return -EOPNOTSUPP;
203 
204 	mutex_lock(&card->conf_mutex);
205 	if (card->state != CARD_STATE_DOWN) {
206 		rc = -EPERM;
207 		goto out;
208 	}
209 
210 	/* check if 1920 devices are supported ,
211 	 * if though we have to permit priority queueing
212 	 */
213 	if (card->qdio.no_out_queues == 1) {
214 		card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT;
215 		rc = -EPERM;
216 		goto out;
217 	}
218 
219 	if (sysfs_streq(buf, "prio_queueing_prec")) {
220 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_PREC;
221 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
222 	} else if (sysfs_streq(buf, "prio_queueing_skb")) {
223 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_SKB;
224 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
225 	} else if (sysfs_streq(buf, "prio_queueing_tos")) {
226 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
227 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
228 	} else if (sysfs_streq(buf, "prio_queueing_vlan")) {
229 		if (IS_LAYER3(card)) {
230 			rc = -ENOTSUPP;
231 			goto out;
232 		}
233 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_VLAN;
234 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
235 	} else if (sysfs_streq(buf, "no_prio_queueing:0")) {
236 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
237 		card->qdio.default_out_queue = 0;
238 	} else if (sysfs_streq(buf, "no_prio_queueing:1")) {
239 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
240 		card->qdio.default_out_queue = 1;
241 	} else if (sysfs_streq(buf, "no_prio_queueing:2")) {
242 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
243 		card->qdio.default_out_queue = 2;
244 	} else if (sysfs_streq(buf, "no_prio_queueing:3")) {
245 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
246 		card->qdio.default_out_queue = 3;
247 	} else if (sysfs_streq(buf, "no_prio_queueing")) {
248 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
249 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
250 	} else
251 		rc = -EINVAL;
252 out:
253 	mutex_unlock(&card->conf_mutex);
254 	return rc ? rc : count;
255 }
256 
257 static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show,
258 		qeth_dev_prioqing_store);
259 
260 static ssize_t qeth_dev_bufcnt_show(struct device *dev,
261 				struct device_attribute *attr, char *buf)
262 {
263 	struct qeth_card *card = dev_get_drvdata(dev);
264 
265 	if (!card)
266 		return -EINVAL;
267 
268 	return sprintf(buf, "%i\n", card->qdio.in_buf_pool.buf_count);
269 }
270 
271 static ssize_t qeth_dev_bufcnt_store(struct device *dev,
272 		struct device_attribute *attr, const char *buf, size_t count)
273 {
274 	struct qeth_card *card = dev_get_drvdata(dev);
275 	char *tmp;
276 	int cnt, old_cnt;
277 	int rc = 0;
278 
279 	if (!card)
280 		return -EINVAL;
281 
282 	mutex_lock(&card->conf_mutex);
283 	if (card->state != CARD_STATE_DOWN) {
284 		rc = -EPERM;
285 		goto out;
286 	}
287 
288 	old_cnt = card->qdio.in_buf_pool.buf_count;
289 	cnt = simple_strtoul(buf, &tmp, 10);
290 	cnt = (cnt < QETH_IN_BUF_COUNT_MIN) ? QETH_IN_BUF_COUNT_MIN :
291 		((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
292 	if (old_cnt != cnt) {
293 		rc = qeth_realloc_buffer_pool(card, cnt);
294 	}
295 out:
296 	mutex_unlock(&card->conf_mutex);
297 	return rc ? rc : count;
298 }
299 
300 static DEVICE_ATTR(buffer_count, 0644, qeth_dev_bufcnt_show,
301 		qeth_dev_bufcnt_store);
302 
303 static ssize_t qeth_dev_recover_store(struct device *dev,
304 		struct device_attribute *attr, const char *buf, size_t count)
305 {
306 	struct qeth_card *card = dev_get_drvdata(dev);
307 	char *tmp;
308 	int i;
309 
310 	if (!card)
311 		return -EINVAL;
312 
313 	if (!qeth_card_hw_is_reachable(card))
314 		return -EPERM;
315 
316 	i = simple_strtoul(buf, &tmp, 16);
317 	if (i == 1)
318 		qeth_schedule_recovery(card);
319 
320 	return count;
321 }
322 
323 static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store);
324 
325 static ssize_t qeth_dev_performance_stats_show(struct device *dev,
326 				struct device_attribute *attr, char *buf)
327 {
328 	struct qeth_card *card = dev_get_drvdata(dev);
329 
330 	if (!card)
331 		return -EINVAL;
332 
333 	return sprintf(buf, "1\n");
334 }
335 
336 static ssize_t qeth_dev_performance_stats_store(struct device *dev,
337 		struct device_attribute *attr, const char *buf, size_t count)
338 {
339 	struct qeth_card *card = dev_get_drvdata(dev);
340 	struct qeth_qdio_out_q *queue;
341 	unsigned int i;
342 	bool reset;
343 	int rc;
344 
345 	if (!card)
346 		return -EINVAL;
347 
348 	rc = kstrtobool(buf, &reset);
349 	if (rc)
350 		return rc;
351 
352 	if (reset) {
353 		memset(&card->stats, 0, sizeof(card->stats));
354 		for (i = 0; i < card->qdio.no_out_queues; i++) {
355 			queue = card->qdio.out_qs[i];
356 			if (!queue)
357 				break;
358 			memset(&queue->stats, 0, sizeof(queue->stats));
359 		}
360 	}
361 
362 	return count;
363 }
364 
365 static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
366 		   qeth_dev_performance_stats_store);
367 
368 static ssize_t qeth_dev_layer2_show(struct device *dev,
369 		struct device_attribute *attr, char *buf)
370 {
371 	struct qeth_card *card = dev_get_drvdata(dev);
372 
373 	if (!card)
374 		return -EINVAL;
375 
376 	return sprintf(buf, "%i\n", card->options.layer);
377 }
378 
379 static ssize_t qeth_dev_layer2_store(struct device *dev,
380 		struct device_attribute *attr, const char *buf, size_t count)
381 {
382 	struct qeth_card *card = dev_get_drvdata(dev);
383 	struct net_device *ndev;
384 	char *tmp;
385 	int i, rc = 0;
386 	enum qeth_discipline_id newdis;
387 
388 	if (!card)
389 		return -EINVAL;
390 
391 	mutex_lock(&card->discipline_mutex);
392 	if (card->state != CARD_STATE_DOWN) {
393 		rc = -EPERM;
394 		goto out;
395 	}
396 
397 	i = simple_strtoul(buf, &tmp, 16);
398 	switch (i) {
399 	case 0:
400 		newdis = QETH_DISCIPLINE_LAYER3;
401 		break;
402 	case 1:
403 		newdis = QETH_DISCIPLINE_LAYER2;
404 		break;
405 	default:
406 		rc = -EINVAL;
407 		goto out;
408 	}
409 
410 	if (card->options.layer == newdis)
411 		goto out;
412 	if (card->info.layer_enforced) {
413 		/* fixed layer, can't switch */
414 		rc = -EOPNOTSUPP;
415 		goto out;
416 	}
417 
418 	if (card->discipline) {
419 		/* start with a new, pristine netdevice: */
420 		ndev = qeth_clone_netdev(card->dev);
421 		if (!ndev) {
422 			rc = -ENOMEM;
423 			goto out;
424 		}
425 
426 		card->discipline->remove(card->gdev);
427 		qeth_core_free_discipline(card);
428 		free_netdev(card->dev);
429 		card->dev = ndev;
430 	}
431 
432 	rc = qeth_core_load_discipline(card, newdis);
433 	if (rc)
434 		goto out;
435 
436 	rc = card->discipline->setup(card->gdev);
437 	if (rc)
438 		qeth_core_free_discipline(card);
439 out:
440 	mutex_unlock(&card->discipline_mutex);
441 	return rc ? rc : count;
442 }
443 
444 static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show,
445 		   qeth_dev_layer2_store);
446 
447 #define ATTR_QETH_ISOLATION_NONE	("none")
448 #define ATTR_QETH_ISOLATION_FWD		("forward")
449 #define ATTR_QETH_ISOLATION_DROP	("drop")
450 
451 static ssize_t qeth_dev_isolation_show(struct device *dev,
452 				struct device_attribute *attr, char *buf)
453 {
454 	struct qeth_card *card = dev_get_drvdata(dev);
455 
456 	if (!card)
457 		return -EINVAL;
458 
459 	switch (card->options.isolation) {
460 	case ISOLATION_MODE_NONE:
461 		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_NONE);
462 	case ISOLATION_MODE_FWD:
463 		return snprintf(buf, 9, "%s\n", ATTR_QETH_ISOLATION_FWD);
464 	case ISOLATION_MODE_DROP:
465 		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_DROP);
466 	default:
467 		return snprintf(buf, 5, "%s\n", "N/A");
468 	}
469 }
470 
471 static ssize_t qeth_dev_isolation_store(struct device *dev,
472 		struct device_attribute *attr, const char *buf, size_t count)
473 {
474 	struct qeth_card *card = dev_get_drvdata(dev);
475 	enum qeth_ipa_isolation_modes isolation;
476 	int rc = 0;
477 
478 	if (!card)
479 		return -EINVAL;
480 
481 	mutex_lock(&card->conf_mutex);
482 	if (!IS_OSD(card) && !IS_OSX(card)) {
483 		rc = -EOPNOTSUPP;
484 		dev_err(&card->gdev->dev, "Adapter does not "
485 			"support QDIO data connection isolation\n");
486 		goto out;
487 	}
488 
489 	/* parse input into isolation mode */
490 	if (sysfs_streq(buf, ATTR_QETH_ISOLATION_NONE)) {
491 		isolation = ISOLATION_MODE_NONE;
492 	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_FWD)) {
493 		isolation = ISOLATION_MODE_FWD;
494 	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_DROP)) {
495 		isolation = ISOLATION_MODE_DROP;
496 	} else {
497 		rc = -EINVAL;
498 		goto out;
499 	}
500 	rc = count;
501 
502 	/* defer IP assist if device is offline (until discipline->set_online)*/
503 	card->options.prev_isolation = card->options.isolation;
504 	card->options.isolation = isolation;
505 	if (qeth_card_hw_is_reachable(card)) {
506 		int ipa_rc = qeth_set_access_ctrl_online(card, 1);
507 		if (ipa_rc != 0)
508 			rc = ipa_rc;
509 	}
510 out:
511 	mutex_unlock(&card->conf_mutex);
512 	return rc;
513 }
514 
515 static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
516 			qeth_dev_isolation_store);
517 
518 static ssize_t qeth_dev_switch_attrs_show(struct device *dev,
519 				struct device_attribute *attr, char *buf)
520 {
521 	struct qeth_card *card = dev_get_drvdata(dev);
522 	struct qeth_switch_info sw_info;
523 	int	rc = 0;
524 
525 	if (!card)
526 		return -EINVAL;
527 
528 	if (!qeth_card_hw_is_reachable(card))
529 		return sprintf(buf, "n/a\n");
530 
531 	rc = qeth_query_switch_attributes(card, &sw_info);
532 	if (rc)
533 		return rc;
534 
535 	if (!sw_info.capabilities)
536 		rc = sprintf(buf, "unknown");
537 
538 	if (sw_info.capabilities & QETH_SWITCH_FORW_802_1)
539 		rc = sprintf(buf, (sw_info.settings & QETH_SWITCH_FORW_802_1 ?
540 							"[802.1]" : "802.1"));
541 	if (sw_info.capabilities & QETH_SWITCH_FORW_REFL_RELAY)
542 		rc += sprintf(buf + rc,
543 			(sw_info.settings & QETH_SWITCH_FORW_REFL_RELAY ?
544 							" [rr]" : " rr"));
545 	rc += sprintf(buf + rc, "\n");
546 
547 	return rc;
548 }
549 
550 static DEVICE_ATTR(switch_attrs, 0444,
551 		   qeth_dev_switch_attrs_show, NULL);
552 
553 static ssize_t qeth_hw_trap_show(struct device *dev,
554 				struct device_attribute *attr, char *buf)
555 {
556 	struct qeth_card *card = dev_get_drvdata(dev);
557 
558 	if (!card)
559 		return -EINVAL;
560 	if (card->info.hwtrap)
561 		return snprintf(buf, 5, "arm\n");
562 	else
563 		return snprintf(buf, 8, "disarm\n");
564 }
565 
566 static ssize_t qeth_hw_trap_store(struct device *dev,
567 		struct device_attribute *attr, const char *buf, size_t count)
568 {
569 	struct qeth_card *card = dev_get_drvdata(dev);
570 	int rc = 0;
571 	int state = 0;
572 
573 	if (!card)
574 		return -EINVAL;
575 
576 	mutex_lock(&card->conf_mutex);
577 	if (qeth_card_hw_is_reachable(card))
578 		state = 1;
579 
580 	if (sysfs_streq(buf, "arm") && !card->info.hwtrap) {
581 		if (state) {
582 			if (qeth_is_diagass_supported(card,
583 			    QETH_DIAGS_CMD_TRAP)) {
584 				rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
585 				if (!rc)
586 					card->info.hwtrap = 1;
587 			} else
588 				rc = -EINVAL;
589 		} else
590 			card->info.hwtrap = 1;
591 	} else if (sysfs_streq(buf, "disarm") && card->info.hwtrap) {
592 		if (state) {
593 			rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
594 			if (!rc)
595 				card->info.hwtrap = 0;
596 		} else
597 			card->info.hwtrap = 0;
598 	} else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap)
599 		rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
600 	else
601 		rc = -EINVAL;
602 
603 	mutex_unlock(&card->conf_mutex);
604 	return rc ? rc : count;
605 }
606 
607 static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
608 		   qeth_hw_trap_store);
609 
610 static ssize_t qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value)
611 {
612 
613 	if (!card)
614 		return -EINVAL;
615 
616 	return sprintf(buf, "%i\n", value);
617 }
618 
619 static ssize_t qeth_dev_blkt_store(struct qeth_card *card,
620 		const char *buf, size_t count, int *value, int max_value)
621 {
622 	char *tmp;
623 	int i, rc = 0;
624 
625 	if (!card)
626 		return -EINVAL;
627 
628 	mutex_lock(&card->conf_mutex);
629 	if (card->state != CARD_STATE_DOWN) {
630 		rc = -EPERM;
631 		goto out;
632 	}
633 	i = simple_strtoul(buf, &tmp, 10);
634 	if (i <= max_value)
635 		*value = i;
636 	else
637 		rc = -EINVAL;
638 out:
639 	mutex_unlock(&card->conf_mutex);
640 	return rc ? rc : count;
641 }
642 
643 static ssize_t qeth_dev_blkt_total_show(struct device *dev,
644 				struct device_attribute *attr, char *buf)
645 {
646 	struct qeth_card *card = dev_get_drvdata(dev);
647 
648 	return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
649 }
650 
651 static ssize_t qeth_dev_blkt_total_store(struct device *dev,
652 		struct device_attribute *attr, const char *buf, size_t count)
653 {
654 	struct qeth_card *card = dev_get_drvdata(dev);
655 
656 	return qeth_dev_blkt_store(card, buf, count,
657 				   &card->info.blkt.time_total, 5000);
658 }
659 
660 
661 
662 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
663 		   qeth_dev_blkt_total_store);
664 
665 static ssize_t qeth_dev_blkt_inter_show(struct device *dev,
666 				struct device_attribute *attr, char *buf)
667 {
668 	struct qeth_card *card = dev_get_drvdata(dev);
669 
670 	return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
671 }
672 
673 static ssize_t qeth_dev_blkt_inter_store(struct device *dev,
674 		struct device_attribute *attr, const char *buf, size_t count)
675 {
676 	struct qeth_card *card = dev_get_drvdata(dev);
677 
678 	return qeth_dev_blkt_store(card, buf, count,
679 				   &card->info.blkt.inter_packet, 1000);
680 }
681 
682 static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
683 		   qeth_dev_blkt_inter_store);
684 
685 static ssize_t qeth_dev_blkt_inter_jumbo_show(struct device *dev,
686 				struct device_attribute *attr, char *buf)
687 {
688 	struct qeth_card *card = dev_get_drvdata(dev);
689 
690 	return qeth_dev_blkt_show(buf, card,
691 				  card->info.blkt.inter_packet_jumbo);
692 }
693 
694 static ssize_t qeth_dev_blkt_inter_jumbo_store(struct device *dev,
695 		struct device_attribute *attr, const char *buf, size_t count)
696 {
697 	struct qeth_card *card = dev_get_drvdata(dev);
698 
699 	return qeth_dev_blkt_store(card, buf, count,
700 				   &card->info.blkt.inter_packet_jumbo, 1000);
701 }
702 
703 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
704 		   qeth_dev_blkt_inter_jumbo_store);
705 
706 static struct attribute *qeth_blkt_device_attrs[] = {
707 	&dev_attr_total.attr,
708 	&dev_attr_inter.attr,
709 	&dev_attr_inter_jumbo.attr,
710 	NULL,
711 };
712 const struct attribute_group qeth_device_blkt_group = {
713 	.name = "blkt",
714 	.attrs = qeth_blkt_device_attrs,
715 };
716 EXPORT_SYMBOL_GPL(qeth_device_blkt_group);
717 
718 static struct attribute *qeth_device_attrs[] = {
719 	&dev_attr_state.attr,
720 	&dev_attr_chpid.attr,
721 	&dev_attr_if_name.attr,
722 	&dev_attr_card_type.attr,
723 	&dev_attr_inbuf_size.attr,
724 	&dev_attr_portno.attr,
725 	&dev_attr_portname.attr,
726 	&dev_attr_priority_queueing.attr,
727 	&dev_attr_buffer_count.attr,
728 	&dev_attr_recover.attr,
729 	&dev_attr_performance_stats.attr,
730 	&dev_attr_layer2.attr,
731 	&dev_attr_isolation.attr,
732 	&dev_attr_hw_trap.attr,
733 	&dev_attr_switch_attrs.attr,
734 	NULL,
735 };
736 const struct attribute_group qeth_device_attr_group = {
737 	.attrs = qeth_device_attrs,
738 };
739 EXPORT_SYMBOL_GPL(qeth_device_attr_group);
740 
741 const struct attribute_group *qeth_generic_attr_groups[] = {
742 	&qeth_device_attr_group,
743 	&qeth_device_blkt_group,
744 	NULL,
745 };
746 
747 static struct attribute *qeth_osn_device_attrs[] = {
748 	&dev_attr_state.attr,
749 	&dev_attr_chpid.attr,
750 	&dev_attr_if_name.attr,
751 	&dev_attr_card_type.attr,
752 	&dev_attr_buffer_count.attr,
753 	&dev_attr_recover.attr,
754 	NULL,
755 };
756 static struct attribute_group qeth_osn_device_attr_group = {
757 	.attrs = qeth_osn_device_attrs,
758 };
759 const struct attribute_group *qeth_osn_attr_groups[] = {
760 	&qeth_osn_device_attr_group,
761 	NULL,
762 };
763