xref: /linux/drivers/s390/net/qeth_core_sys.c (revision 0d456bad36d42d16022be045c8a53ddbb59ee478)
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.isolation = isolation;
517 	if (card->state == CARD_STATE_SOFTSETUP ||
518 	    card->state == CARD_STATE_UP) {
519 		int ipa_rc = qeth_set_access_ctrl_online(card);
520 		if (ipa_rc != 0)
521 			rc = ipa_rc;
522 	}
523 out:
524 	mutex_unlock(&card->conf_mutex);
525 	return rc;
526 }
527 
528 static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
529 		   qeth_dev_isolation_store);
530 
531 static ssize_t qeth_hw_trap_show(struct device *dev,
532 				struct device_attribute *attr, char *buf)
533 {
534 	struct qeth_card *card = dev_get_drvdata(dev);
535 
536 	if (!card)
537 		return -EINVAL;
538 	if (card->info.hwtrap)
539 		return snprintf(buf, 5, "arm\n");
540 	else
541 		return snprintf(buf, 8, "disarm\n");
542 }
543 
544 static ssize_t qeth_hw_trap_store(struct device *dev,
545 		struct device_attribute *attr, const char *buf, size_t count)
546 {
547 	struct qeth_card *card = dev_get_drvdata(dev);
548 	int rc = 0;
549 	char *tmp, *curtoken;
550 	int state = 0;
551 	curtoken = (char *)buf;
552 
553 	if (!card)
554 		return -EINVAL;
555 
556 	mutex_lock(&card->conf_mutex);
557 	if (card->state == CARD_STATE_SOFTSETUP || card->state == CARD_STATE_UP)
558 		state = 1;
559 	tmp = strsep(&curtoken, "\n");
560 
561 	if (!strcmp(tmp, "arm") && !card->info.hwtrap) {
562 		if (state) {
563 			if (qeth_is_diagass_supported(card,
564 			    QETH_DIAGS_CMD_TRAP)) {
565 				rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_ARM);
566 				if (!rc)
567 					card->info.hwtrap = 1;
568 			} else
569 				rc = -EINVAL;
570 		} else
571 			card->info.hwtrap = 1;
572 	} else if (!strcmp(tmp, "disarm") && card->info.hwtrap) {
573 		if (state) {
574 			rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_DISARM);
575 			if (!rc)
576 				card->info.hwtrap = 0;
577 		} else
578 			card->info.hwtrap = 0;
579 	} else if (!strcmp(tmp, "trap") && state && card->info.hwtrap)
580 		rc = qeth_hw_trap(card, QETH_DIAGS_TRAP_CAPTURE);
581 	else
582 		rc = -EINVAL;
583 
584 	mutex_unlock(&card->conf_mutex);
585 	return rc ? rc : count;
586 }
587 
588 static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
589 		   qeth_hw_trap_store);
590 
591 static ssize_t qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value)
592 {
593 
594 	if (!card)
595 		return -EINVAL;
596 
597 	return sprintf(buf, "%i\n", value);
598 }
599 
600 static ssize_t qeth_dev_blkt_store(struct qeth_card *card,
601 		const char *buf, size_t count, int *value, int max_value)
602 {
603 	char *tmp;
604 	int i, rc = 0;
605 
606 	if (!card)
607 		return -EINVAL;
608 
609 	mutex_lock(&card->conf_mutex);
610 	if ((card->state != CARD_STATE_DOWN) &&
611 	    (card->state != CARD_STATE_RECOVER)) {
612 		rc = -EPERM;
613 		goto out;
614 	}
615 	i = simple_strtoul(buf, &tmp, 10);
616 	if (i <= max_value)
617 		*value = i;
618 	else
619 		rc = -EINVAL;
620 out:
621 	mutex_unlock(&card->conf_mutex);
622 	return rc ? rc : count;
623 }
624 
625 static ssize_t qeth_dev_blkt_total_show(struct device *dev,
626 				struct device_attribute *attr, char *buf)
627 {
628 	struct qeth_card *card = dev_get_drvdata(dev);
629 
630 	return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
631 }
632 
633 static ssize_t qeth_dev_blkt_total_store(struct device *dev,
634 		struct device_attribute *attr, const char *buf, size_t count)
635 {
636 	struct qeth_card *card = dev_get_drvdata(dev);
637 
638 	return qeth_dev_blkt_store(card, buf, count,
639 				   &card->info.blkt.time_total, 5000);
640 }
641 
642 
643 
644 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
645 		   qeth_dev_blkt_total_store);
646 
647 static ssize_t qeth_dev_blkt_inter_show(struct device *dev,
648 				struct device_attribute *attr, char *buf)
649 {
650 	struct qeth_card *card = dev_get_drvdata(dev);
651 
652 	return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
653 }
654 
655 static ssize_t qeth_dev_blkt_inter_store(struct device *dev,
656 		struct device_attribute *attr, const char *buf, size_t count)
657 {
658 	struct qeth_card *card = dev_get_drvdata(dev);
659 
660 	return qeth_dev_blkt_store(card, buf, count,
661 				   &card->info.blkt.inter_packet, 1000);
662 }
663 
664 static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
665 		   qeth_dev_blkt_inter_store);
666 
667 static ssize_t qeth_dev_blkt_inter_jumbo_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,
673 				  card->info.blkt.inter_packet_jumbo);
674 }
675 
676 static ssize_t qeth_dev_blkt_inter_jumbo_store(struct device *dev,
677 		struct device_attribute *attr, const char *buf, size_t count)
678 {
679 	struct qeth_card *card = dev_get_drvdata(dev);
680 
681 	return qeth_dev_blkt_store(card, buf, count,
682 				   &card->info.blkt.inter_packet_jumbo, 1000);
683 }
684 
685 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
686 		   qeth_dev_blkt_inter_jumbo_store);
687 
688 static struct attribute *qeth_blkt_device_attrs[] = {
689 	&dev_attr_total.attr,
690 	&dev_attr_inter.attr,
691 	&dev_attr_inter_jumbo.attr,
692 	NULL,
693 };
694 static struct attribute_group qeth_device_blkt_group = {
695 	.name = "blkt",
696 	.attrs = qeth_blkt_device_attrs,
697 };
698 
699 static struct attribute *qeth_device_attrs[] = {
700 	&dev_attr_state.attr,
701 	&dev_attr_chpid.attr,
702 	&dev_attr_if_name.attr,
703 	&dev_attr_card_type.attr,
704 	&dev_attr_inbuf_size.attr,
705 	&dev_attr_portno.attr,
706 	&dev_attr_portname.attr,
707 	&dev_attr_priority_queueing.attr,
708 	&dev_attr_buffer_count.attr,
709 	&dev_attr_recover.attr,
710 	&dev_attr_performance_stats.attr,
711 	&dev_attr_layer2.attr,
712 	&dev_attr_isolation.attr,
713 	&dev_attr_hw_trap.attr,
714 	NULL,
715 };
716 static struct attribute_group qeth_device_attr_group = {
717 	.attrs = qeth_device_attrs,
718 };
719 
720 const struct attribute_group *qeth_generic_attr_groups[] = {
721 	&qeth_device_attr_group,
722 	&qeth_device_blkt_group,
723 	NULL,
724 };
725 
726 static struct attribute *qeth_osn_device_attrs[] = {
727 	&dev_attr_state.attr,
728 	&dev_attr_chpid.attr,
729 	&dev_attr_if_name.attr,
730 	&dev_attr_card_type.attr,
731 	&dev_attr_buffer_count.attr,
732 	&dev_attr_recover.attr,
733 	NULL,
734 };
735 static struct attribute_group qeth_osn_device_attr_group = {
736 	.attrs = qeth_osn_device_attrs,
737 };
738 const struct attribute_group *qeth_osn_attr_groups[] = {
739 	&qeth_osn_device_attr_group,
740 	NULL,
741 };
742