added support for C++ 2011
authorimarom <[email protected]>
Mon, 10 Aug 2015 03:36:58 +0000 (23:36 -0400)
committerimarom <[email protected]>
Mon, 10 Aug 2015 03:36:58 +0000 (23:36 -0400)
this includes refactoring the flags and adding for c++ the flag std=c++0x

linux_dpdk/ws_main.py
src/main_dpdk.cpp
src/pal/linux_dpdk/dpdk180/rte_config.h

index 756b89e..223a81f 100755 (executable)
@@ -333,42 +333,39 @@ l2fwd =SrcGroups([
                 l2fwd_main_src]);
 
 
-
-cxxflags_base =['-DWIN_UCODE_SIM',
-           '-D_BYTE_ORDER',
-           '-Wno-format',
-           '-D_LITTLE_ENDIAN',
-           '-DLINUX',
-           '-g',
-           '-DRTE_DPDK',
-           '-march=native',
-           '-DRTE_MACHINE_CPUFLAG_SSE',
-           '-DRTE_MACHINE_CPUFLAG_SSE2',
-           '-DRTE_MACHINE_CPUFLAG_SSE3',
-           '-DRTE_MACHINE_CPUFLAG_SSSE3',
-           '-DRTE_MACHINE_CPUFLAG_SSE4_1',
-           '-DRTE_MACHINE_CPUFLAG_SSE4_2',
-           '-DRTE_MACHINE_CPUFLAG_AES',
-           '-DRTE_MACHINE_CPUFLAG_PCLMULQDQ',
-           '-DRTE_MACHINE_CPUFLAG_AVX',
-           '-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX',
-           '-include','../src/pal/linux_dpdk/dpdk180/rte_config.h'
-       ];
-
-cxxflags_base_old =['-DWIN_UCODE_SIM',
-           '-D_BYTE_ORDER',
-           '-D_LITTLE_ENDIAN',
-           '-DLINUX',
-           '-Wno-format',
-           '-DUCS_210',
-           '-g',
-           '-DRTE_DPDK',
-           '-march=corei7',
-           '-mtune=generic',
-           '-DRTE_MACHINE_CPUFLAG_SSE',
-           '-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE',
-           '-include','../src/pal/linux_dpdk/dpdk180/rte_config.h'
-       ];
+# common flags for both new and old configurations
+common_flags = ['-DWIN_UCODE_SIM',
+                '-D_BYTE_ORDER',
+                '-D_LITTLE_ENDIAN',
+                '-DLINUX',
+                '-g',
+                '-Wno-format',
+                '-Wno-deprecated-declarations',
+                '-DRTE_DPDK',
+                '-include','../src/pal/linux_dpdk/dpdk180/rte_config.h'
+               ]
+
+common_flags_new = common_flags + [
+                    '-march=native',
+                    '-DRTE_MACHINE_CPUFLAG_SSE',
+                    '-DRTE_MACHINE_CPUFLAG_SSE2',
+                    '-DRTE_MACHINE_CPUFLAG_SSE3',
+                    '-DRTE_MACHINE_CPUFLAG_SSSE3',
+                    '-DRTE_MACHINE_CPUFLAG_SSE4_1',
+                    '-DRTE_MACHINE_CPUFLAG_SSE4_2',
+                    '-DRTE_MACHINE_CPUFLAG_AES',
+                    '-DRTE_MACHINE_CPUFLAG_PCLMULQDQ',
+                    '-DRTE_MACHINE_CPUFLAG_AVX',
+                    '-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE3,RTE_CPUFLAG_SSE,RTE_CPUFLAG_SSE2,RTE_CPUFLAG_SSSE3,RTE_CPUFLAG_SSE4_1,RTE_CPUFLAG_SSE4_2,RTE_CPUFLAG_AES,RTE_CPUFLAG_PCLMULQDQ,RTE_CPUFLAG_AVX',
+                   ]
+
+common_flags_old = common_flags + [
+                      '-march=corei7',
+                      '-DUCS_210',
+                      '-mtune=generic',
+                      '-DRTE_MACHINE_CPUFLAG_SSE',
+                      '-DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE',
+                      ];
 
 
 
@@ -503,20 +500,6 @@ class build_option:
             trg += delimiter + "o"
         return trg;
 
-    def cxxcomp_flags (self,flags):
-        result = copy.copy(flags);
-        if self.is64Platform () :
-            result+=['-m64'];
-        else:
-            result+=['-m32'];
-
-        if self.isRelease () :
-            result+=['-O3'];
-        else:
-            result+=['-O0'];#'-DDEBUG','-D_DEBUG','-DSTILE_CPP_ASSERT','-DSTILE_SHIM_ASSERT'
-
-        return result;
-
     def get_target (self):
         return self.update_executable_name("_t-rex");
 
@@ -526,12 +509,37 @@ class build_option:
     def get_dpdk_target (self):
         return self.update_executable_name("dpdk");
 
