Enabling Ethernet Connectivity on Octoclock and Octoclock-G

From Ettus Knowledge Base
Revision as of 11:19, 13 January 2020 by SamReiter (Talk | contribs)

Jump to: navigation, search

Application Note Number

AN-800

Revision History

Date Author Details
2020-01-13 Sam Reiter Initial creation

Overview

This application note covers, in detail, the steps required to program an Octoclock or Octoclock-G to allow Ethernet connectivity and communication with UHD. This guide serves as a supplement to the UHD Manual's coverage of the topic. In this guide, we will use Ubuntu 19.10 to program an Octoclock using an ATMEL-ICE programmer.

Verify Current Octoclock Configuration

To get started, we want to make sure that this guide is appropriate for your device(s). Currently shipping Octoclocks will come with the following firmware pre-loaded. You can test which unit you have with a simple ping test:

    1. Connect the 6V DC power supply to the Octoclock
    2. Connect your Octoclock's RJ-45 port to a host PC via an Ethernet cable
    3. Configure your host's Ethernet port to a static connection with the IPV4 address: 192.168.10.1
    4. Configure your host's Ethernet port with a subnet mast of: 255.255.255.0
    5. Turn your host's Ethernet port off and back on for changes to take effect
    6. In a terminal, issue the command:
   ping 192.168.10.3

A successful ping between devices means that your device is already configured with updated firmware and this guide is *not* necessary. At this time, this guide has not been tested for recovering bricked devices.

Tools Required

    1. Philips head screwdriver
    2. ATMEL-ICE Programmer (or comparable AVR programmer) with SPI/ISP cable
    3. Ethernet cable

ATMEL-ICE Configuration

To utilize the ATMEL-ICE programmer, the avrdude utility must be used. The version of avrdude should be >= 6.1. At the time of this guide, version 6.3 is the default install from the Ubunu PPA and programming issues were observed. This guide will cover a build of avrdude 6.1 from source.

Install the following dependencies:

   sudo apt-get install bison flex libftdi1-dev libftdi-dev

Download the avrdude-6.1.tar.gz release here. From this download location, uncompress the directory:

   tar xvzf avrdude-6.1.tar.gz

Enter the source directory

   cd avrdude-6.1/

Run the configure script

   ./configure

Expected output:

   Configuration summary:
   ----------------------
   DO HAVE    libelf
   DO HAVE    libusb
   DO HAVE    libusb_1_0
   DO HAVE    libftdi1
   DO HAVE    libftdi (but prefer to use libftdi1)
   DON'T HAVE libhid
   DO HAVE    pthread
   DISABLED   doc
   ENABLED    parport
   DISABLED   linuxgpio


Ensure your CPU governor is set to performance. This can be done with the Linux utility cpufrequtils.

Install cpufrequtils with the command below:

   sudo apt install cpufrequtils

You can then set the CPU governor to performance per core by issuing the command:

   sudo cpufreq-set -c $core_number -g performance

To set the CPU governor to performance for all cores:

   for ((i=0;i<$(nproc);i++)); do sudo cpufreq-set -c $i -r -g performance; done

You can then verify that the CPU governor has been set by running the command:

   cpufreq-info

Thread Priority Scheduling

When UHD spawns a new thread, it may try to boost the thread's scheduling priority. If setting the new priority fails, the UHD software prints a warning to the console, as shown below. This warning is harmless; it simply means that the thread will retain a normal or default scheduling priority.

UHD Warning:
    Unable to set the thread priority. Performance may be negatively affected.
    Please see the general application notes in the manual for instructions.
    EnvironmentError: OSError: error in pthread_setschedparam

To address this issue, non-privileged (non-root) users need to be given special permission to change the scheduling priority. This can be enabled by creating a group usrp, adding your user to it, and then appending the line @usrp - rtprio 99 to the file /etc/security/limits.conf.

   sudo groupadd usrp
   sudo usermod -aG usrp $USER

Then add the line below to end of the file /etc/security/limits.conf:

   @usrp - rtprio  99

You must log out and log back into the account for the settings to take effect. In most Linux distributions, a list of groups and group members can be found in the /etc/group file.

There is further documentation about this in the User Manual at the link below.


Adjust Network Buffers

This applies to Ethernet connected USRPs (N2xx, N3xx, X3xx, E320).

N2xx

   sudo sysctl -w net.core.rmem_max=625000000
   sudo sysctl -w net.core.wmem_max=625000000

X3xx/N3xx/E320

   sudo sysctl -w net.core.wmem_max=576000
   sudo sysctl -w net.core.rmem_max=33554432

Adjust Ethernet MTU

This applies to Ethernet connected USRPs (N2xx, N3xx, X3xx, E320).

For 1 Gigabit connections, the MTU should be set to 1500.

For 10 Gigabit connections, the MTU should be set to 8000.

It is important to set the value and not leave it is automatic

Increasing Ring Buffers

This applies to Ethernet connected USRPs using a 10 Gb interface (X3xx, N3xx, E320).

Increasing the Ring Buffers on the NIC may help prevent flow control errors at higher rates.

   sudo ethtool -G <interface> tx 4096 rx 4096

DPDK

DPDK is supported on N3xx, X3xx and E320 USRPs. DPDK replaces the traditional Linux networking stack with a low overhead user-land based driver. Additional details of using DPDK can be found in the UHD Manual located at the following link: https://files.ettus.com/manual/page_dpdk.html

Disable Hyper-threading

In some applications which require the highest possible CPU performance per core, disabling hyper-threading can provide roughly a 10% increase in core performance, at the cost of having less core threads. Hyper-threading can be disabled within the BIOs and varies by manufacturer.

Disable KPTI Protections for Spectre/Meltdown

In some cases, disabling the KPTI protections for the Linux Kernel can increase performance by 10-15%. It is important to note the ramification making this modification can have. This modification is only recommended for systems that absolutely require the best performance and are not connected to the internet.

Disabling KPTI protections can be done by adding the lines below to your /etc/default/grub file at GRUB_CMDLINE_LINUX_DEFAULT=""

   pti=off spectre_v2=off l1tf=off nospec_store_bypass_disable no_stf_barrier

After modifying the grub file, run the following command to update your configuration and reboot:

   sudo update-grub