2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-28 21:07:47 +00:00

19894 Commits

Author SHA1 Message Date
David Marchand
7404d25ea7 system-dpdk: Test with mlx5 devices.
The DPDK unit test only runs if vfio or igb_uio kernel modules are loaded:
on systems with only mlx5, this test is always skipped.

Besides, the test tries to grab the first device listed by dpdk-devbind.py,
regardless of the PCI device status regarding kmod binding.

Remove dependency on this DPDK script and use a minimal script that
reads PCI sysfs.

This script is not perfect, as one can imagine PCI devices bound to
vfio-pci for virtual machines.
Plus, this script only tries to take over vfio-pci devices. mlx5 devices
can't be taken over blindly as it could mean losing connectivity to the
machine if the netdev was in use for this system.

For those two reasons, add a new environment variable DPDK_PCI_ADDR for
testers to select the PCI device of their liking.
For consistency and grep, the temporary file PCI_ADDR is renamed
to DPDK_PCI_ADDR.

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2024-01-10 11:05:12 +00:00
Roi Dayan
915b97971d checkpatch.py: Load codespell dictionary.
codespell dictionary contains a list of widely used words
which enchant alone could fail on. for an example:
refcount, pthread, enqueuing, etc.
Load that dictionary, if exists, into enchant spell checker.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2024-01-09 09:17:06 -05:00
Gaetan Rivet
21c61243fb checkpatch: Fix personal word list storage.
The enchant dictionary synchronizes additions to the source file.
Keep the two word source separate by adding the extra words only
to the current session.

Fixes: 999c7773a60b ("checkpatch: add a comment spell-checker")
Signed-off-by: Gaetan Rivet <gaetanr@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2024-01-09 08:52:15 -05:00
Cheng Li
2535d171a3 vconn: Count vconn_sent regardless of log level.
vconn_sent counter is supposed to increase each time send() return
0, no matter if the vconn log debug is on or off.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Cheng Li <lic121@chinatelecom.cn>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:45:41 +01:00
Frode Nordahl
54b3eb531a backtrace: Fix error in log_backtrace() documentation.
The documentation for log_backtrace() states the backtrace is
logged at DEBUG level, while in reality it is logged at ERROR
level.

Fixes: d0b99d38edab ("backtrace: Add log_backtrace()")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:44:43 +01:00
Ilya Maximets
94371c0996 ovsdb: trigger: Do not allow conversion in read-only mode.
It's not a big problem, but it would be nice to ensure that
the backup database cannot be locally converted.

Fixes: e51879e99b3e ("ovsdb: Make OVSDB backup sever read only")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:42:08 +01:00
Ilya Maximets
e951af81cb ovsdb: jsonrpc-server: Fix the DSCP value in default options.
The DSCP_DEFAULT is not zero and is a value that supposed
to be used for all connections by default.

Fixes: f125905cdd3d ("Allow configuring DSCP on controller and manager connections.")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:57 +01:00
Ilya Maximets
d07a3b798d jsonrpc: Sort JSON objects while printing debug messages.
We compare the logs in some tests, for example record/replay tests.
And those fail if for some reason the JSON object traversal happens
in the different order.

Sort the output in debug logs in order to fix sporadic test failures.
Should not affect performance in real-world cases as the actual
outgoing message is still not sorted.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:45 +01:00
Ilya Maximets
0a2e16b67d tests: ovsdb: Use diff -up format for replay test.
It's easier to analyze failures when the lines that are different
are shown next to each other.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:36 +01:00
Ilya Maximets
7c3df36762 ovsdb-server.at: Enbale debug logs in active-backup tests.
It's almost impossible to debug test failures without them.

Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:30 +01:00
Ilya Maximets
0ef3ebb0cf ovsdb: transaction: Don't try to diff unchanged columns.
While reassessing weak references the code attempts to collect added
and removed atoms, even if the column didn't change.  In case the
column contains a large set, it may take significant amount of time
to process.

Add a check for the column actually being changed either by removing
references to deleted rows or by direct removal.

For example, rows in OVN Port_Group tables frequently have two large
sets - 'ports' and 'acls'.  In case a new ACL is added to the set
without changing the ports, ports don't need to be reassessed.

