[quagga-dev 8205] Re: [PATCH 2/3] BGP: use Jenkins hash for transit and cluster

Balaji G balajig81 at gmail.com
Sat Aug 28 17:41:38 BST 2010


Hi Stephen

Applied, Thanks

Cheers,
  - Balaji


On Sat, Aug 28, 2010 at 2:42 AM, Stephen Hemminger <shemminger at vyatta.com>wrote:

> Existing BGP attribute hash was using simple additive method,
> convert to Jenkins hash.
>
> Signed-off-by: Stephen Hemminger <shemminger at vyatta.com>
> ---
>  bgpd/bgp_attr.c |   27 +++++----------------------
>  1 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
> index 94d402b..7641edf 100644
> --- a/bgpd/bgp_attr.c
> +++ b/bgpd/bgp_attr.c
> @@ -28,6 +28,7 @@ Software Foundation, Inc., 59 Temple Place - Suite 330,
> Boston, MA
>  #include "stream.h"
>  #include "log.h"
>  #include "hash.h"
> +#include "jhash.h"
>
>  #include "bgpd/bgpd.h"
>  #include "bgpd/bgp_attr.h"
> @@ -116,18 +117,9 @@ cluster_loop_check (struct cluster_list *cluster,
> struct in_addr originator)
>  static unsigned int
>  cluster_hash_key_make (void *p)
>  {
> -  struct cluster_list * cluster = (struct cluster_list *) p;
> -  unsigned int key = 0;
> -  int length;
> -  caddr_t pnt;
> -
> -  length = cluster->length;
> -  pnt = (caddr_t) cluster->list;
> -
> -  while (length)
> -    key += pnt[--length];
> +  const struct cluster_list *cluster = p;
>
> -  return key;
> +  return jhash(cluster->list, cluster->length, 0);
>  }
>
>  static int
> @@ -258,18 +250,9 @@ transit_unintern (struct transit *transit)
>  static unsigned int
>  transit_hash_key_make (void *p)
>  {
> -  struct transit * transit = (struct transit *) p;
> -  unsigned int key = 0;
> -  int length;
> -  caddr_t pnt;
> -
> -  length = transit->length;
> -  pnt = (caddr_t) transit->val;
> -
> -  while (length)
> -    key += pnt[--length];
> +  const struct transit * transit = p;
>
> -  return key;
> +  return jhash(transit->val, transit->length, 0);
>  }
>
>  static int
> --
> 1.7.0.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.quagga.net/pipermail/quagga-dev/attachments/20100828/4f32d2de/attachment-0001.html>


More information about the Quagga-dev mailing list