summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHanoh Haim <hhaim@cisco.com>2017-03-16 11:55:04 +0200
committerHanoh Haim <hhaim@cisco.com>2017-03-16 11:55:04 +0200
commita933bd1addc181fe623ad9f60b0631bbad539190 (patch)
treef65f38ef7cfab153dc49b8d50b5110da142fdf1c
parentb3ffe2a0aa4b06920a75761ccc010c884ff8609d (diff)
early support mlx4 driver for connectX-3
Signed-off-by: Hanoh Haim <hhaim@cisco.com>
-rwxr-xr-xlinux_dpdk/ws_main.py44
-rwxr-xr-xsrc/bp_sim.h8
-rw-r--r--src/main_dpdk.cpp13
3 files changed, 65 insertions, 0 deletions
diff --git a/linux_dpdk/ws_main.py b/linux_dpdk/ws_main.py
index 9b348d4..703bb6a 100755
--- a/linux_dpdk/ws_main.py
+++ b/linux_dpdk/ws_main.py
@@ -533,6 +533,11 @@ mlx5_dpdk_src = SrcGroup(dir='src/dpdk/',
'drivers/net/mlx5/mlx5_vlan.c',
]);
+mlx4_dpdk_src = SrcGroup(dir='src/dpdk/',
+ src_list=[
+ 'drivers/net/mlx4/mlx4.c',
+ ]);
+
bp_dpdk =SrcGroups([
dpdk_src
]);
@@ -541,6 +546,10 @@ mlx5_dpdk =SrcGroups([
mlx5_dpdk_src
]);
+mlx4_dpdk =SrcGroups([
+ mlx4_dpdk_src
+ ]);
+
# this is the library dp going to falcon (and maybe other platforms)
bp =SrcGroups([
@@ -821,9 +830,15 @@ class build_option:
def get_mlx5_target (self):
return self.update_executable_name("mlx5");
+ def get_mlx4_target (self):
+ return self.update_executable_name("mlx4");
+
def get_mlx5so_target (self):
return self.update_executable_name("libmlx5")+'.so';
+ def get_mlx4so_target (self):
+ return self.update_executable_name("libmlx4")+'.so';
+
def get_common_flags (self):
if self.isPIE():
flags = copy.copy(common_flags_old)
@@ -917,8 +932,19 @@ def build_prog (bld, build_obj):
source = mlx5_dpdk.file_list(top),
target = build_obj.get_mlx5_target()
+ )
+
+ bld.shlib(
+ features='c',
+ includes = dpdk_includes_path+dpdk_includes_verb_path,
+ cflags = (build_obj.get_c_flags()+DPDK_FLAGS ),
+ use =['ibverbs'],
+ source = mlx4_dpdk.file_list(top),
+ target = build_obj.get_mlx4_target()
)
+
+
bld.program(features='cxx cxxprogram',
includes =includes_path,
cxxflags =(build_obj.get_cxx_flags()+['-std=gnu++11',]),
@@ -986,6 +1012,11 @@ def install_single_system (bld, exec_p, build_obj):
dest_mlx_file = exec_p + build_obj.get_mlx5so_target()
do_create_link(src_mlx_file,dest_mlx_file,exec_p);
+ src_mlx4_file = os.path.realpath(o+build_obj.get_mlx4so_target())
+ dest_mlx4_file = exec_p + build_obj.get_mlx4so_target()
+ do_create_link(src_mlx4_file,dest_mlx4_file,exec_p);
+
+
def pre_build(bld):
@@ -1080,6 +1111,15 @@ def _copy_single_system2 (bld, exec_p, build_obj):
os.system("cp %s %s " %(src_file,dest_file));
os.system("chmod +x %s " %(dest_file));
+def _copy_single_system3 (bld, exec_p, build_obj):
+ o='../scripts/';
+ src_file = os.path.realpath(o+build_obj.get_mlx4so_target())
+ print(src_file)
+ if os.path.exists(src_file):
+ dest_file = exec_p +build_obj.get_mlx4so_target()
+ os.system("cp %s %s " %(src_file,dest_file));
+ os.system("chmod +x %s " %(dest_file));
+
def copy_single_system (bld, exec_p, build_obj):
_copy_single_system (bld, exec_p, build_obj)
@@ -1090,6 +1130,9 @@ def copy_single_system1 (bld, exec_p, build_obj):
def copy_single_system2 (bld, exec_p, build_obj):
_copy_single_system2 (bld, exec_p, build_obj)
+def copy_single_system3 (bld, exec_p, build_obj):
+ _copy_single_system3 (bld, exec_p, build_obj)
+
files_list=[
'libzmq.so.3',
@@ -1206,6 +1249,7 @@ def release(bld, custom_dir = None):
copy_single_system(bld,exec_p,obj)
copy_single_system1(bld,exec_p,obj)
copy_single_system2(bld,exec_p,obj)
+ copy_single_system3(bld,exec_p,obj)
for obj in files_list:
src_file = '../scripts/'+obj
diff --git a/src/bp_sim.h b/src/bp_sim.h
index 24681d4..d8f620e 100755
--- a/src/bp_sim.h
+++ b/src/bp_sim.h
@@ -654,6 +654,14 @@ public:
return (btGetMaskBit32(m_flags1, 11, 11) ? true : false);
}
+ void set_mlx4_so_mode(bool enable) {
+ btSetMaskBit32(m_flags1, 12, 12, (enable ? 1 : 0) );
+ }
+
+ bool get_mlx4_so_mode() {
+ return (btGetMaskBit32(m_flags1, 12, 12) ? true : false);
+ }
+
public:
void Dump(FILE *fd);
diff --git a/src/main_dpdk.cpp b/src/main_dpdk.cpp
index 89c6b65..ecd1ca9 100644
--- a/src/main_dpdk.cpp
+++ b/src/main_dpdk.cpp
@@ -121,6 +121,7 @@ static char global_prefix_str[100];
static char global_loglevel_str[20];
static char global_master_id_str[10];
static char global_mlx5_so_id_str[50];
+static char global_mlx4_so_id_str[50];
static char global_image_postfix[10];
#define TREX_NAME "_t-rex-64"
@@ -730,6 +731,7 @@ enum { OPT_HELP,
OPT_NO_SCAPY_SERVER,
OPT_ACTIVE_FLOW,
OPT_RT,
+ OPT_MLX4_SO,
OPT_MLX5_SO
};
@@ -790,6 +792,7 @@ static CSimpleOpt::SOption parser_options[] =
{ OPT_CHECKSUM_OFFLOAD, "--checksum-offload", SO_NONE },
{ OPT_ACTIVE_FLOW, "--active-flows", SO_REQ_SEP },
{ OPT_MLX5_SO, "--mlx5-so", SO_NONE },
+ { OPT_MLX4_SO, "--mlx4-so", SO_NONE },
{ OPT_CLOSE, "--close-at-end", SO_NONE },
{ OPT_ARP_REF_PER, "--arp-refresh-period", SO_REQ_SEP },
{ OPT_NO_OFED_CHECK, "--no-ofed-check", SO_NONE },
@@ -987,6 +990,10 @@ static int parse_options(int argc, char *argv[], CParserOption* po, bool first_t
po->preview.set_mlx5_so_mode(true);
break;
+ case OPT_MLX4_SO:
+ po->preview.set_mlx4_so_mode(true);
+ break;
+
case OPT_LEARN :
po->m_learn_mode = CParserOption::LEARN_MODE_IP_OPTION;
break;
@@ -5566,6 +5573,12 @@ int update_dpdk_args(void){
global_dpdk_args[global_dpdk_args_num++]=(char *)global_mlx5_so_id_str;
}
+ if ( CGlobalInfo::m_options.preview.get_mlx4_so_mode() ){
+ global_dpdk_args[global_dpdk_args_num++]=(char *)"-d";
+ snprintf(global_mlx4_so_id_str, sizeof(global_mlx4_so_id_str), "libmlx4-64%s.so",global_image_postfix );
+ global_dpdk_args[global_dpdk_args_num++]=(char *)global_mlx4_so_id_str;
+ }
+
global_dpdk_args[global_dpdk_args_num++]=(char *)"-c";
global_dpdk_args[global_dpdk_args_num++]=(char *)global_cores_str;
global_dpdk_args[global_dpdk_args_num++]=(char *)"-n";