Merge pull request #3552 from donaldsharp/zebra_combined_meta_peanuts

zebra: Consolidate meta_queue_map into route_info
This commit is contained in:
Mark Stapp 2019-01-08 11:59:45 -05:00 committed by GitHub
commit 91c5235a09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,31 +73,32 @@ extern int allow_delete;
static const struct {
int key;
int distance;
uint8_t meta_q_map;
} route_info[ZEBRA_ROUTE_MAX] = {
[ZEBRA_ROUTE_SYSTEM] = {ZEBRA_ROUTE_SYSTEM, 0},
[ZEBRA_ROUTE_KERNEL] = {ZEBRA_ROUTE_KERNEL, 0},
[ZEBRA_ROUTE_CONNECT] = {ZEBRA_ROUTE_CONNECT, 0},
[ZEBRA_ROUTE_STATIC] = {ZEBRA_ROUTE_STATIC, 1},
[ZEBRA_ROUTE_RIP] = {ZEBRA_ROUTE_RIP, 120},
[ZEBRA_ROUTE_RIPNG] = {ZEBRA_ROUTE_RIPNG, 120},
[ZEBRA_ROUTE_OSPF] = {ZEBRA_ROUTE_OSPF, 110},
[ZEBRA_ROUTE_OSPF6] = {ZEBRA_ROUTE_OSPF6, 110},
[ZEBRA_ROUTE_ISIS] = {ZEBRA_ROUTE_ISIS, 115},
[ZEBRA_ROUTE_BGP] = {ZEBRA_ROUTE_BGP, 20 /* IBGP is 200. */},
[ZEBRA_ROUTE_PIM] = {ZEBRA_ROUTE_PIM, 255},
[ZEBRA_ROUTE_EIGRP] = {ZEBRA_ROUTE_EIGRP, 90},
[ZEBRA_ROUTE_NHRP] = {ZEBRA_ROUTE_NHRP, 10},
[ZEBRA_ROUTE_HSLS] = {ZEBRA_ROUTE_HSLS, 255},
[ZEBRA_ROUTE_OLSR] = {ZEBRA_ROUTE_OLSR, 255},
[ZEBRA_ROUTE_TABLE] = {ZEBRA_ROUTE_TABLE, 150},
[ZEBRA_ROUTE_LDP] = {ZEBRA_ROUTE_LDP, 150},
[ZEBRA_ROUTE_VNC] = {ZEBRA_ROUTE_VNC, 20},
[ZEBRA_ROUT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TABLE] = {ZEBRA_ROUTE_TABLE, 150, 1},
[ZEBRA_ROUTE_LDP] = {ZEBRA_ROUTE_LDP, 150, 4},
[ZEBRA_ROUTE_VNC] = {ZEBRA_ROUTE_VNC, 20, 3},
[ZEBRA_ROUTE_VNC_DIRECT] = {ZEBRA_ROUTE_VNC_DIRECT, 20, 3},
[ZEBRA_ROUTE_VNC_DIRECT_RH] = {ZEBRA_ROUTE_VNC_DIRECT_RH, 20, 3},
[ZEBRA_ROUTE_BGP_DIRECT] = {ZEBRA_ROUTE_BGP_DIRECT, 20, 3},
[ZEBRA_ROUTE_BGP_DIRECT_EXT] = {ZEBRA_ROUTE_BGP_DIRECT_EXT, 20, 3},
[ZEBRA_ROUTE_BABEL] = {ZEBRA_ROUTE_BABEL, 100, 2},
[ZEBRA_ROUTE_SHARP] = {ZEBRA_ROUTE_SHARP, 150, 4},
/* no entry/default: 150 */
};
@ -2143,36 +2144,6 @@ static wq_item_status meta_queue_process(struct work_queue *dummy, void *data)
return mq->size ? WQ_REQUEUE : WQ_SUCCESS;
}
/*
* Map from rib types to queue type (priority) in meta queue
*/
static const uint8_t meta_queue_map[ZEBRA_ROUTE_MAX] = {
[ZEBRA_ROUTE_SYSTEM] = 4,
[ZEBRA_ROUTE_KERNEL] = 0,
[ZEBRA_ROUTE_CONNECT] = 0,
[ZEBRA_ROUTE_STATIC] = 1,
[ZEBRA_ROUTE_RIP] = 2,
[ZEBRA_ROUTE_RIPNG] = 2,
[ZEBRA_ROUTE_OSPF] = 2,
[ZEBRA_ROUTE_OSPF6] = 2,
[ZEBRA_ROUTE_ISIS] = 2,
[ZEBRA_ROUTE_BGP] = 3,
[ZEBRA_ROUTE_PIM] = 4, // Shouldn't happen but for safety
[ZEBRA_ROUTE_EIGRP] = 2,
[ZEBRA_ROUTE_NHRP] = 2,
[ZEBRA_ROUTE_HSLS] = 4,
[ZEBRA_ROUTE_OLSR] = 4,
[ZEBRA_ROUTE_TABLE] = 1,
[ZEBRA_ROUTE_LDP] = 4,
[ZEBRA_ROUTE_VNC] = 3,
[ZEBRA_ROUTE_VNC_DIRECT] = 3,
[ZEBRA_ROUTE_VNC_DIRECT_RH] = 3,
[ZEBRA_ROUTE_BGP_DIRECT] = 3,
[ZEBRA_ROUTE_BGP_DIRECT_EXT] = 3,
[ZEBRA_ROUTE_BABEL] = 2,
[ZEBRA_ROUTE_ALL] = 4, // Shouldn't happen but for safety
};
/* Look into the RN and queue it into one or more priority queues,
* increasing the size for each data push done.
*/
@ -2181,7 +2152,7 @@ static void rib_meta_queue_add(struct meta_queue *mq, struct route_node *rn)
struct route_entry *re;
RNODE_FOREACH_RE (rn, re) {
uint8_t qindex = meta_queue_map[re->type];
uint8_t qindex = route_info[re->type].meta_q_map;
struct zebra_vrf *zvrf;
/* Invariant: at this point we always have rn->info set. */