/r8152

USB NIC Driver for ESXi 5.1/5.5/6.0/6.5 based on the Realtek r8152 source code

Primary LanguageC

USB NIC Driver for ESXi 5.1/5.5/6.0/6.5 (Realtek)

Realtek r8152 driver for ESXi

Key features:

  • Supports Realtek RTL8153 and RTL8152
  • TCP, UDP and IPv4 checksum offload (RX and TX)
  • TCP, UDP and IPv6 checksum offload (RX and TX)
  • Scatter-Gather support
  • TCP Segmentation Offload support
  • Wake on LAN support
  • VLAN support
  • Jumbo Frames (9k)
  • Energy Efficient Ethernet (EEE)

Known issues

  • Unloading the module manually is not supported
    • The following message appears on vmkernel.log:
      Failed to close vmnic32: not ready. Flags 0x1140

This message can be safely ignored, however, if the module is reloaded, the vmnic number will change

###Table of Contents

Tested Devices

Tested by Glen Kemp

USB 2.0 Adapter (RTL8152B Chipset)

Tested by Glen Kemp

Required Software

CentOS 5.3-x86 64 bit DVD ISO - http://mirror.ash.fastserv.com/centos/5.3/isos/x86_64/CentOS-5.3-x86_64-bin-DVD.iso

ESXi 6.0 and 6.5

VMware ESXi 6.0 source code (VMware-ESXI-60U2-ODP.iso) and build toolchain (VMware-TOOLCHAIN-ODP-vsphere60u2-Mar-01-2016.iso)

ESXi 5.5

VMware ESXi 5.5 source code (VMware-ESX-5.5.0u03-ODP.iso) and build toolchain (VMware-550u3-TOOLCHAIN-ODP_21_July_2015.iso)

ESXi 5.1

VMware ESXi 5.1 source code and build toolchain are both included in a single file (VMware-esx-open-source-5.1.0u2.oss.tar).

Setup

The embedded documentation for the ESXi open source disclosure packages recommends the build should be performed on a CentOS 5.3 x64 system to produce 64-bit packages. There are other systems mentioned (CentOS 32-bit, Red Hat, FreeBSD and Windows), so take your pick!

To make life easier, I customised the Kickstart file provided with the ESXi 5.5 Toolchain ISO (under the config folder) to build a CentOS 5.3 x64 server VM. Once it is up and running, we deviate a bit from the instructions provided by VMware.

The initial build directory structure should be:

mkdir -p /build/{vsphere,toolchain}

The next steps are a bit different, depending on whether the build environment is being prepared for ESXi 5.1 or later versions:

Prepare the build environment

ESXi 5.1

Extract the contents of the compressed tar archive to /build/vsphere:

cd /build/vsphere
tar xvf /path/to/VMware-esx-open-source-5.1.0u2.oss.tar --strip-components=1 server/vmkdrivers-gpl
cd vmkdrivers-gpl

You are now ready to compile the build toolchain:

glibc

cd glibc-2.3.2-95.44
bash ./BUILD.txt
cd ..

binutils

cd binutils-2.17.50.0.15-modcall
bash ./BUILD.txt
cd ..

gcc

cd gcc-4.1.2-9
bash ./BUILD.txt
cd ..		

Unlike ESXi 5.1, the ODP source code and the build toolchain for 5.5 and 6.0 are distributed as two separate ISO images. The two ISOs include hundreds of packages, but only a small subset is actually required to build the drivers.

Building the driver

There is a little bit more preparation to be done to build the driver. Again, some of the steps are different depending on the version of ESXi.

Common

cd /build/vsphere/vmkdrivers-gpl
tar zxvf vmkdrivers-gpl.tgz

Create the directory for the driver's source code. The same source files are used to build the driver on all environments.

cd /build/vsphere/vmkdrivers-gpl
mkdir vmkdrivers/src_92/drivers/usb/net/r8152-2.06.0
cp /path/to/source/r8152.c vmkdrivers/src_92/drivers/usb/net/r8152-2.06.0/
cp /path/to/source/compatibility.h vmkdrivers/src_92/drivers/usb/net/r8152-2.06.0/

Create the directory that will hold the driver's namespace dependencies map:

ESXi 5.1

cd /build/vsphere/vmkdrivers-gpl
mkdir BLD/build/HEADERS/CUR-92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0
echo -e "VMK_NAMESPACE_REQUIRED(\"com.vmware.usb\", \"9.2.1.0\");\
\nVMK_NAMESPACE_REQUIRED(\"com.vmware.usbnet\", \"9.2.1.0\");"\
> BLD/build/HEADERS/CUR-92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0/__namespace.h

ESXi 5.5

cd /build/vsphere/vmkdrivers-gpl
mkdir BLD/build/HEADERS/CUR-92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0
echo -e "VMK_NAMESPACE_REQUIRED(\"com.vmware.usb\", \"9.2.2.0\");\
\nVMK_NAMESPACE_REQUIRED(\"com.vmware.usbnet\", \"9.2.2.0\");"\
> BLD/build/HEADERS/CUR-92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0/__namespace.h

ESXi 6.0

cd /build/vsphere/vmkdrivers-gpl
mkdir BLD/build/HEADERS/92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0
echo -e "VMK_NAMESPACE_REQUIRED(\"com.vmware.usb\", \"9.2.3.0\");\
\nVMK_NAMESPACE_REQUIRED(\"com.vmware.usbnet\", \"9.2.3.0\");"\
> BLD/build/HEADERS/92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0/__namespace.h

ESXi 6.5

cd /build/vsphere/vmkdrivers-gpl
mkdir BLD/build/HEADERS/92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0
echo -e "VMK_NAMESPACE_REQUIRED(\"com.vmware.usb\", \"10.0\");\
\nVMK_NAMESPACE_REQUIRED(\"com.vmware.usbnet\", \"9.2.3.0\");"\
> BLD/build/HEADERS/92-vmkdrivers-namespace/vmkernel64/release/r8152-2.06.0/__namespace.h

Finally, copy the appropriate build script to /build/vsphere/vmkdrivers-gpl and compile the driver.

ESXi 5.1

cd /build/vsphere/vmkdrivers-gpl
cp /path/to/scripts/build-r8152-2.06.0_u51.sh .
chmod a+x build-r8152-2.06.0_u51.sh
./build-r8152-2.06.0_u51.sh

ESXi 5.5

cd /build/vsphere/vmkdrivers-gpl
cp /path/to/scripts/build-r8152-2.06.0_u55.sh .
chmod a+x build-r8152-2.06.0_u55.sh
./build-r8152-2.06.0_u55.sh

ESXi 6.0 and 6.5

cd /build/vsphere/vmkdrivers-gpl
cp /path/to/scripts/build-r8152-2.06.0_u60.sh .
chmod a+x build-r8152-2.06.0_u60.sh
./build-r8152-2.06.0_u60.sh