Skip to content

Commit 27d9ed5

Browse files
authored
[Bug Fix + Documentation] Port count fix + Documentation updates
This PR updates our install guide to include Python, needed for many of our scripts. Commit log: * scripts/*.py files updated to use python3 * hashbang reflects use of python3 in .py files * Python dependency noted in Installation guide * Install script edits * syntax errors fixed * scripts/*.py files updated to use python3 * hashbang reflects use of python3 in .py files * Python dependency noted in Installation guide * Install script edits * syntax errors fixed * fixed syntax errors * spacing errors fixed * addressing pylint errors * switched exit(1) to sys.exit(1) given pylint suggestion * cleaned up print statements * [Bug Fix[ Fix for Manager go.sh Incorrectly Comparing Ports Available 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
1 parent 5bc00ac commit 27d9ed5

File tree

4 files changed

+240
-199
lines changed

4 files changed

+240
-199
lines changed

docs/Install.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,30 @@ Check System
1818
your Kernel version should be higher than 2.6.33.
1919

2020
3. Install dependencies
21+
22+
Install the Linux Kernel headers package for your kernel version.
2123
```sh
2224
sudo apt-get install build-essential linux-headers-$(uname -r) git
2325
```
26+
If your distribution didn't come with Python or came with an earlier version, you will need to install Python 3 v3.4+.
27+
28+
See if Python is already installed with
29+
30+
```sh
31+
python3 --version
32+
```
33+
Install Python with your distribution's package manager (Note: the command and package name may vary).
34+
35+
On Debian derivatives such as Ubuntu, use `apt`. Check the apt repository for the versions of Python available to you. Then, run the following command:
36+
```sh
37+
sudo apt-get install python3
38+
```
39+
40+
Verify that Python installed correctly with
41+
```sh
42+
python3 --version
43+
```
44+
2445
4. Assure your kernel supports uio
2546
```sh
2647
locate uio

onvm/go.sh

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,18 @@ fi
4848

4949
shift 3
5050

51-
if [ -z "$nf_cores" ]
51+
# Verify that bc is installed
52+
if [[ -z $(command -v bc) ]]
5253
then
53-
usage
54+
echo "Error: bc is not installed. Install using:"
55+
echo " sudo apt-get install bc"
56+
echo "See dependencies for more information"
57+
exit 1
5458
fi
5559

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

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

82+
# Convert the port mask to binary
83+
# Using bc where obase=2 indicates the output is base 2 and ibase=16 indicates the output is base 16
84+
ports_bin=$(echo "obase=2; ibase=16; $ports" | bc)
85+
# Splice out the 0's from the binary numbers. The result is only 1's. Example: 1011001 -> 1111
86+
ports_bin="${ports_bin//0/}"
87+
# The number of ports is the length of the string of 1's. Using above example: 1111 -> 4
88+
count_ports="${#ports_bin}"
89+
90+
ports_detected=$("$RTE_SDK"/usertools/dpdk-devbind.py --status-dev net | sed '/Network devices using kernel driver/q' | grep -c "drv")
91+
if [[ $ports_detected -lt $count_ports ]]
92+
then
93+
echo "Error: Invalid port mask. Insufficient NICs bound."
94+
exit 1
95+
fi
96+
8097
verbosity_level="-v $verbosity"
8198

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

0 commit comments

Comments
 (0)