4 ###Check environment K8S_SRIOV_DP (0 or 1, default 0), K8S_CPU_MANAGER (0 or 1, default 0), XRAN_DIR before running this script
8 ###$1 - used to specify sriov net devices to run XRAN sample app.
9 ###The input will be different depending on k8s sriov device plugin enabled or not.
10 ###If k8s sriov net device plugin is enabled, container will request integral sriov VF devices ($1) from k8s,
11 ###which is specified in the pod configuration file like - intel.com/intel_sriov_dpdk: "2".
12 ###Then the input of this parameter would be number like 2, or 4.
13 ###Else this parameter $1 will be sriov net devices PCIe address list like "18:02.0 18:02.1"
15 ###$2 - Test case index. Like "mu3_100mhz"
19 ###$4 - Instance/wls ID. Like "1", "2", or "3".
21 ###$5 - Used to assign core affinity to different threads of XRAN sample app.
22 ###If this parameter input is "0", k8s CPU Manager is enabled, and this script will get core mapping from the container taskset affinity,
23 ###which is assigned by the CPU Manager.
24 ###Else this parameter input should be taskset core mask assigned by user (in Hex format, but removing 0x in the head), like "0000f0"
28 #########Assigned PCIe VF for container
30 #########Test Case index
34 ########instance/wls ID
36 ########taskset core mask
39 ###########Get SRIOV VF PCI addresses if K8S_SRIOV_DP enabled or not
41 if [ $K8S_SRIOV_DP ]; then
42 env_pci_list=$(env | grep -i PCIDEVICE | grep -i DPDK | awk -F= '{print $2}')
45 while [ $i -le $vf_num ]
47 addr=$(echo $env_pci_list | awk -F, '{print $'$i'}')
48 array_pci_list="$array_pci_list $addr"
52 array_pci_list=$vf_number
55 #####Specify which test case to run and the VF number
56 sed -i "s/\.\/build\/sample-app .*/\.\/build\/sample-app \.\/usecase\/$case_index\/config_file_o_${mode_du_ru}.dat $array_pci_list/" $XRAN_DIR/app/run_o_${mode_du_ru}.sh
58 ####Update some parameters for test case
59 sed -i "s/debugStop=.*/debugStop=0/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
60 sed -i "s/CPenable=.*/CPenable=1/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
61 sed -i "s/instanceId=.*/instanceId=${wls_id}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
63 ####Get core ID from core mask
64 if [ $K8S_CPU_MANAGER ]; then
65 taskset_str=$(echo $(taskset -p 1) | sed 's/.*affinity mask: \(.*\)/\1/')
67 let core_map="0x$taskset_str"
69 let first_core_mask=$((core_map & core_mask))
73 #####Get first core ID for system thread
75 while [ $first_core_mask -eq 0 ]
77 if [ $max_cpu -eq 0 ]; then
78 echo "ERROR: provided core mask is wrong in your system. Please check."
80 core_mask=$(($core_mask+$core_mask))
81 first_core_num=$(($first_core_num+1))
82 echo core_mask $core_mask
83 echo first_core_num $first_core_num
84 first_core_mask=$((core_map & core_mask))
85 echo first_core_mask=$first_core_mask
86 max_cpu=$(($max_cpu-1))
89 system_core_num=$first_core_num
91 core_map=$(($core_map-$core_mask))
92 if [ $core_map -eq 0 ]
94 echo "ERROR: require at least two cores for O-DU/RU sample app"
98 #####Get the second core ID for timing thread
100 while [ $first_core_mask -eq 0 ]
102 if [ $max_cpu -eq 0 ]; then
103 echo "ERROR: provided core mask is wrong in your system. Please check."
106 core_mask=$(($core_mask+$core_mask))
107 first_core_num=$(($first_core_num+1))
108 echo core_mask $core_mask
109 echo first_core_num $first_core_num
110 first_core_mask=$((core_map & core_mask))
111 echo first_core_mask=$first_core_mask
112 max_cpu=$(($max_cpu-1))
115 timing_core_num=$first_core_num
116 ####Currently only use 2 cores to run O-DU/RU sample app
117 sed -i "s/ioCore.*/ioCore=${system_core_num}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
118 sed -i "s/pktAuxCore.*/pktAuxCore=${system_core_num}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
119 sed -i "s/pktProcCore.*/pktProcCore=${system_core_num}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
120 sed -i "s/systemCore.*/systemCore=${system_core_num}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
121 sed -i "s/timingCore.*/timingCore=${timing_core_num}/" app/usecase/${case_index}/config_file_o_${mode_du_ru}.dat
124 sh run_o_${mode_du_ru}.sh