diff options
author | Scott Feldman <sfeldma@gmail.com> | 2015-05-10 18:47:48 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-13 00:43:53 +0200 |
commit | 3094333d9089d43e8b8f0418676fa6ae06c27b51 (patch) | |
tree | e2796ab07d0356c4fba4b0040702f3ac2172a6dc /net/core/net-sysfs.c | |
parent | switchdev: s/swdev_/switchdev_/ (diff) | |
download | linux-3094333d9089d43e8b8f0418676fa6ae06c27b51.tar.xz linux-3094333d9089d43e8b8f0418676fa6ae06c27b51.zip |
switchdev: introduce get/set attrs ops
Add two new swdev ops for get/set switch port attributes. Most swdev
interactions on a port are gets or sets on port attributes, so rather than
adding ops for each attribute, let's define clean get/set ops for all
attributes, and then we can have clear, consistent rules on how attributes
propagate on stacked devs.
Add the basic algorithms for get/set attr ops. Use the same recusive algo
to walk lower devs we've used for STP updates, for example. For get,
compare attr value for each lower dev and only return success if attr
values match across all lower devs. For sets, set the same attr value for
all lower devs. We'll use a two-phase prepare-commit transaction model for
sets. In the first phase, the driver(s) are asked if attr set is OK. If
all OK, the commit attr set in second phase. A driver would NACK the
prepare phase if it can't set the attr due to lack of resources or support,
within it's control. RTNL lock must be held across both phases because
we'll recurse all lower devs first in prepare phase, and then recurse all
lower devs again in commit phase. If any lower dev fails the prepare
phase, we need to abort the transaction for all lower devs.
If lower dev recusion isn't desired, allow a flag SWITCHDEV_F_NO_RECURSE to
indicate get/set only work on port (lowest) device.
Signed-off-by: Scott Feldman <sfeldma@gmail.com>
Acked-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net-sysfs.c')
0 files changed, 0 insertions, 0 deletions