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