net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c
Subsystems (5)
PATCH 3/8 net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c
This patch removes the open-coded version of the greatest common divider to use lib/gcd.c, the latter also implementing the a < b case.
Signed-off-by Florian Fainelli <[email protected]>
---
net/netfilter/ipvs/Kconfig +1 -0
@@ -113,6 +113,7 @@ config IP_VS_RR config IP_VS_WRR tristate "weighted round-robin scheduling" + select GCD ---help--- The weighted robin-robin scheduling algorithm directs network connections to different real servers based on server weights
net/netfilter/ipvs/ip_vs_wrr.c +1 -14
@@ -21,6 +21,7 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/net.h> +#include <linux/gcd.h> #include <net/ip_vs.h>
@@ -35,20 +36,6 @@ struct ip_vs_wrr_mark { }; -/* -* Get the gcd of server weights -*/ -static int gcd (int a,int b) -{ -int c; - -while ((c = a % b)) { - a = b; - b = c; - } -return b; -} -static int ip_vs_wrr_gcd_weight (struct ip_vs_service *svc) {struct ip_vs_dest *dest;
Quoted 5 lines · Florian Fainelli
This patch removes the open-coded version of the greatest common divider to use
lib/gcd.c, the latter also implementing the a < b case.Signed-off-by Florian Fainelli <[email protected]>
Acked-by Simon Horman <[email protected]>