kernel-fxtec-pro1x/drivers/net/bonding
Nikolay Aleksandrov 0911736245 bonding: add infrastructure for an option API
This patch adds the necessary basic infrastructure to support
centralized and unified option manipulation API for the bonding. The new
structure bond_option will be used to describe each option with its
dependencies on modes which will be checked automatically thus removing a
lot of duplicated code. Also automatic range checking is added for
some options. Currently the option setting function requires RTNL to
be acquired prior to calling it, since many options already rely on RTNL
it seemed like the best choice to protect all against common race
conditions.
In order to add an option the following steps need to be done:
1. Add an entry BOND_OPT_<option> to bond_options.h so it gets a unique id
   and a bit corresponding to the id
2. Add a bond_option entry to the bond_opts[] array in bond_options.c which
   describes the option, its dependencies and its manipulation function
3. Add code to export the option through sysfs and/or as a module parameter
   (the sysfs export will be made automatically in the future)

The options can have different flags set, currently the following are
supported:
BOND_OPTFLAG_NOSLAVES - require that the bond device has no slaves prior
                        to setting the option
BOND_OPTFLAG_IFDOWN - require that the bond device is down prior to
                      setting the option
BOND_OPTFLAG_RAWVAL - don't parse the value but return it raw for the
                      option to parse

There's a new value structure to describe different types of values
which can have the following flags:
BOND_VALFLAG_DEFAULT - marks the default option (permanent string alias
                       to this option is "default")
BOND_VALFLAG_MIN - the minimum value that this option can have
BOND_VALFLAG_MAX - the maximum value that this option can have

An example would be nice here, so if we have an option which can have
the values "off"(2), "special"(4, default) and supports a range, say
16 - 32, it should be defined as follows:
"off", 2,
"special", 4, BOND_VALFLAG_DEFAULT,
"rangemin", 16, BOND_VALFLAG_MIN,
"rangemax", 32, BOND_VALFLAG_MAX
So we have the valid intervals: [2, 2], [4, 4], [16, 32]
Also the valid strings: "off" = 2, "special" and "default" = 4
                        "rangemin" = 16, "rangemax" = 32

BOND_VALFLAG_(MIN|MAX) can be used to specify a valid range for an
option, if MIN is omitted then 0 is considered as a minimum. If an
exact match is found in the values[] table it will be returned,
otherwise the range is tried (if available).

The option parameter passing is done by using a special structure called
bond_opt_value which can take either a string or a value to parse. One
of the bond_opt_init(val|str) macros should be used depending on which
one does the user want to parse (string or value). Then a call to
__bond_opt_set should be done under RTNL.

Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22 15:38:41 -08:00
..
bond_3ad.c bonding: fix __get_active_agg() RCU logic 2014-01-13 22:22:27 -08:00
bond_3ad.h bonding: remove the return value for bond_3ad_bind_slave() 2014-01-01 22:58:55 -05:00
bond_alb.c bonding: slight optimization for bond_alb_xmit() 2014-01-01 22:58:15 -05:00
bond_alb.h drivers/net/*: Fix FSF address in file headers 2013-12-06 12:37:55 -05:00
bond_debugfs.c bonding: delete migrated IP addresses from the rlb hash table 2012-11-30 12:07:27 -05:00
bond_main.c reciprocal_divide: update/correction of the algorithm 2014-01-21 23:17:20 -08:00
bond_netlink.c reciprocal_divide: update/correction of the algorithm 2014-01-21 23:17:20 -08:00
bond_options.c bonding: add infrastructure for an option API 2014-01-22 15:38:41 -08:00
bond_options.h bonding: add infrastructure for an option API 2014-01-22 15:38:41 -08:00
bond_procfs.c bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00
bond_sysfs.c reciprocal_divide: update/correction of the algorithm 2014-01-21 23:17:20 -08:00
bond_sysfs_slave.c bond: make slave_sysfs_ops static 2014-01-21 16:45:41 -08:00
bonding.h bonding: add infrastructure for an option API 2014-01-22 15:38:41 -08:00
Makefile bonding: add sysfs /slave dir for bond slave devices. 2014-01-17 18:51:58 -08:00