diff options
author | Vratko Polak <vrpolak@cisco.com> | 2022-09-22 15:50:29 +0200 |
---|---|---|
committer | Viliam Luc <vluc@cisco.com> | 2022-10-11 09:08:26 +0200 |
commit | 466674c41326aa5765f18805a9dbc37a8df7918a (patch) | |
tree | fce63e23c1f012768414e3c8c9640722047197ea /resources/libraries/python/DPDK/L3fwdTest.py | |
parent | e354b47df550caf96cc886f91ea16ff9ce8444d8 (diff) |
fix: l3fwd config
Flipping logic depends whether TG and DUT ports are reordered.
# If TG and DUT ports are reordered -> flip
# If TG reordered and DUT not reordered -> don't flip
# If DUT reordered and TG not reordered -> don't flip
# If DUT and TG not reordered -> flip
Change-Id: I7202a17e03e48d112ed5b98e3ef0e3816ce50f14
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/DPDK/L3fwdTest.py')
-rw-r--r-- | resources/libraries/python/DPDK/L3fwdTest.py | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/resources/libraries/python/DPDK/L3fwdTest.py b/resources/libraries/python/DPDK/L3fwdTest.py index 2ceeab2a51..265806c7e9 100644 --- a/resources/libraries/python/DPDK/L3fwdTest.py +++ b/resources/libraries/python/DPDK/L3fwdTest.py @@ -55,6 +55,7 @@ class L3fwdTest: """ cpu_count_int = dp_count_int = int(phy_cores) dp_cores = cpu_count_int+1 + tg_flip = topology_info[f"tg_if1_pci"] > topology_info[f"tg_if2_pci"] for node in nodes: if u"DUT" in node: compute_resource_info = CpuUtils.get_affinity_vswitch( @@ -76,7 +77,7 @@ class L3fwdTest: L3fwdTest.start_l3fwd( nodes, nodes[node], if1=if1, if2=if2, lcores_list=cpu_dp, nb_cores=dp_count_int, queue_nums=rxq_count_int, - jumbo_frames=jumbo_frames + jumbo_frames=jumbo_frames, tg_flip=tg_flip ) for node in nodes: if u"DUT" in node: @@ -88,7 +89,8 @@ class L3fwdTest: L3fwdTest.start_l3fwd( nodes, nodes[node], if1=if1, if2=if2, lcores_list=cpu_dp, nb_cores=dp_count_int, - queue_nums=rxq_count_int, jumbo_frames=jumbo_frames + queue_nums=rxq_count_int, jumbo_frames=jumbo_frames, + tg_flip=tg_flip ) else: message = f"Failed to start l3fwd at node {node}" @@ -97,10 +99,14 @@ class L3fwdTest: @staticmethod def start_l3fwd( nodes, node, if1, if2, lcores_list, nb_cores, queue_nums, - jumbo_frames): + jumbo_frames, tg_flip): """ Execute the l3fwd on the dut_node. + L3fwd uses default IP forwarding table, but sorts ports by API address. + When that does not match the traffic profile (depends on topology), + the only way to fix is is to latch and recompile l3fwd app. + :param nodes: All the nodes info in the topology file. :param node: DUT node. :param if1: The test link interface 1. @@ -110,6 +116,7 @@ class L3fwdTest: :param queue_nums: The queues number for the NIC :param jumbo_frames: Indication if the jumbo frames are used (True) or not (False). + :param tg_flip: Whether TG ports are reordered. :type nodes: dict :type node: dict :type if1: str @@ -118,10 +125,11 @@ class L3fwdTest: :type nb_cores: str :type queue_nums: str :type jumbo_frames: bool + :type tg_flip: bool """ if node[u"type"] == NodeType.DUT: adj_mac0, adj_mac1, if_pci0, if_pci1 = L3fwdTest.get_adj_mac( - nodes, node, if1, if2 + nodes, node, if1, if2, tg_flip ) lcores = [int(item) for item in lcores_list.split(u",")] @@ -184,18 +192,24 @@ class L3fwdTest: exec_cmd_no_error(node, command, timeout=1800, message=message) @staticmethod - def get_adj_mac(nodes, node, if1, if2): + def get_adj_mac(nodes, node, if1, if2, tg_flip): """ Get adjacency MAC addresses of the DUT node. + Interfaces are re-ordered according to PCI address, + but the need to patch and recompile also depends on TG port order. + "tg_flip" signals whether TG ports are reordered. + :param nodes: All the nodes info in the topology file. :param node: DUT node. :param if1: The test link interface 1. :param if2: The test link interface 2. + :param tg_flip: Whether tg ports are reordered. :type nodes: dict :type node: dict :type if1: str :type if2: str + :type tg_flip: bool :returns: Returns MAC addresses of adjacency DUT nodes and PCI addresses. :rtype: str @@ -205,9 +219,19 @@ class L3fwdTest: if_pci0 = Topology.get_interface_pci_addr(node, if_key0) if_pci1 = Topology.get_interface_pci_addr(node, if_key1) + # Flipping routes logic: + # If TG and DUT ports are reordered -> flip + # If TG reordered and DUT not reordered -> don't flip + # If DUT reordered and TG not reordered -> don't flip + # If DUT and TG not reordered -> flip + # Detect which is the port 0. - if min(if_pci0, if_pci1) != if_pci0: + dut_flip = if_pci0 > if_pci1 + if dut_flip: if_key0, if_key1 = if_key1, if_key0 + if tg_flip: + L3fwdTest.patch_l3fwd(node, u"patch_l3fwd_flip_routes") + elif not tg_flip: L3fwdTest.patch_l3fwd(node, u"patch_l3fwd_flip_routes") adj_node0, adj_if_key0 = Topology.get_adjacent_node_and_interface( |