netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/8] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c
@ 2009-06-04 14:16 Florian Fainelli
  2009-06-07  8:41 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2009-06-04 14:16 UTC (permalink / raw)
  To: Linux-MIPS, Ralf Baechle, Andrew Morton, netdev, David Miller, l

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 <florian@openwrt.org>
---
diff --git a/net/netfilter/ipvs/Kconfig b/net/netfilter/ipvs/Kconfig
index 79a6980..5b37675 100644
--- a/net/netfilter/ipvs/Kconfig
+++ b/net/netfilter/ipvs/Kconfig
@@ -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
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index f7d74ef..8701212 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/8] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c
  2009-06-04 14:16 [PATCH 3/8] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c Florian Fainelli
@ 2009-06-07  8:41 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2009-06-07  8:41 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Linux-MIPS, Ralf Baechle, Andrew Morton, netdev, David Miller,
	linux-kernel

On Thu, Jun 04, 2009 at 04:16:21PM +0200, Florian Fainelli wrote:
> 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 <florian@openwrt.org>

Acked-by: Simon Horman <horms@verge.net.au>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-06-07  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-04 14:16 [PATCH 3/8] net/netfilter/ipvs/ip_vs_wrr.c: use lib/gcd.c Florian Fainelli
2009-06-07  8:41 ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).