diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-02-27 14:41:52 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-28 03:49:47 -0500 |
commit | d902eee43f1951b358d7347d9165c6af21cf7b1b (patch) | |
tree | 8e3342100e0f7b6c581292e0a7a8b66430400fbc /net/bridge | |
parent | b195167fcf089dbdc650bb874084555035f07f98 (diff) |
bridge: Add multicast count/interval sysfs entries
This patch allows the user to the IGMP parameters related to the
snooping function of the bridge. This includes various time
values and retransmission limits.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r-- | net/bridge/br_sysfs_br.c | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c index d2ee53b3ad7d..dd321e39e621 100644 --- a/net/bridge/br_sysfs_br.c +++ b/net/bridge/br_sysfs_br.c | |||
@@ -415,6 +415,201 @@ static ssize_t store_hash_max(struct device *d, struct device_attribute *attr, | |||
415 | } | 415 | } |
416 | static DEVICE_ATTR(hash_max, S_IRUGO | S_IWUSR, show_hash_max, | 416 | static DEVICE_ATTR(hash_max, S_IRUGO | S_IWUSR, show_hash_max, |
417 | store_hash_max); | 417 | store_hash_max); |
418 | |||
419 | static ssize_t show_multicast_last_member_count(struct device *d, | ||
420 | struct device_attribute *attr, | ||
421 | char *buf) | ||
422 | { | ||
423 | struct net_bridge *br = to_bridge(d); | ||
424 | return sprintf(buf, "%u\n", br->multicast_last_member_count); | ||
425 | } | ||
426 | |||
427 | static int set_last_member_count(struct net_bridge *br, unsigned long val) | ||
428 | { | ||
429 | br->multicast_last_member_count = val; | ||
430 | return 0; | ||
431 | } | ||
432 | |||
433 | static ssize_t store_multicast_last_member_count(struct device *d, | ||
434 | struct device_attribute *attr, | ||
435 | const char *buf, size_t len) | ||
436 | { | ||
437 | return store_bridge_parm(d, buf, len, set_last_member_count); | ||
438 | } | ||
439 | static DEVICE_ATTR(multicast_last_member_count, S_IRUGO | S_IWUSR, | ||
440 | show_multicast_last_member_count, | ||
441 | store_multicast_last_member_count); | ||
442 | |||
443 | static ssize_t show_multicast_startup_query_count( | ||
444 | struct device *d, struct device_attribute *attr, char *buf) | ||
445 | { | ||
446 | struct net_bridge *br = to_bridge(d); | ||
447 | return sprintf(buf, "%u\n", br->multicast_startup_query_count); | ||
448 | } | ||
449 | |||
450 | static int set_startup_query_count(struct net_bridge *br, unsigned long val) | ||
451 | { | ||
452 | br->multicast_startup_query_count = val; | ||
453 | return 0; | ||
454 | } | ||
455 | |||
456 | static ssize_t store_multicast_startup_query_count( | ||
457 | struct device *d, struct device_attribute *attr, const char *buf, | ||
458 | size_t len) | ||
459 | { | ||
460 | return store_bridge_parm(d, buf, len, set_startup_query_count); | ||
461 | } | ||
462 | static DEVICE_ATTR(multicast_startup_query_count, S_IRUGO | S_IWUSR, | ||
463 | show_multicast_startup_query_count, | ||
464 | store_multicast_startup_query_count); | ||
465 | |||
466 | static ssize_t show_multicast_last_member_interval( | ||
467 | struct device *d, struct device_attribute *attr, char *buf) | ||
468 | { | ||
469 | struct net_bridge *br = to_bridge(d); | ||
470 | return sprintf(buf, "%lu\n", | ||
471 | jiffies_to_clock_t(br->multicast_last_member_interval)); | ||
472 | } | ||
473 | |||
474 | static int set_last_member_interval(struct net_bridge *br, unsigned long val) | ||
475 | { | ||
476 | br->multicast_last_member_interval = clock_t_to_jiffies(val); | ||
477 | return 0; | ||
478 | } | ||
479 | |||
480 | static ssize_t store_multicast_last_member_interval( | ||
481 | struct device *d, struct device_attribute *attr, const char *buf, | ||
482 | size_t len) | ||
483 | { | ||
484 | return store_bridge_parm(d, buf, len, set_last_member_interval); | ||
485 | } | ||
486 | static DEVICE_ATTR(multicast_last_member_interval, S_IRUGO | S_IWUSR, | ||
487 | show_multicast_last_member_interval, | ||
488 | store_multicast_last_member_interval); | ||
489 | |||
490 | static ssize_t show_multicast_membership_interval( | ||
491 | struct device *d, struct device_attribute *attr, char *buf) | ||
492 | { | ||
493 | struct net_bridge *br = to_bridge(d); | ||
494 | return sprintf(buf, "%lu\n", | ||
495 | jiffies_to_clock_t(br->multicast_membership_interval)); | ||
496 | } | ||
497 | |||
498 | static int set_membership_interval(struct net_bridge *br, unsigned long val) | ||
499 | { | ||
500 | br->multicast_membership_interval = clock_t_to_jiffies(val); | ||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | static ssize_t store_multicast_membership_interval( | ||
505 | struct device *d, struct device_attribute *attr, const char *buf, | ||
506 | size_t len) | ||
507 | { | ||
508 | return store_bridge_parm(d, buf, len, set_membership_interval); | ||
509 | } | ||
510 | static DEVICE_ATTR(multicast_membership_interval, S_IRUGO | S_IWUSR, | ||
511 | show_multicast_membership_interval, | ||
512 | store_multicast_membership_interval); | ||
513 | |||
514 | static ssize_t show_multicast_querier_interval(struct device *d, | ||
515 | struct device_attribute *attr, | ||
516 | char *buf) | ||
517 | { | ||
518 | struct net_bridge *br = to_bridge(d); | ||
519 | return sprintf(buf, "%lu\n", | ||
520 | jiffies_to_clock_t(br->multicast_querier_interval)); | ||
521 | } | ||
522 | |||
523 | static int set_querier_interval(struct net_bridge *br, unsigned long val) | ||
524 | { | ||
525 | br->multicast_querier_interval = clock_t_to_jiffies(val); | ||
526 | return 0; | ||
527 | } | ||
528 | |||
529 | static ssize_t store_multicast_querier_interval(struct device *d, | ||
530 | struct device_attribute *attr, | ||
531 | const char *buf, size_t len) | ||
532 | { | ||
533 | return store_bridge_parm(d, buf, len, set_querier_interval); | ||
534 | } | ||
535 | static DEVICE_ATTR(multicast_querier_interval, S_IRUGO | S_IWUSR, | ||
536 | show_multicast_querier_interval, | ||
537 | store_multicast_querier_interval); | ||
538 | |||
539 | static ssize_t show_multicast_query_interval(struct device *d, | ||
540 | struct device_attribute *attr, | ||
541 | char *buf) | ||
542 | { | ||
543 | struct net_bridge *br = to_bridge(d); | ||
544 | return sprintf(buf, "%lu\n", | ||
545 | jiffies_to_clock_t(br->multicast_query_interval)); | ||
546 | } | ||
547 | |||
548 | static int set_query_interval(struct net_bridge *br, unsigned long val) | ||
549 | { | ||
550 | br->multicast_query_interval = clock_t_to_jiffies(val); | ||
551 | return 0; | ||
552 | } | ||
553 | |||
554 | static ssize_t store_multicast_query_interval(struct device *d, | ||
555 | struct device_attribute *attr, | ||
556 | const char *buf, size_t len) | ||
557 | { | ||
558 | return store_bridge_parm(d, buf, len, set_query_interval); | ||
559 | } | ||
560 | static DEVICE_ATTR(multicast_query_interval, S_IRUGO | S_IWUSR, | ||
561 | show_multicast_query_interval, | ||
562 | store_multicast_query_interval); | ||
563 | |||
564 | static ssize_t show_multicast_query_response_interval( | ||
565 | struct device *d, struct device_attribute *attr, char *buf) | ||
566 | { | ||
567 | struct net_bridge *br = to_bridge(d); | ||
568 | return sprintf( | ||
569 | buf, "%lu\n", | ||
570 | jiffies_to_clock_t(br->multicast_query_response_interval)); | ||
571 | } | ||
572 | |||
573 | static int set_query_response_interval(struct net_bridge *br, unsigned long val) | ||
574 | { | ||
575 | br->multicast_query_response_interval = clock_t_to_jiffies(val); | ||
576 | return 0; | ||
577 | } | ||
578 | |||
579 | static ssize_t store_multicast_query_response_interval( | ||
580 | struct device *d, struct device_attribute *attr, const char *buf, | ||
581 | size_t len) | ||
582 | { | ||
583 | return store_bridge_parm(d, buf, len, set_query_response_interval); | ||
584 | } | ||
585 | static DEVICE_ATTR(multicast_query_response_interval, S_IRUGO | S_IWUSR, | ||
586 | show_multicast_query_response_interval, | ||
587 | store_multicast_query_response_interval); | ||
588 | |||
589 | static ssize_t show_multicast_startup_query_interval( | ||
590 | struct device *d, struct device_attribute *attr, char *buf) | ||
591 | { | ||
592 | struct net_bridge *br = to_bridge(d); | ||
593 | return sprintf( | ||
594 | buf, "%lu\n", | ||
595 | jiffies_to_clock_t(br->multicast_startup_query_interval)); | ||
596 | } | ||
597 | |||
598 | static int set_startup_query_interval(struct net_bridge *br, unsigned long val) | ||
599 | { | ||
600 | br->multicast_startup_query_interval = clock_t_to_jiffies(val); | ||
601 | return 0; | ||
602 | } | ||
603 | |||
604 | static ssize_t store_multicast_startup_query_interval( | ||
605 | struct device *d, struct device_attribute *attr, const char *buf, | ||
606 | size_t len) | ||
607 | { | ||
608 | return store_bridge_parm(d, buf, len, set_startup_query_interval); | ||
609 | } | ||
610 | static DEVICE_ATTR(multicast_startup_query_interval, S_IRUGO | S_IWUSR, | ||
611 | show_multicast_startup_query_interval, | ||
612 | store_multicast_startup_query_interval); | ||
418 | #endif | 613 | #endif |
419 | 614 | ||
420 | static struct attribute *bridge_attrs[] = { | 615 | static struct attribute *bridge_attrs[] = { |
@@ -441,6 +636,14 @@ static struct attribute *bridge_attrs[] = { | |||
441 | &dev_attr_multicast_snooping.attr, | 636 | &dev_attr_multicast_snooping.attr, |
442 | &dev_attr_hash_elasticity.attr, | 637 | &dev_attr_hash_elasticity.attr, |
443 | &dev_attr_hash_max.attr, | 638 | &dev_attr_hash_max.attr, |
639 | &dev_attr_multicast_last_member_count.attr, | ||
640 | &dev_attr_multicast_startup_query_count.attr, | ||
641 | &dev_attr_multicast_last_member_interval.attr, | ||
642 | &dev_attr_multicast_membership_interval.attr, | ||
643 | &dev_attr_multicast_querier_interval.attr, | ||
644 | &dev_attr_multicast_query_interval.attr, | ||
645 | &dev_attr_multicast_query_response_interval.attr, | ||
646 | &dev_attr_multicast_startup_query_interval.attr, | ||
444 | #endif | 647 | #endif |
445 | NULL | 648 | NULL |
446 | }; | 649 | }; |