openvswitch-dpdk starting with DPDK_OPTS parameter

Bug #1547463 reported by Janghoon-Paul Sim on 2016-02-19
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openvswitch-dpdk (Ubuntu)
Undecided
Unassigned

Bug Description

To start OpenvSwitch in DPDK mode,
Users can use parameter DPDK_OPTS in /etc/default/openvswitch-switch.
However, OpenvSwitch-dpdk doesn't start although DPDK_OPTS parameter is uncomment.
For example,
# DPDK options - see /usr/share/doc/openvswitch-common/INSTALL.DPDK.md.gz
DPDK_OPTS='--dpdk -c 0x1 -n 4'

What I did was,

#install openvswitch-dpdk package
$sudo apt-get install openvswitch-switch-dpdk

#enable hugepage
on /etc/default/grub
GRUB_CMDLINE_LINUX="transparent_hugepage=never hugepagesz=1G hugepages=4 default_hugepagesz=1G"
$sudo update-grub
$sudo reboot

#mount hugepage
$sudo mount -t hugetlbfs -o pagesize=1G none /dev/hugepages

# DPDK setup
$sudo modprobe uio_pci_generic
$sudo dpdk_nic_bind --bind=uio_pci_generic p1p1

#uncomment DPDK_OPTS on /etc/default/openvswitch-switch
DPDK_OPTS='--dpdk -c 0x1 -n 4'

# update alternatives ovs-vswitchd and start openvswitch
$sudo update-alternatives --set ovs-vswitchd /usr/lib/openvswitch-switch-dpdk/ovs-vswitchd-dpdk
$sudo start openvswitch-switch

# check if openvswitch-dpdk enabled
ps -ef doesn't show ovs-vswitchd process running with --dpdk option.
Also, /var/log/openvswitch/ovs-ctl.log doesn't show any DPDK relevant message.

Package version :
ubuntu@ubuntu:~$ dpkg -l | grep openvswitch
ii openvswitch-common 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch common components
ii openvswitch-switch 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch switch implementations
ii openvswitch-switch-dpdk 2.4.0-0ubuntu1~cloud0 amd64 DPDK enabled Open vSwitch switch implementation

Janghoon-Paul Sim (janghoon) wrote :

This issue happens since DPDK_OPTS parameter is not forwarded to ovs-ctl.

To make it working,
/etc/init/openvswitch-switch.conf should be modified like the following so that DPDK_OPTS parameter can be forwarded to ovs-ctl

if test X"$FORCE_COREFILES" != X; then
set "$@" --force-corefiles="$FORCE_COREFILES"
fi
set "$@" $OVS_CTL_OPTS

# To enable openvswitch-dpdk
if test X"$DPDK_OPTS" != X; then
set "$@" --dpdk-opts="$DPDK_OPTS"
fi

This patch works fine on my machine.

Hua Zhang (zhhuabj) wrote :

Hi Paul,

Above workaround can't work for me, do you know why ?

hua@node1:~$ cat /etc/default/openvswitch-switch |grep DPDK_OPTS
DPDK_OPTS='--dpdk -c 0x1 -n 4'

hua@node1:~$ cat /etc/init/openvswitch-switch.conf |grep -B 1 -A 2 DPDK
  set "$@" $OVS_CTL_OPTS
  if test X"$DPDK_OPTS" != X; then
    #set "$@" DPDK_OPTS="$DPDK_OPTS"
    set "$@" --dpdk-opts="$DPDK_OPTS"
  fi
  "$@"

hua@node1:~$ cat /usr/share/openvswitch/scripts/ovs-ctl |grep -A 2 DPDK
  if test X"$DPDK_OPTS" != X; then
      set "$@" $DPDK_OPTS --
  fi
  set "$@" unix:"$DB_SOCK"

hua@node1:~$ sudo restart openvswitch-switch
openvswitch-switch start/running

hua@node1:~$ ps -ef |grep ovs-vswitchd
root 22896 1 0 11:38 ? 00:00:00 ovs-vswitchd: monitoring pid 22897 (healthy)
root 22897 22896 5 11:38 ? 00:00:00 ovs-vswitchd unix:/var/run/openvswitch/db.sock -vconsole:emer -vsyslog:err -vfile:info --mlockall --no-chdir --log-file=/var/log/openvswitch/ovs-vswitchd.log --pidfile=/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor
hua 23000 4470 0 11:38 pts/12 00:00:00 grep --color=auto ovs-vswitchd

hua@node1:~$ dpkg -l |grep openvswitch
ii openvswitch-common 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch common components
ii openvswitch-switch 2.4.0-0ubuntu4~cloud0 amd64 Open vSwitch switch implementations
ii openvswitch-switch-dpdk 2.4.0-0ubuntu1~cloud0 amd64 DPDK enabled Open vSwitch switch implementation

Hua Zhang (zhhuabj) wrote :

Finally I use the following workaround, it works for me.

sudo restart openvswitch-switch
sudo killall ovs-vswitchd
sudo ovs-vswitchd --dpdk -c 0x1 -n 2 -- unix:/var/run/openvswitch/db.sock --pidfile --detach

hua@node1:~$ ps -ef |grep ovs-vswitchd |grep dpdk
root 24124 3720 99 11:47 ? 00:01:59 ovs-vswitchd --dpdk -c 0x1 -n 2 -- unix:/var/run/openvswitch/db.sock --pidfile --detach

But I hit another following problem after executing the command 'sudo ovs-vsctl add-port ovsbr0 dpdk0 -- set Interface dpdk0 type=dpdk':

2016-04-12T03:44:32.151Z|00014|netdev|WARN|could not create netdev dpdk0 of unknown type dpdk
2016-04-12T03:44:32.151Z|00015|bridge|WARN|could not open network device dpdk0 (Address family not supported by protocol)

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in openvswitch-dpdk (Ubuntu):
status: New → Confirmed

Hi,

It's work for me if I add

test -e /etc/default/openvswitch-switch && . /etc/default/openvswitch-switch

at the begin of
/usr/share/openvswitch/scripts/ovs-ctl

Ethan Lynn (ethanlynn) wrote :

Will this be fixed in 16.04.1? I have this problem in 16.04.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers