summaryrefslogtreecommitdiffstats
path: root/lib/workqueue.c
Commit message (Collapse)AuthorAgeFilesLines
* *: make sure zebra.h is always included firstDavid Lamparter2015-10-161-1/+1
| | | | | | | | zebra.h pulls in config.h, which results in fiddling with things like __FILE_OFFSET_BITS. It must always be included first, in order to set flags that influence the compiler via <features.h>. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
* lib/workqueue: Add trivial work_queue_is_scheduled helperPaul Jakma2015-09-241-0/+6
|
* Fix most compiler warnings in default GCC build.Paul Jakma2014-09-231-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix lots of warnings. Some const and type-pun breaks strict-aliasing warnings left but much reduced. * bgp_advertise.h: (struct bgp_advertise_fifo) is functionally identical to (struct fifo), so just use that. Makes it clearer the beginning of (struct bgp_advertise) is compatible with with (struct fifo), which seems to be enough for gcc. Add a BGP_ADV_FIFO_HEAD macro to contain the right cast to try shut up type-punning breaks strict aliasing warnings. * bgp_packet.c: Use BGP_ADV_FIFO_HEAD. (bgp_route_refresh_receive) fix an interesting logic error in (!ok || (ret != BLAH)) where ret is only well-defined if ok. * bgp_vty.c: Peer commands should use bgp_vty_return to set their return. * jhash.{c,h}: Can take const on * args without adding issues & fix warnings. * libospf.h: LSA sequence numbers use the unsigned range of values, and constants need to be set to unsigned, or it causes warnings in ospf6d. * md5.h: signedness of caddr_t is implementation specific, change to an explicit (uint_8 *), fix sign/unsigned comparison warnings. * vty.c: (vty_log_fixed) const on level is well-intentioned, but not going to fly given iov_base. * workqueue.c: ALL_LIST_ELEMENTS_RO tests for null pointer, which is always true for address of static variable. Correct but pointless warning in this case, but use a 2nd pointer to shut it up. * ospf6_route.h: Add a comment about the use of (struct prefix) to stuff 2 different 32 bit IDs into in (struct ospf6_route), and the resulting type-pun strict-alias breakage warnings this causes. Need to use 2 different fields to fix that warning? general: * remove unused variables, other than a few cases where they serve a sufficiently useful documentary purpose (e.g. for code that needs fixing), or they're required dummies. In those cases, try mark them as unused. * Remove dead code that can't be reached. * Quite a few 'no ...' forms of vty commands take arguments, but do not check the argument matches the command being negated. E.g., should 'distance X <prefix>' succeed if previously 'distance Y <prefix>' was set? Or should it be required that the distance match the previously configured distance for the prefix? Ultimately, probably better to be strict about this. However, changing from slack to strict might expose problems in command aliases and tools. * Fix uninitialised use of variables. * Fix sign/unsigned comparison warnings by making signedness of types consistent. * Mark functions as static where their use is restricted to the same compilation unit. * Add required headers * Move constants defined in headers into code. * remove dead, unused functions that have no debug purpose.
* general: remove inline qualifiers and move in-header functions to objectsPaul Jakma2012-01-061-1/+1
| | | | | | * (general) Move functions in headers into files, to be compiled into shared object files. Remove inline qualifier from functions. Let the compiler do the work.
* lib: Make workqueue more conservative about ramping upPaul Jakma2010-12-081-8/+9
| | | | | | * workqueue.c: (work_queue_run) Err more on the side of keeping granularity down, by being more conservative about increasing it. Also, fix mispelling.
* [bgp] Fix crash on SIGHUP, deref of freed workqueuesSteve Hill2009-06-021-0/+3
| | | | | | | * lib/workqueue.c: free-ing workqueues had never been tested obviously, queue's thread was not being stopped * bgpd/bgpd.c: null out freed workqueues, to prevent acting on freed workqueues
* + initial edition of meta-queue for RIB updates processing (bug #431)Denis Ovsienko2008-06-021-14/+2
|
* + fixed bug #418 (changing address on an existing interface doesn't cause ↵Denis Ovsienko2007-11-121-5/+19
| | | | existing static routes to be revalidated)
* [lib] Trivial: fix line lengths of a comment in workqueu.cPaul Jakma2006-03-301-2/+3
| | | | | | 2006-03-30 Paul Jakma <paul.jakma@sun.com> * workqueue.c: (work_queue_run) fix line length of comment
* [lib/workqueue] remove the useless 'delay' factor.paul2006-02-021-25/+12
| | | | | | | | | | | | | | 2006-02-02 Paul Jakma <paul.jakma@sun.com> * workqueue.h: (struct work_queue) Remove the delay field. It served no purpose and just introduced bad behaviour. Should be excised before its allowed to escape into 1.0. This removes need for the 'flood' and runs_since_clear fields. * workqueue.c: (general) excise delay factor between queue runs, hence the 'flood' crap too.. See above. * bgp_route.c: (bgp_{clear_node,process}_queue_init) delay field is removed from workqueue spec.
* [workqueue] Update workqueue users callbacks to additional argumentspaul2005-11-141-2/+2
| | | | | | | | | | | | | | 2005-11-14 Paul Jakma <paul.jakma@sun.com> * (general) pass struct work-queue to callback functions. * workqueue.h: (struct work_queue) move the state flag variables to end. Add an opaque pointer to spec, for user-data global to the queue. Pass reference to work_queue to all callbacks. * workqueue.c: (work_queue_item_remove) pass ref to workqueue to user callbacks. (work_queue_run) ditto.
* 2005-11-14 Paul Jakma <paul.jakma@sun.com>paul2005-11-141-11/+27
| | | | | | | | | | | | | | | | | | | | | * (general) Add state to detect queue floods. There's no sense trying to be sparing of CPU resources, if the queue is flooding and using ever more memory resources. we should just get on with clearing the queue. The sense of delay and hold were wrong way around, fix. * workqueue.h: (struct work_queue) Add status bitfield. Add 'flood' integer to workqueue spec. Add runs_since_clear counter to workqueue. * workqueue.c: (work_queue_new) set defaults for delay, hold and flood. (work_queue_add) initial schedule should use delay, not hold. (show_work_queues) Print flood field, conserve whitespace. (work_queue_unplug) use delay, not hold. (work_queue_run) consecutive runs should be seperated by hold time, not delay. Keep track of number of consecutive runs, go into 'overdrive' if queue is being flooded, we can't avoid making heavy use of resources, better to use CPU than ever more RAM.
* 2005-05-23 Paul Jakma <paul@dishone.st>paul2005-05-231-18/+65
| | | | | | | | | | | | | | | | | | | | | | | | * workqueue.h: Add a WQ_QUEUE_BLOCKED item_status return code, to allow a queue function to indicate the queue is not ready/blocked - rather than any problem with the item at hand. Add a notion of being able to 'plug' and 'unplug' a queue. Add helpers to plug/unplug a queue. Add a completion callback, to be called when a queue is emptied. * workqueue.c: (work_queue_new) remove useless list_free. (work_queue_schedule) new internal helper function to schedule queue, if appropriate. (work_queue_add) use work_queue_schedule (show_work_queues) Print 'P' if queue is plugged. (work_queue_plug) new API function, plug a queue - ie prevent it from 'drained' / processed / scheduled. (work_queue_unplug) unplug a queue, allowing it to be drained / scheduled / processed again. (work_queue_run) Add support for WQ_QUEUE_BLOCKED. Add comment for RETRY_NOW case. Make hysteris more aggresive in ramping up granularity, improves performance significantly. Add support for calling completion callback when queue is emptied, possibly useful for knowing when to unplug a queue.
* 2005-04-27 Andrew J. Schorr <ajschorr@alumni.princeton.edu>ajs2005-04-271-3/+0
| | | | * workqueue.c (show_work_queues): Remove unused gettimeofday call.
* 2005-04-27 Paul Jakma <paul.jakma@sun.com>paul2005-04-271-10/+9
| | | | | | | | | | * workqueue.h: (struct work_queue_item) change retry_count to ran, its a count of number item has been run. * workqueue.c: (show_work_queues) Fix formating of slightly bugfix: fix SIGFPE if wq->runs is 0. (work_queue_run) retry logic was slightly wrong. cycles.best is 0 initialy, granularity is 1, so update best if cycles >= granularity, not just >.
* 2005-04-25 Paul Jakma <paul.jakma@sun.com>paul2005-04-251-0/+329
* workqueue.{c,h}: Helper API for setting up and running queues via background threads. * command.c: install the 'show workqueues' command * memtypes.c: Add work queue mtypes, and a rib-queue type for a zebra rib work queue. * memtypes.h: Updated to match memtypes.c * Makefile.am: Add new workqueue files to build.