xref: /openbmc/linux/drivers/s390/net/qeth_core_sys.c (revision dfd4f649)
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 	mutex_lock(&card->conf_mutex);
202 	if (card->state != CARD_STATE_DOWN) {
203 		rc = -EPERM;
204 		goto out;
205 	}
206 
207 	/* check if 1920 devices are supported ,
208 	 * if though we have to permit priority queueing
209 	 */
210 	if (card->qdio.no_out_queues == 1) {
211 		card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT;
212 		rc = -EPERM;
213 		goto out;
214 	}
215 
216 	if (sysfs_streq(buf, "prio_queueing_prec")) {
217 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_PREC;
218 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
219 	} else if (sysfs_streq(buf, "prio_queueing_skb")) {
220 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_SKB;
221 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
222 	} else if (sysfs_streq(buf, "prio_queueing_tos")) {
223 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
224 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
225 	} else if (sysfs_streq(buf, "prio_queueing_vlan")) {
226 		if (IS_LAYER3(card)) {
227 			rc = -ENOTSUPP;
228 			goto out;
229 		}
230 		card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_VLAN;
231 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
232 	} else if (sysfs_streq(buf, "no_prio_queueing:0")) {
233 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
234 		card->qdio.default_out_queue = 0;
235 	} else if (sysfs_streq(buf, "no_prio_queueing:1")) {
236 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
237 		card->qdio.default_out_queue = 1;
238 	} else if (sysfs_streq(buf, "no_prio_queueing:2")) {
239 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
240 		card->qdio.default_out_queue = 2;
241 	} else if (sysfs_streq(buf, "no_prio_queueing:3")) {
242 		if (card->info.type == QETH_CARD_TYPE_IQD) {
243 			rc = -EPERM;
244 			goto out;
245 		}
246 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
247 		card->qdio.default_out_queue = 3;
248 	} else if (sysfs_streq(buf, "no_prio_queueing")) {
249 		card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
250 		card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
251 	} else
252 		rc = -EINVAL;
253 out:
254 	mutex_unlock(&card->conf_mutex);
255 	return rc ? rc : count;
256 }
257 
258 static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show,
259 		qeth_dev_prioqing_store);
260 
261 static ssize_t qeth_dev_bufcnt_show(struct device *dev,
262 				struct device_attribute *attr, char *buf)
263 {
264 	struct qeth_card *card = dev_get_drvdata(dev);
265 
266 	if (!card)
267 		return -EINVAL;
268 
269 	return sprintf(buf, "%i\n", card->qdio.in_buf_pool.buf_count);
270 }
271 
272 static ssize_t qeth_dev_bufcnt_store(struct device *dev,
273 		struct device_attribute *attr, const char *buf, size_t count)
274 {
275 	struct qeth_card *card = dev_get_drvdata(dev);
276 	char *tmp;
277 	int cnt, old_cnt;
278 	int rc = 0;
279 
280 	if (!card)
281 		return -EINVAL;
282 
283 	mutex_lock(&card->conf_mutex);
284 	if (card->state != CARD_STATE_DOWN) {
285 		rc = -EPERM;
286 		goto out;
287 	}
288 
289 	old_cnt = card->qdio.in_buf_pool.buf_count;
290 	cnt = simple_strtoul(buf, &tmp, 10);
291 	cnt = (cnt < QETH_IN_BUF_COUNT_MIN) ? QETH_IN_BUF_COUNT_MIN :
292 		((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
293 	if (old_cnt != cnt) {
294 		rc = qeth_realloc_buffer_pool(card, cnt);
295 	}
296 out:
297 	mutex_unlock(&card->conf_mutex);
298 	return rc ? rc : count;
299 }
300 
301 static DEVICE_ATTR(buffer_count, 0644, qeth_dev_bufcnt_show,
302 		qeth_dev_bufcnt_store);
303 
304 static ssize_t qeth_dev_recover_store(struct device *dev,
305 		struct device_attribute *attr, const char *buf, size_t count)
306 {
307 	struct qeth_card *card = dev_get_drvdata(dev);
308 	char *tmp;
309 	int i;
310 
311 	if (!card)
312 		return -EINVAL;
313 
314 	if (!qeth_card_hw_is_reachable(card))
315 		return -EPERM;
316 
317 	i = simple_strtoul(buf, &tmp, 16);
318 	if (i == 1)
319 		qeth_schedule_recovery(card);
320 
321 	return count;
322 }
323 
324 static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store);
325 
326 static ssize_t qeth_dev_performance_stats_show(struct device *dev,
327 				struct device_attribute *attr, char *buf)
328 {
329 	struct qeth_card *card = dev_get_drvdata(dev);
330 
331 	if (!card)
332 		return -EINVAL;
333 
334 	return sprintf(buf, "1\n");
335 }
336 
337 static ssize_t qeth_dev_performance_stats_store(struct device *dev,
338 		struct device_attribute *attr, const char *buf, size_t count)
339 {
340 	struct qeth_card *card = dev_get_drvdata(dev);
341 	struct qeth_qdio_out_q *queue;
342 	unsigned int i;
343 	bool reset;
344 	int rc;
345 
346 	if (!card)
347 		return -EINVAL;
348 
349 	rc = kstrtobool(buf, &reset);
350 	if (rc)
351 		return rc;
352 
353 	if (reset) {
354 		memset(&card->stats, 0, sizeof(card->stats));
355 		for (i = 0; i < card->qdio.no_out_queues; i++) {
356 			queue = card->qdio.out_qs[i];
357 			if (!queue)
358 				break;
359 			memset(&queue->stats, 0, sizeof(queue->stats));
360 		}
361 	}
362 
363 	return count;
364 }
365 
366 static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
367 		   qeth_dev_performance_stats_store);
368 
369 static ssize_t qeth_dev_layer2_show(struct device *dev,
370 		struct device_attribute *attr, char *buf)
371 {
372 	struct qeth_card *card = dev_get_drvdata(dev);
373 
374 	if (!card)
375 		return -EINVAL;
376 
377 	return sprintf(buf, "%i\n", card->options.layer);
378 }
379 
380 static ssize_t qeth_dev_layer2_store(struct device *dev,
381 		struct device_attribute *attr, const char *buf, size_t count)
382 {
383 	struct qeth_card *card = dev_get_drvdata(dev);
384 	struct net_device *ndev;
385 	char *tmp;
386 	int i, rc = 0;
387 	enum qeth_discipline_id newdis;
388 
389 	if (!card)
390 		return -EINVAL;
391 
392 	mutex_lock(&card->discipline_mutex);
393 	if (card->state != CARD_STATE_DOWN) {
394 		rc = -EPERM;
395 		goto out;
396 	}
397 
398 	i = simple_strtoul(buf, &tmp, 16);
399 	switch (i) {
400 	case 0:
401 		newdis = QETH_DISCIPLINE_LAYER3;
402 		break;
403 	case 1:
404 		newdis = QETH_DISCIPLINE_LAYER2;
405 		break;
406 	default:
407 		rc = -EINVAL;
408 		goto out;
409 	}
410 
411 	if (card->options.layer == newdis)
412 		goto out;
413 	if (card->info.layer_enforced) {
414 		/* fixed layer, can't switch */
415 		rc = -EOPNOTSUPP;
416 		goto out;
417 	}
418 
419 	if (card->discipline) {
420 		/* start with a new, pristine netdevice: */
421 		ndev = qeth_clone_netdev(card->dev);
422 		if (!ndev) {
423 			rc = -ENOMEM;
424 			goto out;
425 		}
426 
427 		card->discipline->remove(card->gdev);
428 		qeth_core_free_discipline(card);
429 		free_netdev(card->dev);
430 		card->dev = ndev;
431 	}
432 
433 	rc = qeth_core_load_discipline(card, newdis);
434 	if (rc)
435 		goto out;
436 
437 	rc = card->discipline->setup(card->gdev);
438 	if (rc)
439 		qeth_core_free_discipline(card);
440 out:
441 	mutex_unlock(&card->discipline_mutex);
442 	return rc ? rc : count;
443 }
444 
445 static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show,
446 		   qeth_dev_layer2_store);
447 
448 #define ATTR_QETH_ISOLATION_NONE	("none")
449 #define ATTR_QETH_ISOLATION_FWD		("forward")
450 #define ATTR_QETH_ISOLATION_DROP	("drop")
451 
452 static ssize_t qeth_dev_isolation_show(struct device *dev,
453 				struct device_attribute *attr, char *buf)
454 {
455 	struct qeth_card *card = dev_get_drvdata(dev);
456 
457 	if (!card)
458 		return -EINVAL;
459 
460 	switch (card->options.isolation) {
461 	case ISOLATION_MODE_NONE:
462 		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_NONE);
463 	case ISOLATION_MODE_FWD:
464 		return snprintf(buf, 9, "%s\n", ATTR_QETH_ISOLATION_FWD);
465 	case ISOLATION_MODE_DROP:
466 		return snprintf(buf, 6, "%s\n", ATTR_QETH_ISOLATION_DROP);
467 	default:
468 		return snprintf(buf, 5, "%s\n", "N/A");
469 	}
470 }
471 
472 static ssize_t qeth_dev_isolation_store(struct device *dev,
473 		struct device_attribute *attr, const char *buf, size_t count)
474 {
475 	struct qeth_card *card = dev_get_drvdata(dev);
476 	enum qeth_ipa_isolation_modes isolation;
477 	int rc = 0;
478 
479 	if (!card)
480 		return -EINVAL;
481 
482 	mutex_lock(&card->conf_mutex);
483 	if (card->info.type != QETH_CARD_TYPE_OSD &&
484 	    card->info.type != QETH_CARD_TYPE_OSX) {
485 		rc = -EOPNOTSUPP;
486 		dev_err(&card->gdev->dev, "Adapter does not "
487 			"support QDIO data connection isolation\n");
488 		goto out;
489 	}
490 
491 	/* parse input into isolation mode */
492 	if (sysfs_streq(buf, ATTR_QETH_ISOLATION_NONE)) {
493 		isolation = ISOLATION_MODE_NONE;
494 	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_FWD)) {
495 		isolation = ISOLATION_MODE_FWD;
496 	} else if (sysfs_streq(buf, ATTR_QETH_ISOLATION_DROP)) {
497 		isolation = ISOLATION_MODE_DROP;
498 	} else {
499 		rc = -EINVAL;
500 		goto out;
501 	}
502 	rc = count;
503 
504 	/* defer IP assist if device is offline (until discipline->set_online)*/
505 	card->options.prev_isolation = card->options.isolation;
506 	card->options.isolation = isolation;
507 	if (qeth_card_hw_is_reachable(card)) {
508 		int ipa_rc = qeth_set_access_ctrl_online(card, 1);
509 		if (ipa_rc != 0)
510 			rc = ipa_rc;
511 	}
512 out:
513 	mutex_unlock(&card->conf_mutex);
514 	return rc;
515 }
516 
517 static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
518 			qeth_dev_isolation_store);
519 
520 static ssize_t qeth_dev_switch_attrs_show(struct device *dev,
521 				struct device_attribute *attr, char *buf)
522 {
523 	struct qeth_card *card = dev_get_drvdata(dev);
524 	struct qeth_switch_info sw_info;
525 	int	rc = 0;
526 
527 	if (!card)
528 		return -EINVAL;
529 
530 	if (!qeth_card_hw_is_reachable(card))
531 		return sprintf(buf, "n/a\n");
532 
533 	rc = qeth_query_switch_attributes(card, &sw_info);
534 	if (rc)
535 		return rc;
536 
537 	if (!sw_info.capabilities)
538 		rc = sprintf(buf, "unknown");
539 
540 	if (sw_info.capabilities & QETH_SWITCH_FORW_802_1)
541 		rc = sprintf(buf, (sw_info.settings & QETH_SWITCH_FORW_802_1 ?
542 							"[802.1]" : "802.1"));
543 	if (sw_info.capabilities & QETH_SWITCH_FORW_REFL_RELAY)
544 		rc += sprintf(buf + rc,
545 			(sw_info.settings & QETH_SWITCH_FORW_REFL_RELAY ?
546 							" [rr]" : " rr"));
547 	rc += sprintf(buf + rc, "\n");
548 
549 	return rc;
550 }
551 
552 static DEVICE_ATTR(switch_attrs, 0444,
553 		   qeth_dev_switch_attrs_show, NULL);
554 
555 static ssize_t qeth_hw_trap_show(struct device *dev,
556 				struct device_attribute *attr, char *buf)
557 {
558 	struct qeth_card *card = dev_get_drvdata(dev);
559 
560 	if (!card)
561 		return -EINVAL;
562 	if (card->info.hwtrap)
563 		return snprintf(buf, 5, "arm\n");
564 	else
565 		return snprintf(buf, 8, "disarm\n");
566 }
567 
568 static ssize_t qeth_hw_trap_store(struct device *dev,
569 		struct device_attribute *attr, const char *buf, size_t count)
570 {
571 	struct qeth_card *card = dev_get_drvdata(dev);
572 	int rc = 0;
573 	int state = 0;
574 
575 	if (!card)
576 		return -EINVAL;
577 
578 	mutex_lock(&card->conf_mutex);
579 	if (qeth_card_hw_is_reachable(card))
580 		state = 1;
581 
582 	if (sysfs_streq(buf, "arm") && !card->info.hwtrap) {
583 		if (state) {
584 			if (qeth_is_diagass_supported(card,
585 			    QETH_DIAGS_CMD_TRAP)) {
586 				rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
587 				if (!rc)
588 					card->info.hwtrap = 1;
589 			} else
590 				rc = -EINVAL;
591 		} else
592 			card->info.hwtrap = 1;
593 	} else if (sysfs_streq(buf, "disarm") && card->info.hwtrap) {
594 		if (state) {
595 			rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
596 			if (!rc)
597 				card->info.hwtrap = 0;
598 		} else
599 			card->info.hwtrap = 0;
600 	} else if (sysfs_streq(buf, "trap") && state && card->info.hwtrap)
601 		rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
602 	else
603 		rc = -EINVAL;
604 
605 	mutex_unlock(&card->conf_mutex);
606 	return rc ? rc : count;
607 }
608 
609 static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
610 		   qeth_hw_trap_store);
611 
612 static ssize_t qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value)
613 {
614 
615 	if (!card)
616 		return -EINVAL;
617 
618 	return sprintf(buf, "%i\n", value);
619 }
620 
621 static ssize_t qeth_dev_blkt_store(struct qeth_card *card,
622 		const char *buf, size_t count, int *value, int max_value)
623 {
624 	char *tmp;
625 	int i, rc = 0;
626 
627 	if (!card)
628 		return -EINVAL;
629 
630 	mutex_lock(&card->conf_mutex);
631 	if (card->state != CARD_STATE_DOWN) {
632 		rc = -EPERM;
633 		goto out;
634 	}
635 	i = simple_strtoul(buf, &tmp, 10);
636 	if (i <= max_value)
637 		*value = i;
638 	else
639 		rc = -EINVAL;
640 out:
641 	mutex_unlock(&card->conf_mutex);
642 	return rc ? rc : count;
643 }
644 
645 static ssize_t qeth_dev_blkt_total_show(struct device *dev,
646 				struct device_attribute *attr, char *buf)
647 {
648 	struct qeth_card *card = dev_get_drvdata(dev);
649 
650 	return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
651 }
652 
653 static ssize_t qeth_dev_blkt_total_store(struct device *dev,
654 		struct device_attribute *attr, const char *buf, size_t count)
655 {
656 	struct qeth_card *card = dev_get_drvdata(dev);
657 
658 	return qeth_dev_blkt_store(card, buf, count,
659 				   &card->info.blkt.time_total, 5000);
660 }
661 
662 
663 
664 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
665 		   qeth_dev_blkt_total_store);
666 
667 static ssize_t qeth_dev_blkt_inter_show(struct device *dev,
668 				struct device_attribute *attr, char *buf)
669 {
670 	struct qeth_card *card = dev_get_drvdata(dev);
671 
672 	return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
673 }
674 
675 static ssize_t qeth_dev_blkt_inter_store(struct device *dev,
676 		struct device_attribute *attr, const char *buf, size_t count)
677 {
678 	struct qeth_card *card = dev_get_drvdata(dev);
679 
680 	return qeth_dev_blkt_store(card, buf, count,
681 				   &card->info.blkt.inter_packet, 1000);
682 }
683 
684 static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
685 		   qeth_dev_blkt_inter_store);
686 
687 static ssize_t qeth_dev_blkt_inter_jumbo_show(struct device *dev,
688 				struct device_attribute *attr, char *buf)
689 {
690 	struct qeth_card *card = dev_get_drvdata(dev);
691 
692 	return qeth_dev_blkt_show(buf, card,
693 				  card->info.blkt.inter_packet_jumbo);
694 }
695 
696 static ssize_t qeth_dev_blkt_inter_jumbo_store(struct device *dev,
697 		struct device_attribute *attr, const char *buf, size_t count)
698 {
699 	struct qeth_card *card = dev_get_drvdata(dev);
700 
701 	return qeth_dev_blkt_store(card, buf, count,
702 				   &card->info.blkt.inter_packet_jumbo, 1000);
703 }
704 
705 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
706 		   qeth_dev_blkt_inter_jumbo_store);
707 
708 static struct attribute *qeth_blkt_device_attrs[] = {
709 	&dev_attr_total.attr,
710 	&dev_attr_inter.attr,
711 	&dev_attr_inter_jumbo.attr,
712 	NULL,
713 };
714 const struct attribute_group qeth_device_blkt_group = {
715 	.name = "blkt",
716 	.attrs = qeth_blkt_device_attrs,
717 };
718 EXPORT_SYMBOL_GPL(qeth_device_blkt_group);
719 
720 static struct attribute *qeth_device_attrs[] = {
721 	&dev_attr_state.attr,
722 	&dev_attr_chpid.attr,
723 	&dev_attr_if_name.attr,
724 	&dev_attr_card_type.attr,
725 	&dev_attr_inbuf_size.attr,
726 	&dev_attr_portno.attr,
727 	&dev_attr_portname.attr,
728 	&dev_attr_priority_queueing.attr,
729 	&dev_attr_buffer_count.attr,
730 	&dev_attr_recover.attr,
731 	&dev_attr_performance_stats.attr,
732 	&dev_attr_layer2.attr,
733 	&dev_attr_isolation.attr,
734 	&dev_attr_hw_trap.attr,
735 	&dev_attr_switch_attrs.attr,
736 	NULL,
737 };
738 const struct attribute_group qeth_device_attr_group = {
739 	.attrs = qeth_device_attrs,
740 };
741 EXPORT_SYMBOL_GPL(qeth_device_attr_group);
742 
743 const struct attribute_group *qeth_generic_attr_groups[] = {
744 	&qeth_device_attr_group,
745 	&qeth_device_blkt_group,
746 	NULL,
747 };
748 
749 static struct attribute *qeth_osn_device_attrs[] = {
750 	&dev_attr_state.attr,
751 	&dev_attr_chpid.attr,
752 	&dev_attr_if_name.attr,
753 	&dev_attr_card_type.attr,
754 	&dev_attr_buffer_count.attr,
755 	&dev_attr_recover.attr,
756 	NULL,
757 };
758 static struct attribute_group qeth_osn_device_attr_group = {
759 	.attrs = qeth_osn_device_attrs,
760 };
761 const struct attribute_group *qeth_osn_attr_groups[] = {
762 	&qeth_osn_device_attr_group,
763 	NULL,
764 };
765