From 1602ab2067f1752b0c72c2cd1335d210260b3b04 Mon Sep 17 00:00:00 2001 From: Yaroslav Brustinov Date: Thu, 15 Dec 2016 23:39:32 +0200 Subject: [PATCH] issue: trex-295 attach the interfaces one by one in our order instead of init all and reorder. Change-Id: I3bbab970c5e2847b6a6250ec515d8003738c5d97 Signed-off-by: Yaroslav Brustinov --- src/dpdk/lib/librte_ether/rte_ethdev.c | 3 +- src/main_dpdk.cpp | 64 +++++++++++++--------------------- 2 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/dpdk/lib/librte_ether/rte_ethdev.c b/src/dpdk/lib/librte_ether/rte_ethdev.c index e7bc9d6d..06d35656 100644 --- a/src/dpdk/lib/librte_ether/rte_ethdev.c +++ b/src/dpdk/lib/librte_ether/rte_ethdev.c @@ -450,8 +450,7 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id) return -ENODEV; } -/* TREX_PATCH removed "static" */ -int +static int rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id) { int i; diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index f8f365c8..6cd44b57 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -103,8 +103,6 @@ extern "C" { typedef struct rte_mbuf * (*rte_mbuf_convert_to_one_seg_t)(struct rte_mbuf *m); struct rte_mbuf * rte_mbuf_convert_to_one_seg(struct rte_mbuf *m); -extern "C" int rte_eth_dev_get_port_by_addr(const struct rte_pci_addr *addr, uint8_t *port_id); -void reorder_dpdk_ports(); #define RTE_TEST_TX_DESC_DEFAULT 512 #define RTE_TEST_RX_DESC_DROP 0 @@ -5444,12 +5442,10 @@ int update_dpdk_args(void){ global_dpdk_args[global_dpdk_args_num++]=(char *)"-w"; global_dpdk_args[global_dpdk_args_num++]=(char *)lpop->dump_interfaces[i].c_str(); } - } - else { - for (int i=0; i<(int)global_platform_cfg_info.m_if_list.size(); i++) { - global_dpdk_args[global_dpdk_args_num++]=(char *)"-w"; - global_dpdk_args[global_dpdk_args_num++]=(char *)global_platform_cfg_info.m_if_list[i].c_str(); - } + } else { + // add here only first interface. if give them all, they will be sorted alphanumerically. + global_dpdk_args[global_dpdk_args_num++]=(char *)"-w"; + global_dpdk_args[global_dpdk_args_num++]=(char *)global_platform_cfg_info.m_if_list[0].c_str(); } @@ -5598,7 +5594,27 @@ int main_test(int argc , char * argv[]){ dump_interfaces_info(); exit(0); } - reorder_dpdk_ports(); + + // now attach the rest of interfaces in "our" order + for (uint8_t i=1; i 0){ - printf("TRex cfg port id: %d <-> DPDK port id: %d\n", i, port_id); - } - } - - // actual reorder - for (int i=0; i<(int)global_platform_cfg_info.m_if_list.size(); i++) { - memcpy(&rte_eth_devices[m_port_map[i]], &rte_eth_devices_temp[i], sizeof rte_eth_devices_temp[i]); - } -} ////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////// -- 2.16.6