-    def get_flags (self):
+    def get_common_flags (self):
         if self.isPIE():
-            return self.cxxcomp_flags(cxxflags_base_old);
+            flags = copy.copy(common_flags_old)
         else:
-            return self.cxxcomp_flags(cxxflags_base);
+            flags = copy.copy(common_flags_new);
+
+        if self.is64Platform () :
+            flags += ['-m64'];
+        else:
+            flags += ['-m32'];
+
+        if self.isRelease () :
+            flags += ['-O3'];
+        else:
+            flags += ['-O0'];
+
+        return (flags)
+
+    def get_cxx_flags (self):
+        flags = self.get_common_flags()
+
+        # support c++ 2011
+        flags += ['-std=c++0x']
+
+        return (flags)
+
+    def get_c_flags (self):
+        flags = self.get_common_flags()
 
+        # for C no special flags yet
+        return (flags)
 
     def get_link_flags(self):
         base_flags = [];
@@ -569,14 +577,14 @@ def build_prog (bld, build_obj):
       features='c ',
       includes = dpdk_includes_path,
       
-      cflags   = (build_obj.get_flags()+DPDK_WARNING ),
+      cflags   = (build_obj.get_c_flags()+DPDK_WARNING ),
       source   = bp_dpdk.file_list(top),
       target=build_obj.get_dpdk_target() 
       );
 
     bld.program(features='cxx cxxprogram', 
                 includes =includes_path,
-                cxxflags =build_obj.get_flags(),
+                cxxflags =build_obj.get_cxx_flags(),
                 linkflags = build_obj.get_link_flags() ,
                 lib=['pthread','dl'],
                 use =[build_obj.get_dpdk_target(),'zmq'],
index a0258ef..cafea34 100755 (executable)
@@ -4575,7 +4575,6 @@ void CTRexExtendedDriverBase1G::update_global_config_fdir(port_cfg_t * cfg){
     cfg->update_global_config_fdir_10g_1g();
 }
 
-
 int CTRexExtendedDriverBase1G::configure_rx_filter_rules(CPhyEthIF * _if){
 
     uint16_t hops = get_rx_check_hops();
@@ -4587,15 +4586,15 @@ int CTRexExtendedDriverBase1G::configure_rx_filter_rules(CPhyEthIF * _if){
         int i;
         // IPv4: bytes being compared are {TTL, Protocol}
         uint16_t ff_rules_v4[4]={
-            0xFF06 - v4_hops,
-            0xFE11 - v4_hops,
-            0xFF11 - v4_hops,
-            0xFE06 - v4_hops,
+            (uint16_t)(0xFF06 - v4_hops),
+            (uint16_t)(0xFE11 - v4_hops),
+            (uint16_t)(0xFF11 - v4_hops),
+            (uint16_t)(0xFE06 - v4_hops),
         }  ;
         // IPv6: bytes being compared are {NextHdr, HopLimit}
         uint16_t ff_rules_v6[2]={
-            0x3CFF - hops,
-            0x3CFE - hops,
+            (uint16_t)(0x3CFF - hops),
+            (uint16_t)(0x3CFE - hops),
         }  ;
         uint16_t *ff_rules;
         uint16_t num_rules;
@@ -4733,17 +4732,17 @@ int CTRexExtendedDriverBase10G::configure_rx_filter_rules(CPhyEthIF * _if){
 
         // IPv4: bytes being compared are {TTL, Protocol}
         uint16_t ff_rules_v4[4]={
-            0xFF11 - v4_hops,
-            0xFE11 - v4_hops,
-            0xFF06 - v4_hops,
-            0xFE06 - v4_hops,
+            (uint16_t)(0xFF11 - v4_hops),
+            (uint16_t)(0xFE11 - v4_hops),
+            (uint16_t)(0xFF06 - v4_hops),
+            (uint16_t)(0xFE06 - v4_hops),
         }  ;
         // IPv6: bytes being compared are {NextHdr, HopLimit}
         uint16_t ff_rules_v6[4]={
-            0x3CFF - hops,
-            0x3CFE - hops,
-            0x3CFF - hops,
-            0x3CFE - hops,
+            (uint16_t)(0x3CFF - hops),
+            (uint16_t)(0x3CFE - hops),
+            (uint16_t)(0x3CFF - hops),
+            (uint16_t)(0x3CFE - hops),
         }  ;
         const rte_l4type ff_rules_type[4]={
             RTE_FDIR_L4TYPE_UDP,
index 68dd7a7..0603ed0 100755 (executable)
@@ -1,5 +1,8 @@
 #ifndef __RTE_CONFIG_H
 #define __RTE_CONFIG_H
+
+#define typeof __typeof__
+
 #undef RTE_EXEC_ENV
 #define RTE_EXEC_ENV "linuxapp"
 #undef RTE_EXEC_ENV_LINUXAPP