aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bonding/bond_options.c104
-rw-r--r--drivers/net/bonding/bond_options.h5
-rw-r--r--drivers/net/bonding/bond_procfs.c2
3 files changed, 56 insertions, 55 deletions
diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c
index fc6d25e7d053..22800bde9752 100644
--- a/drivers/net/bonding/bond_options.c
+++ b/drivers/net/bonding/bond_options.c
@@ -21,55 +21,55 @@
21#include "bonding.h" 21#include "bonding.h"
22 22
23static int bond_option_active_slave_set(struct bonding *bond, 23static int bond_option_active_slave_set(struct bonding *bond,
24 struct bond_opt_value *newval); 24 const struct bond_opt_value *newval);
25static int bond_option_miimon_set(struct bonding *bond, 25static int bond_option_miimon_set(struct bonding *bond,
26 struct bond_opt_value *newval); 26 const struct bond_opt_value *newval);
27static int bond_option_updelay_set(struct bonding *bond, 27static int bond_option_updelay_set(struct bonding *bond,
28 struct bond_opt_value *newval); 28 const struct bond_opt_value *newval);
29static int bond_option_downdelay_set(struct bonding *bond, 29static int bond_option_downdelay_set(struct bonding *bond,
30 struct bond_opt_value *newval); 30 const struct bond_opt_value *newval);
31static int bond_option_use_carrier_set(struct bonding *bond, 31static int bond_option_use_carrier_set(struct bonding *bond,
32 struct bond_opt_value *newval); 32 const struct bond_opt_value *newval);
33static int bond_option_arp_interval_set(struct bonding *bond, 33static int bond_option_arp_interval_set(struct bonding *bond,
34 struct bond_opt_value *newval); 34 const struct bond_opt_value *newval);
35static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target); 35static int bond_option_arp_ip_target_add(struct bonding *bond, __be32 target);
36static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target); 36static int bond_option_arp_ip_target_rem(struct bonding *bond, __be32 target);
37static int bond_option_arp_ip_targets_set(struct bonding *bond, 37static int bond_option_arp_ip_targets_set(struct bonding *bond,
38 struct bond_opt_value *newval); 38 const struct bond_opt_value *newval);
39static int bond_option_arp_validate_set(struct bonding *bond, 39static int bond_option_arp_validate_set(struct bonding *bond,
40 struct bond_opt_value *newval); 40 const struct bond_opt_value *newval);
41static int bond_option_arp_all_targets_set(struct bonding *bond, 41static int bond_option_arp_all_targets_set(struct bonding *bond,
42 struct bond_opt_value *newval); 42 const struct bond_opt_value *newval);
43static int bond_option_primary_set(struct bonding *bond, 43static int bond_option_primary_set(struct bonding *bond,
44 struct bond_opt_value *newval); 44 const struct bond_opt_value *newval);
45static int bond_option_primary_reselect_set(struct bonding *bond, 45static int bond_option_primary_reselect_set(struct bonding *bond,
46 struct bond_opt_value *newval); 46 const struct bond_opt_value *newval);
47static int bond_option_fail_over_mac_set(struct bonding *bond, 47static int bond_option_fail_over_mac_set(struct bonding *bond,
48 struct bond_opt_value *newval); 48 const struct bond_opt_value *newval);
49static int bond_option_xmit_hash_policy_set(struct bonding *bond, 49static int bond_option_xmit_hash_policy_set(struct bonding *bond,
50 struct bond_opt_value *newval); 50 const struct bond_opt_value *newval);
51static int bond_option_resend_igmp_set(struct bonding *bond, 51static int bond_option_resend_igmp_set(struct bonding *bond,
52 struct bond_opt_value *newval); 52 const struct bond_opt_value *newval);
53static int bond_option_num_peer_notif_set(struct bonding *bond, 53static int bond_option_num_peer_notif_set(struct bonding *bond,
54 struct bond_opt_value *newval); 54 const struct bond_opt_value *newval);
55static int bond_option_all_slaves_active_set(struct bonding *bond, 55static int bond_option_all_slaves_active_set(struct bonding *bond,
56 struct bond_opt_value *newval); 56 const struct bond_opt_value *newval);
57static int bond_option_min_links_set(struct bonding *bond, 57static int bond_option_min_links_set(struct bonding *bond,
58 struct bond_opt_value *newval); 58 const struct bond_opt_value *newval);
59static int bond_option_lp_interval_set(struct bonding *bond, 59static int bond_option_lp_interval_set(struct bonding *bond,
60 struct bond_opt_value *newval); 60 const struct bond_opt_value *newval);
61static int bond_option_pps_set(struct bonding *bond, 61static int bond_option_pps_set(struct bonding *bond,
62 struct bond_opt_value *newval); 62 const struct bond_opt_value *newval);
63static int bond_option_lacp_rate_set(struct bonding *bond, 63static int bond_option_lacp_rate_set(struct bonding *bond,
64 struct bond_opt_value *newval); 64 const struct bond_opt_value *newval);
65static int bond_option_ad_select_set(struct bonding *bond, 65static int bond_option_ad_select_set(struct bonding *bond,
66 struct bond_opt_value *newval); 66 const struct bond_opt_value *newval);
67static int bond_option_queue_id_set(struct bonding *bond, 67static int bond_option_queue_id_set(struct bonding *bond,
68 struct bond_opt_value *newval); 68 const struct bond_opt_value *newval);
69static int bond_option_mode_set(struct bonding *bond, 69static int bond_option_mode_set(struct bonding *bond,
70 struct bond_opt_value *newval); 70 const struct bond_opt_value *newval);
71static int bond_option_slaves_set(struct bonding *bond, 71static int bond_option_slaves_set(struct bonding *bond,
72 struct bond_opt_value *newval); 72 const struct bond_opt_value *newval);
73 73
74 74
75static const struct bond_opt_value bond_mode_tbl[] = { 75static const struct bond_opt_value bond_mode_tbl[] = {
@@ -504,7 +504,7 @@ static int bond_opt_check_deps(struct bonding *bond,
504static void bond_opt_dep_print(struct bonding *bond, 504static void bond_opt_dep_print(struct bonding *bond,
505 const struct bond_option *opt) 505 const struct bond_option *opt)
506{ 506{
507 struct bond_opt_value *modeval; 507 const struct bond_opt_value *modeval;
508 struct bond_params *params; 508 struct bond_params *params;
509 509
510 params = &bond->params; 510 params = &bond->params;
@@ -517,9 +517,9 @@ static void bond_opt_dep_print(struct bonding *bond,
517 517
518static void bond_opt_error_interpret(struct bonding *bond, 518static void bond_opt_error_interpret(struct bonding *bond,
519 const struct bond_option *opt, 519 const struct bond_option *opt,
520 int error, struct bond_opt_value *val) 520 int error, const struct bond_opt_value *val)
521{ 521{
522 struct bond_opt_value *minval, *maxval; 522 const struct bond_opt_value *minval, *maxval;
523 char *p; 523 char *p;
524 524
525 switch (error) { 525 switch (error) {
@@ -574,7 +574,7 @@ static void bond_opt_error_interpret(struct bonding *bond,
574int __bond_opt_set(struct bonding *bond, 574int __bond_opt_set(struct bonding *bond,
575 unsigned int option, struct bond_opt_value *val) 575 unsigned int option, struct bond_opt_value *val)
576{ 576{
577 struct bond_opt_value *retval = NULL; 577 const struct bond_opt_value *retval = NULL;
578 const struct bond_option *opt; 578 const struct bond_option *opt;
579 int ret = -ENOENT; 579 int ret = -ENOENT;
580 580
@@ -637,7 +637,7 @@ const struct bond_option *bond_opt_get(unsigned int option)
637 return &bond_opts[option]; 637 return &bond_opts[option];
638} 638}
639 639
640int bond_option_mode_set(struct bonding *bond, struct bond_opt_value *newval) 640int bond_option_mode_set(struct bonding *bond, const struct bond_opt_value *newval)
641{ 641{
642 if (BOND_NO_USES_ARP(newval->value) && bond->params.arp_interval) { 642 if (BOND_NO_USES_ARP(newval->value) && bond->params.arp_interval) {
643 pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n", 643 pr_info("%s: %s mode is incompatible with arp monitoring, start mii monitoring\n",
@@ -676,7 +676,7 @@ struct net_device *bond_option_active_slave_get(struct bonding *bond)
676} 676}
677 677
678static int bond_option_active_slave_set(struct bonding *bond, 678static int bond_option_active_slave_set(struct bonding *bond,
679 struct bond_opt_value *newval) 679 const struct bond_opt_value *newval)
680{ 680{
681 char ifname[IFNAMSIZ] = { 0, }; 681 char ifname[IFNAMSIZ] = { 0, };
682 struct net_device *slave_dev; 682 struct net_device *slave_dev;
@@ -745,7 +745,7 @@ static int bond_option_active_slave_set(struct bonding *bond,
745} 745}
746 746
747static int bond_option_miimon_set(struct bonding *bond, 747static int bond_option_miimon_set(struct bonding *bond,
748 struct bond_opt_value *newval) 748 const struct bond_opt_value *newval)
749{ 749{
750 pr_info("%s: Setting MII monitoring interval to %llu\n", 750 pr_info("%s: Setting MII monitoring interval to %llu\n",
751 bond->dev->name, newval->value); 751 bond->dev->name, newval->value);
@@ -783,7 +783,7 @@ static int bond_option_miimon_set(struct bonding *bond,
783} 783}
784 784
785static int bond_option_updelay_set(struct bonding *bond, 785static int bond_option_updelay_set(struct bonding *bond,
786 struct bond_opt_value *newval) 786 const struct bond_opt_value *newval)
787{ 787{
788 int value = newval->value; 788 int value = newval->value;
789 789
@@ -807,7 +807,7 @@ static int bond_option_updelay_set(struct bonding *bond,
807} 807}
808 808
809static int bond_option_downdelay_set(struct bonding *bond, 809static int bond_option_downdelay_set(struct bonding *bond,
810 struct bond_opt_value *newval) 810 const struct bond_opt_value *newval)
811{ 811{
812 int value = newval->value; 812 int value = newval->value;
813 813
@@ -831,7 +831,7 @@ static int bond_option_downdelay_set(struct bonding *bond,
831} 831}
832 832
833static int bond_option_use_carrier_set(struct bonding *bond, 833static int bond_option_use_carrier_set(struct bonding *bond,
834 struct bond_opt_value *newval) 834 const struct bond_opt_value *newval)
835{ 835{
836 pr_info("%s: Setting use_carrier to %llu\n", 836 pr_info("%s: Setting use_carrier to %llu\n",
837 bond->dev->name, newval->value); 837 bond->dev->name, newval->value);
@@ -841,7 +841,7 @@ static int bond_option_use_carrier_set(struct bonding *bond,
841} 841}
842 842
843static int bond_option_arp_interval_set(struct bonding *bond, 843static int bond_option_arp_interval_set(struct bonding *bond,
844 struct bond_opt_value *newval) 844 const struct bond_opt_value *newval)
845{ 845{
846 pr_info("%s: Setting ARP monitoring interval to %llu\n", 846 pr_info("%s: Setting ARP monitoring interval to %llu\n",
847 bond->dev->name, newval->value); 847 bond->dev->name, newval->value);
@@ -991,7 +991,7 @@ void bond_option_arp_ip_targets_clear(struct bonding *bond)
991} 991}
992 992
993static int bond_option_arp_ip_targets_set(struct bonding *bond, 993static int bond_option_arp_ip_targets_set(struct bonding *bond,
994 struct bond_opt_value *newval) 994 const struct bond_opt_value *newval)
995{ 995{
996 int ret = -EPERM; 996 int ret = -EPERM;
997 __be32 target; 997 __be32 target;
@@ -1018,7 +1018,7 @@ static int bond_option_arp_ip_targets_set(struct bonding *bond,
1018} 1018}
1019 1019
1020static int bond_option_arp_validate_set(struct bonding *bond, 1020static int bond_option_arp_validate_set(struct bonding *bond,
1021 struct bond_opt_value *newval) 1021 const struct bond_opt_value *newval)
1022{ 1022{
1023 pr_info("%s: Setting arp_validate to %s (%llu)\n", 1023 pr_info("%s: Setting arp_validate to %s (%llu)\n",
1024 bond->dev->name, newval->string, newval->value); 1024 bond->dev->name, newval->string, newval->value);
@@ -1035,7 +1035,7 @@ static int bond_option_arp_validate_set(struct bonding *bond,
1035} 1035}
1036 1036
1037static int bond_option_arp_all_targets_set(struct bonding *bond, 1037static int bond_option_arp_all_targets_set(struct bonding *bond,
1038 struct bond_opt_value *newval) 1038 const struct bond_opt_value *newval)
1039{ 1039{
1040 pr_info("%s: Setting arp_all_targets to %s (%llu)\n", 1040 pr_info("%s: Setting arp_all_targets to %s (%llu)\n",
1041 bond->dev->name, newval->string, newval->value); 1041 bond->dev->name, newval->string, newval->value);
@@ -1045,7 +1045,7 @@ static int bond_option_arp_all_targets_set(struct bonding *bond,
1045} 1045}
1046 1046
1047static int bond_option_primary_set(struct bonding *bond, 1047static int bond_option_primary_set(struct bonding *bond,
1048 struct bond_opt_value *newval) 1048 const struct bond_opt_value *newval)
1049{ 1049{
1050 char *p, *primary = newval->string; 1050 char *p, *primary = newval->string;
1051 struct list_head *iter; 1051 struct list_head *iter;
@@ -1098,7 +1098,7 @@ out:
1098} 1098}
1099 1099
1100static int bond_option_primary_reselect_set(struct bonding *bond, 1100static int bond_option_primary_reselect_set(struct bonding *bond,
1101 struct bond_opt_value *newval) 1101 const struct bond_opt_value *newval)
1102{ 1102{
1103 pr_info("%s: Setting primary_reselect to %s (%llu)\n", 1103 pr_info("%s: Setting primary_reselect to %s (%llu)\n",
1104 bond->dev->name, newval->string, newval->value); 1104 bond->dev->name, newval->string, newval->value);
@@ -1114,7 +1114,7 @@ static int bond_option_primary_reselect_set(struct bonding *bond,
1114} 1114}
1115 1115
1116static int bond_option_fail_over_mac_set(struct bonding *bond, 1116static int bond_option_fail_over_mac_set(struct bonding *bond,
1117 struct bond_opt_value *newval) 1117 const struct bond_opt_value *newval)
1118{ 1118{
1119 pr_info("%s: Setting fail_over_mac to %s (%llu)\n", 1119 pr_info("%s: Setting fail_over_mac to %s (%llu)\n",
1120 bond->dev->name, newval->string, newval->value); 1120 bond->dev->name, newval->string, newval->value);
@@ -1124,7 +1124,7 @@ static int bond_option_fail_over_mac_set(struct bonding *bond,
1124} 1124}
1125 1125
1126static int bond_option_xmit_hash_policy_set(struct bonding *bond, 1126static int bond_option_xmit_hash_policy_set(struct bonding *bond,
1127 struct bond_opt_value *newval) 1127 const struct bond_opt_value *newval)
1128{ 1128{
1129 pr_info("%s: Setting xmit hash policy to %s (%llu)\n", 1129 pr_info("%s: Setting xmit hash policy to %s (%llu)\n",
1130 bond->dev->name, newval->string, newval->value); 1130 bond->dev->name, newval->string, newval->value);
@@ -1134,7 +1134,7 @@ static int bond_option_xmit_hash_policy_set(struct bonding *bond,
1134} 1134}
1135 1135
1136static int bond_option_resend_igmp_set(struct bonding *bond, 1136static int bond_option_resend_igmp_set(struct bonding *bond,
1137 struct bond_opt_value *newval) 1137 const struct bond_opt_value *newval)
1138{ 1138{
1139 pr_info("%s: Setting resend_igmp to %llu\n", 1139 pr_info("%s: Setting resend_igmp to %llu\n",
1140 bond->dev->name, newval->value); 1140 bond->dev->name, newval->value);
@@ -1144,7 +1144,7 @@ static int bond_option_resend_igmp_set(struct bonding *bond,
1144} 1144}
1145 1145
1146static int bond_option_num_peer_notif_set(struct bonding *bond, 1146static int bond_option_num_peer_notif_set(struct bonding *bond,
1147 struct bond_opt_value *newval) 1147 const struct bond_opt_value *newval)
1148{ 1148{
1149 bond->params.num_peer_notif = newval->value; 1149 bond->params.num_peer_notif = newval->value;
1150 1150
@@ -1152,7 +1152,7 @@ static int bond_option_num_peer_notif_set(struct bonding *bond,
1152} 1152}
1153 1153
1154static int bond_option_all_slaves_active_set(struct bonding *bond, 1154static int bond_option_all_slaves_active_set(struct bonding *bond,
1155 struct bond_opt_value *newval) 1155 const struct bond_opt_value *newval)
1156{ 1156{
1157 struct list_head *iter; 1157 struct list_head *iter;
1158 struct slave *slave; 1158 struct slave *slave;
@@ -1173,7 +1173,7 @@ static int bond_option_all_slaves_active_set(struct bonding *bond,
1173} 1173}
1174 1174
1175static int bond_option_min_links_set(struct bonding *bond, 1175static int bond_option_min_links_set(struct bonding *bond,
1176 struct bond_opt_value *newval) 1176 const struct bond_opt_value *newval)
1177{ 1177{
1178 pr_info("%s: Setting min links value to %llu\n", 1178 pr_info("%s: Setting min links value to %llu\n",
1179 bond->dev->name, newval->value); 1179 bond->dev->name, newval->value);
@@ -1183,7 +1183,7 @@ static int bond_option_min_links_set(struct bonding *bond,
1183} 1183}
1184 1184
1185static int bond_option_lp_interval_set(struct bonding *bond, 1185static int bond_option_lp_interval_set(struct bonding *bond,
1186 struct bond_opt_value *newval) 1186 const struct bond_opt_value *newval)
1187{ 1187{
1188 bond->params.lp_interval = newval->value; 1188 bond->params.lp_interval = newval->value;
1189 1189
@@ -1191,7 +1191,7 @@ static int bond_option_lp_interval_set(struct bonding *bond,
1191} 1191}
1192 1192
1193static int bond_option_pps_set(struct bonding *bond, 1193static int bond_option_pps_set(struct bonding *bond,
1194 struct bond_opt_value *newval) 1194 const struct bond_opt_value *newval)
1195{ 1195{
1196 bond->params.packets_per_slave = newval->value; 1196 bond->params.packets_per_slave = newval->value;
1197 if (newval->value > 0) { 1197 if (newval->value > 0) {
@@ -1209,7 +1209,7 @@ static int bond_option_pps_set(struct bonding *bond,
1209} 1209}
1210 1210
1211static int bond_option_lacp_rate_set(struct bonding *bond, 1211static int bond_option_lacp_rate_set(struct bonding *bond,
1212 struct bond_opt_value *newval) 1212 const struct bond_opt_value *newval)
1213{ 1213{
1214 pr_info("%s: Setting LACP rate to %s (%llu)\n", 1214 pr_info("%s: Setting LACP rate to %s (%llu)\n",
1215 bond->dev->name, newval->string, newval->value); 1215 bond->dev->name, newval->string, newval->value);
@@ -1220,7 +1220,7 @@ static int bond_option_lacp_rate_set(struct bonding *bond,
1220} 1220}
1221 1221
1222static int bond_option_ad_select_set(struct bonding *bond, 1222static int bond_option_ad_select_set(struct bonding *bond,
1223 struct bond_opt_value *newval) 1223 const struct bond_opt_value *newval)
1224{ 1224{
1225 pr_info("%s: Setting ad_select to %s (%llu)\n", 1225 pr_info("%s: Setting ad_select to %s (%llu)\n",
1226 bond->dev->name, newval->string, newval->value); 1226 bond->dev->name, newval->string, newval->value);
@@ -1230,7 +1230,7 @@ static int bond_option_ad_select_set(struct bonding *bond,
1230} 1230}
1231 1231
1232static int bond_option_queue_id_set(struct bonding *bond, 1232static int bond_option_queue_id_set(struct bonding *bond,
1233 struct bond_opt_value *newval) 1233 const struct bond_opt_value *newval)
1234{ 1234{
1235 struct slave *slave, *update_slave; 1235 struct slave *slave, *update_slave;
1236 struct net_device *sdev; 1236 struct net_device *sdev;
@@ -1291,7 +1291,7 @@ err_no_cmd:
1291} 1291}
1292 1292
1293static int bond_option_slaves_set(struct bonding *bond, 1293static int bond_option_slaves_set(struct bonding *bond,
1294 struct bond_opt_value *newval) 1294 const struct bond_opt_value *newval)
1295{ 1295{
1296 char command[IFNAMSIZ + 1] = { 0, }; 1296 char command[IFNAMSIZ + 1] = { 0, };
1297 struct net_device *dev; 1297 struct net_device *dev;
diff --git a/drivers/net/bonding/bond_options.h b/drivers/net/bonding/bond_options.h
index 6c5ba0ffc31c..12be9e1bfb0c 100644
--- a/drivers/net/bonding/bond_options.h
+++ b/drivers/net/bonding/bond_options.h
@@ -94,14 +94,15 @@ struct bond_option {
94 */ 94 */
95 const struct bond_opt_value *values; 95 const struct bond_opt_value *values;
96 96
97 int (*set)(struct bonding *bond, struct bond_opt_value *val); 97 int (*set)(struct bonding *bond, const struct bond_opt_value *val);
98}; 98};
99 99
100int __bond_opt_set(struct bonding *bond, unsigned int option, 100int __bond_opt_set(struct bonding *bond, unsigned int option,
101 struct bond_opt_value *val); 101 struct bond_opt_value *val);
102int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf); 102int bond_opt_tryset_rtnl(struct bonding *bond, unsigned int option, char *buf);
103
103const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt, 104const struct bond_opt_value *bond_opt_parse(const struct bond_option *opt,
104 struct bond_opt_value *val); 105 struct bond_opt_value *val);
105const struct bond_option *bond_opt_get(unsigned int option); 106const struct bond_option *bond_opt_get(unsigned int option);
106const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val); 107const struct bond_opt_value *bond_opt_get_val(unsigned int option, u64 val);
107 108
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c
index 588cf39d832c..013fdd0f45e9 100644
--- a/drivers/net/bonding/bond_procfs.c
+++ b/drivers/net/bonding/bond_procfs.c
@@ -65,7 +65,7 @@ static void bond_info_seq_stop(struct seq_file *seq, void *v)
65static void bond_info_show_master(struct seq_file *seq) 65static void bond_info_show_master(struct seq_file *seq)
66{ 66{
67 struct bonding *bond = seq->private; 67 struct bonding *bond = seq->private;
68 struct bond_opt_value *optval; 68 const struct bond_opt_value *optval;
69 struct slave *curr; 69 struct slave *curr;
70 int i; 70 int i;
71 71