Skip to content

Commit

Permalink
[Bug Fix[ Fix for Manager go.sh Incorrectly Comparing Ports Available
Browse files Browse the repository at this point in the history
Fixes an issue where port mask was being calculated 
incorrectly.

Commit log:

* Fixed bug in #228

* Changed dependency checking to be more OS-agnostic

* Forcing workflow rerun

* Forcing workflow rerun

* Improved dependency check

* Simplified port counting

* Added comments for port conversions

* Moved port check to prevent future merge conflict
  • Loading branch information
EthanBaron14 authored Jun 18, 2020
1 parent c527955 commit 6cfc261
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions onvm/go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,18 @@ fi

shift 3

if [ -z "$nf_cores" ]
# Verify that bc is installed
if [[ -z $(command -v bc) ]]
then
usage
echo "Error: bc is not installed. Install using:"
echo " sudo apt-get install bc"
echo "See dependencies for more information"
exit 1
fi

ports_detected=$("$RTE_SDK"/usertools/dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q' | grep -c "drv")
if [[ $ports_detected -lt $ports ]]
if [ -z "$nf_cores" ]
then
echo "Error: Invalid port mask. Insufficient NICs bound."
exit 1
usage
fi

while getopts "a:r:d:s:t:l:p:z:cv" opt; do
Expand All @@ -77,6 +79,21 @@ while getopts "a:r:d:s:t:l:p:z:cv" opt; do
esac
done

# Convert the port mask to binary
# Using bc where obase=2 indicates the output is base 2 and ibase=16 indicates the output is base 16
ports_bin=$(echo "obase=2; ibase=16; $ports" | bc)
# Splice out the 0's from the binary numbers. The result is only 1's. Example: 1011001 -> 1111
ports_bin="${ports_bin//0/}"
# The number of ports is the length of the string of 1's. Using above example: 1111 -> 4
count_ports="${#ports_bin}"

ports_detected=$("$RTE_SDK"/usertools/dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q' | grep -c "drv")
if [[ $ports_detected -lt $count_ports ]]
then
echo "Error: Invalid port mask. Insufficient NICs bound."
exit 1
fi

verbosity_level="-v $verbosity"

# If base virtual address has not been set by the user, set to default.
Expand Down

0 comments on commit 6cfc261

Please sign in to comment.