Fixes: 4dbff9f0a685 ("ovsdb: transaction: Incremental reassessment of weak refs.")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:24 +01:00
Ilya Maximets
6f11d9daad ovsdb: transaction: Avoid diffs for different type references.
While counting strong references current code first generates a
difference between old and new datums and only after it checks
the types of the atoms to be strong references.

Similar thing happens while assessing weak references.  First
the added/removed are generated and then we check for atoms
to be weak references.

Check the type first to avoid unnecessary work.  This change
doubles the performance of transactions that modify large sets
of references.

For example, with this change applied, initial read of OVSDB
file containing 136K transactions of large OVN port groups
and address sets on my laptop takes 24 seconds vs 43 seconds
without.

Fixes: 4dbff9f0a685 ("ovsdb: transaction: Incremental reassessment of weak refs.")
Fixes: b2712d026eae ("ovsdb: transaction: Use diffs for strong reference counting.")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:15 +01:00
Ilya Maximets
d51d4f42d3 ovsdb: Fix incorrect sharing of UUID and _version columns.
Datum of UUID and _version columns is accessed directly via
ovsdb_row_get_uuid_rw() and ovsdb_row_get_version_rw() functions
instead of ovsdb_data_* functions.  Meaning, the data will be
directly modified even if it is shared between rows.

Fix that by unsharing the data whenever RW pointer is taken.

The issue was mostly hidden because weak reference assessment
code always called ovsdb_datum_subtract() even if not needed.
This way all the new transaction rows were always implicitly
unshared.

Also making ovsdb_datum_subtract() call conditional, so the
issue can be hit by existing unit tests.

Fixes: 485ac63d10f8 ("ovsdb: Add lazy-copy support for ovsdb_datum objects.")
Acked-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2024-01-08 22:41:11 +01:00
Mike Pattrick
4102674b3e ovsdb-idl: Preserve change_seqno when deleting rows.
In the case of a weak reference, clearing all change_seqno's can delete
useful information. Instead of clearing all seqno's when removing
track_node, only clear those values in cases including row insertion,
and row deleting if no dst_arcs remain.

Fixes: 95689f166818 ("ovsdb-idl: Preserve references for deleted rows.")
Reported-at: https://issues.redhat.com/browse/FDP-193
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2024-01-04 13:26:20 +00:00
David Marchand
5c38104912 tests: Move MFEX tests to dpif-netdev.
The MFEX code and tests do not depend on DPDK anymore.
We can move the unit tests to dpif-netdev.

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Kumar Amber <kumar.amber@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-12-21 14:52:58 +01:00
David Marchand
98ee21ef63 system-dpdk: Use dummy-pmd port for packet injection.
net_pcap is not always available in DPDK (like, in a dev
environment when you forgot to install the libpcap-devel).
On the other hand, OVS already has its own way to inject packets into a
bridge. Let's make use of it.

The generating script outputs a bulk of 8 packets per line (to save some
cpu spent calling ovs-appctl).

Suggested-by: Ilya Maximets <i.maximets@ovn.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-12-21 14:52:27 +01:00
Simon Horman
df5e5cf431 Documentation: Add section on inclusive language.
As a community we should strive to be inclusive.
As such it seems appropriate to adopt an word list,
to help guide the use of inclusive language.

This patch proposes use of the Inclusive Naming Word List v1.0.

Link: https://inclusivenaming.org/word-lists/
Signed-off-by: Simon Horman <horms@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2023-12-21 14:18:33 +01:00
Eelco Chaudron
de4cccf930 ci: Add make check-afxdp to GitHub actions ci.
This patch adds 'make check-afxdp' to the GitHub actions ci.
The tests are not split into two separate test runs as they
complete in around 10 minutes.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:40:30 +01:00
Eelco Chaudron
67c53a89df ci: Allow make check-dpdk to run the MFEX tests.
Currently, if you use the python/test_requirements.txt file to
set up your test environment the MFEX tests will be skipped due
to the Scapy package not being included. This is fixed as part
of this patch.

The test case change will make sure the 'MFEX Configuration' test
will run without the need for Scapy and its auto-generated tests.

