From 22bed39abcdf20c31d685794004ca232308dd6a8 Mon Sep 17 00:00:00 2001 From: Ido Barnea Date: Wed, 9 Mar 2016 13:40:00 +0200 Subject: Support for rx_thread_id instead of latency_thread_id Some white space/indentation cleanup --- src/platform_cfg.cpp | 144 ++++++++++++++++++++++----------------------------- 1 file changed, 63 insertions(+), 81 deletions(-) diff --git a/src/platform_cfg.cpp b/src/platform_cfg.cpp index ec67af64..a76cea2b 100755 --- a/src/platform_cfg.cpp +++ b/src/platform_cfg.cpp @@ -4,7 +4,7 @@ */ /* -Copyright (c) 2015-2015 Cisco Systems, Inc. +Copyright (c) 2015-2016 Cisco Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,16 +19,15 @@ See the License for the specific language governing permissions and limitations under the License. */ -#include "platform_cfg.h" -#include -#include -#include #include - +#include +#include +#include "common/basic_utils.h" +#include "platform_cfg.h" void CPlatformMemoryYamlInfo::reset(){ int i; - i=0; + i=0; for (i=0; i> (const YAML::Node& node, CPlatformDualIfYamlInfo & plat_info) { } } - void operator >> (const YAML::Node& node, CPlatformCoresYamlInfo & plat_info) { node["master_thread_id"] >> plat_info.m_master_thread; - node["latency_thread_id"] >> plat_info.m_rx_thread; + if (node.FindValue("rx_thread_id")) { + node["rx_thread_id"] >> plat_info.m_rx_thread; + } else { + // Obolete option. + if (node.FindValue("latency_thread_id")) { + node["latency_thread_id"] >> plat_info.m_rx_thread; + } else { + node["rx_thread_id"] >> plat_info.m_rx_thread; // do this to get the error message + } + } const YAML::Node& dual_info = node["dual_if"]; for(unsigned i=0;i> (const YAML::Node& node, CPlatformCoresYamlInfo & plat_info) { } } - void CPlatformMemoryYamlInfo::Dump(FILE *fd){ - fprintf(fd," memory per 2x10G ports \n"); const std::string * names =get_mbuf_names(); - int i=0; + int i=0; for (i=0; i> (const YAML::Node& node, CMacYamlInfo & mac_info) { - const YAML::Node& dmac = node["dest_mac"]; for(unsigned i=0;i> (const YAML::Node& node, CMacYamlInfo & mac_info) { } void operator >> (const YAML::Node& node, CPlatformMemoryYamlInfo & plat_info) { - if ( node.FindValue("mbuf_64") ){ - node["mbuf_64"] >> plat_info.m_mbuf[MBUF_64]; + node["mbuf_64"] >> plat_info.m_mbuf[MBUF_64]; } if ( node.FindValue("mbuf_128") ){ - node["mbuf_128"] >> plat_info.m_mbuf[MBUF_128]; + node["mbuf_128"] >> plat_info.m_mbuf[MBUF_128]; } if ( node.FindValue("mbuf_256") ){ - node["mbuf_256"] >> plat_info.m_mbuf[MBUF_256]; + node["mbuf_256"] >> plat_info.m_mbuf[MBUF_256]; } if ( node.FindValue("mbuf_512") ){ - node["mbuf_512"] >> plat_info.m_mbuf[MBUF_512]; + node["mbuf_512"] >> plat_info.m_mbuf[MBUF_512]; } if ( node.FindValue("mbuf_1024") ){ - node["mbuf_1024"] >> plat_info.m_mbuf[MBUF_1024]; + node["mbuf_1024"] >> plat_info.m_mbuf[MBUF_1024]; } if ( node.FindValue("mbuf_2048") ){ - node["mbuf_2048"] >> plat_info.m_mbuf[MBUF_2048]; + node["mbuf_2048"] >> plat_info.m_mbuf[MBUF_2048]; } if ( node.FindValue("mbuf_4096") ){ - node["mbuf_4096"] >> plat_info.m_mbuf[MBUF_4096]; + node["mbuf_4096"] >> plat_info.m_mbuf[MBUF_4096]; } if ( node.FindValue("mbuf_9k") ){ - node["mbuf_9k"] >> plat_info.m_mbuf[MBUF_9k]; + node["mbuf_9k"] >> plat_info.m_mbuf[MBUF_9k]; } if ( node.FindValue("traffic_mbuf_64") ){ - node["traffic_mbuf_64"] >> plat_info.m_mbuf[TRAFFIC_MBUF_64]; + node["traffic_mbuf_64"] >> plat_info.m_mbuf[TRAFFIC_MBUF_64]; } if ( node.FindValue("traffic_mbuf_128") ){ - node["traffic_mbuf_128"] >> plat_info.m_mbuf[TRAFFIC_MBUF_128]; + node["traffic_mbuf_128"] >> plat_info.m_mbuf[TRAFFIC_MBUF_128]; } if ( node.FindValue("traffic_mbuf_256") ){ - node["traffic_mbuf_256"] >> plat_info.m_mbuf[TRAFFIC_MBUF_256]; + node["traffic_mbuf_256"] >> plat_info.m_mbuf[TRAFFIC_MBUF_256]; } if ( node.FindValue("traffic_mbuf_512") ){ - node["traffic_mbuf_512"] >> plat_info.m_mbuf[TRAFFIC_MBUF_512]; + node["traffic_mbuf_512"] >> plat_info.m_mbuf[TRAFFIC_MBUF_512]; } if ( node.FindValue("traffic_mbuf_1024") ){ - node["traffic_mbuf_1024"] >> plat_info.m_mbuf[TRAFFIC_MBUF_1024]; + node["traffic_mbuf_1024"] >> plat_info.m_mbuf[TRAFFIC_MBUF_1024]; } if ( node.FindValue("traffic_mbuf_2048") ){ - node["traffic_mbuf_2048"] >> plat_info.m_mbuf[TRAFFIC_MBUF_2048]; + node["traffic_mbuf_2048"] >> plat_info.m_mbuf[TRAFFIC_MBUF_2048]; } if ( node.FindValue("traffic_mbuf_4096") ){ - node["traffic_mbuf_4096"] >> plat_info.m_mbuf[TRAFFIC_MBUF_4096]; + node["traffic_mbuf_4096"] >> plat_info.m_mbuf[TRAFFIC_MBUF_4096]; } if ( node.FindValue("traffic_mbuf_9k") ){ - node["traffic_mbuf_9k"] >> plat_info.m_mbuf[TRAFFIC_MBUF_9k]; + node["traffic_mbuf_9k"] >> plat_info.m_mbuf[TRAFFIC_MBUF_9k]; } if ( node.FindValue("dp_flows") ){ - node["dp_flows"] >> plat_info.m_mbuf[MBUF_DP_FLOWS]; + node["dp_flows"] >> plat_info.m_mbuf[MBUF_DP_FLOWS]; } if ( node.FindValue("global_flows") ){ - node["global_flows"] >> plat_info.m_mbuf[MBUF_GLOBAL_FLOWS]; + node["global_flows"] >> plat_info.m_mbuf[MBUF_GLOBAL_FLOWS]; } } - void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) { - if (node.FindValue("interface_mask")) { printf("WARNING interface_mask in not used any more !\n"); } @@ -299,7 +289,7 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) { if ( node.FindValue("port_limit") ){ - node["port_limit"] >> plat_info.m_port_limit; + node["port_limit"] >> plat_info.m_port_limit; plat_info.m_port_limit_exist=true; } @@ -307,29 +297,29 @@ void operator >> (const YAML::Node& node, CPlatformYamlInfo & plat_info) { plat_info.m_enable_zmq_pub_exist = true; if ( node.FindValue("enable_zmq_pub") ){ - node["enable_zmq_pub"] >> plat_info.m_enable_zmq_pub; + node["enable_zmq_pub"] >> plat_info.m_enable_zmq_pub; plat_info.m_enable_zmq_pub_exist = true; } if ( node.FindValue("zmq_pub_port") ){ - node["zmq_pub_port"] >> plat_info.m_zmq_pub_port; + node["zmq_pub_port"] >> plat_info.m_zmq_pub_port; plat_info.m_enable_zmq_pub_exist = true; } if ( node.FindValue("prefix") ){ - node["prefix"] >> plat_info.m_prefix; + node["prefix"] >> plat_info.m_prefix; } if ( node.FindValue("limit_memory") ){ - node["limit_memory"] >> plat_info.m_limit_memory; + node["limit_memory"] >> plat_info.m_limit_memory; } if ( node.FindValue("c") ){ - node["c"] >> plat_info.m_thread_per_dual_if; + node["c"] >> plat_info.m_thread_per_dual_if; } if ( node.FindValue("telnet_port") ){ - node["telnet_port"] >> plat_info.m_telnet_port; + node["telnet_port"] >> plat_info.m_telnet_port; plat_info.m_telnet_exist=true; } @@ -388,7 +378,6 @@ int CPlatformYamlInfo::load_from_yaml_file(std::string file_name){ return (0); } - std::string CPlatformYamlInfo::get_use_if_comma_seperated(){ std::string s=""; int i; @@ -399,23 +388,21 @@ std::string CPlatformYamlInfo::get_use_if_comma_seperated(){ return (s); } - void CPlatformYamlInfo::Dump(FILE *fd){ if ( m_info_exist ==false ){ fprintf(fd," file info does not exist \n"); return; } - if (m_port_limit_exist && (m_port_limit != 0xffffffff)) { - fprintf(fd," port limit : %d \n",m_port_limit); + fprintf(fd," port limit : %d \n",m_port_limit); }else{ - fprintf(fd," port limit : not configured \n"); + fprintf(fd," port limit : not configured \n"); } fprintf(fd," port_bandwidth_gb : %lu \n", (ulong)m_port_bandwidth_gb); - + if ( m_if_mask_exist && m_if_mask.size() ) { - fprintf(fd," if_mask : "); + fprintf(fd," if_mask : "); int i; for (i=0; i<(int)m_if_mask.size(); i++) { fprintf(fd," %s,",m_if_mask[i].c_str()); @@ -423,9 +410,9 @@ void CPlatformYamlInfo::Dump(FILE *fd){ fprintf(fd,"\n"); }else{ - fprintf(fd," if_mask : None \n"); + fprintf(fd," if_mask : None \n"); } - + if ( m_prefix.length() ){ fprintf(fd," prefix : %s \n",m_prefix.c_str()); } @@ -460,8 +447,3 @@ void CPlatformYamlInfo::Dump(FILE *fd){ m_memory.Dump(fd); m_platform.Dump(fd); } - - - - - -- cgit 1.2.3-korg