Skip to content

Instantly share code, notes, and snippets.

@byates
Created June 24, 2024 13:12
Show Gist options
  • Save byates/26bf2f14b7dfe08cd7b0a71f2fd13e0d to your computer and use it in GitHub Desktop.
Save byates/26bf2f14b7dfe08cd7b0a71f2fd13e0d to your computer and use it in GitHub Desktop.
This script performs the initial installation for the igb_uio driver in AWS and GCP
#!/usr/bin/env bash
# This script performs the initial installation for the igb_uio driver in AWS and GCP
CURRENT_DIR=$(pwd)
if [ ! -d "./dpdk-kmods" ]; then
# Make sure the correct dependencies are installed
sudo apt update
sudo apt install -y git gcc make
# Clone the kernel mods repo and checkout the correct branch
git clone https://github.com/swxtchio/dpdk-kmods.git
cd dpdk-kmods || exit
git checkout swxtch
cd ..
fi
# Build the kernel mod
cd dpdk-kmods/linux/igb_uio || exit
make clean
make
# Insert the correct k mods
sudo modprobe uio
sudo insmod igb_uio.ko
cd "$CURRENT_DIR" || exit
INTERFACE="ens4"
#PCI is the identifier of the PCI device you wish to attach to.
# Can be optained by lspci or lshw -c network -businfo
# E.g. 00:05.0, 0000:00:03.1, .etc
PCI=00:04.0
if [ -z "$INTERFACE" ]; then
echo "The interface to attach the igb_uio driver must be supplied."
echo "Example: ./attach_igb_uio.sh ens5 00:06.0"
exit 1
fi
if [ -z "$PCI" ]; then
echo "The PCI device number must be supplied."
echo "Example: ./attach_igb_uio.sh ens5 00:06.0"
fi
# Install the necessary dependencies
sudo apt update
sudo apt install -y net-tools
# Detach the interface from the OS and bind it to dpdk
sudo ifconfig $INTERFACE down
sudo python3 ./dpdk-kmods/linux/igb_uio/dpdk-devbind.py --bind=igb_uio $PCI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment