Closed xwedea closed 2 years ago
@twood02 we allocate and free lb->weights and lb->policy using standard malloc and free functions. However, in the previous of the code dpdk's function rte_calloc and rte_free are used. Should I edit this code to use those functions? I am not sure how to free them later in that case.
@twood02 we allocate and free lb->weights and lb->policy using standard malloc and free functions. However, in the previous of the code dpdk's function rte_calloc and rte_free are used. Should I edit this code to use those functions? I am not sure how to free them later in that case.
The main differences between normal malloc and rte_malloc are:
rte_malloc
allocates memory in the DPDK shared memory pool. This allows all NFs and the manager to access the data. That can either be a good thing or a bad thingrte_malloc
is much faster than malloc
if you are frequently allocating and freeing objects (if you want to understand why, read about DPDK memory allocation and pools here)For your use case, you are allocating memory which will only be used by the LB NF and you are only doing it once when the NF starts. So it is fine to use normal malloc here.
@twood02 I removed the commented code and did a final check with all policies. this should be good to go
@xwedea - can you put a description of what this PR adds at the top of this page. When we make our release notes for each ONVM version we go back to the PRs to get short descriptions of each new feature.
Otherwise this looks good and I will merge it into develop. Then next week we'll go through a full review process with @andreaseno's PR where he will run the NFs and demonstrate it working for me.
@twood02 I put a description.
This PR adds 2 new policies to the load balancer: Random and Weighted Random.
After this PR, there are 3 policies that can be specified in the configuration file as:
Summary:
Usage:
Merging notes:
TODO before merging :
Test Plan:
Review:
(optional) << @-mention people who should review these changes >>
(optional) Subscribers: << @-mention people who probably care about these changes >>