I wanted to create a clone of one existing rte_lpm structure. It looks like there is no function available in DPDK to do this directly.
Docs: https://doc.dpdk.org/api/rte__lpm_8h.html
Is there any way to clone it manually ?
I wanted to create a clone of one existing rte_lpm structure. It looks like there is no function available in DPDK to do this directly.
Docs: https://doc.dpdk.org/api/rte__lpm_8h.html
Is there any way to clone it manually ?
Unfortunately, there is no such functionality. Also there is also no functionality to iterate over the rules. But there are few options:
We can keep the original routing table along the LPM structure. For example, a simple list. This list will be used to show to a user the routing table.
There are few examples in DPDK, have a look at the l3fwd: https://doc.dpdk.org/guides/sample_app_ug/l3_forward.html
So, instead of creating a deep copy of LPM, we can just create a new one and populate it with the rules form this list.
We can create two LMPs and the very beginning and add rules to both of them. This might slow down the add/delete rule process, but once you need a copy -- you always have it.
Another cons is that you will have just one copy, i.e. if you need a few -- this all not work.
So instead of creating a deep copy of LPM, we just always keep two tables.