diff options
author | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-02 21:51:24 +0200 |
---|---|---|
committer | Xavier Simonart <xavier.simonart@intel.com> | 2020-05-29 23:31:54 +0200 |
commit | 08fee9c5d2e1d1f3fe14d00683c2a4b7a17e7876 (patch) | |
tree | 5b1f2a9aaab23b654c9504f83eaa1cb8ac2a0b01 /VNFs/DPPD-PROX/prox_lua_types.c | |
parent | 354bfce1e946ec796516b3ae7f3fc677960867ef (diff) |
Added initial support for BGP
Through this commit BGP messages are forwarded to tap device
Netlink messages are enabled to receive route Updates.
In addition, generating tasks can also specify a routing table
which will be used when sending packets
The routes initialized by the routing table can be changed through
the reception of BGP messages
Change-Id: I187ba9a921885cbc9b209aae5fb654309e3388b8
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/prox_lua_types.c')
-rw-r--r-- | VNFs/DPPD-PROX/prox_lua_types.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/VNFs/DPPD-PROX/prox_lua_types.c b/VNFs/DPPD-PROX/prox_lua_types.c index 3ef3d472..bc1671d4 100644 --- a/VNFs/DPPD-PROX/prox_lua_types.c +++ b/VNFs/DPPD-PROX/prox_lua_types.c @@ -437,11 +437,11 @@ int lua_to_next_hop(struct lua_State *L, enum lua_place from, const char *name, while (lua_next(L, -2)) { if (lua_to_int(L, TABLE, "id", &next_hop_index) || lua_to_int(L, TABLE, "port_id", &port_id) || - lua_to_ip(L, TABLE, "ip", &ip) || - lua_to_mac(L, TABLE, "mac", &mac) || - lua_to_int(L, TABLE, "mpls", &mpls)) + lua_to_ip(L, TABLE, "ip", &ip)) return -1; + lua_to_mac(L, TABLE, "mac", &mac); + lua_to_int(L, TABLE, "mpls", &mpls); PROX_PANIC(port_id >= PROX_MAX_PORTS, "Port id too high (only supporting %d ports)\n", PROX_MAX_PORTS); PROX_PANIC(next_hop_index >= MAX_HOP_INDEX, "Next-hop to high (only supporting %d next hops)\n", MAX_HOP_INDEX); @@ -504,6 +504,7 @@ int lua_to_next_hop6(struct lua_State *L, enum lua_place from, const char *name, return 0; } +#define MAX_NEW_RULES 128 int lua_to_routes4(struct lua_State *L, enum lua_place from, const char *name, uint8_t socket, struct lpm4 *lpm) { struct ip4_subnet dst; @@ -514,11 +515,12 @@ int lua_to_routes4(struct lua_State *L, enum lua_place from, const char *name, u char lpm_name[64]; int ret; int pop; + static int count = 1; if ((pop = lua_getfrom(L, from, name)) < 0) return -1; - snprintf(lpm_name, sizeof(lpm_name), "IPv4_lpm_s%u", socket); + snprintf(lpm_name, sizeof(lpm_name), "IPv4_lpm_s%u_%d", socket, count++); if (!lua_istable(L, -1)) { set_err("Data is not a table\n"); @@ -531,12 +533,12 @@ int lua_to_routes4(struct lua_State *L, enum lua_place from, const char *name, u lua_pop(L, 1); #if RTE_VERSION >= RTE_VERSION_NUM(16,4,0,1) struct rte_lpm_config conf; - conf.max_rules = 2 * n_tot_rules; + conf.max_rules = 2 * n_tot_rules + MAX_NEW_RULES; conf.number_tbl8s = 256; conf.flags = 0; new_lpm = rte_lpm_create(lpm_name, socket, &conf); #else - new_lpm = rte_lpm_create(lpm_name, socket, 2 * n_tot_rules, 0); + new_lpm = rte_lpm_create(lpm_name, socket, 2 * n_tot_rules + MAX_NEW_RULES, 0); #endif PROX_PANIC(NULL == new_lpm, "Failed to allocate lpm\n"); |