9 #define KMSG_COMPONENT "qeth"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/list.h>
25 switch (card->
state) {
29 return sprintf(buf,
"HARDSETUP\n");
31 return sprintf(buf,
"SOFTSETUP\n");
34 return sprintf(buf,
"UP (LAN ONLINE)\n");
36 return sprintf(buf,
"UP (LAN OFFLINE)\n");
38 return sprintf(buf,
"RECOVER\n");
40 return sprintf(buf,
"UNKNOWN\n");
81 static inline const char *qeth_get_bufsize_str(
struct qeth_card *card)
83 if (card->
qdio.in_buf_size == 16384)
85 else if (card->
qdio.in_buf_size == 24576)
87 else if (card->
qdio.in_buf_size == 32768)
89 else if (card->
qdio.in_buf_size == 40960)
102 return sprintf(buf,
"%s\n", qeth_get_bufsize_str(card));
140 limit = (card->
ssqd.pcnt ? card->
ssqd.pcnt - 1 : card->
ssqd.pcnt);
141 if (portno > limit) {
148 return rc ? rc :
count;
151 static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store);
157 char portname[9] = {0, };
162 if (card->
info.portname_required) {
165 return sprintf(buf,
"%s\n", portname);
167 return sprintf(buf,
"no portname required\n");
187 tmp =
strsep((
char **) &buf,
"\n");
195 for (i = 1; i < 9; i++)
196 card->
info.portname[i] =
' ';
201 return rc ? rc :
count;
204 static DEVICE_ATTR(portname, 0644, qeth_dev_portname_show,
205 qeth_dev_portname_store);
215 switch (card->
qdio.do_prio_queueing) {
217 return sprintf(buf,
"%s\n",
"by precedence");
219 return sprintf(buf,
"%s\n",
"by type of service");
221 return sprintf(buf,
"always queue %i\n",
222 card->
qdio.default_out_queue);
246 if (card->
qdio.no_out_queues == 1) {
252 tmp =
strsep((
char **) &buf,
"\n");
253 if (!
strcmp(tmp,
"prio_queueing_prec"))
255 else if (!
strcmp(tmp,
"prio_queueing_tos"))
257 else if (!
strcmp(tmp,
"no_prio_queueing:0")) {
259 card->
qdio.default_out_queue = 0;
260 }
else if (!
strcmp(tmp,
"no_prio_queueing:1")) {
262 card->
qdio.default_out_queue = 1;
263 }
else if (!
strcmp(tmp,
"no_prio_queueing:2")) {
265 card->
qdio.default_out_queue = 2;
266 }
else if (!
strcmp(tmp,
"no_prio_queueing:3")) {
268 card->
qdio.default_out_queue = 3;
269 }
else if (!
strcmp(tmp,
"no_prio_queueing")) {
276 return rc ? rc :
count;
279 static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show,
280 qeth_dev_prioqing_store);
290 return sprintf(buf,
"%i\n", card->
qdio.in_buf_pool.buf_count);
311 old_cnt = card->
qdio.in_buf_pool.buf_count;
315 if (old_cnt != cnt) {
320 return rc ? rc :
count;
323 static DEVICE_ATTR(buffer_count, 0644, qeth_dev_bufcnt_show,
324 qeth_dev_bufcnt_store);
348 static ssize_t qeth_dev_performance_stats_show(
struct device *dev,
356 return sprintf(buf,
"%i\n", card->
options.performance_stats ? 1:0);
359 static ssize_t qeth_dev_performance_stats_store(
struct device *dev,
371 if ((i == 0) || (i == 1)) {
372 if (i == card->
options.performance_stats)
374 card->
options.performance_stats =
i;
384 return rc ? rc :
count;
387 static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
388 qeth_dev_performance_stats_store);
431 if (card->
options.layer2 == newdis)
434 card->
info.mac_bits = 0;
448 return rc ? rc :
count;
452 qeth_dev_layer2_store);
454 #define ATTR_QETH_ISOLATION_NONE ("none")
455 #define ATTR_QETH_ISOLATION_FWD ("forward")
456 #define ATTR_QETH_ISOLATION_DROP ("drop")
466 switch (card->
options.isolation) {
474 return snprintf(buf, 5,
"%s\n",
"N/A");
484 char *
tmp, *curtoken;
485 curtoken = (
char *) buf;
497 "support QDIO data connection isolation\n");
502 tmp =
strsep(&curtoken,
"\n");
516 card->
options.isolation = isolation;
528 static DEVICE_ATTR(isolation, 0644, qeth_dev_isolation_show,
529 qeth_dev_isolation_store);
538 if (card->
info.hwtrap)
541 return snprintf(buf, 8,
"disarm\n");
549 char *
tmp, *curtoken;
551 curtoken = (
char *)buf;
559 tmp =
strsep(&curtoken,
"\n");
561 if (!
strcmp(tmp,
"arm") && !card->
info.hwtrap) {
563 if (qeth_is_diagass_supported(card,
567 card->
info.hwtrap = 1;
571 card->
info.hwtrap = 1;
572 }
else if (!
strcmp(tmp,
"disarm") && card->
info.hwtrap) {
576 card->
info.hwtrap = 0;
578 card->
info.hwtrap = 0;
579 }
else if (!
strcmp(tmp,
"trap") && state && card->
info.hwtrap)
585 return rc ? rc :
count;
588 static DEVICE_ATTR(hw_trap, 0644, qeth_hw_trap_show,
597 return sprintf(buf,
"%i\n", value);
601 const char *buf,
size_t count,
int *value,
int max_value)
622 return rc ? rc :
count;
630 return qeth_dev_blkt_show(buf, card, card->
info.blkt.time_total);
638 return qeth_dev_blkt_store(card, buf, count,
639 &card->
info.blkt.time_total, 5000);
644 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
645 qeth_dev_blkt_total_store);
652 return qeth_dev_blkt_show(buf, card, card->
info.blkt.inter_packet);
660 return qeth_dev_blkt_store(card, buf, count,
661 &card->
info.blkt.inter_packet, 1000);
665 qeth_dev_blkt_inter_store);
667 static ssize_t qeth_dev_blkt_inter_jumbo_show(
struct device *dev,
672 return qeth_dev_blkt_show(buf, card,
673 card->
info.blkt.inter_packet_jumbo);
676 static ssize_t qeth_dev_blkt_inter_jumbo_store(
struct device *dev,
681 return qeth_dev_blkt_store(card, buf, count,
682 &card->
info.blkt.inter_packet_jumbo, 1000);
685 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
686 qeth_dev_blkt_inter_jumbo_store);
688 static struct attribute *qeth_blkt_device_attrs[] = {
689 &dev_attr_total.attr,
690 &dev_attr_inter.attr,
691 &dev_attr_inter_jumbo.attr,
696 .attrs = qeth_blkt_device_attrs,
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,
717 .attrs = qeth_device_attrs,
721 &qeth_device_attr_group,
722 &qeth_device_blkt_group,
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,
736 .attrs = qeth_osn_device_attrs,
739 &qeth_osn_device_attr_group,