3 * linux/drivers/s390/net/qeth_sys.c
5 * Linux on zSeries OSA Express and HiperSockets support
6 * This file contains code related to sysfs.
8 * Copyright 2000,2003 IBM Corporation
10 * Author(s): Thomas Spatzier <tspat@de.ibm.com>
11 * Frank Pavlic <fpavlic@de.ibm.com>
14 #include <linux/list.h>
15 #include <linux/rwsem.h>
17 #include <asm/ebcdic.h>
23 /*****************************************************************************/
25 /* /sys-fs stuff UNDER DEVELOPMENT !!! */
27 /*****************************************************************************/
31 qeth_dev_state_show(struct device *dev, struct device_attribute *attr, char *buf)
33 struct qeth_card *card = dev->driver_data;
37 switch (card->state) {
39 return sprintf(buf, "DOWN\n");
40 case CARD_STATE_HARDSETUP:
41 return sprintf(buf, "HARDSETUP\n");
42 case CARD_STATE_SOFTSETUP:
43 return sprintf(buf, "SOFTSETUP\n");
46 return sprintf(buf, "UP (LAN ONLINE)\n");
48 return sprintf(buf, "UP (LAN OFFLINE)\n");
49 case CARD_STATE_RECOVER:
50 return sprintf(buf, "RECOVER\n");
52 return sprintf(buf, "UNKNOWN\n");
56 static DEVICE_ATTR(state, 0444, qeth_dev_state_show, NULL);
59 qeth_dev_chpid_show(struct device *dev, struct device_attribute *attr, char *buf)
61 struct qeth_card *card = dev->driver_data;
65 return sprintf(buf, "%02X\n", card->info.chpid);
68 static DEVICE_ATTR(chpid, 0444, qeth_dev_chpid_show, NULL);
71 qeth_dev_if_name_show(struct device *dev, struct device_attribute *attr, char *buf)
73 struct qeth_card *card = dev->driver_data;
76 return sprintf(buf, "%s\n", QETH_CARD_IFNAME(card));
79 static DEVICE_ATTR(if_name, 0444, qeth_dev_if_name_show, NULL);
82 qeth_dev_card_type_show(struct device *dev, struct device_attribute *attr, char *buf)
84 struct qeth_card *card = dev->driver_data;
88 return sprintf(buf, "%s\n", qeth_get_cardname_short(card));
91 static DEVICE_ATTR(card_type, 0444, qeth_dev_card_type_show, NULL);
94 qeth_dev_portno_show(struct device *dev, struct device_attribute *attr, char *buf)
96 struct qeth_card *card = dev->driver_data;
100 return sprintf(buf, "%i\n", card->info.portno);
104 qeth_dev_portno_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
106 struct qeth_card *card = dev->driver_data;
113 if ((card->state != CARD_STATE_DOWN) &&
114 (card->state != CARD_STATE_RECOVER))
117 portno = simple_strtoul(buf, &tmp, 16);
118 if (portno > MAX_PORTNO){
119 PRINT_WARN("portno 0x%X is out of range\n", portno);
123 card->info.portno = portno;
127 static DEVICE_ATTR(portno, 0644, qeth_dev_portno_show, qeth_dev_portno_store);
130 qeth_dev_portname_show(struct device *dev, struct device_attribute *attr, char *buf)
132 struct qeth_card *card = dev->driver_data;
133 char portname[9] = {0, };
138 if (card->info.portname_required) {
139 memcpy(portname, card->info.portname + 1, 8);
141 return sprintf(buf, "%s\n", portname);
143 return sprintf(buf, "no portname required\n");
147 qeth_dev_portname_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
149 struct qeth_card *card = dev->driver_data;
156 if ((card->state != CARD_STATE_DOWN) &&
157 (card->state != CARD_STATE_RECOVER))
160 tmp = strsep((char **) &buf, "\n");
161 if ((strlen(tmp) > 8) || (strlen(tmp) == 0))
164 card->info.portname[0] = strlen(tmp);
165 /* for beauty reasons */
166 for (i = 1; i < 9; i++)
167 card->info.portname[i] = ' ';
168 strcpy(card->info.portname + 1, tmp);
169 ASCEBC(card->info.portname + 1, 8);
174 static DEVICE_ATTR(portname, 0644, qeth_dev_portname_show,
175 qeth_dev_portname_store);
178 qeth_dev_checksum_show(struct device *dev, struct device_attribute *attr, char *buf)
180 struct qeth_card *card = dev->driver_data;
185 return sprintf(buf, "%s checksumming\n", qeth_get_checksum_str(card));
189 qeth_dev_checksum_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
191 struct qeth_card *card = dev->driver_data;
197 if ((card->state != CARD_STATE_DOWN) &&
198 (card->state != CARD_STATE_RECOVER))
201 tmp = strsep((char **) &buf, "\n");
202 if (!strcmp(tmp, "sw_checksumming"))
203 card->options.checksum_type = SW_CHECKSUMMING;
204 else if (!strcmp(tmp, "hw_checksumming"))
205 card->options.checksum_type = HW_CHECKSUMMING;
206 else if (!strcmp(tmp, "no_checksumming"))
207 card->options.checksum_type = NO_CHECKSUMMING;
209 PRINT_WARN("Unknown checksumming type '%s'\n", tmp);
215 static DEVICE_ATTR(checksumming, 0644, qeth_dev_checksum_show,
216 qeth_dev_checksum_store);
219 qeth_dev_prioqing_show(struct device *dev, struct device_attribute *attr, char *buf)
221 struct qeth_card *card = dev->driver_data;
226 switch (card->qdio.do_prio_queueing) {
227 case QETH_PRIO_Q_ING_PREC:
228 return sprintf(buf, "%s\n", "by precedence");
229 case QETH_PRIO_Q_ING_TOS:
230 return sprintf(buf, "%s\n", "by type of service");
232 return sprintf(buf, "always queue %i\n",
233 card->qdio.default_out_queue);
238 qeth_dev_prioqing_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
240 struct qeth_card *card = dev->driver_data;
246 if ((card->state != CARD_STATE_DOWN) &&
247 (card->state != CARD_STATE_RECOVER))
250 /* check if 1920 devices are supported ,
251 * if though we have to permit priority queueing
253 if (card->qdio.no_out_queues == 1) {
254 PRINT_WARN("Priority queueing disabled due "
255 "to hardware limitations!\n");
256 card->qdio.do_prio_queueing = QETH_PRIOQ_DEFAULT;
260 tmp = strsep((char **) &buf, "\n");
261 if (!strcmp(tmp, "prio_queueing_prec"))
262 card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_PREC;
263 else if (!strcmp(tmp, "prio_queueing_tos"))
264 card->qdio.do_prio_queueing = QETH_PRIO_Q_ING_TOS;
265 else if (!strcmp(tmp, "no_prio_queueing:0")) {
266 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
267 card->qdio.default_out_queue = 0;
268 } else if (!strcmp(tmp, "no_prio_queueing:1")) {
269 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
270 card->qdio.default_out_queue = 1;
271 } else if (!strcmp(tmp, "no_prio_queueing:2")) {
272 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
273 card->qdio.default_out_queue = 2;
274 } else if (!strcmp(tmp, "no_prio_queueing:3")) {
275 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
276 card->qdio.default_out_queue = 3;
277 } else if (!strcmp(tmp, "no_prio_queueing")) {
278 card->qdio.do_prio_queueing = QETH_NO_PRIO_QUEUEING;
279 card->qdio.default_out_queue = QETH_DEFAULT_QUEUE;
281 PRINT_WARN("Unknown queueing type '%s'\n", tmp);
287 static DEVICE_ATTR(priority_queueing, 0644, qeth_dev_prioqing_show,
288 qeth_dev_prioqing_store);
291 qeth_dev_bufcnt_show(struct device *dev, struct device_attribute *attr, char *buf)
293 struct qeth_card *card = dev->driver_data;
298 return sprintf(buf, "%i\n", card->qdio.in_buf_pool.buf_count);
302 qeth_dev_bufcnt_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
304 struct qeth_card *card = dev->driver_data;
312 if ((card->state != CARD_STATE_DOWN) &&
313 (card->state != CARD_STATE_RECOVER))
316 old_cnt = card->qdio.in_buf_pool.buf_count;
317 cnt = simple_strtoul(buf, &tmp, 10);
318 cnt = (cnt < QETH_IN_BUF_COUNT_MIN) ? QETH_IN_BUF_COUNT_MIN :
319 ((cnt > QETH_IN_BUF_COUNT_MAX) ? QETH_IN_BUF_COUNT_MAX : cnt);
320 if (old_cnt != cnt) {
321 if ((rc = qeth_realloc_buffer_pool(card, cnt)))
322 PRINT_WARN("Error (%d) while setting "
323 "buffer count.\n", rc);
328 static DEVICE_ATTR(buffer_count, 0644, qeth_dev_bufcnt_show,
329 qeth_dev_bufcnt_store);
332 qeth_dev_route_show(struct qeth_card *card, struct qeth_routing_info *route,
335 switch (route->type) {
337 return sprintf(buf, "%s\n", "primary router");
338 case SECONDARY_ROUTER:
339 return sprintf(buf, "%s\n", "secondary router");
340 case MULTICAST_ROUTER:
341 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
342 return sprintf(buf, "%s\n", "multicast router+");
344 return sprintf(buf, "%s\n", "multicast router");
345 case PRIMARY_CONNECTOR:
346 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
347 return sprintf(buf, "%s\n", "primary connector+");
349 return sprintf(buf, "%s\n", "primary connector");
350 case SECONDARY_CONNECTOR:
351 if (card->info.broadcast_capable == QETH_BROADCAST_WITHOUT_ECHO)
352 return sprintf(buf, "%s\n", "secondary connector+");
354 return sprintf(buf, "%s\n", "secondary connector");
356 return sprintf(buf, "%s\n", "no");
361 qeth_dev_route4_show(struct device *dev, struct device_attribute *attr, char *buf)
363 struct qeth_card *card = dev->driver_data;
368 return qeth_dev_route_show(card, &card->options.route4, buf);
372 qeth_dev_route_store(struct qeth_card *card, struct qeth_routing_info *route,
373 enum qeth_prot_versions prot, const char *buf, size_t count)
375 enum qeth_routing_types old_route_type = route->type;
379 tmp = strsep((char **) &buf, "\n");
381 if (!strcmp(tmp, "no_router")){
382 route->type = NO_ROUTER;
383 } else if (!strcmp(tmp, "primary_connector")) {
384 route->type = PRIMARY_CONNECTOR;
385 } else if (!strcmp(tmp, "secondary_connector")) {
386 route->type = SECONDARY_CONNECTOR;
387 } else if (!strcmp(tmp, "primary_router")) {
388 route->type = PRIMARY_ROUTER;
389 } else if (!strcmp(tmp, "secondary_router")) {
390 route->type = SECONDARY_ROUTER;
391 } else if (!strcmp(tmp, "multicast_router")) {
392 route->type = MULTICAST_ROUTER;
394 PRINT_WARN("Invalid routing type '%s'.\n", tmp);
397 if (((card->state == CARD_STATE_SOFTSETUP) ||
398 (card->state == CARD_STATE_UP)) &&
399 (old_route_type != route->type)){
400 if (prot == QETH_PROT_IPV4)
401 rc = qeth_setrouting_v4(card);
402 else if (prot == QETH_PROT_IPV6)
403 rc = qeth_setrouting_v6(card);
409 qeth_dev_route4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
411 struct qeth_card *card = dev->driver_data;
416 return qeth_dev_route_store(card, &card->options.route4,
417 QETH_PROT_IPV4, buf, count);
420 static DEVICE_ATTR(route4, 0644, qeth_dev_route4_show, qeth_dev_route4_store);
422 #ifdef CONFIG_QETH_IPV6
424 qeth_dev_route6_show(struct device *dev, struct device_attribute *attr, char *buf)
426 struct qeth_card *card = dev->driver_data;
431 if (!qeth_is_supported(card, IPA_IPV6))
432 return sprintf(buf, "%s\n", "n/a");
434 return qeth_dev_route_show(card, &card->options.route6, buf);
438 qeth_dev_route6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
440 struct qeth_card *card = dev->driver_data;
445 if (!qeth_is_supported(card, IPA_IPV6)){
446 PRINT_WARN("IPv6 not supported for interface %s.\n"
447 "Routing status no changed.\n",
448 QETH_CARD_IFNAME(card));
452 return qeth_dev_route_store(card, &card->options.route6,
453 QETH_PROT_IPV6, buf, count);
456 static DEVICE_ATTR(route6, 0644, qeth_dev_route6_show, qeth_dev_route6_store);
460 qeth_dev_add_hhlen_show(struct device *dev, struct device_attribute *attr, char *buf)
462 struct qeth_card *card = dev->driver_data;
467 return sprintf(buf, "%i\n", card->options.add_hhlen);
471 qeth_dev_add_hhlen_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
473 struct qeth_card *card = dev->driver_data;
480 if ((card->state != CARD_STATE_DOWN) &&
481 (card->state != CARD_STATE_RECOVER))
484 i = simple_strtoul(buf, &tmp, 10);
485 if ((i < 0) || (i > MAX_ADD_HHLEN)) {
486 PRINT_WARN("add_hhlen out of range\n");
489 card->options.add_hhlen = i;
494 static DEVICE_ATTR(add_hhlen, 0644, qeth_dev_add_hhlen_show,
495 qeth_dev_add_hhlen_store);
498 qeth_dev_fake_ll_show(struct device *dev, struct device_attribute *attr, char *buf)
500 struct qeth_card *card = dev->driver_data;
505 return sprintf(buf, "%i\n", card->options.fake_ll? 1:0);
509 qeth_dev_fake_ll_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
511 struct qeth_card *card = dev->driver_data;
518 if ((card->state != CARD_STATE_DOWN) &&
519 (card->state != CARD_STATE_RECOVER))
522 i = simple_strtoul(buf, &tmp, 16);
523 if ((i != 0) && (i != 1)) {
524 PRINT_WARN("fake_ll: write 0 or 1 to this file!\n");
527 card->options.fake_ll = i;
531 static DEVICE_ATTR(fake_ll, 0644, qeth_dev_fake_ll_show,
532 qeth_dev_fake_ll_store);
535 qeth_dev_fake_broadcast_show(struct device *dev, struct device_attribute *attr, char *buf)
537 struct qeth_card *card = dev->driver_data;
542 return sprintf(buf, "%i\n", card->options.fake_broadcast? 1:0);
546 qeth_dev_fake_broadcast_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
548 struct qeth_card *card = dev->driver_data;
555 if ((card->state != CARD_STATE_DOWN) &&
556 (card->state != CARD_STATE_RECOVER))
559 i = simple_strtoul(buf, &tmp, 16);
560 if ((i == 0) || (i == 1))
561 card->options.fake_broadcast = i;
563 PRINT_WARN("fake_broadcast: write 0 or 1 to this file!\n");
569 static DEVICE_ATTR(fake_broadcast, 0644, qeth_dev_fake_broadcast_show,
570 qeth_dev_fake_broadcast_store);
573 qeth_dev_recover_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
575 struct qeth_card *card = dev->driver_data;
582 if (card->state != CARD_STATE_UP)
585 i = simple_strtoul(buf, &tmp, 16);
587 qeth_schedule_recovery(card);
592 static DEVICE_ATTR(recover, 0200, NULL, qeth_dev_recover_store);
595 qeth_dev_broadcast_mode_show(struct device *dev, struct device_attribute *attr, char *buf)
597 struct qeth_card *card = dev->driver_data;
602 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
603 (card->info.link_type == QETH_LINK_TYPE_LANE_TR)))
604 return sprintf(buf, "n/a\n");
606 return sprintf(buf, "%s\n", (card->options.broadcast_mode ==
607 QETH_TR_BROADCAST_ALLRINGS)?
608 "all rings":"local");
612 qeth_dev_broadcast_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
614 struct qeth_card *card = dev->driver_data;
620 if ((card->state != CARD_STATE_DOWN) &&
621 (card->state != CARD_STATE_RECOVER))
624 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
625 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))){
626 PRINT_WARN("Device is not a tokenring device!\n");
630 tmp = strsep((char **) &buf, "\n");
632 if (!strcmp(tmp, "local")){
633 card->options.broadcast_mode = QETH_TR_BROADCAST_LOCAL;
635 } else if (!strcmp(tmp, "all_rings")) {
636 card->options.broadcast_mode = QETH_TR_BROADCAST_ALLRINGS;
639 PRINT_WARN("broadcast_mode: invalid mode %s!\n",
646 static DEVICE_ATTR(broadcast_mode, 0644, qeth_dev_broadcast_mode_show,
647 qeth_dev_broadcast_mode_store);
650 qeth_dev_canonical_macaddr_show(struct device *dev, struct device_attribute *attr, char *buf)
652 struct qeth_card *card = dev->driver_data;
657 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
658 (card->info.link_type == QETH_LINK_TYPE_LANE_TR)))
659 return sprintf(buf, "n/a\n");
661 return sprintf(buf, "%i\n", (card->options.macaddr_mode ==
662 QETH_TR_MACADDR_CANONICAL)? 1:0);
666 qeth_dev_canonical_macaddr_store(struct device *dev, struct device_attribute *attr, const char *buf,
669 struct qeth_card *card = dev->driver_data;
676 if ((card->state != CARD_STATE_DOWN) &&
677 (card->state != CARD_STATE_RECOVER))
680 if (!((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
681 (card->info.link_type == QETH_LINK_TYPE_LANE_TR))){
682 PRINT_WARN("Device is not a tokenring device!\n");
686 i = simple_strtoul(buf, &tmp, 16);
687 if ((i == 0) || (i == 1))
688 card->options.macaddr_mode = i?
689 QETH_TR_MACADDR_CANONICAL :
690 QETH_TR_MACADDR_NONCANONICAL;
692 PRINT_WARN("canonical_macaddr: write 0 or 1 to this file!\n");
698 static DEVICE_ATTR(canonical_macaddr, 0644, qeth_dev_canonical_macaddr_show,
699 qeth_dev_canonical_macaddr_store);
702 qeth_dev_layer2_show(struct device *dev, struct device_attribute *attr, char *buf)
704 struct qeth_card *card = dev->driver_data;
709 return sprintf(buf, "%i\n", card->options.layer2 ? 1:0);
713 qeth_dev_layer2_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
715 struct qeth_card *card = dev->driver_data;
721 if (card->info.type == QETH_CARD_TYPE_IQD) {
722 PRINT_WARN("Layer2 on Hipersockets is not supported! \n");
726 if (((card->state != CARD_STATE_DOWN) &&
727 (card->state != CARD_STATE_RECOVER)))
730 i = simple_strtoul(buf, &tmp, 16);
731 if ((i == 0) || (i == 1))
732 card->options.layer2 = i;
734 PRINT_WARN("layer2: write 0 or 1 to this file!\n");
740 static DEVICE_ATTR(layer2, 0644, qeth_dev_layer2_show,
741 qeth_dev_layer2_store);
744 qeth_dev_performance_stats_show(struct device *dev, struct device_attribute *attr, char *buf)
746 struct qeth_card *card = dev->driver_data;
751 return sprintf(buf, "%i\n", card->options.performance_stats ? 1:0);
755 qeth_dev_performance_stats_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
757 struct qeth_card *card = dev->driver_data;
764 i = simple_strtoul(buf, &tmp, 16);
765 if ((i == 0) || (i == 1)) {
766 if (i == card->options.performance_stats)
768 card->options.performance_stats = i;
770 memset(&card->perf_stats, 0,
771 sizeof(struct qeth_perf_stats));
772 card->perf_stats.initial_rx_packets = card->stats.rx_packets;
773 card->perf_stats.initial_tx_packets = card->stats.tx_packets;
775 PRINT_WARN("performance_stats: write 0 or 1 to this file!\n");
781 static DEVICE_ATTR(performance_stats, 0644, qeth_dev_performance_stats_show,
782 qeth_dev_performance_stats_store);
785 qeth_dev_large_send_show(struct device *dev, struct device_attribute *attr, char *buf)
787 struct qeth_card *card = dev->driver_data;
792 switch (card->options.large_send) {
793 case QETH_LARGE_SEND_NO:
794 return sprintf(buf, "%s\n", "no");
795 case QETH_LARGE_SEND_EDDP:
796 return sprintf(buf, "%s\n", "EDDP");
797 case QETH_LARGE_SEND_TSO:
798 return sprintf(buf, "%s\n", "TSO");
800 return sprintf(buf, "%s\n", "N/A");
805 qeth_dev_large_send_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
807 struct qeth_card *card = dev->driver_data;
808 enum qeth_large_send_types type;
814 tmp = strsep((char **) &buf, "\n");
815 if (!strcmp(tmp, "no")){
816 type = QETH_LARGE_SEND_NO;
817 } else if (!strcmp(tmp, "EDDP")) {
818 type = QETH_LARGE_SEND_EDDP;
819 } else if (!strcmp(tmp, "TSO")) {
820 type = QETH_LARGE_SEND_TSO;
822 PRINT_WARN("large_send: invalid mode %s!\n", tmp);
825 if (card->options.large_send == type)
827 if ((rc = qeth_set_large_send(card, type)))
832 static DEVICE_ATTR(large_send, 0644, qeth_dev_large_send_show,
833 qeth_dev_large_send_store);
836 qeth_dev_blkt_show(char *buf, struct qeth_card *card, int value )
842 return sprintf(buf, "%i\n", value);
846 qeth_dev_blkt_store(struct qeth_card *card, const char *buf, size_t count,
847 int *value, int max_value)
855 if ((card->state != CARD_STATE_DOWN) &&
856 (card->state != CARD_STATE_RECOVER))
859 i = simple_strtoul(buf, &tmp, 10);
860 if (i <= max_value) {
863 PRINT_WARN("blkt total time: write values between"
864 " 0 and %d to this file!\n", max_value);
871 qeth_dev_blkt_total_show(struct device *dev, struct device_attribute *attr, char *buf)
873 struct qeth_card *card = dev->driver_data;
875 return qeth_dev_blkt_show(buf, card, card->info.blkt.time_total);
880 qeth_dev_blkt_total_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
882 struct qeth_card *card = dev->driver_data;
884 return qeth_dev_blkt_store(card, buf, count,
885 &card->info.blkt.time_total,1000);
890 static DEVICE_ATTR(total, 0644, qeth_dev_blkt_total_show,
891 qeth_dev_blkt_total_store);
894 qeth_dev_blkt_inter_show(struct device *dev, struct device_attribute *attr, char *buf)
896 struct qeth_card *card = dev->driver_data;
898 return qeth_dev_blkt_show(buf, card, card->info.blkt.inter_packet);
903 qeth_dev_blkt_inter_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
905 struct qeth_card *card = dev->driver_data;
907 return qeth_dev_blkt_store(card, buf, count,
908 &card->info.blkt.inter_packet,100);
911 static DEVICE_ATTR(inter, 0644, qeth_dev_blkt_inter_show,
912 qeth_dev_blkt_inter_store);
915 qeth_dev_blkt_inter_jumbo_show(struct device *dev, struct device_attribute *attr, char *buf)
917 struct qeth_card *card = dev->driver_data;
919 return qeth_dev_blkt_show(buf, card,
920 card->info.blkt.inter_packet_jumbo);
925 qeth_dev_blkt_inter_jumbo_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
927 struct qeth_card *card = dev->driver_data;
929 return qeth_dev_blkt_store(card, buf, count,
930 &card->info.blkt.inter_packet_jumbo,100);
933 static DEVICE_ATTR(inter_jumbo, 0644, qeth_dev_blkt_inter_jumbo_show,
934 qeth_dev_blkt_inter_jumbo_store);
936 static struct device_attribute * qeth_blkt_device_attrs[] = {
939 &dev_attr_inter_jumbo,
943 static struct attribute_group qeth_device_blkt_group = {
945 .attrs = (struct attribute **)qeth_blkt_device_attrs,
948 static struct device_attribute * qeth_device_attrs[] = {
955 &dev_attr_checksumming,
956 &dev_attr_priority_queueing,
957 &dev_attr_buffer_count,
959 #ifdef CONFIG_QETH_IPV6
964 &dev_attr_fake_broadcast,
966 &dev_attr_broadcast_mode,
967 &dev_attr_canonical_macaddr,
969 &dev_attr_large_send,
970 &dev_attr_performance_stats,
974 static struct attribute_group qeth_device_attr_group = {
975 .attrs = (struct attribute **)qeth_device_attrs,
978 static struct device_attribute * qeth_osn_device_attrs[] = {
983 &dev_attr_buffer_count,
988 static struct attribute_group qeth_osn_device_attr_group = {
989 .attrs = (struct attribute **)qeth_osn_device_attrs,
992 #define QETH_DEVICE_ATTR(_id,_name,_mode,_show,_store) \
993 struct device_attribute dev_attr_##_id = { \
994 .attr = {.name=__stringify(_name), .mode=_mode, .owner=THIS_MODULE },\
1000 qeth_check_layer2(struct qeth_card *card)
1002 if (card->options.layer2)
1009 qeth_dev_ipato_enable_show(struct device *dev, struct device_attribute *attr, char *buf)
1011 struct qeth_card *card = dev->driver_data;
1016 if (qeth_check_layer2(card))
1018 return sprintf(buf, "%i\n", card->ipato.enabled? 1:0);
1022 qeth_dev_ipato_enable_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1024 struct qeth_card *card = dev->driver_data;
1030 if ((card->state != CARD_STATE_DOWN) &&
1031 (card->state != CARD_STATE_RECOVER))
1034 if (qeth_check_layer2(card))
1037 tmp = strsep((char **) &buf, "\n");
1038 if (!strcmp(tmp, "toggle")){
1039 card->ipato.enabled = (card->ipato.enabled)? 0 : 1;
1040 } else if (!strcmp(tmp, "1")){
1041 card->ipato.enabled = 1;
1042 } else if (!strcmp(tmp, "0")){
1043 card->ipato.enabled = 0;
1045 PRINT_WARN("ipato_enable: write 0, 1 or 'toggle' to "
1052 static QETH_DEVICE_ATTR(ipato_enable, enable, 0644,
1053 qeth_dev_ipato_enable_show,
1054 qeth_dev_ipato_enable_store);
1057 qeth_dev_ipato_invert4_show(struct device *dev, struct device_attribute *attr, char *buf)
1059 struct qeth_card *card = dev->driver_data;
1064 if (qeth_check_layer2(card))
1067 return sprintf(buf, "%i\n", card->ipato.invert4? 1:0);
1071 qeth_dev_ipato_invert4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1073 struct qeth_card *card = dev->driver_data;
1079 if (qeth_check_layer2(card))
1082 tmp = strsep((char **) &buf, "\n");
1083 if (!strcmp(tmp, "toggle")){
1084 card->ipato.invert4 = (card->ipato.invert4)? 0 : 1;
1085 } else if (!strcmp(tmp, "1")){
1086 card->ipato.invert4 = 1;
1087 } else if (!strcmp(tmp, "0")){
1088 card->ipato.invert4 = 0;
1090 PRINT_WARN("ipato_invert4: write 0, 1 or 'toggle' to "
1097 static QETH_DEVICE_ATTR(ipato_invert4, invert4, 0644,
1098 qeth_dev_ipato_invert4_show,
1099 qeth_dev_ipato_invert4_store);
1102 qeth_dev_ipato_add_show(char *buf, struct qeth_card *card,
1103 enum qeth_prot_versions proto)
1105 struct qeth_ipato_entry *ipatoe;
1106 unsigned long flags;
1108 int entry_len; /* length of 1 entry string, differs between v4 and v6 */
1111 if (qeth_check_layer2(card))
1114 entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
1115 /* add strlen for "/<mask>\n" */
1116 entry_len += (proto == QETH_PROT_IPV4)? 5 : 6;
1117 spin_lock_irqsave(&card->ip_lock, flags);
1118 list_for_each_entry(ipatoe, &card->ipato.entries, entry){
1119 if (ipatoe->proto != proto)
1121 /* String must not be longer than PAGE_SIZE. So we check if
1122 * string length gets near PAGE_SIZE. Then we can savely display
1123 * the next IPv6 address (worst case, compared to IPv4) */
1124 if ((PAGE_SIZE - i) <= entry_len)
1126 qeth_ipaddr_to_string(proto, ipatoe->addr, addr_str);
1127 i += snprintf(buf + i, PAGE_SIZE - i,
1128 "%s/%i\n", addr_str, ipatoe->mask_bits);
1130 spin_unlock_irqrestore(&card->ip_lock, flags);
1131 i += snprintf(buf + i, PAGE_SIZE - i, "\n");
1137 qeth_dev_ipato_add4_show(struct device *dev, struct device_attribute *attr, char *buf)
1139 struct qeth_card *card = dev->driver_data;
1144 return qeth_dev_ipato_add_show(buf, card, QETH_PROT_IPV4);
1148 qeth_parse_ipatoe(const char* buf, enum qeth_prot_versions proto,
1149 u8 *addr, int *mask_bits)
1151 const char *start, *end;
1153 char buffer[40] = {0, };
1156 /* get address string */
1157 end = strchr(start, '/');
1158 if (!end || (end - start >= 40)){
1159 PRINT_WARN("Invalid format for ipato_addx/delx. "
1160 "Use <ip addr>/<mask bits>\n");
1163 strncpy(buffer, start, end - start);
1164 if (qeth_string_to_ipaddr(buffer, proto, addr)){
1165 PRINT_WARN("Invalid IP address format!\n");
1169 *mask_bits = simple_strtoul(start, &tmp, 10);
1170 if (!strlen(start) ||
1172 (*mask_bits > ((proto == QETH_PROT_IPV4) ? 32 : 128))) {
1173 PRINT_WARN("Invalid mask bits for ipato_addx/delx !\n");
1180 qeth_dev_ipato_add_store(const char *buf, size_t count,
1181 struct qeth_card *card, enum qeth_prot_versions proto)
1183 struct qeth_ipato_entry *ipatoe;
1188 if (qeth_check_layer2(card))
1190 if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits)))
1193 if (!(ipatoe = kzalloc(sizeof(struct qeth_ipato_entry), GFP_KERNEL))){
1194 PRINT_WARN("No memory to allocate ipato entry\n");
1197 ipatoe->proto = proto;
1198 memcpy(ipatoe->addr, addr, (proto == QETH_PROT_IPV4)? 4:16);
1199 ipatoe->mask_bits = mask_bits;
1201 if ((rc = qeth_add_ipato_entry(card, ipatoe))){
1210 qeth_dev_ipato_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1212 struct qeth_card *card = dev->driver_data;
1217 return qeth_dev_ipato_add_store(buf, count, card, QETH_PROT_IPV4);
1220 static QETH_DEVICE_ATTR(ipato_add4, add4, 0644,
1221 qeth_dev_ipato_add4_show,
1222 qeth_dev_ipato_add4_store);
1225 qeth_dev_ipato_del_store(const char *buf, size_t count,
1226 struct qeth_card *card, enum qeth_prot_versions proto)
1232 if (qeth_check_layer2(card))
1234 if ((rc = qeth_parse_ipatoe(buf, proto, addr, &mask_bits)))
1237 qeth_del_ipato_entry(card, proto, addr, mask_bits);
1243 qeth_dev_ipato_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1245 struct qeth_card *card = dev->driver_data;
1250 return qeth_dev_ipato_del_store(buf, count, card, QETH_PROT_IPV4);
1253 static QETH_DEVICE_ATTR(ipato_del4, del4, 0200, NULL,
1254 qeth_dev_ipato_del4_store);
1256 #ifdef CONFIG_QETH_IPV6
1258 qeth_dev_ipato_invert6_show(struct device *dev, struct device_attribute *attr, char *buf)
1260 struct qeth_card *card = dev->driver_data;
1265 if (qeth_check_layer2(card))
1268 return sprintf(buf, "%i\n", card->ipato.invert6? 1:0);
1272 qeth_dev_ipato_invert6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1274 struct qeth_card *card = dev->driver_data;
1280 if (qeth_check_layer2(card))
1283 tmp = strsep((char **) &buf, "\n");
1284 if (!strcmp(tmp, "toggle")){
1285 card->ipato.invert6 = (card->ipato.invert6)? 0 : 1;
1286 } else if (!strcmp(tmp, "1")){
1287 card->ipato.invert6 = 1;
1288 } else if (!strcmp(tmp, "0")){
1289 card->ipato.invert6 = 0;
1291 PRINT_WARN("ipato_invert6: write 0, 1 or 'toggle' to "
1298 static QETH_DEVICE_ATTR(ipato_invert6, invert6, 0644,
1299 qeth_dev_ipato_invert6_show,
1300 qeth_dev_ipato_invert6_store);
1304 qeth_dev_ipato_add6_show(struct device *dev, struct device_attribute *attr, char *buf)
1306 struct qeth_card *card = dev->driver_data;
1311 return qeth_dev_ipato_add_show(buf, card, QETH_PROT_IPV6);
1315 qeth_dev_ipato_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1317 struct qeth_card *card = dev->driver_data;
1322 return qeth_dev_ipato_add_store(buf, count, card, QETH_PROT_IPV6);
1325 static QETH_DEVICE_ATTR(ipato_add6, add6, 0644,
1326 qeth_dev_ipato_add6_show,
1327 qeth_dev_ipato_add6_store);
1330 qeth_dev_ipato_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1332 struct qeth_card *card = dev->driver_data;
1337 return qeth_dev_ipato_del_store(buf, count, card, QETH_PROT_IPV6);
1340 static QETH_DEVICE_ATTR(ipato_del6, del6, 0200, NULL,
1341 qeth_dev_ipato_del6_store);
1342 #endif /* CONFIG_QETH_IPV6 */
1344 static struct device_attribute * qeth_ipato_device_attrs[] = {
1345 &dev_attr_ipato_enable,
1346 &dev_attr_ipato_invert4,
1347 &dev_attr_ipato_add4,
1348 &dev_attr_ipato_del4,
1349 #ifdef CONFIG_QETH_IPV6
1350 &dev_attr_ipato_invert6,
1351 &dev_attr_ipato_add6,
1352 &dev_attr_ipato_del6,
1357 static struct attribute_group qeth_device_ipato_group = {
1358 .name = "ipa_takeover",
1359 .attrs = (struct attribute **)qeth_ipato_device_attrs,
1363 qeth_dev_vipa_add_show(char *buf, struct qeth_card *card,
1364 enum qeth_prot_versions proto)
1366 struct qeth_ipaddr *ipaddr;
1368 int entry_len; /* length of 1 entry string, differs between v4 and v6 */
1369 unsigned long flags;
1372 if (qeth_check_layer2(card))
1375 entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
1376 entry_len += 2; /* \n + terminator */
1377 spin_lock_irqsave(&card->ip_lock, flags);
1378 list_for_each_entry(ipaddr, &card->ip_list, entry){
1379 if (ipaddr->proto != proto)
1381 if (ipaddr->type != QETH_IP_TYPE_VIPA)
1383 /* String must not be longer than PAGE_SIZE. So we check if
1384 * string length gets near PAGE_SIZE. Then we can savely display
1385 * the next IPv6 address (worst case, compared to IPv4) */
1386 if ((PAGE_SIZE - i) <= entry_len)
1388 qeth_ipaddr_to_string(proto, (const u8 *)&ipaddr->u, addr_str);
1389 i += snprintf(buf + i, PAGE_SIZE - i, "%s\n", addr_str);
1391 spin_unlock_irqrestore(&card->ip_lock, flags);
1392 i += snprintf(buf + i, PAGE_SIZE - i, "\n");
1398 qeth_dev_vipa_add4_show(struct device *dev, struct device_attribute *attr, char *buf)
1400 struct qeth_card *card = dev->driver_data;
1405 return qeth_dev_vipa_add_show(buf, card, QETH_PROT_IPV4);
1409 qeth_parse_vipae(const char* buf, enum qeth_prot_versions proto,
1412 if (qeth_string_to_ipaddr(buf, proto, addr)){
1413 PRINT_WARN("Invalid IP address format!\n");
1420 qeth_dev_vipa_add_store(const char *buf, size_t count,
1421 struct qeth_card *card, enum qeth_prot_versions proto)
1423 u8 addr[16] = {0, };
1426 if (qeth_check_layer2(card))
1428 if ((rc = qeth_parse_vipae(buf, proto, addr)))
1431 if ((rc = qeth_add_vipa(card, proto, addr)))
1438 qeth_dev_vipa_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1440 struct qeth_card *card = dev->driver_data;
1445 return qeth_dev_vipa_add_store(buf, count, card, QETH_PROT_IPV4);
1448 static QETH_DEVICE_ATTR(vipa_add4, add4, 0644,
1449 qeth_dev_vipa_add4_show,
1450 qeth_dev_vipa_add4_store);
1453 qeth_dev_vipa_del_store(const char *buf, size_t count,
1454 struct qeth_card *card, enum qeth_prot_versions proto)
1459 if (qeth_check_layer2(card))
1461 if ((rc = qeth_parse_vipae(buf, proto, addr)))
1464 qeth_del_vipa(card, proto, addr);
1470 qeth_dev_vipa_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1472 struct qeth_card *card = dev->driver_data;
1477 return qeth_dev_vipa_del_store(buf, count, card, QETH_PROT_IPV4);
1480 static QETH_DEVICE_ATTR(vipa_del4, del4, 0200, NULL,
1481 qeth_dev_vipa_del4_store);
1483 #ifdef CONFIG_QETH_IPV6
1485 qeth_dev_vipa_add6_show(struct device *dev, struct device_attribute *attr, char *buf)
1487 struct qeth_card *card = dev->driver_data;
1492 return qeth_dev_vipa_add_show(buf, card, QETH_PROT_IPV6);
1496 qeth_dev_vipa_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1498 struct qeth_card *card = dev->driver_data;
1503 return qeth_dev_vipa_add_store(buf, count, card, QETH_PROT_IPV6);
1506 static QETH_DEVICE_ATTR(vipa_add6, add6, 0644,
1507 qeth_dev_vipa_add6_show,
1508 qeth_dev_vipa_add6_store);
1511 qeth_dev_vipa_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1513 struct qeth_card *card = dev->driver_data;
1518 if (qeth_check_layer2(card))
1521 return qeth_dev_vipa_del_store(buf, count, card, QETH_PROT_IPV6);
1524 static QETH_DEVICE_ATTR(vipa_del6, del6, 0200, NULL,
1525 qeth_dev_vipa_del6_store);
1526 #endif /* CONFIG_QETH_IPV6 */
1528 static struct device_attribute * qeth_vipa_device_attrs[] = {
1529 &dev_attr_vipa_add4,
1530 &dev_attr_vipa_del4,
1531 #ifdef CONFIG_QETH_IPV6
1532 &dev_attr_vipa_add6,
1533 &dev_attr_vipa_del6,
1538 static struct attribute_group qeth_device_vipa_group = {
1540 .attrs = (struct attribute **)qeth_vipa_device_attrs,
1544 qeth_dev_rxip_add_show(char *buf, struct qeth_card *card,
1545 enum qeth_prot_versions proto)
1547 struct qeth_ipaddr *ipaddr;
1549 int entry_len; /* length of 1 entry string, differs between v4 and v6 */
1550 unsigned long flags;
1553 if (qeth_check_layer2(card))
1556 entry_len = (proto == QETH_PROT_IPV4)? 12 : 40;
1557 entry_len += 2; /* \n + terminator */
1558 spin_lock_irqsave(&card->ip_lock, flags);
1559 list_for_each_entry(ipaddr, &card->ip_list, entry){
1560 if (ipaddr->proto != proto)
1562 if (ipaddr->type != QETH_IP_TYPE_RXIP)
1564 /* String must not be longer than PAGE_SIZE. So we check if
1565 * string length gets near PAGE_SIZE. Then we can savely display
1566 * the next IPv6 address (worst case, compared to IPv4) */
1567 if ((PAGE_SIZE - i) <= entry_len)
1569 qeth_ipaddr_to_string(proto, (const u8 *)&ipaddr->u, addr_str);
1570 i += snprintf(buf + i, PAGE_SIZE - i, "%s\n", addr_str);
1572 spin_unlock_irqrestore(&card->ip_lock, flags);
1573 i += snprintf(buf + i, PAGE_SIZE - i, "\n");
1579 qeth_dev_rxip_add4_show(struct device *dev, struct device_attribute *attr, char *buf)
1581 struct qeth_card *card = dev->driver_data;
1586 return qeth_dev_rxip_add_show(buf, card, QETH_PROT_IPV4);
1590 qeth_parse_rxipe(const char* buf, enum qeth_prot_versions proto,
1593 if (qeth_string_to_ipaddr(buf, proto, addr)){
1594 PRINT_WARN("Invalid IP address format!\n");
1601 qeth_dev_rxip_add_store(const char *buf, size_t count,
1602 struct qeth_card *card, enum qeth_prot_versions proto)
1604 u8 addr[16] = {0, };
1607 if (qeth_check_layer2(card))
1609 if ((rc = qeth_parse_rxipe(buf, proto, addr)))
1612 if ((rc = qeth_add_rxip(card, proto, addr)))
1619 qeth_dev_rxip_add4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1621 struct qeth_card *card = dev->driver_data;
1626 return qeth_dev_rxip_add_store(buf, count, card, QETH_PROT_IPV4);
1629 static QETH_DEVICE_ATTR(rxip_add4, add4, 0644,
1630 qeth_dev_rxip_add4_show,
1631 qeth_dev_rxip_add4_store);
1634 qeth_dev_rxip_del_store(const char *buf, size_t count,
1635 struct qeth_card *card, enum qeth_prot_versions proto)
1640 if (qeth_check_layer2(card))
1642 if ((rc = qeth_parse_rxipe(buf, proto, addr)))
1645 qeth_del_rxip(card, proto, addr);
1651 qeth_dev_rxip_del4_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1653 struct qeth_card *card = dev->driver_data;
1658 return qeth_dev_rxip_del_store(buf, count, card, QETH_PROT_IPV4);
1661 static QETH_DEVICE_ATTR(rxip_del4, del4, 0200, NULL,
1662 qeth_dev_rxip_del4_store);
1664 #ifdef CONFIG_QETH_IPV6
1666 qeth_dev_rxip_add6_show(struct device *dev, struct device_attribute *attr, char *buf)
1668 struct qeth_card *card = dev->driver_data;
1673 return qeth_dev_rxip_add_show(buf, card, QETH_PROT_IPV6);
1677 qeth_dev_rxip_add6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1679 struct qeth_card *card = dev->driver_data;
1684 return qeth_dev_rxip_add_store(buf, count, card, QETH_PROT_IPV6);
1687 static QETH_DEVICE_ATTR(rxip_add6, add6, 0644,
1688 qeth_dev_rxip_add6_show,
1689 qeth_dev_rxip_add6_store);
1692 qeth_dev_rxip_del6_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1694 struct qeth_card *card = dev->driver_data;
1699 return qeth_dev_rxip_del_store(buf, count, card, QETH_PROT_IPV6);
1702 static QETH_DEVICE_ATTR(rxip_del6, del6, 0200, NULL,
1703 qeth_dev_rxip_del6_store);
1704 #endif /* CONFIG_QETH_IPV6 */
1706 static struct device_attribute * qeth_rxip_device_attrs[] = {
1707 &dev_attr_rxip_add4,
1708 &dev_attr_rxip_del4,
1709 #ifdef CONFIG_QETH_IPV6
1710 &dev_attr_rxip_add6,
1711 &dev_attr_rxip_del6,
1716 static struct attribute_group qeth_device_rxip_group = {
1718 .attrs = (struct attribute **)qeth_rxip_device_attrs,
1722 qeth_create_device_attributes(struct device *dev)
1725 struct qeth_card *card = dev->driver_data;
1727 if (card->info.type == QETH_CARD_TYPE_OSN)
1728 return sysfs_create_group(&dev->kobj,
1729 &qeth_osn_device_attr_group);
1731 if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_attr_group)))
1733 if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_ipato_group))){
1734 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1737 if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_vipa_group))){
1738 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1739 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
1742 if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_rxip_group))){
1743 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1744 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
1745 sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
1748 if ((ret = sysfs_create_group(&dev->kobj, &qeth_device_blkt_group))){
1749 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1750 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
1751 sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
1752 sysfs_remove_group(&dev->kobj, &qeth_device_rxip_group);
1759 qeth_remove_device_attributes(struct device *dev)
1761 struct qeth_card *card = dev->driver_data;
1763 if (card->info.type == QETH_CARD_TYPE_OSN)
1764 return sysfs_remove_group(&dev->kobj,
1765 &qeth_osn_device_attr_group);
1767 sysfs_remove_group(&dev->kobj, &qeth_device_attr_group);
1768 sysfs_remove_group(&dev->kobj, &qeth_device_ipato_group);
1769 sysfs_remove_group(&dev->kobj, &qeth_device_vipa_group);
1770 sysfs_remove_group(&dev->kobj, &qeth_device_rxip_group);
1771 sysfs_remove_group(&dev->kobj, &qeth_device_blkt_group);
1774 /**********************/
1775 /* DRIVER ATTRIBUTES */
1776 /**********************/
1778 qeth_driver_group_store(struct device_driver *ddrv, const char *buf,
1781 const char *start, *end;
1782 char bus_ids[3][BUS_ID_SIZE], *argv[3];
1787 for (i = 0; i < 3; i++) {
1788 static const char delim[] = { ',', ',', '\n' };
1791 if (!(end = strchr(start, delim[i])))
1793 len = min_t(ptrdiff_t, BUS_ID_SIZE, end - start);
1794 strncpy(bus_ids[i], start, len);
1795 bus_ids[i][len] = '\0';
1797 argv[i] = bus_ids[i];
1799 err = ccwgroup_create(qeth_root_dev, qeth_ccwgroup_driver.driver_id,
1800 &qeth_ccw_driver, 3, argv);
1808 static DRIVER_ATTR(group, 0200, NULL, qeth_driver_group_store);
1811 qeth_driver_notifier_register_store(struct device_driver *ddrv, const char *buf,
1818 tmp = strsep((char **) &buf, "\n");
1819 if (!strncmp(tmp, "unregister", 10)){
1820 if ((rc = qeth_notifier_unregister(current)))
1825 signum = simple_strtoul(tmp, &tmp2, 10);
1826 if ((signum < 0) || (signum > 32)){
1827 PRINT_WARN("Signal number %d is out of range\n", signum);
1830 if ((rc = qeth_notifier_register(current, signum)))
1836 static DRIVER_ATTR(notifier_register, 0200, NULL,
1837 qeth_driver_notifier_register_store);
1840 qeth_create_driver_attributes(void)
1844 if ((rc = driver_create_file(&qeth_ccwgroup_driver.driver,
1845 &driver_attr_group)))
1847 return driver_create_file(&qeth_ccwgroup_driver.driver,
1848 &driver_attr_notifier_register);
1852 qeth_remove_driver_attributes(void)
1854 driver_remove_file(&qeth_ccwgroup_driver.driver,
1855 &driver_attr_group);
1856 driver_remove_file(&qeth_ccwgroup_driver.driver,
1857 &driver_attr_notifier_register);