summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/packet_utils.h
diff options
context:
space:
mode:
authorXavier Simonart <xavier.simonart@intel.com>2020-04-29 01:22:10 +0200
committerXavier Simonart <xavier.simonart@intel.com>2020-05-29 23:28:44 +0200
commit9e0c77ef5b6569b8db31269916102f5219bffdc9 (patch)
treef61fe61e20dbd0bfe255d62c5290088bb015c9f2 /VNFs/DPPD-PROX/packet_utils.h
parentca250755c6ecad89fc30507a4c6707eedc658f5d (diff)
Improve ctrlplane performance
The crlplane performance has been improved. This is necessary when handling many IP in L3 mode (i.e. many ARP Requests/Replies). Before this change, arp timer was updated as soon as an arp request was tentativaly sent to the master. This means that, if the request failed to be sent (e.g. ring full) we had to wait arp_update_time (default 1sec) before trying again. Now arp_update_time is only used when an arp reply is received. If a request has been successfully sent, then the arp timer is updated by 1 second (i.e. we will not send any arp reuest for this IP within this second) If we failed to send the request, then the timer is updated by 100 msec which means we will wait 100 msec before trying again. A too high value here would have meant that we have to wait a long time before trying again. A too short value overload the master ring with request to transmit ARP requests, so that master is unable to handle arp replies. arp_update_time is now also partly randomized to avoid all IPs to request arp request at the beginning of the test. So if arp_update_time is 10 sec then the configuration sets it to 5 to 15 sec. As a final note the following parameter (already implemented before) can be changed to improve ctrlplane performance (at the cost of dataplane) ctrl path polling frequency=10000 Change-Id: I9660458a22e7442eaa0c83aaa0c9893a15069f98 Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/packet_utils.h')
-rw-r--r--VNFs/DPPD-PROX/packet_utils.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/VNFs/DPPD-PROX/packet_utils.h b/VNFs/DPPD-PROX/packet_utils.h
index d6e2dbb9..a111b944 100644
--- a/VNFs/DPPD-PROX/packet_utils.h
+++ b/VNFs/DPPD-PROX/packet_utils.h
@@ -60,13 +60,22 @@ struct l3_base {
struct rte_hash *ip_hash;
struct arp_table *arp_table;
struct rte_mempool *arp_pool;
+ uint seed;
};
void task_init_l3(struct task_base *tbase, struct task_args *targ);
void task_start_l3(struct task_base *tbase, struct task_args *targ);
-int write_dst_mac(struct task_base *tbase, struct rte_mbuf *mbuf, uint32_t *ip_dst);
+int write_dst_mac(struct task_base *tbase, struct rte_mbuf *mbuf, uint32_t *ip_dst, uint64_t **time);
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
+ const uint64_t hz = rte_get_tsc_hz();
+ uint64_t tsc = rte_rdtsc();
+ uint64_t rand = 500 + (1000L * rand_r(&l3->seed)) / RAND_MAX;
+ *ptr = tsc + (base * rand / 1000) * hz / 1000;
+}
#endif /* _PACKET_UTILS_H_ */