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