Skip to content

Commit

Permalink
jsonc_gen.sh: fixup linting errors
Browse files Browse the repository at this point in the history
Signed-off-by: Maryam Tahhan <[email protected]>
  • Loading branch information
maryamtahhan committed Mar 27, 2023
1 parent 2204943 commit f86286d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tools/jsonc_gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ fi

num_of_interfaces=0
num_of_qids=0
num_of_lcores=0
numa_node=0
i=0
l=0
Expand Down Expand Up @@ -64,14 +63,14 @@ function get_lcore()
else
nic_numa_node=${1}
fi
while [ $l -lt $nic_numa_node ]
while [ $l -lt "$nic_numa_node" ]
do
((offset+=${num_of_cores_in_each_numa_node[l]}))
((offset+=num_of_cores_in_each_numa_node[l]))
((l++))
done

index=$((offset+i%num_of_cores_in_each_numa_node[nic_numa_node]))
echo ${LCORE[index]}
echo """${LCORE[index]}"""

}
output=$(lscpu | grep "NUMA node[0-9] CPU")
Expand All @@ -85,10 +84,10 @@ do
((num_of_numa_nodes++))
else
# split the comma separated value of cores into an array
IFS=', ' read -a list_of_numa_lcores <<< "$each_output"
IFS=', ' read -ra list_of_numa_lcores <<< "$each_output"

num_of_cores_in_each_numa_node[numa_node++]=${#list_of_numa_lcores[@]}
LCORE=(${LCORE[@]} ${list_of_numa_lcores[@]})
LCORE=("${LCORE[@]}" "${list_of_numa_lcores[@]}")
fi
((l++))
done
Expand Down Expand Up @@ -130,8 +129,8 @@ EOF
EOF
)
if [ $KIND = false ] ; then
nic_numa_node=$(cat /sys/class/net/${NET[i]}/device/numa_node || echo 0)
lcore=$(get_lcore $nic_numa_node $i)
nic_numa_node=$(cat /sys/class/net/"${NET[i]}"/device/numa_node || echo 0)
lcore=$(get_lcore "$nic_numa_node" $i)
else
lcore=0 # For kind you can't really retrieve the numa node as shown above
fi
Expand Down Expand Up @@ -198,7 +197,7 @@ cat <<-EOF > ${config_file}
// description | desc - (O) Description of the umem space.
"umems": {
"umem0": {
"bufcnt": $((16*$num_of_interfaces)),
"bufcnt": (16*$num_of_interfaces),
"bufsz": 2,
"mtype": "2MB",
"regions": [${regions[*]}
Expand Down

0 comments on commit f86286d

Please sign in to comment.