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