diff options
author | imarom <imarom@cisco.com> | 2016-12-13 19:06:48 +0200 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2016-12-13 19:06:48 +0200 |
commit | 603bd7a4d9dcb8058812633ac60a75598578cb83 (patch) | |
tree | 71cf010b8568e02bf6d5a7d9af7477f8e4bb8d28 | |
parent | 0fdd81a94d62592b0ec9888022d793f670c8476f (diff) |
startup issues with L2/L3
Signed-off-by: imarom <imarom@cisco.com>
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 2 | ||||
-rw-r--r-- | src/main_dpdk.cpp | 41 |
2 files changed, 23 insertions, 20 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index e44fe801..487f3055 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -903,7 +903,7 @@ class Port(object): # Grat ARP grat_arp = rx_info['grat_arp'] if grat_arp['is_active']: - info['grat_arp'] = grat_arp['interval_sec'] + info['grat_arp'] = "every {0} seconds".format(grat_arp['interval_sec']) else: info['grat_arp'] = "off" diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp index e26aaa22..45c37260 100644 --- a/src/main_dpdk.cpp +++ b/src/main_dpdk.cpp @@ -3309,17 +3309,32 @@ void CGlobalTRex::pre_test() { // Configure port back to normal mode. Only relevant packets handled by software. CTRexExtendedDriverDb::Ins()->get_drv()->set_rcv_all(pif, false); - /* set resolved IPv4 */ - uint32_t dg = CGlobalInfo::m_options.m_ip_cfg[port_id].get_def_gw(); - const uint8_t *dst_mac = CGlobalInfo::m_options.m_mac_addr[port_id].u.m_mac.dest; - if (dg) { - m_ports[port_id].get_port_attr()->get_dest().set_dest(dg, dst_mac); - } else { - m_ports[port_id].get_port_attr()->get_dest().set_dest(dst_mac); } + } + + /* for stateless only - set port mode */ + if (get_is_stateless()) { + for (int port_id = 0; port_id < m_max_ports; port_id++) { + uint32_t src_ipv4 = CGlobalInfo::m_options.m_ip_cfg[port_id].get_ip(); + uint32_t dg = CGlobalInfo::m_options.m_ip_cfg[port_id].get_def_gw(); + const uint8_t *dst_mac = CGlobalInfo::m_options.m_mac_addr[port_id].u.m_mac.dest; + + /* L3 mode */ + if (src_ipv4 && dg) { + if (memcmp(dst_mac, empty_mac, 6) == 0) { + m_trex_stateless->get_port_by_id(port_id)->set_l3_mode(src_ipv4, dg); + } else { + m_trex_stateless->get_port_by_id(port_id)->set_l3_mode(src_ipv4, dg, dst_mac); + } + /* L2 mode */ + } else { + m_trex_stateless->get_port_by_id(port_id)->set_l2_mode(dst_mac); + } } } + + } /** @@ -4893,18 +4908,6 @@ bool CPhyEthIF::Create(uint8_t portid) { (struct ether_addr *)&CGlobalInfo::m_options.m_mac_addr[m_port_id].u.m_mac.src); } - /* set src IPv4 */ - uint32_t src_ipv4 = CGlobalInfo::m_options.m_ip_cfg[m_port_id].get_ip(); - if (src_ipv4) { - m_port_attr->set_src_ipv4(src_ipv4); - } - - /* for now set as unresolved IPv4 destination */ - uint32_t dest_ipv4 = CGlobalInfo::m_options.m_ip_cfg[m_port_id].get_def_gw(); - if (dest_ipv4) { - m_port_attr->get_dest().set_dest(dest_ipv4); - } - return true; } |