Skip to content

Commit

Permalink
ON-15561: Fix test_multi_ns*[ipvlan] cplane sysunit tests
Browse files Browse the repository at this point in the history
The affected tests failed because they did not specify the IPVLAN
mode. The IPVLAN mode selected by default, L3 (1), is not accelerated
by Onload, that only supports L2 (0). As a result, when the test case
tried to resolve a test route, the resulting HW port mask was empty,
i.e. unexpectedly unaccelerated.

To fix it, the test case passes additional options for using the L2
mode when it creates an IPVLAN interface.
  • Loading branch information
ivatet-amd committed Apr 23, 2024
1 parent 8db2c93 commit e1f7141
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/tests/onload/cplane_sysunit/scripts/test_cplane1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from random import randint
from pyroute2 import NetNS, netlink, IPRoute, NetlinkError
from pyroute2.netlink.rtnl.ifaddrmsg import IFA_F_NODAD
from pyroute2.netlink.rtnl.ifinfmsg.plugins.ipvlan import ipvlan
from cplane import *

def ip2v4(ip):
Expand Down Expand Up @@ -911,6 +912,18 @@ def test_nic_order(encap):
do_test_nic_order(encap=encap)


def link_options(kind):
''' Return additional options to pass to pyroute2 when creating
new acceleratable interfaces (in subordinate namespaces).
'''

# Override the default ipvlan mode L3 because Onload supports only L2
if kind == 'ipvlan':
return {'ipvlan_mode': ipvlan.modes['IPVLAN_MODE_L2']}

return {}


@cpdecorate(tag='main_ns')
@cpdecorate(tag='myns', parent_tag='main_ns')
def do_test_multi_ns(main_ns, myns, encap):
Expand All @@ -926,7 +939,7 @@ def do_test_multi_ns(main_ns, myns, encap):

vifname= 'p0dmv'
main_ns.netns.link('add', kind=encap, ifname=vifname,
link=main_ix)
link=main_ix, **link_options(encap))

ix = main_ns.netns.link_lookup(ifname=vifname)[0]
main_ns.netns.link('set', index=ix,
Expand Down Expand Up @@ -962,7 +975,8 @@ def do_test_multi_ns_bond(main_ns, myns, encap):
main_ns.netns, nics=nics, address=None)

main_ns.netns.link('add', kind=encap, ifname='bond2mv',
link=main_ns.netns.link_lookup(ifname='bond2')[0])
link=main_ns.netns.link_lookup(ifname='bond2')[0],
**link_options(encap))
main_ns.netns.link('set',
index=main_ns.netns.link_lookup(ifname='bond2mv')[0],
net_ns_fd=myns.cpserver.getNetNsPath())
Expand Down

0 comments on commit e1f7141

Please sign in to comment.