[Olsr-cvs] olsrd-current/src/linux kernel_routes.c,1.34,1.35

Bernd Petrovitsch (spam-protected)
Wed Dec 12 22:57:29 CET 2007


Update of /cvsroot/olsrd/olsrd-current/src/linux
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15735/src/linux

Modified Files:
	kernel_routes.c 
Log Message:
applied patch by Hannes Gredler <(spam-protected)>::

pls find attached a pointer for further CPU savings in olsrd.
even in large networks (>250 nodes) the avg. CPU utilization
does not get beyond 0.5% CPU load on standard 200Mhz WRT hardware.

patch from http://gredler.at/download/olsrd/rib2-refactoring4.diff

change-list:

- avoid the periodical rib-tree insertion

- add a FOR_ALL_HNA_RT_ENTRIES() macro for the snmp folks
    (or any parties who want to walk HNA entries).

- add an olsr_cnf option 'flat_fib_metrics' which defaults to TRUE.

   this is as per sven-olas request who has expressed concerns
   that the current flap-metric style is a bit unpleasant for troubleshooting.

   note that i have not yet added the cfg file parser routine for that -
   just the required tweaks in the change-processing FIB code.



Index: kernel_routes.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/linux/kernel_routes.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** kernel_routes.c	2 Dec 2007 19:00:28 -0000	1.34
--- kernel_routes.c	12 Dec 2007 21:57:27 -0000	1.35
***************
*** 88,94 ****
  		0
  	};
! 	olsr_u32_t metric = 1;
  	const struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ?
  		&rt->rt_best->rtp_nexthop : &rt->rt_nexthop;
  
  	memset(&req, 0, sizeof(req));
--- 88,96 ----
  		0
  	};
!         olsr_u32_t metric = RT_METRIC_DEFAULT;
  	const struct rt_nexthop* nexthop = (RTM_NEWROUTE == cmd) ?
  		&rt->rt_best->rtp_nexthop : &rt->rt_nexthop;
+ 	const struct rt_metric* met = (RTM_NEWROUTE == cmd) ?
+ 		&rt->rt_best->rtp_metric : &rt->rt_metric;
  
  	memset(&req, 0, sizeof(req));
***************
*** 109,113 ****
  			olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4));
  			req.r.rtm_scope = RT_SCOPE_UNIVERSE;
! 			metric = RT_METRIC_DEFAULT;
  		}
  		olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v4, sizeof(rt->rt_dst.prefix.v4));
--- 111,115 ----
  			olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v4, sizeof(nexthop->gateway.v4));
  			req.r.rtm_scope = RT_SCOPE_UNIVERSE;
! 			metric = olsr_fib_metric(met);
  		}
  		olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v4, sizeof(rt->rt_dst.prefix.v4));
***************
*** 119,123 ****
  			olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6));
  			req.r.rtm_scope = RT_SCOPE_UNIVERSE;
! 			metric = RT_METRIC_DEFAULT;
  		}
  		olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v6, sizeof(rt->rt_dst.prefix.v6));
--- 121,125 ----
  			olsr_netlink_addreq(&req, RTA_GATEWAY, &nexthop->gateway.v6, sizeof(nexthop->gateway.v6));
  			req.r.rtm_scope = RT_SCOPE_UNIVERSE;
! 			metric = olsr_fib_metric(met);
  		}
  		olsr_netlink_addreq(&req, RTA_DST, &rt->rt_dst.prefix.v6, sizeof(rt->rt_dst.prefix.v6));
***************
*** 204,208 ****
  
    kernel_route.rt_flags = olsr_rt_flags(rt);
!   kernel_route.rt_metric = RT_METRIC_DEFAULT;
  
    /*
--- 206,210 ----
  
    kernel_route.rt_flags = olsr_rt_flags(rt);
!   kernel_route.rt_metric = olsr_fib_metric(&rt->rt_best->rtp_metric.hops);
  
    /*
***************
*** 269,273 ****
  
    kernel_route.rtmsg_flags = olsr_rt_flags(rt);
!   kernel_route.rtmsg_metric = RT_METRIC_DEFAULT;
    
    /*
--- 271,275 ----
  
    kernel_route.rtmsg_flags = olsr_rt_flags(rt);
!   kernel_route.rtmsg_metric = olsr_fib_metric(&rt->rt_best->rtp_metric.hops);
    
    /*
***************
*** 333,337 ****
  
    kernel_route.rt_flags = olsr_rt_flags(rt);
!   kernel_route.rt_metric = RT_METRIC_DEFAULT;
  
    /*
--- 335,339 ----
  
    kernel_route.rt_flags = olsr_rt_flags(rt);
!   kernel_route.rt_metric = olsr_fib_metric(&rt->rt_metric.hops);
  
    /*
***************
*** 389,393 ****
  
    kernel_route.rtmsg_flags = olsr_rt_flags(rt);
!   kernel_route.rtmsg_metric = RT_METRIC_DEFAULT;
  
    if ((rslt = ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route) >= 0)) {
--- 391,395 ----
  
    kernel_route.rtmsg_flags = olsr_rt_flags(rt);
!   kernel_route.rtmsg_metric = olsr_fib_metric(&rt->rt_best->rtp_metric.hops);
  
    if ((rslt = ioctl(olsr_cnf->ioctl_s, SIOCDELRT, &kernel_route) >= 0)) {





More information about the Olsr-cvs mailing list