Bug 2138339

Summary: OVS fails to set qdisc on tap interfaces with "noqueue" qdisc
Product: Red Hat Enterprise Linux Fast Datapath Reporter: Slawek Kaplonski <skaplons>
Component: openvswitch2.15Assignee: Ilya Maximets <i.maximets>
Status: CLOSED ERRATA QA Contact: Rick Alongi <ralongi>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: FDP 22.DCC: ctrautma, fleitner, i.maximets, jhsiao, ralongi, tredaelli
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openvswitch2.15-2.15.0-127.el8fdp Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-15 20:20:52 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2041859    
Attachments:
Description Flags
Proposed fix none

Description Slawek Kaplonski 2022-10-28 08:29:43 UTC
Description of problem:
Libvirt since version 6.9.0 (see https://www.libvirt.org/news.html#v6-9-0-2020-11-02) is by default setting "noqueue" qdisc for tap interfaces. So newly created tap device looks in tc like:

qdisc noqueue 8007: dev tap20326cf2-f1 root refcnt 2

When qos and queue is set for such interface in ovs, e.g. with commands like:

ovs-vsctl -- set port tap20326cf2-f1 qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=1000000 queues:0=@newqueue -- --id=@newqueue create queue other-config:burst=800000 other-config:max-rate=1000000

OVS fails to create htb qdisc for this interface.

AFAIU ovs, to create proper htb qdisc is doing something like:

tc qdisc add dev tap20326cf2-f1 root handle 1: htb default 100

and this ends up with error like:

Error: NLM_F_REPLACE needed to override.

OVS should first delete existing qdisc with function tc_del_qdisc (https://github.com/openvswitch/ovs/blob/850e639021125c3646effa0eae9e422082ade2ca/lib/netdev-linux.c#L6127) but it not happens. Probably because this function is just trying to delete qdisc with handle "1:0" even if doc says that it's doing equivalent to "tc qdisc del dev <name> root".

Version-Release number of selected component (if applicable):

I checked on:
openvswitch2.15-2.15.0-109.el8fdp.x86_64
and
openvswitch2.17-2.17.0-59.el8fdp.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Spawn VM with libvirt (e.g. using OpenStack)
2. Create qos and queue for tap port in ovs:

ovs-vsctl -- set port tap20326cf2-f1 qos=@newqos -- --id=@newqos create qos type=linux-htb other-config:max-rate=1000000 queues:0=@newqueue -- --id=@newqueue create queue other-config:burst=800000 other-config:max-rate=1000000

or use neutron qos ingress bandwith limit rule to create it automatically by neutron-openvswitch-agent.
3. check if htb qdisc is created for tap port

Actual results:
tap interface still have "noqueue" qdisc configured

Expected results:
tap interface should have "htb" qdisc configured

Additional info:

Comment 1 Slawek Kaplonski 2022-10-28 08:40:08 UTC
Created attachment 1920825 [details]
Proposed fix

Comment 2 Ilya Maximets 2022-10-31 17:42:48 UTC
The fix posted for review:
  https://patchwork.ozlabs.org/project/openvswitch/patch/20221031161759.607307-1-i.maximets@ovn.org/

It is interesting though that libvirt explicitly avoids setting
noqueue for OVS interfaces, but that doesn't work because OpenStack
doesn't mark interfaces as OVS interfaces while creating XML.
See https://bugzilla.redhat.com/show_bug.cgi?id=1329644#c33 .

Comment 3 OvS team 2022-11-03 02:59:34 UTC
* Wed Nov 02 2022 Open vSwitch CI <ovs-ci> - 2.15.0-127
- Merging upstream branch-2.15 [RH git: 96456c53d4]
    Commit list:
    bc49ebfbbd netdev-linux: Fix inability to apply QoS on ports with custom qdiscs. (#2138339)
    f1ae6e59bf vswitch.xml: Fix the name of rstp-path-cost option.
    b5539fe008 bond: Fix crash while logging not yet enabled member.

Comment 10 errata-xmlrpc 2022-12-15 20:20:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (openvswitch2.15 bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:9091