Lines Matching +full:d +full:-
1 // SPDX-License-Identifier: GPL-2.0-or-later
31 static ssize_t store_bridge_parm(struct device *d, in store_bridge_parm() argument
36 struct net_bridge *br = to_bridge(d); in store_bridge_parm()
41 if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN)) in store_bridge_parm()
42 return -EPERM; in store_bridge_parm()
53 netdev_state_change(br->dev); in store_bridge_parm()
66 static ssize_t forward_delay_show(struct device *d, in forward_delay_show() argument
69 struct net_bridge *br = to_bridge(d); in forward_delay_show()
70 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->forward_delay)); in forward_delay_show()
79 static ssize_t forward_delay_store(struct device *d, in forward_delay_store() argument
83 return store_bridge_parm(d, buf, len, set_forward_delay); in forward_delay_store()
87 static ssize_t hello_time_show(struct device *d, struct device_attribute *attr, in hello_time_show() argument
91 jiffies_to_clock_t(to_bridge(d)->hello_time)); in hello_time_show()
100 static ssize_t hello_time_store(struct device *d, in hello_time_store() argument
104 return store_bridge_parm(d, buf, len, set_hello_time); in hello_time_store()
108 static ssize_t max_age_show(struct device *d, struct device_attribute *attr, in max_age_show() argument
112 jiffies_to_clock_t(to_bridge(d)->max_age)); in max_age_show()
121 static ssize_t max_age_store(struct device *d, struct device_attribute *attr, in max_age_store() argument
124 return store_bridge_parm(d, buf, len, set_max_age); in max_age_store()
128 static ssize_t ageing_time_show(struct device *d, in ageing_time_show() argument
131 struct net_bridge *br = to_bridge(d); in ageing_time_show()
132 return sprintf(buf, "%lu\n", jiffies_to_clock_t(br->ageing_time)); in ageing_time_show()
141 static ssize_t ageing_time_store(struct device *d, in ageing_time_store() argument
145 return store_bridge_parm(d, buf, len, set_ageing_time); in ageing_time_store()
149 static ssize_t stp_state_show(struct device *d, in stp_state_show() argument
152 struct net_bridge *br = to_bridge(d); in stp_state_show()
153 return sprintf(buf, "%d\n", br->stp_enabled); in stp_state_show()
163 static ssize_t stp_state_store(struct device *d, in stp_state_store() argument
167 return store_bridge_parm(d, buf, len, set_stp_state); in stp_state_store()
171 static ssize_t group_fwd_mask_show(struct device *d, in group_fwd_mask_show() argument
175 struct net_bridge *br = to_bridge(d); in group_fwd_mask_show()
176 return sprintf(buf, "%#x\n", br->group_fwd_mask); in group_fwd_mask_show()
183 return -EINVAL; in set_group_fwd_mask()
185 br->group_fwd_mask = val; in set_group_fwd_mask()
190 static ssize_t group_fwd_mask_store(struct device *d, in group_fwd_mask_store() argument
195 return store_bridge_parm(d, buf, len, set_group_fwd_mask); in group_fwd_mask_store()
199 static ssize_t priority_show(struct device *d, struct device_attribute *attr, in priority_show() argument
202 struct net_bridge *br = to_bridge(d); in priority_show()
203 return sprintf(buf, "%d\n", in priority_show()
204 (br->bridge_id.prio[0] << 8) | br->bridge_id.prio[1]); in priority_show()
214 static ssize_t priority_store(struct device *d, struct device_attribute *attr, in priority_store() argument
217 return store_bridge_parm(d, buf, len, set_priority); in priority_store()
221 static ssize_t root_id_show(struct device *d, struct device_attribute *attr, in root_id_show() argument
224 return br_show_bridge_id(buf, &to_bridge(d)->designated_root); in root_id_show()
228 static ssize_t bridge_id_show(struct device *d, struct device_attribute *attr, in bridge_id_show() argument
231 return br_show_bridge_id(buf, &to_bridge(d)->bridge_id); in bridge_id_show()
235 static ssize_t root_port_show(struct device *d, struct device_attribute *attr, in root_port_show() argument
238 return sprintf(buf, "%d\n", to_bridge(d)->root_port); in root_port_show()
242 static ssize_t root_path_cost_show(struct device *d, in root_path_cost_show() argument
245 return sprintf(buf, "%d\n", to_bridge(d)->root_path_cost); in root_path_cost_show()
249 static ssize_t topology_change_show(struct device *d, in topology_change_show() argument
252 return sprintf(buf, "%d\n", to_bridge(d)->topology_change); in topology_change_show()
256 static ssize_t topology_change_detected_show(struct device *d, in topology_change_detected_show() argument
260 struct net_bridge *br = to_bridge(d); in topology_change_detected_show()
261 return sprintf(buf, "%d\n", br->topology_change_detected); in topology_change_detected_show()
265 static ssize_t hello_timer_show(struct device *d, in hello_timer_show() argument
268 struct net_bridge *br = to_bridge(d); in hello_timer_show()
269 return sprintf(buf, "%ld\n", br_timer_value(&br->hello_timer)); in hello_timer_show()
273 static ssize_t tcn_timer_show(struct device *d, struct device_attribute *attr, in tcn_timer_show() argument
276 struct net_bridge *br = to_bridge(d); in tcn_timer_show()
277 return sprintf(buf, "%ld\n", br_timer_value(&br->tcn_timer)); in tcn_timer_show()
281 static ssize_t topology_change_timer_show(struct device *d, in topology_change_timer_show() argument
285 struct net_bridge *br = to_bridge(d); in topology_change_timer_show()
286 return sprintf(buf, "%ld\n", br_timer_value(&br->topology_change_timer)); in topology_change_timer_show()
290 static ssize_t gc_timer_show(struct device *d, struct device_attribute *attr, in gc_timer_show() argument
293 struct net_bridge *br = to_bridge(d); in gc_timer_show()
294 return sprintf(buf, "%ld\n", br_timer_value(&br->gc_work.timer)); in gc_timer_show()
298 static ssize_t group_addr_show(struct device *d, in group_addr_show() argument
301 struct net_bridge *br = to_bridge(d); in group_addr_show()
302 return sprintf(buf, "%pM\n", br->group_addr); in group_addr_show()
305 static ssize_t group_addr_store(struct device *d, in group_addr_store() argument
309 struct net_bridge *br = to_bridge(d); in group_addr_store()
312 if (!ns_capable(dev_net(br->dev)->user_ns, CAP_NET_ADMIN)) in group_addr_store()
313 return -EPERM; in group_addr_store()
316 return -EINVAL; in group_addr_store()
319 return -EINVAL; in group_addr_store()
324 return -EINVAL; in group_addr_store()
329 spin_lock_bh(&br->lock); in group_addr_store()
330 ether_addr_copy(br->group_addr, new_addr); in group_addr_store()
331 spin_unlock_bh(&br->lock); in group_addr_store()
335 netdev_state_change(br->dev); in group_addr_store()
355 static ssize_t flush_store(struct device *d, in flush_store() argument
359 return store_bridge_parm(d, buf, len, set_flush); in flush_store()
363 static ssize_t no_linklocal_learn_show(struct device *d, in no_linklocal_learn_show() argument
367 struct net_bridge *br = to_bridge(d); in no_linklocal_learn_show()
368 return sprintf(buf, "%d\n", br_boolopt_get(br, BR_BOOLOPT_NO_LL_LEARN)); in no_linklocal_learn_show()
377 static ssize_t no_linklocal_learn_store(struct device *d, in no_linklocal_learn_store() argument
381 return store_bridge_parm(d, buf, len, set_no_linklocal_learn); in no_linklocal_learn_store()
386 static ssize_t multicast_router_show(struct device *d, in multicast_router_show() argument
389 struct net_bridge *br = to_bridge(d); in multicast_router_show()
390 return sprintf(buf, "%d\n", br->multicast_ctx.multicast_router); in multicast_router_show()
396 return br_multicast_set_router(&br->multicast_ctx, val); in set_multicast_router()
399 static ssize_t multicast_router_store(struct device *d, in multicast_router_store() argument
403 return store_bridge_parm(d, buf, len, set_multicast_router); in multicast_router_store()
407 static ssize_t multicast_snooping_show(struct device *d, in multicast_snooping_show() argument
411 struct net_bridge *br = to_bridge(d); in multicast_snooping_show()
412 return sprintf(buf, "%d\n", br_opt_get(br, BROPT_MULTICAST_ENABLED)); in multicast_snooping_show()
415 static ssize_t multicast_snooping_store(struct device *d, in multicast_snooping_store() argument
419 return store_bridge_parm(d, buf, len, br_multicast_toggle); in multicast_snooping_store()
423 static ssize_t multicast_query_use_ifaddr_show(struct device *d, in multicast_query_use_ifaddr_show() argument
427 struct net_bridge *br = to_bridge(d); in multicast_query_use_ifaddr_show()
428 return sprintf(buf, "%d\n", in multicast_query_use_ifaddr_show()
440 multicast_query_use_ifaddr_store(struct device *d, in multicast_query_use_ifaddr_store() argument
444 return store_bridge_parm(d, buf, len, set_query_use_ifaddr); in multicast_query_use_ifaddr_store()
448 static ssize_t multicast_querier_show(struct device *d, in multicast_querier_show() argument
452 struct net_bridge *br = to_bridge(d); in multicast_querier_show()
453 return sprintf(buf, "%d\n", br->multicast_ctx.multicast_querier); in multicast_querier_show()
459 return br_multicast_set_querier(&br->multicast_ctx, val); in set_multicast_querier()
462 static ssize_t multicast_querier_store(struct device *d, in multicast_querier_store() argument
466 return store_bridge_parm(d, buf, len, set_multicast_querier); in multicast_querier_store()
470 static ssize_t hash_elasticity_show(struct device *d, in hash_elasticity_show() argument
485 static ssize_t hash_elasticity_store(struct device *d, in hash_elasticity_store() argument
489 return store_bridge_parm(d, buf, len, set_elasticity); in hash_elasticity_store()
493 static ssize_t hash_max_show(struct device *d, struct device_attribute *attr, in hash_max_show() argument
496 struct net_bridge *br = to_bridge(d); in hash_max_show()
497 return sprintf(buf, "%u\n", br->hash_max); in hash_max_show()
503 br->hash_max = val; in set_hash_max()
507 static ssize_t hash_max_store(struct device *d, struct device_attribute *attr, in hash_max_store() argument
510 return store_bridge_parm(d, buf, len, set_hash_max); in hash_max_store()
514 static ssize_t multicast_igmp_version_show(struct device *d, in multicast_igmp_version_show() argument
518 struct net_bridge *br = to_bridge(d); in multicast_igmp_version_show()
520 return sprintf(buf, "%u\n", br->multicast_ctx.multicast_igmp_version); in multicast_igmp_version_show()
526 return br_multicast_set_igmp_version(&br->multicast_ctx, val); in set_multicast_igmp_version()
529 static ssize_t multicast_igmp_version_store(struct device *d, in multicast_igmp_version_store() argument
533 return store_bridge_parm(d, buf, len, set_multicast_igmp_version); in multicast_igmp_version_store()
537 static ssize_t multicast_last_member_count_show(struct device *d, in multicast_last_member_count_show() argument
541 struct net_bridge *br = to_bridge(d); in multicast_last_member_count_show()
542 return sprintf(buf, "%u\n", br->multicast_ctx.multicast_last_member_count); in multicast_last_member_count_show()
548 br->multicast_ctx.multicast_last_member_count = val; in set_last_member_count()
552 static ssize_t multicast_last_member_count_store(struct device *d, in multicast_last_member_count_store() argument
556 return store_bridge_parm(d, buf, len, set_last_member_count); in multicast_last_member_count_store()
561 struct device *d, struct device_attribute *attr, char *buf) in multicast_startup_query_count_show() argument
563 struct net_bridge *br = to_bridge(d); in multicast_startup_query_count_show()
564 return sprintf(buf, "%u\n", br->multicast_ctx.multicast_startup_query_count); in multicast_startup_query_count_show()
570 br->multicast_ctx.multicast_startup_query_count = val; in set_startup_query_count()
575 struct device *d, struct device_attribute *attr, const char *buf, in multicast_startup_query_count_store() argument
578 return store_bridge_parm(d, buf, len, set_startup_query_count); in multicast_startup_query_count_store()
583 struct device *d, struct device_attribute *attr, char *buf) in multicast_last_member_interval_show() argument
585 struct net_bridge *br = to_bridge(d); in multicast_last_member_interval_show()
587 jiffies_to_clock_t(br->multicast_ctx.multicast_last_member_interval)); in multicast_last_member_interval_show()
593 br->multicast_ctx.multicast_last_member_interval = clock_t_to_jiffies(val); in set_last_member_interval()
598 struct device *d, struct device_attribute *attr, const char *buf, in multicast_last_member_interval_store() argument
601 return store_bridge_parm(d, buf, len, set_last_member_interval); in multicast_last_member_interval_store()
606 struct device *d, struct device_attribute *attr, char *buf) in multicast_membership_interval_show() argument
608 struct net_bridge *br = to_bridge(d); in multicast_membership_interval_show()
610 jiffies_to_clock_t(br->multicast_ctx.multicast_membership_interval)); in multicast_membership_interval_show()
616 br->multicast_ctx.multicast_membership_interval = clock_t_to_jiffies(val); in set_membership_interval()
621 struct device *d, struct device_attribute *attr, const char *buf, in multicast_membership_interval_store() argument
624 return store_bridge_parm(d, buf, len, set_membership_interval); in multicast_membership_interval_store()
628 static ssize_t multicast_querier_interval_show(struct device *d, in multicast_querier_interval_show() argument
632 struct net_bridge *br = to_bridge(d); in multicast_querier_interval_show()
634 jiffies_to_clock_t(br->multicast_ctx.multicast_querier_interval)); in multicast_querier_interval_show()
640 br->multicast_ctx.multicast_querier_interval = clock_t_to_jiffies(val); in set_querier_interval()
644 static ssize_t multicast_querier_interval_store(struct device *d, in multicast_querier_interval_store() argument
648 return store_bridge_parm(d, buf, len, set_querier_interval); in multicast_querier_interval_store()
652 static ssize_t multicast_query_interval_show(struct device *d, in multicast_query_interval_show() argument
656 struct net_bridge *br = to_bridge(d); in multicast_query_interval_show()
658 jiffies_to_clock_t(br->multicast_ctx.multicast_query_interval)); in multicast_query_interval_show()
664 br_multicast_set_query_intvl(&br->multicast_ctx, val); in set_query_interval()
668 static ssize_t multicast_query_interval_store(struct device *d, in multicast_query_interval_store() argument
672 return store_bridge_parm(d, buf, len, set_query_interval); in multicast_query_interval_store()
677 struct device *d, struct device_attribute *attr, char *buf) in multicast_query_response_interval_show() argument
679 struct net_bridge *br = to_bridge(d); in multicast_query_response_interval_show()
682 jiffies_to_clock_t(br->multicast_ctx.multicast_query_response_interval)); in multicast_query_response_interval_show()
688 br->multicast_ctx.multicast_query_response_interval = clock_t_to_jiffies(val); in set_query_response_interval()
693 struct device *d, struct device_attribute *attr, const char *buf, in multicast_query_response_interval_store() argument
696 return store_bridge_parm(d, buf, len, set_query_response_interval); in multicast_query_response_interval_store()
701 struct device *d, struct device_attribute *attr, char *buf) in multicast_startup_query_interval_show() argument
703 struct net_bridge *br = to_bridge(d); in multicast_startup_query_interval_show()
706 jiffies_to_clock_t(br->multicast_ctx.multicast_startup_query_interval)); in multicast_startup_query_interval_show()
712 br_multicast_set_startup_query_intvl(&br->multicast_ctx, val); in set_startup_query_interval()
717 struct device *d, struct device_attribute *attr, const char *buf, in multicast_startup_query_interval_store() argument
720 return store_bridge_parm(d, buf, len, set_startup_query_interval); in multicast_startup_query_interval_store()
724 static ssize_t multicast_stats_enabled_show(struct device *d, in multicast_stats_enabled_show() argument
728 struct net_bridge *br = to_bridge(d); in multicast_stats_enabled_show()
730 return sprintf(buf, "%d\n", in multicast_stats_enabled_show()
741 static ssize_t multicast_stats_enabled_store(struct device *d, in multicast_stats_enabled_store() argument
746 return store_bridge_parm(d, buf, len, set_stats_enabled); in multicast_stats_enabled_store()
751 static ssize_t multicast_mld_version_show(struct device *d, in multicast_mld_version_show() argument
755 struct net_bridge *br = to_bridge(d); in multicast_mld_version_show()
757 return sprintf(buf, "%u\n", br->multicast_ctx.multicast_mld_version); in multicast_mld_version_show()
763 return br_multicast_set_mld_version(&br->multicast_ctx, val); in set_multicast_mld_version()
766 static ssize_t multicast_mld_version_store(struct device *d, in multicast_mld_version_store() argument
770 return store_bridge_parm(d, buf, len, set_multicast_mld_version); in multicast_mld_version_store()
777 struct device *d, struct device_attribute *attr, char *buf) in nf_call_iptables_show() argument
779 struct net_bridge *br = to_bridge(d); in nf_call_iptables_show()
791 struct device *d, struct device_attribute *attr, const char *buf, in nf_call_iptables_store() argument
794 return store_bridge_parm(d, buf, len, set_nf_call_iptables); in nf_call_iptables_store()
799 struct device *d, struct device_attribute *attr, char *buf) in nf_call_ip6tables_show() argument
801 struct net_bridge *br = to_bridge(d); in nf_call_ip6tables_show()
813 struct device *d, struct device_attribute *attr, const char *buf, in nf_call_ip6tables_store() argument
816 return store_bridge_parm(d, buf, len, set_nf_call_ip6tables); in nf_call_ip6tables_store()
821 struct device *d, struct device_attribute *attr, char *buf) in nf_call_arptables_show() argument
823 struct net_bridge *br = to_bridge(d); in nf_call_arptables_show()
835 struct device *d, struct device_attribute *attr, const char *buf, in nf_call_arptables_store() argument
838 return store_bridge_parm(d, buf, len, set_nf_call_arptables); in nf_call_arptables_store()
843 static ssize_t vlan_filtering_show(struct device *d, in vlan_filtering_show() argument
847 struct net_bridge *br = to_bridge(d); in vlan_filtering_show()
848 return sprintf(buf, "%d\n", br_opt_get(br, BROPT_VLAN_ENABLED)); in vlan_filtering_show()
851 static ssize_t vlan_filtering_store(struct device *d, in vlan_filtering_store() argument
855 return store_bridge_parm(d, buf, len, br_vlan_filter_toggle); in vlan_filtering_store()
859 static ssize_t vlan_protocol_show(struct device *d, in vlan_protocol_show() argument
863 struct net_bridge *br = to_bridge(d); in vlan_protocol_show()
864 return sprintf(buf, "%#06x\n", ntohs(br->vlan_proto)); in vlan_protocol_show()
867 static ssize_t vlan_protocol_store(struct device *d, in vlan_protocol_store() argument
871 return store_bridge_parm(d, buf, len, br_vlan_set_proto); in vlan_protocol_store()
875 static ssize_t default_pvid_show(struct device *d, in default_pvid_show() argument
879 struct net_bridge *br = to_bridge(d); in default_pvid_show()
880 return sprintf(buf, "%d\n", br->default_pvid); in default_pvid_show()
883 static ssize_t default_pvid_store(struct device *d, in default_pvid_store() argument
887 return store_bridge_parm(d, buf, len, br_vlan_set_default_pvid); in default_pvid_store()
891 static ssize_t vlan_stats_enabled_show(struct device *d, in vlan_stats_enabled_show() argument
895 struct net_bridge *br = to_bridge(d); in vlan_stats_enabled_show()
905 static ssize_t vlan_stats_enabled_store(struct device *d, in vlan_stats_enabled_store() argument
909 return store_bridge_parm(d, buf, len, set_vlan_stats_enabled); in vlan_stats_enabled_store()
913 static ssize_t vlan_stats_per_port_show(struct device *d, in vlan_stats_per_port_show() argument
917 struct net_bridge *br = to_bridge(d); in vlan_stats_per_port_show()
927 static ssize_t vlan_stats_per_port_store(struct device *d, in vlan_stats_per_port_store() argument
931 return store_bridge_parm(d, buf, len, set_vlan_stats_per_port); in vlan_stats_per_port_store()
1014 return -EINVAL; in brforward_read()
1045 struct kobject *brobj = &dev->dev.kobj; in br_sysfs_addbr()
1052 __func__, dev->name, bridge_group.name); in br_sysfs_addbr()
1059 __func__, dev->name, bridge_forward.attr.name); in br_sysfs_addbr()
1063 br->ifobj = kobject_create_and_add(SYSFS_BRIDGE_PORT_SUBDIR, brobj); in br_sysfs_addbr()
1064 if (!br->ifobj) { in br_sysfs_addbr()
1066 __func__, dev->name, SYSFS_BRIDGE_PORT_SUBDIR); in br_sysfs_addbr()
1067 err = -ENOMEM; in br_sysfs_addbr()
1072 sysfs_remove_bin_file(&dev->dev.kobj, &bridge_forward); in br_sysfs_addbr()
1074 sysfs_remove_group(&dev->dev.kobj, &bridge_group); in br_sysfs_addbr()
1082 struct kobject *kobj = &dev->dev.kobj; in br_sysfs_delbr()
1085 kobject_put(br->ifobj); in br_sysfs_delbr()