2 * drivers/net/bond/bond_options.c - bonding options
3 * Copyright (c) 2013 Jiri Pirko <jiri@resnulli.us>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
11 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/errno.h>
17 static bool bond_mode_is_valid(int mode
)
21 for (i
= 0; bond_mode_tbl
[i
].modename
; i
++);
23 return mode
>= 0 && mode
< i
;
26 int bond_option_mode_set(struct bonding
*bond
, int mode
)
28 if (!bond_mode_is_valid(mode
)) {
29 pr_err("invalid mode value %d.\n", mode
);
33 if (bond
->dev
->flags
& IFF_UP
) {
34 pr_err("%s: unable to update mode because interface is up.\n",
39 if (bond_has_slaves(bond
)) {
40 pr_err("%s: unable to update mode because bond has slaves.\n",
45 if (BOND_MODE_IS_LB(mode
) && bond
->params
.arp_interval
) {
46 pr_err("%s: %s mode is incompatible with arp monitoring.\n",
47 bond
->dev
->name
, bond_mode_tbl
[mode
].modename
);
51 /* don't cache arp_validate between modes */
52 bond
->params
.arp_validate
= BOND_ARP_VALIDATE_NONE
;
53 bond
->params
.mode
= mode
;
This page took 0.047582 seconds and 6 git commands to generate.