In addition, we exclude the traffic-related MFEX tests from running
on GitHub actions due to limited resources.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:40:30 +01:00
Eelco Chaudron
26ffd192f2 ci: Fix dpdk build cache key generation.
When new drivers are introduced, the cache key is not accurately computed.

Before the commit 1a1b3106d90e ("ci: Separate DPDK from OVS build."), the
DPDK build process was integrated in .ci/linux-{setup,build}.sh scripts,
where specific lines were employed to generate the key. Since it is now
separated in .ci/dpdk-{setup,build}.sh, this patch computes the key based
on the content of those dedicated scripts.

Fixes: 4e90baca89f0 ("system-dpdk: Run traffic tests.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2023-12-20 15:40:30 +01:00
Eelco Chaudron
adfc3d4a32 ci: Add make check-system-tso to GitHub actions ci.
This patch adds 'make check-system-tso' to the GitHub actions ci.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:40:30 +01:00
Eelco Chaudron
09958e081c ci: Add make check-system-userspace to GitHub actions ci.
This patch adds 'make check-system-userspace' to the GitHub actions ci.
The tests are not split into two separate test runs as they complete in
around 10 minutes.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:40:30 +01:00
Eelco Chaudron
15f179324c ci: Add make check-offloads to GitHub actions ci.
This patch also adds the 'CHECK_GITHUB_ACTION' macro to skip
tests that won't execute successfully through GitHub actions.
We could not use the -k !keyword option, as it can not be
combined with a range of tests.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
e7b51b38fe ci: Add make check-kernel to GitHub actions ci.
This patch adds 'make check-kernel' to the GitHub actions ci.
However, to do this, some additional changes were needed. First,
some of the missing test and package dependencies had to be added.
Finally, we added an option to the GitHub run matrix that allows
the tests to be split up, to avoid lengthy single test runs.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
a80883f768 ci: Fixed tests that show random failures through GitHub actions.
I ran 80 series of full tests, and the following tests showed failures:

  conntrack - Multiple ICMP traverse
    ./system-traffic.at:7571: ovs-appctl dpctl/dump-conntrack | ...
      -e 's/state=[0-9_A-Z]*/state=<cleared>/g' | sort | uniq
    --- -	2023-11-20 15:36:02.591051192 +0000
    +++ /home/runner/work/ovs/ovs/tests/system-kmod-testsuite.dir/...
    @@ -1,2 +1,9 @@
    +tcp,orig=(src=10.1.1.7,dst=13.107.43.16,sport=<cleared>,
      dport=<cleared>),reply=(src=13.107.43.16,dst=10.1.1.7,sport=<cleared>,
      dport=<cleared>),protoinfo=(state=<cleared>)
    +tcp,orig=(src=10.1.1.7,dst=168.63.129.16,sport=<cleared>,
      dport=<cleared>),reply=(src=168.63.129.16,dst=10.1.1.7,sport=<cleared>,
      dport=<cleared>),protoinfo=(state=<cleared>)
    ...
    +tcp,orig=(src=20.22.98.201,dst=10.1.1.7,sport=<cleared>,dport=<cleared>),
      reply=(src=10.1.1.7,dst=20.22.98.201,sport=<cleared>,dport=<cleared>),
      protoinfo=(state=<cleared>)

  conntrack - ct flush
    +++ /home/runner/work/ovs/ovs/tests/system-kmod-testsuite.dir/...
    @@ -1,3 +1,5 @@
    +tcp,orig=(src=10.1.1.154,dst=13.107.42.16,sport=45300,dport=443),
      reply=(src=13.107.42.16,dst=10.1.1.154,sport=443,dport=45300),
      protoinfo=(state=ESTABLISHED)
    +tcp,orig=(src=10.1.1.154,dst=20.72.125.48,sport=45572,dport=443),
      reply=(src=20.72.125.48,dst=10.1.1.154,sport=443,dport=45572),
      protoinfo=(state=ESTABLISHED)

These tests showed local IP addresses in the results. The tests were
modified to only include the IP addresses relevant to the test case.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
6660fccb19 ci: Exclude tests that show random failures through GitHub actions.
I ran 80 series of full tests, and the following tests showed failures:

 802.1ad - vlan_limit
   +2023-11-20T10:32:11.245Z|00001|dpif_netdev(revalidator5)|ERR|internal
     error parsing flow key recirc_id(0),dp_hash(0),skb_priority(0),
     in_port(2),skb_mark(0),ct_state(0),ct_zone(0),ct_mark(0),ct_label(0),
     packet_type(ns=0,id=0),eth(src=42:7e:4b:46:68:1b,dst=33:33:ff:46:68:1b),
     eth_type(0x88a8),vlan(vid=4094,pcp=0),encap(eth_type(0x8100),
     vlan(vid=100,pcp=0),encap(eth_type(0x86dd),ipv6(
     src=::,dst=ff02::1:ff46:681b,label=0,proto=58,tclass=0,hlimit=255,
     frag=no),icmpv6(type=135,code=0),nd(target=fe80::407e:4bff:fe46:681b,
     sll=00:00:00:00:00:00,tll=00:00:00:00:00:00)))
   +2023-11-20T10:32:11.245Z|00002|dpif(revalidator5)|WARN|netdev@ovs-netdev:
     failed to put[modify] (Invalid argument)
     ufid:ef1ca90c-dbd0-4ca7-9869-411bdffd1ece recirc_id(0),dp_hash(0/0),
     skb_priority(0/0),in_port(2),skb_mark(0/0),ct_state(0/0),ct_zone(0/0),
     ct_mark(0/0),ct_label(0/0),packet_type(ns=0,id=0),
     eth(src=42:7e:4b:46:68:1b,dst=33:33:ff:46:68:1b),eth_type(0x88a8),
     vlan(vid=4094,pcp=0/0x0),encap(eth_type(0x8100),
     vlan(vid=100/0x0,pcp=0/0x0),encap(eth_type(0x86dd),
     ipv6(src=::/::,dst=ff02::1:ff46:681b/::,label=0/0,proto=58/0,
     tclass=0/0,hlimit=255/0,frag=no),icmpv6(type=135/0,code=0/0),
     nd(target=fe80::407e:4bff:fe46:681b/::,
     sll=00:00:00:00:00:00/00:00:00:00:00:00,
     tll=00:00:00:00:00:00/00:00:00:00:00:00))), actions:drop

  conntrack - zones from other field, more tests
    +2023-11-20T10:45:43.015Z|00001|dpif(handler5)|WARN|system@ovs-system:
      execute ct(commit),3 failed (Invalid argument) on packet tcp,
      vlan_tci=0x0000,dl_src=42:7e:4b:46:68:1b,dl_dst=ba:72:4c:a5:31:6b,
      nw_src=10.1.1.1,nw_dst=10.1.1.2,nw_tos=0,nw_ecn=0,nw_ttl=64,
      nw_frag=no,tp_src=53738,tp_dst=80,tcp_flags=psh|ack tcp_csum:e4a

  conntrack - limit by zone
    ./system-traffic.at:5154: ovs-appctl dpctl/ct-get-limits zone=0,1,2,3,4,5
    --- -	2023-11-20 10:51:09.965375141 +0000
    +++ /home/runner/work/ovs/ovs/tests/system-kmod-testsuite.dir/at-groups/
      114/stdout	2023-11-20 10:51:09.956723756 +0000
    @@ -1,5 +1,5 @@
     default limit=10
    -zone=0,limit=5,count=5
    +zone=0,limit=5,count=6

As I do not see those failures when running these stand alone on the
same Ubuntu distribution, I've disabled them.

This patch also adds the 'CHECK_GITHUB_ACTION' macro to skip
tests that won't execute successfully through GitHub actions.
We could not use the -k !keyword option, as it can not be
combined with a range of tests.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
9dfa65dc7b ci: Update the GitHub Ubuntu runner image to Ubuntu 22.04.
Updating this image is a requirement for the kernel system-traffic
tests to pass on Ubuntu. In addition, 20.04 might be replaced,
as soon as 24.04 comes out. Or we need to do this when it becomes
EOL in April 2025.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
e07ae9a6d7 ci: Add make check-ovsdb-cluster tests to GitHub action ci.
This patch adds 'make check-ovsdb-cluster' tests to GitHub action ci.
In addition, this patch also makes sure this test and 'make check' do
not run as root.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:39:38 +01:00
Eelco Chaudron
ee93f364b9 ci: Add JOBS variable to replace all the '-j4' instances.
Add a JOBS variable, which defaults to '-j4' but can be overwritten
with the same environment variable. This can be useful if you use
this linux-build.sh script outside of GitHub actions on a machine
with many cores.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
2023-12-20 15:39:38 +01:00
Kevin Traynor
4cbbf56e6c dpif-netdev: Add per PMD sleep config.
Extend 'pmd-sleep-max' so that individual PMD thread cores may have a
specified max sleep request value.

Existing behaviour is maintained.

Any PMD thread core without a value will use the global value if set
or default no sleep.

To set PMD thread cores 8 and 9 to never request a load based sleep
and all other PMD thread cores to be able to request a max sleep of
50 usecs:

 $ ovs-vsctl set open_vswitch . other_config:pmd-sleep-max=50,8:0,9:0

To set PMD thread cores 10 and 11 to request a max sleep of 100 usecs
and all other PMD thread cores to never request a sleep:

 $ ovs-vsctl set open_vswitch . other_config:pmd-sleep-max=10:100,11:100

'pmd-sleep-show' is updated to show the max sleep value for each PMD
thread.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-16 01:07:59 +01:00
Ales Musil
a095794bcc openflow: Allow CT flush to match on mark and labels.
Extend the current NX_CT_FLUSH with four additional fields,
that allow to match on CT entry "mark" or "labels". This
is encoded as separate TLV values which is backward compatible.
Versions that do not support them will fail the command.

Extend also the ovs-dpctl and ovs-ofctl command line tools with
option to specify those two matching parameters for the "ct-flush"
command.

Reported-at: https://issues.redhat.com/browse/FDP-55
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-15 00:35:41 +01:00
Ales Musil
386deb32cd dpctl, ovs-ofctl: Unify parsing of ct-flush arguments.
In order to make the command extensible unify the arguments
parsing into single function. This will be later on used
for the mark and labels arguments.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-14 23:06:12 +01:00
Ales Musil
62c5d32ad4 ofp-prop: Add helper for parsing and storing of ovs_u128.
Add helper methods that allow us to store and parse the
ovs_u128 type.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-14 22:58:37 +01:00
David Marchand
cc670e7411 system-dpdk: Wait for MTU changes to be applied.
Because a DPDK backed netdev configuration is done in an asynchronous way,
and a MTU change requires a reconfiguration, directly checking
ovs-vswitchd logs or querying ovsdb for the interface current MTU value
is racy.

Add synchronisation points on the interface MTU value in ovsdb as it
ensures that a netdev (re)configuration did happen.
With those synchronisation points in place, error messages may be checked
in logs afterward.

Fixes: bf47829116a8 ("tests: Add OVS-DPDK MTU unit tests.")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2023-12-06 12:54:08 +00:00
Ales Musil
7067ed1660 tests: Do not use zone 0 for CT limit system test.
The zone 0 is default system zone, do not use this
zone for the test because it might contain some
entries already which could cause flakiness during
the check.

In order to still have the zone 0 parsing coverage
add simple unit tests for dpctl.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 21:54:48 +01:00
Ales Musil
27e0349e20 ct-dpif: Enforce CT zone limit protection.
Make sure that if any zone limit was set via DB
all zones are forced to be set there also. This
is done by tracking which datapath has zone limit
protection and it is reflected in the dpctl command.

If the datapath is protected the dpctl command will
return permission error.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 21:54:48 +01:00
Ales Musil
1b3557f53d vswitchd, ofproto-dpif: Propagate the CT limit from database.
Propagate the CT limit that is present in the DB into
datapath. The limit is currently only propagated on change
and can be overwritten by the dpctl commands.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 21:54:48 +01:00
Ales Musil
3248833619 ovs-vsctl: Add limit to CT zone.
Add limit to the CT zone DB table with ovs-vsctl
helper methods. The limit has two special values
besides any number, 0 is unlimited and empty limit
is to leave the value untouched in the datapath.

This is preparation step and the value is not yet
propagated to the datapath.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 21:54:47 +01:00
Ales Musil
8f4b86237b dpctl: Allow the default CT zone limit to be deleted.
Add optional argument to dpctl ct-del-limits called
"default", which allows to remove the default limit
making it effectively system default.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 21:53:52 +01:00
Ales Musil
4b9eb061b1 ct-dpif: Handle default zone limit the same way as other limits.
Internally handle default CT zone limit as other limits that
can be passed via the list with special value -1. Currently,
the -1 is treated by both datapaths as default, add static
asserts to make sure that this remains the case in the future.
This allows us to easily delete the default zone limit.

Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-05 20:42:04 +01:00
Ilya Maximets
6b17235885 tunnel: Do not carry source port from a previous tunnel.
If a packet is received from a UDP tunnel, it has a source port
populated in the tunnel metadata.  This field cannot be read or
changed with OpenFlow or the tunnel configuration.  However, while
sending this packet to a different tunnel, the value remains in
the metadata and is being sent to the datapath to use as a source
port for this new tunnel.  Tunnel implementations largely ignore
this value, and it is a random value from a different tunnel
anyway.

Clear it while sending to a different tunnel, so the unnecessary
information is not being passed to the datapath.  This additionally
allows traffic from one tunnel to anther to be offloaded to TC,
as TC doesn't allow setting the source port at all.

Tested-by: Vladislav Odintsov <odivlad@gmail.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-04 17:57:24 +01:00
Ilya Maximets
472dd66423 netdev-offload-tc: Fix offload of tunnel key tp_src.
There is no TCA_TUNNEL_KEY_ENC_SRC_PORT in the kernel, so the offload
should not be attempted if OVS_TUNNEL_KEY_ATTR_TP_SRC is requested
by OVS.  Current code just ignores the attribute in the tunnel(set())
action leading to a flow mismatch and potential incorrect datapath
behavior:

  |tc(handler21)|DBG|tc flower compare failed action compare
  ...
  Action 0 mismatch:
  - Expected Action:
  00000010 01 00 00 00 00 00 00 00-00 00 00 00 00 ff 00 11
  00000020 c0 5b 17 c1 00 40 00 00-0a 01 00 6d 0a 01 01 12
  00000050 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00000060 01 02 80 01 00 18 00 0b-00 00 00 00 00 00 00 00
  ...
 - Received Action:
  00000010 01 00 00 00 00 00 00 00-00 00 00 00 00 ff 00 11
  00000020 00 00 17 c1 00 40 00 00-0a 01 00 6d 0a 01 01 12
  00000050 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  00000060 01 02 80 01 00 18 00 0b-00 00 00 00 00 00 00 00
  ...

In the tc_action dump above we can see the difference on the second
line.  The action dumped from a kernel is missing 'c0 5b' - source
port for a tunnel(set()) action on the second line.

Removing the field from the tc_action_encap structure entirely to
avoid any potential confusion.

Note: In general, the source port number in the tunnel(set()) action
is not particularly useful for most tunnels, because they may just
ignore the value.  Specs for Geneve and VXLAN suggest using a value
based on the headers of the inner packet as a source port.
In vast majority of scenarios the source port doesn't actually end
up in the action itself.
Having a mismatch between the userspace and TC leads to constant
revalidation of the flow and warnings in the log.

Adding a test case that demonstrates a scenario where the issue
occurs - bridging of two tunnels.

Fixes: 8f283af89298 ("netdev-tc-offloads: Implement netdev flow put using tc interface")
Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2023-October/052744.html
Reported-by: Vladislav Odintsov <odivlad@gmail.com>
Tested-by: Vladislav Odintsov <odivlad@gmail.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Marcelo Ricardo Leitner <mleitner@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-04 17:57:24 +01:00
Ales Musil
a34e306a0d ofp-ct: Return error for unknown property in CT flush.
CT flush extension would silently ignore unknown properties,
which could lead to potential surprise by deleting more than
it was requested to. Return error on unknown property instead
to avoid this problem and at the same time inform the user
that the specified property is not supported.

Fixes: 08146bf7d9b4 ("openflow: Add extension to flush CT by generic match.")
Signed-off-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-04 16:00:13 +01:00
Jakob Meng
20022fbf5a editorconfig: Remove [*] section and trim_trailing_whitespace.
Wildcard sections [*] and [**] are unsafe because properties cannot be
applied safely to any filetype in general. For example, IDEs like
Visual Studio Code and KDevelop store configuration files in subfolders
like .vscode or .kdev4. Properties from wildcard sections also apply to
those files which is not safe in general.
Another example are patches created with 'git format-patch' which can
contain trailing whitespaces. When editing a patch, e.g. to fix a typo
in the title, trailing whitespaces should not be removed.

Property trim_trailing_whitespace should not be defined at all because
it is interpreted differently by editors. Some wipe whitespaces from
the whole file, others remove them from edited lines only and a few
change their behavior between releases [0]. Limiting the property to a
subset of files like *.c/*.h will not mitigate the issue:

Multiple definitions of a whitespace exist. Unicode considers a form
feed (0x0C) to be a whitespace [1]. QChar::isSpace() [2] from Qt
follows this definition, causing the Kate editor identify a form feed
as a trailing whitespace and removing it from sources [3]. This breaks
patches when editors remove form feeds and thus causing broken patches
which cannot be applied cleanly.

Removing trim_trailing_whitespace will be a minor inconvienence, in
particular because utilities/checkpatch.py and thus 0-day Robot will
prevent trailing whitespaces for our definition of a whitespace.

[0] 94b328fc64
[1] https://en.wikipedia.org/wiki/Whitespace_character
[2] 5628600a07/src/corelib/text/qchar.h (L554)
[3] 10210ec1dd/src/document/katedocument.cpp (L5643)

Fixes: 07f6d6a0cb51 ("Add editorconfig file.")

Signed-off-by: Jakob Meng <code@jakobmeng.de>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: Robin-Jarry <rjarry@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
2023-12-04 09:19:43 -05:00
Flavio Leitner
8b5fe2dc60 userspace: Add Generic Segmentation Offloading.
This provides a software implementation in the case
the egress netdev doesn't support segmentation in hardware.

The challenge here is to guarantee packet ordering in the
original batch that may be full of TSO packets. Each TSO
packet can go up to ~64kB, so with segment size of 1440
that means about 44 packets for each TSO. Each batch has
32 packets, so the total batch amounts to 1408 normal
packets.

The segmentation estimates the total number of packets
and then the total number of batches. Then allocate
enough memory and finally do the work.

Finally each batch is sent in order to the netdev.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Co-authored-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-02 01:33:37 +01:00
Flavio Leitner
e0056018c4 userspace: Respect tso/gso segment size.
Currently OVS will calculate the segment size based on the
MTU of the egress port. That usually happens to be correct
when the ports share the same MTU, but that is not always true.

Therefore, if the segment size is provided, then use that and
make sure the over sized packets are dropped.

Signed-off-by: Flavio Leitner <fbl@sysclose.org>
Co-authored-by: Mike Pattrick <mkp@redhat.com>
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-02 00:56:36 +01:00
Mike Pattrick
6c59c19526 netdev-linux: Use ethtool to detect offload support.
Currently when userspace-tso is enabled, netdev-linux interfaces will
indicate support for all offload flags regardless of interface
configuration. This patch checks for which offload features are enabled
during netdev construction.

Signed-off-by: Mike Pattrick <mkp@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-02 00:56:36 +01:00
Ilya Maximets
c8d4946367 cirrus: Update from FreeBSD 12 to 14.
FreeBSD 12 is going EOL in December [1] and will likely become
unavailable shortly after.  FreeBSD 14 was released recently,
so replacing the old with the new.

[1] https://www.freebsd.org/security/

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-01 14:34:00 +01:00
Ilya Maximets
cf984d5bec appveyor: Use previous image to unblock CI.
It may take a few days for AppVeyor to fix their broken
images [1], use the 'Previous' version of the image for now
to unblock CI.

We'll need to revert this once the issue is fixed.

[1] https://github.com/appveyor/ci/issues/3893

Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-12-01 14:34:00 +01:00
Kevin Traynor
ceb29608db faq: Update matching DPDK releases for older branches.
Branches 2.17/3.0/3.1/3.2 are using newer DPDK LTS releases.

Update the faq.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-30 13:06:43 +00:00