diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/routemap.h | 10 | ||||
| -rw-r--r-- | lib/table.c | 1 | ||||
| -rw-r--r-- | lib/thread.c | 76 | ||||
| -rw-r--r-- | lib/thread.h | 1 |
4 files changed, 41 insertions, 47 deletions
diff --git a/lib/routemap.h b/lib/routemap.h index b166de1e09..8c00e8104c 100644 --- a/lib/routemap.h +++ b/lib/routemap.h @@ -194,7 +194,15 @@ extern int route_map_delete_set(struct route_map_index *index, /* Install rule command to the match list. */ extern void route_map_install_match(struct route_map_rule_cmd *cmd); -/* Install rule command to the set list. */ +/* + * Install rule command to the set list. + * + * When installing a particular item, Allow a difference of handling + * of bad cli inputted(return NULL) -vs- this particular daemon cannot use + * this form of the command(return a pointer and handle it appropriately + * in the apply command). See 'set metric' command + * as it is handled in ripd/ripngd and ospfd. + */ extern void route_map_install_set(struct route_map_rule_cmd *cmd); /* Lookup route map by name. */ diff --git a/lib/table.c b/lib/table.c index 67cf6aeec3..b0b0d24ea0 100644 --- a/lib/table.c +++ b/lib/table.c @@ -281,6 +281,7 @@ struct route_node *route_node_get(struct route_table *const table, u_char prefixlen = p->prefixlen; const u_char *prefix = &p->u.prefix; + apply_mask((struct prefix *)p); node = hash_get(table->hash, (void *)p, NULL); if (node && node->info) return route_lock_node(node); diff --git a/lib/thread.c b/lib/thread.c index 4a5c61d036..b39f2d55c2 100644 --- a/lib/thread.c +++ b/lib/thread.c @@ -47,9 +47,6 @@ DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats") write(m->io_pipe[1], &wakebyte, 1); \ } while (0); -/* max # of thread_fetch() calls before we force a poll() */ -#define MAX_TICK_IO 1000 - /* control variable for initializer */ pthread_once_t init_once = PTHREAD_ONCE_INIT; pthread_key_t thread_current; @@ -552,7 +549,7 @@ void thread_master_free(struct thread_master *m) { listnode_delete(masters, m); if (masters->count == 0) { - list_free (masters); + list_free(masters); masters = NULL; } } @@ -1320,6 +1317,20 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) do_thread_cancel(m); /* + * Attempt to flush ready queue before going into poll(). + * This is performance-critical. Think twice before modifying. + */ + if ((thread = thread_trim_head(&m->ready))) { + fetch = thread_run(m, thread, fetch); + if (fetch->ref) + *fetch->ref = NULL; + pthread_mutex_unlock(&m->mtx); + break; + } + + /* otherwise, tick through scheduling sequence */ + + /* * Post events to ready queue. This must come before the * following block since events should occur immediately */ @@ -1362,44 +1373,26 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) memcpy(m->handler.copy, m->handler.pfds, m->handler.copycount * sizeof(struct pollfd)); - /* - * Attempt to flush ready queue before going into poll(). - * This is performance-critical. Think twice before modifying. - */ - if (m->ready.count == 0 || m->tick_since_io >= MAX_TICK_IO) { - pthread_mutex_unlock(&m->mtx); - { - m->tick_since_io = 0; - num = fd_poll(m, m->handler.copy, - m->handler.pfdsize, - m->handler.copycount, tw); - } - pthread_mutex_lock(&m->mtx); - - /* Handle any errors received in poll() */ - if (num < 0) { - if (errno == EINTR) { - pthread_mutex_unlock(&m->mtx); - /* loop around to signal handler */ - continue; - } + pthread_mutex_unlock(&m->mtx); + { + num = fd_poll(m, m->handler.copy, m->handler.pfdsize, + m->handler.copycount, tw); + } + pthread_mutex_lock(&m->mtx); - /* else die */ - zlog_warn("poll() error: %s", - safe_strerror(errno)); + /* Handle any errors received in poll() */ + if (num < 0) { + if (errno == EINTR) { pthread_mutex_unlock(&m->mtx); - fetch = NULL; - break; + /* loop around to signal handler */ + continue; } - /* - * Since we could have received more cancellation - * requests during poll(), process those - */ - do_thread_cancel(m); - - } else { - m->tick_since_io++; + /* else die */ + zlog_warn("poll() error: %s", safe_strerror(errno)); + pthread_mutex_unlock(&m->mtx); + fetch = NULL; + break; } /* Post timers to ready queue. */ @@ -1410,13 +1403,6 @@ struct thread *thread_fetch(struct thread_master *m, struct thread *fetch) if (num > 0) thread_process_io(m, num); - /* have a ready task ==> return it to caller */ - if ((thread = thread_trim_head(&m->ready))) { - fetch = thread_run(m, thread, fetch); - if (fetch->ref) - *fetch->ref = NULL; - } - pthread_mutex_unlock(&m->mtx); } while (!thread && m->spin); diff --git a/lib/thread.h b/lib/thread.h index 86bf4df7c0..c830446e10 100644 --- a/lib/thread.h +++ b/lib/thread.h @@ -70,7 +70,6 @@ struct cancel_req { struct thread_master { char *name; - int tick_since_io; struct thread **read; struct thread **write; struct pqueue *timer; |
