From 08fee9c5d2e1d1f3fe14d00683c2a4b7a17e7876 Mon Sep 17 00:00:00 2001 From: Xavier Simonart Date: Sat, 2 May 2020 21:51:24 +0200 Subject: 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 --- VNFs/DPPD-PROX/packet_utils.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'VNFs/DPPD-PROX/packet_utils.h') diff --git a/VNFs/DPPD-PROX/packet_utils.h b/VNFs/DPPD-PROX/packet_utils.h index a111b944..021528de 100644 --- a/VNFs/DPPD-PROX/packet_utils.h +++ b/VNFs/DPPD-PROX/packet_utils.h @@ -27,7 +27,7 @@ #define FLAG_DST_MAC_KNOWN 1 #define MAX_ARP_ENTRIES 65536 -#define IP4(x) x & 0xff, (x >> 8) & 0xff, (x >> 16) & 0xff, x >> 24 +#define IP4(x) x & 0xff, (x >> 8) & 0xff, (x >> 16) & 0xff, x >> 24 // From Network (BE) enum { SEND_MBUF_AND_ARP, SEND_MBUF, @@ -43,6 +43,7 @@ struct arp_table { uint64_t arp_update_time; uint64_t arp_timeout; uint32_t ip; + uint32_t nh; prox_rte_ether_addr mac; }; struct l3_base { @@ -55,12 +56,15 @@ struct l3_base { uint8_t task_id; uint32_t arp_timeout; uint32_t arp_update_time; + uint seed; + prox_next_hop_index_type nb_gws; struct arp_table gw; struct arp_table optimized_arp_table[4]; struct rte_hash *ip_hash; struct arp_table *arp_table; struct rte_mempool *arp_pool; - uint seed; + struct rte_lpm *ipv4_lpm; + struct arp_table *next_hops; }; void task_init_l3(struct task_base *tbase, struct task_args *targ); @@ -69,6 +73,7 @@ int write_dst_mac(struct task_base *tbase, struct rte_mbuf *mbuf, uint32_t *ip_d void task_set_gateway_ip(struct task_base *tbase, uint32_t ip); void task_set_local_ip(struct task_base *tbase, uint32_t ip); void handle_ctrl_plane_pkts(struct task_base *tbase, struct rte_mbuf **mbufs, uint16_t n_pkts); + static inline void update_arp_update_time(struct l3_base *l3, uint64_t *ptr, uint32_t base) { // randomize timers - from 0.5 to 1.5 * configured time @@ -77,5 +82,4 @@ static inline void update_arp_update_time(struct l3_base *l3, uint64_t *ptr, uin uint64_t rand = 500 + (1000L * rand_r(&l3->seed)) / RAND_MAX; *ptr = tsc + (base * rand / 1000) * hz / 1000; } - #endif /* _PACKET_UTILS_H_ */ -- cgit 1.2.3-korg