aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_netlink.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2015-07-31bonding: add tlb_dynamic_lb netlink supportNikolay Aleksandrov1-2/+15
tlb_dynamic_lb could be set only via sysfs, this patch allows it to be set via netlink. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-23bonding: Display LACP info only to CAP_NET_ADMIN capable userMahesh Bandewar1-11/+12
Actor and Partner details can be accessed via proc-fs, sys-fs entries or netlink interface. These interfaces are world readable at this moment. The earlier patch-series made the LACP communication secure to avoid nuisance attack from within the same L2 domain but it did not prevent "someone unprivileged" looking at that information on host and perform the same act. This patch essentially avoids spitting those entries if the user in question does not have enough privileges. Signed-off-by: Mahesh Bandewar <maheshb@google.com> Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-15bonding: export slave's partner_oper_port_state via sysfs and netlinkNikolay Aleksandrov1-0/+5
Export the partner_oper_port_state of each port via sysfs and netlink. In 802.3ad mode it is valuable for the user to be able to check the partner_oper state, it is already exported via bond's proc entry. Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-06-15bonding: export slave's actor_oper_port_state via sysfs and netlinkNikolay Aleksandrov1-1/+9
Export the actor_oper_port_state of each port via sysfs and netlink. In 802.3ad mode it is valuable for the user to be able to check the actor_oper state, it is already exported via bond's proc entry. Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2015-05-11bonding: add netlink support for sys prio, actor sys mac, and port keyAndy Gospodarek1-0/+50
Adds netlink support for the following bonding options: * BOND_OPT_AD_ACTOR_SYS_PRIO * BOND_OPT_AD_ACTOR_SYSTEM * BOND_OPT_AD_USER_PORT_KEY When setting the actor system mac address we assume the netlink message contains a binary mac and not a string representation of a mac. Signed-off-by: Andy Gospodarek <gospo@cumulusnetworks.com> [jt: completed the setting side of the netlink attributes] Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com> Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-12-10Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller1-1/+6
Conflicts: drivers/net/ethernet/amd/xgbe/xgbe-desc.c drivers/net/ethernet/renesas/sh_eth.c Overlapping changes in both conflict cases. Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-29bond: Check length of IFLA_BOND_ARP_IP_TARGET attributesThomas Graf1-1/+6
Fixes: 7f28fa10 ("bonding: add arp_ip_target netlink support") Reported-by: John Fastabend <john.fastabend@gmail.com> Cc: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Acked-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-10net: Move bonding headers under include/netDavid S. Miller1-1/+1
This ways drivers like cxgb4 don't need to do ugly relative includes. Reported-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-09bonding: convert primary_slave to use RCUNikolay Aleksandrov1-3/+4
This is necessary mainly for two bonding call sites: procfs and sysfs as it was dereferenced without any real protection. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-05bonding: add slave netlink policy and put slave-related ops togetherJiri Pirko1-2/+7
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-09-01bonding: add slave_changelink support and use it for queue_idNikolay Aleksandrov1-0/+29
This patch adds support for slave_changelink to the bonding and uses it to give the ability to change the queue_id of the enslaved devices via netlink. It sets slave_maxtype and uses bond_changelink as a prototype for bond_slave_changelink. Example/test command after the iproute2 patch: ip link set eth0 type bond_slave queue_id 10 CC: David S. Miller <davem@davemloft.net> CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Veaceslav Falico <vfalico@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Suggested-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Acked-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-15bonding: bonding: remove pr_fmt from bond_netlink.cVeaceslav Falico1-2/+0
To maintain the same message structure as netdev_* functions print. CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-15bonding: convert bond_netlink.c to use netdev_printk instead of pr_Veaceslav Falico1-6/+3
CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-07-15bonding: get rid of bond_option_active_slave_get()Eric Dumazet1-5/+16
Only keep bond_option_active_slave_get_rcu() helper. bond_fill_info() uses a new bond_option_active_slave_get_ifindex() helper. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Veaceslav Falico <vfalico@gmail.com> Reviewed-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-05-16bonding: create a macro for bond mode and use itVeaceslav Falico1-3/+3
CC: Jay Vosburgh <j.vosburgh@gmail.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-05-14bonding: alloc the structure ad_info dynamically in per slavedingtianhong1-1/+1
The struct ad_slave_info is very huge, and only be used for 802.3ad mode, so alloc the structure dynamically could save 356 Bits for every slave in non 802.3ad mode. Cc: Jay Vosburgh <j.vosburgh@gmail.com> Cc: Veaceslav Falico <vfalico@gmail.com> Cc: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Ding Tianhong <dingtianhong@huawei.com> Acked-by: Veaceslav Falico <vfalico@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-03-11bonding: force cast of IP address in optionsstephen hemminger1-1/+1
The option code is taking IP address and putting it into a generic container. Force cast to silence sparse warnings. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-02-17bonding: Neaten pr_<level>Joe Perches1-3/+3
Add missing terminating newlines. Convert uses of pr_info to pr_cont in bond_check_params. Standardize upper/lower case styles. Typo fixes, remove unnecessary parentheses and periods. Alignment neatening. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert netlink to use slave data info apiJiri Pirko1-2/+19
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22rtnetlink: put "BOND" into nl attribute names which are related to bondingJiri Pirko1-6/+6
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert lp_interval to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so lp_interval would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert resend_igmp to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so resend_igmp would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert all_slaves_active to use the new option APINikolay Aleksandrov1-2/+2
This patch adds the necessary changes so all_slaves_active would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert active_slave to use the new option APINikolay Aleksandrov1-4/+5
This patch adds the necessary changes so active_slave would use the new bonding option API. Also some trivial/style fixes. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert use_carrier to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so use_carrier would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert primary_reselect to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so primary_reselect would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert primary to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so primary would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert miimon to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so miimon would use the new bonding option API. The "default" definition has been removed as it was 0. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert num_peer_notif to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so num_peer_notif would use the new bonding option API. When the auto-sysfs generation is done an alias should be added for this option as there're currently 2 entries in sysfs for it. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert ad_select to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so ad_select would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert min_links to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so min_links would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert lacp_rate to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so lacp_rate would use the new bonding option API. Also some trivial/style error fixes. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert updelay to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so updelay would use the new bonding option API. Also some trivial style fixes. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert downdelay to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so downdelay would use the new bonding option API. Also some trivial style fixes. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert arp_ip_target to use the new option APINikolay Aleksandrov1-4/+11
This patch adds the necessary changes so arp_ip_target would use the new bonding option API. This option is an exception because of the way it's currently implemented that's why its netlink code is a bit different from the other options to keep the functionality as before and at the same time to have a single set function. This patch also fixes a few stylistic errors. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert arp_interval to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so arp_interval would use the new bonding option API. The "default" definition has been removed as it was 0. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert fail_over_mac to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so fail_over_mac would use the new bonding option API. Also fixes a trivial copy/paste error in bond_check_params where the wrong variable was used for the error msg. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert arp_all_targets to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so arp_all_targets would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert arp_validate to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so arp_validate would use the new bonding option API. Also fix some trivial/style errors. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert xmit_hash_policy to use the new option APINikolay Aleksandrov1-1/+2
This patch adds the necessary changes so xmit_hash_policy would use the new bonding option API. Also fix some trivial/style errors. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert packets_per_slave to use the new option APINikolay Aleksandrov1-2/+2
This patch adds the necessary changes so packets_per_slave would use the new bonding option API. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-22bonding: convert mode setting to use the new option APINikolay Aleksandrov1-1/+3
This patch makes the bond's mode setting use the new option API and adds support for dependency printing which relies on having an entry for the mode option in the bond_opts[] array. Also add the ability to print the mode name when mode dependency fails and fix some trivial/style errors. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-21reciprocal_divide: update/correction of the algorithmHannes Frederic Sowa1-4/+0
Jakub Zawadzki noticed that some divisions by reciprocal_divide() were not correct [1][2], which he could also show with BPF code after divisions are transformed into reciprocal_value() for runtime invariance which can be passed to reciprocal_divide() later on; reverse in BPF dump ended up with a different, off-by-one K in some situations. This has been fixed by Eric Dumazet in commit aee636c4809fa5 ("bpf: do not use reciprocal divide"). This follow-up patch improves reciprocal_value() and reciprocal_divide() to work in all cases by using Granlund and Montgomery method, so that also future use is safe and without any non-obvious side-effects. Known problems with the old implementation were that division by 1 always returned 0 and some off-by-ones when the dividend and divisor where very large. This seemed to not be problematic with its current users, as far as we can tell. Eric Dumazet checked for the slab usage, we cannot surely say so in the case of flex_array. Still, in order to fix that, we propose an extension from the original implementation from commit 6a2d7a955d8d resp. [3][4], by using the algorithm proposed in "Division by Invariant Integers Using Multiplication" [5], Torbjörn Granlund and Peter L. Montgomery, that is, pseudocode for q = n/d where q, n, d is in u32 universe: 1) Initialization: int l = ceil(log_2 d) uword m' = floor((1<<32)*((1<<l)-d)/d)+1 int sh_1 = min(l,1) int sh_2 = max(l-1,0) 2) For q = n/d, all uword: uword t = (n*m')>>32 q = (t+((n-t)>>sh_1))>>sh_2 The assembler implementation from Agner Fog [6] also helped a lot while implementing. We have tested the implementation on x86_64, ppc64, i686, s390x; on x86_64/haswell we're still half the latency compared to normal divide. Joint work with Daniel Borkmann. [1] http://www.wireshark.org/~darkjames/reciprocal-buggy.c [2] http://www.wireshark.org/~darkjames/set-and-dump-filter-k-bug.c [3] https://gmplib.org/~tege/division-paper.pdf [4] http://homepage.cs.uiowa.edu/~jones/bcd/divide.html [5] http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.1.2556 [6] http://www.agner.org/optimize/asmlib.zip Reported-by: Jakub Zawadzki <darkjames-ws@darkjames.pl> Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Austin S Hemmelgarn <ahferroin7@gmail.com> Cc: linux-kernel@vger.kernel.org Cc: Jesse Gross <jesse@nicira.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Stephen Hemminger <stephen@networkplumber.org> Cc: Matt Mackall <mpm@selenic.com> Cc: Pekka Enberg <penberg@kernel.org> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Andy Gospodarek <andy@greyhouse.net> Cc: Veaceslav Falico <vfalico@redhat.com> Cc: Jay Vosburgh <fubar@us.ibm.com> Cc: Jakub Zawadzki <darkjames-ws@darkjames.pl> Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-17bonding: add netlink attributes to slave link devsfeldma@cumulusnetworks.com1-0/+36
If link is IFF_SLAVE, extend link dev netlink attributes to include slave attributes with new IFLA_SLAVE nest. Add netlink notification (RTM_NEWLINK) when slave status changes from backup to active, or visa-versa. Adds new ndo_get_slave op to net_device_ops to fill skb with IFLA_SLAVE attributes. Currently only used by bonding driver, but could be used by other aggregating devices with slaves. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-03bonding: fix netlink msg sizesfeldma@cumulusnetworks.com1-0/+1
Add missing space for IFLA_BOND_ARP_IP_TARGET nest header. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-03bonding: add ad_info attribute netlink supportsfeldma@cumulusnetworks.com1-0/+38
Add nested IFLA_BOND_AD_INFO for bonding 802.3ad info. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-03bonding: add ad_select attribute netlink supportsfeldma@cumulusnetworks.com1-0/+14
Add IFLA_BOND_AD_SELECT to allow get/set of bonding parameter ad_select via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2014-01-03bonding: add lacp_rate attribute netlink supportsfeldma@cumulusnetworks.com1-0/+14
Add IFLA_BOND_AD_LACP_RATE to allow get/set of bonding parameter lacp_rate via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-19bonding: add packets_per_slave attribute netlink supportsfeldma@cumulusnetworks.com1-0/+21
Add IFLA_BOND_PACKETS_PER_SLAVE to allow get/set of bonding parameter packets_per_slave via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
2013-12-19bonding: add lp_interval attribute netlink supportsfeldma@cumulusnetworks.com1-0/+14
Add IFLA_BOND_LP_INTERVAL to allow get/set of bonding parameter lp_interval via netlink. Signed-off-by: Scott Feldman <sfeldma@cumulusnetworks.com> Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>