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

19894 Commits

Author SHA1 Message Date
Ales Musil
3626c17443 ovs-ofctl: Correctly mark the CT flush commands.
Change the ct-flush and ct-flush-zone to RW
as they do in fact modify the state.

Fixes: 2a7c4805a76d ("Add OpenFlow command to flush conntrack table entries.")
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-11-29 16:05:31 +01:00
David Marchand
40f651ce07 mcast-snooping: Fix comments format.
Capitalize comments and end them with a . when needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:54:39 +00:00
David Marchand
42c1e2efed mcast-snooping: Flush flood and report ports when deleting interfaces.
When a configuration change triggers an interface destruction/creation
(like for example, setting ofport_request), a port object may still be
referenced as a fport or a rport in the mdb.

Before the fix, when flooding multicast traffic:
bridge("br0")
-------------
 0. priority 32768
    NORMAL
     -> forwarding to mcast group port
     >> mcast flood port is unknown, dropping
     -> mcast flood port is input port, dropping
     -> forwarding to mcast flood port

Before the fix, when flooding igmp report traffic:
bridge("br0")
-------------
 0. priority 32768
    NORMAL
     >> mcast port is unknown, dropping the report
     -> forwarding report to mcast flagged port
     -> mcast port is input port, dropping the Report
     -> forwarding report to mcast flagged port

Add relevant cleanup and update unit tests.

Fixes: 4fbbf8624868 ("mcast-snooping: Flush ports mdb when VLAN configuration changed.")
Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:54:39 +00:00
David Marchand
4990a9a271 mcast-snooping: Test per port explicit flooding.
Various options affect how the mcast snooping module work.

When multicast snooping is enabled and a reporter is known, it is still
possible to flood associated packets to some other port via the
mcast-snooping-flood option.

If flooding unregistered traffic is disabled, it is still possible to
flood multicast traffic too with the mcast-snooping-flood option.

IGMP reports may have to be flooded to some ports explicitly with the
mcast-snooping-flood-reports option.

Test those parameters.

Acked-by: Paolo Valerio <pvalerio@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:54:22 +00:00
David Marchand
4e90baca89 system-dpdk: Run traffic tests.
Integrate system-traffic.at tests as part of check-dpdk.

Some tests that can't work with the userspace datapath are skipped by
overriding some OVS_CHECK_* macros.

ADD_VETH is implemented using the net/af_xdp DPDK driver.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:49 +00:00
David Marchand
1d0ff364b0 system-dpdk: Rework cleanup for vhost-user client tests.
Those tests are subject to a race when a testpmd hosting the vhost-user
server is stopped and OVS has enough time to detect the vhost-user socket
drop and tries to reconnect to this socket.

In such a situation, the tests can fail as the OVS process with the
vhost-user client port complains with a warning log:

2023-09-08T13:15:18.160Z|00163|dpdk|INFO|VHOST_CONFIG:
	(.../005/dpdkvhostclient0) vhost peer closed
2023-09-08T13:15:18.160Z|00164|netdev_dpdk|INFO|vHost Device
	'.../005/dpdkvhostclient0' connection has been destroyed
2023-09-08T13:15:18.160Z|00165|dpdk|INFO|VHOST_CONFIG:
	(.../005/dpdkvhostclient0) vhost-user client: socket created, fd: 24
2023-09-08T13:15:18.160Z|00166|dpdk|WARN|VHOST_CONFIG:
	(.../005/dpdkvhostclient0) failed to connect: Connection refused
2023-09-08T13:15:18.160Z|00167|dpdk|INFO|VHOST_CONFIG:
	(.../005/dpdkvhostclient0) reconnecting...

Invert the order of the cleanup steps.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:45 +00:00
David Marchand
1c37d869c2 system-dpdk: Refactor tests using vhost-user ports.
Introduce macros responsible for adding a vhost-user / vhost-user client
port to a userspace datapath bridge and check associated logs.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:27 +00:00
David Marchand
d0a6cf57dd system-dpdk: Fix race in some vhost-user client MTU test.
Adding those grep gives enough time to OVS to be ready to connect with
the testpmd virtio-user port instantiated afterward.

Fixes: bf47829116a8 ("tests: Add OVS-DPDK MTU unit tests.")
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:22 +00:00
David Marchand
64c1d16c6a system-dpdk: Remove tap interfaces from vport MTU tests.
The unit tests for changing MTU with vhost-user ports are not using
those tap interfaces.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:16 +00:00
David Marchand
b561bbdc27 netdev-afxdp: Postpone libbpf logging helper registration.
When using net/af_xdp DPDK driver along OVS native AF_XDP support,
confusing logs are reported, like:

netdev_dpdk|INFO|Device 'net_af_xdpp0,iface=ovs-p0' attached to DPDK
dpif_netdev|INFO|PMD thread on numa_id: 0, core id: 11 created.
dpif_netdev|INFO|There are 1 pmd threads on numa node 0
dpdk|INFO|Device with port_id=0 already stopped
dpdk(pmd-c11/id:22)|INFO|PMD thread uses DPDK lcore 1.
netdev_dpdk|WARN|Rx checksum offload is not supported on port 0
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(6)
	.xdp_run_config
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata
netdev_afxdp|INFO|libbpf: elf: skipping unrecognized data section(7)
	xdp_metadata

This comes from the fact that netdev-afxdp unconditionnally registers a
helper for logging libbpf messages.
Making both net/af_xdp and netdev-afxdp work at the same time seems
difficult, so at least, ensure that netdev-afxdp won't register this
helper unless a netdev is actually allocated.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:11 +00:00
David Marchand
818217eafe system-dpdk: Refactor OVS daemons helpers.
Align system-dpdk existing helpers to other common OVS helpers so they
can accept some optional arguments.

Introduce a OVS_DPDK_STOP_VSWITCHD wrapper around OVS_VSWITCHD_STOP to
catch dpdk related logs in a centralised fashion.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:40:02 +00:00
David Marchand
e6dd50d615 tests: Define a macro to skip tc relying tests.
Some unit tests expect that a OVS port has an associated netdevice on
which they can hook tc.
This will not be possible when testing the userspace datapath with DPDK.
Introduce a helper (which will be overriden in system-dpdk tests) and
use it in the existing tests.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:39:48 +00:00
David Marchand
ab3eca6122 ci: Run DPDK tests in GitHub Actions.
Let's enhance our coverage in the CI and run DPDK system tests.

A few DPDK drivers are enabled in DPDK compilation.

Put DPDK build in $PATH for dpdk-testpmd to be available.
sudo drops PATH= updates and -E alone does not seem to preserve this
variable.
Pass PATH=$PATH when running the tests, as a workaround.
Since those tests are run as root, the collection of logs is updated
accordingly.

In GHA, only two cores are available but some test rely on testpmd using
three lcores.
Add a DPDK_EAL_OPTIONS environment variable and use it to map all
testpmd lcores to core 1 (and leave core 0 alone for OVS main and PMD
threads).

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-21 09:39:44 +00:00
David Marchand
c488f28a0e system-dpdk: Don't require hugetlbfs.
dpdk-testpmd does not need hugetlbfs backing as we don't require
multiprocess support in OVS unit tests.

Switch to --in-memory and remove the (then unneeded) check on
hugetlbfs presence.

Acked-by: Aaron Conole <aconole@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-11-21 09:39:39 +00:00
David Marchand
209667c0ee system-dpdk: Introduce helpers for testpmd.
Rather than copy/paste everywhere, introduce helpers to control
testpmd runs.
Rely on --stats-period (which outputs port stats every n seconds) so that
testpmd keeps running without expecting any user input.

Acked-by: Aaron Conole <aconole@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-11-21 09:38:46 +00:00
Nobuhiro MIKI
7b514aba0e ofproto-dpif-trace: Improve conjunctive match tracing.
A conjunctive flow consists of two or more multiple flows with
conjunction actions. When input to the ofproto/trace command
matches a conjunctive flow, it outputs flows of all dimensions.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-16 18:41:07 +01:00
Ihar Hrachyshka
c62b4ac8f8 ovs-ofctl: Implement compose-packet --bare [--bad-csum].
With --bare, it will produce a bare hexified payload with no spaces or
offset indicators inserted, which is useful in tests to produce frames
to pass to e.g. `ovs-ofctl receive`.

With --bad-csum, it will produce a frame that has an invalid IP checksum
(applicable to IPv4 only because IPv6 doesn't have checksums.)

The command is now more useful in tests, where we may need to produce
hex frame payloads to compare observed frames against.

As an example of the tool use, a single test case is converted to it.
The test uses both normal --bare and --bad-csum behaviors of the
command, confirming they work as advertised.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-16 18:16:59 +01:00
Roi Dayan
3e0d8d1f4b checkpatch.at: Add cases to verify skip committer check.
First case without the skip flag should fail.
Second case uses the skip flag and should pass.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-16 11:58:55 +00:00
Salem Sol
74bfe37014 checkpatch: Add argument to skip committer signoff check.
Introduce --skip-committer-signoff arg that can be used internally
by groups using gerrit for code reviews and gerrit maintainers could
do the rebase instead of the author or push upstream commits to be
merged through gerrit.

Signed-off-by: Salem Sol <salems@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-16 11:58:36 +00:00
Ilya Maximets
4d74e23073 build-aux/extract-ofp-fields: Fix the number of Summary columns.
The table has only 6 columns, not 7.  This doesn't really affect
rendering.  Only slightly affects calculations around how much space
the table needs.

Fixes: 96fee5e0a2a0 ("ovs-fields: New manpage to document Open vSwitch and OpenFlow fields.")
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-14 21:50:11 +01:00
Ilya Maximets
8b4265c111 release-process: Update LTS designation schedule example.
It is an example and the dates are not set in stone, so updating
the table it is not very important.  But it's nice to see currently
supported releases there as well as the near future plans.

Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-14 21:50:11 +01:00
Jakob Meng
c19a5b48bf netdev-dpdk: Sync and clean {get, set}_config() callbacks.
For better usability, the function pairs get_config() and
set_config() for netdevs should be symmetric: Options which are
accepted by set_config() should be returned by get_config() and the
latter should output valid options for set_config() only.

This patch moves key-value pairs which are not valid options from
get_config() to the get_status() callback. For example, get_config()
in lib/netdev-dpdk.c returned {configured,requested}_{rx,tx}_queues
previously. For requested rx queues the proper option name is n_rxq,
so requested_rx_queues has been renamed respectively. Tx queues
cannot be changed by the user, hence requested_tx_queues has been
dropped. Both configured_{rx,tx}_queues will be returned as
n_{r,t}xq in the get_status() callback.

The netdev dpdk classes no longer share a common get_config() callback,
instead both the dpdk_class and the dpdk_vhost_client_class define
their own callbacks. The get_config() callback for dpdk_vhost_class has
been dropped because it does not have a set_config() callback.

The documentation in vswitchd/vswitch.xml for status columns as well
as tests have been updated accordingly.

Reported-at: https://bugzilla.redhat.com/1949855
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2023-11-14 11:03:35 +00:00
Jakob Meng
d614f2863f netdev-afxdp: Sync and clean {get, set}_config() callbacks.
For better usability, the function pairs get_config() and
set_config() for netdevs should be symmetric: Options which are
accepted by set_config() should be returned by get_config() and the
latter should output valid options for set_config() only. This patch
also moves key-value pairs which are not valid options from get_config()
to the get_status() callback.

The documentation in vswitchd/vswitch.xml for status columns has been
updated accordingly.

Reported-at: https://bugzilla.redhat.com/1949855
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2023-11-14 11:03:28 +00:00
Jakob Meng
169c6b2d4a netdev-dummy: Sync and clean {get, set}_config() callbacks.
For better usability, the function pairs get_config() and
set_config() for netdevs should be symmetric: Options which are
accepted by set_config() should be returned by get_config() and the
latter should output valid options for set_config() only. This patch
also moves key-value pairs which are not valid options from get_config()
to the get_status() callback. The tests have been updated accordingly.

Reported-at: https://bugzilla.redhat.com/1949855
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Reviewed-by: Robin Jarry <rjarry@redhat.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
2023-11-14 11:03:20 +00:00
Eli Britstein
bf843fd439 checkpatch: Don't spell check Fixes tag.
Fixes tag quotes another commit that might fail in a spell check. Don't
fail it.

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Roi Dayan <roid@nvidia.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-11-03 16:18:16 +00:00
Ihar Hrachyshka
fdbf0bb2ae flake8: Fix E721 check failures.
E721: "do not compare types, for exact checks use `is` / `is not`, for
instance checks use `isinstance()`"

This fixes `make flake8-check` target when running with
pycodestyle>=1.2.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ihar Hrachyshka <ihrachys@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-11-01 10:54:19 +01:00
Ilya Maximets
28f6e7602c build-aux: Enable flake8 checks for python extraction scripts.
These were recently updated to pass the checks, so should be
added to the list in order to avoid regressions in the future.
While at it, fixing the indentation.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:35:45 +01:00
Ilya Maximets
20e6309ba6 build-aux/extract-ofp-msgs: Fix flake8 and syntax errors.
A few general style issues like extra spacing and line length,
semicolons at the end of the line and unused variable 'raw_types'.
And a few invalid escape sequences, which are not actual escape
sequences, but cause actual syntax warnings starting python 3.12
and will eventually become syntax errors [1]:

 extract-ofp-msgs:118: SyntaxWarning: invalid escape sequence '\s'
  m = re.match('\s+(?:OFPRAW_%s)(\d*)_([A-Z0-9_]+),?$' % type_,

These are fixed by converting to raw strings.

[1] https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:35:30 +01:00
Ilya Maximets
23fb4bd4bc build-aux/extract-ofp-fields: Fix flake8 and syntax errors.
A few general style issues like extra spacing and block comment format.
And a few invalid escape sequences, which are not actual escape
sequences, but cause actual syntax warnings starting python 3.12 and
will eventually become syntax errors [1]:

 extract-ofp-fields:323: SyntaxWarning: invalid escape sequence '\_'
  "\_;\_;\_;\_;\_;\_\n",
 extract-ofp-fields:332: SyntaxWarning: invalid escape sequence '\_'
  s = """tab(;);
 extract-ofp-fields:374: SyntaxWarning: invalid escape sequence '\-'
  """\

These are fixed by converting to raw strings.  While doing that we
also have to remove all the now unnecessary escaping from actual
escape sequences like '\\'.

[1] https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:35:22 +01:00
Ilya Maximets
6625f6f2f2 build-aux/extract-ofp-errors: Fix flake8 and syntax errors.
A few general style issues like extra spacing and lines being too long,
unused variable 'error_types', passing more arguments than a format
string has.  And a few invalid escape sequences, which are not actual
escape sequences, but cause actual syntax warnings starting python 3.12
and will eventually become syntax errors [1]:

 extract-ofp-errors:244: SyntaxWarning: invalid escape sequence '\.'
  m = re.match('Expected: (.*)\.$', comment)
 extract-ofp-errors:249: SyntaxWarning: invalid escape sequence '\.'
  m = re.match('((?:.(?!\.  ))+.)\.\s+(.*)$', comment)
 extract-ofp-errors:256: SyntaxWarning: invalid escape sequence '\s'
  m = re.match('\s+(?:OFPERR_([A-Z0-9_]+))(\s*=\s*OFPERR_OFS)?,',
 extract-ofp-errors:265: SyntaxWarning: invalid escape sequence '\['
  comments.append(re.sub('\[[^]]*\]', '', comment))

These are fixed by converting to raw strings.

[1] https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:35:14 +01:00
Ilya Maximets
51fb992904 build-aux/extract-ofp-actions: Fix flake8 and syntax errors.
A few general style issues like extra spacing and lines being too long.
Also, unused variables 'error_types' and 'comments'.  And a few invalid
escape sequences, which are not actual escape sequences, but cause
actual syntax warnings starting python 3.12 and will eventually become
syntax errors [1]:

 extract-ofp-actions:122: SyntaxWarning: invalid escape sequence '\['
  comment = re.sub('\[[^]]*\]', '', comment)
 extract-ofp-actions:125: SyntaxWarning: invalid escape sequence '\s'
  m = re.match('([^:]+):\s+(.*)$', comment)

These are fixed by converting to raw strings.

[1] https://docs.python.org/3/reference/lexical_analysis.html#escape-sequences

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:35:04 +01:00
Ilya Maximets
723cd4c9be automake: Move build-aux EXTRA_DIST updates to their own file.
Otherwise it's hard to keep track of all the scripts we have.

Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-By: Ihar Hrachyshka <ihar@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-31 19:34:44 +01:00
Eelco Chaudron
08212d755e netdev-offload: Fix Clang's static analyzer 'Division by zero' warnings.
When enabling DPDK with the configure the below, ovs-vswitchd will crash.

  ovs-vsctl set Open_vSwitch . other_config:n-offload-threads=0
  ovs-vsctl set Open_vSwitch . other_config:hw-offload=true

This issue arises because setting the 'n-offload-threads' value to zero
is not a supported configuration. This fix addresses this by implementing
a check to ensure a valid 'n-offload-threads' value, both during
configuration and statistics gathering.

Fixes: 62c2d8a67543 ("netdev-offload: Add multi-thread API.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Eelco Chaudron
979bc94b1b ovsdb: Fix Clang's static analyzer 'func null dereference' warnings.
In the existing code, there is no existing path that would result
in a crash. Therefore, this code is currently implemented to
satisfy Clang's requirements. Nevertheless, it serves the
additional purpose of preventing issues with potential new use
cases of the ovsdb_mutation_set_execute() API.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Eelco Chaudron
03c8e8010e ofp-table: Fix count_common_prefix_run() function.
It appears that an issue existed in the count_common_prefix_run()
function from the beginning. This problem came to light while
addressing 'Dead assignment' warnings identified by the Clang
static analyzer.

Instead of updating the extra_prefix_len with the current (next)
value, the next value was inadvertently updated with extra_prefix_len.
This patch rectifies this behavior.

Fixes: 95a5454c5110 ("ofp-print: Abbreviate lists of fields in table features output.")
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Eelco Chaudron
5b6021957b general: Fix Clang's static analyzer 'Dead assignment' warnings.
This patch addresses a 'Dead assignment' warning by designating
the variable as OVS_UNUSED. We opted for this approach instead
of comparing it to the sizeof(struct ...) method because of
concerns related to code clarity.

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Eelco Chaudron
49096a0cf1 general: Fix Clang's static analyzer 'Dead initialization' warnings.
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Jakob Meng
fea52dc717 python: Remove duplicate UnixctlClient implementation.
The unixctl implementation in Python has been split into three parts in
the past. During this process the UnixctlClient was duplicated, in
python/ovs/unixctl/client.py and python/ovs/unixctl/server.py. This
patch removes the duplicate from the latter.

Fixes: 53cf9963ccc6 ("python: Break unixctl implementation into registry, client, and server.")
Signed-off-by: Jakob Meng <code@jakobmeng.de>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-31 15:00:17 +00:00
Kevin Traynor
2c841eef95 vswitch.xml: Add entry for dpdkvhostuser userspace-tso.
get_status for dpdkvhostuser(/client) netdev class may display
userspace-tso status.

Fixes: a5669fd51c9b ("netdev-dpdk: Drop TSO in case of conflicting virtio features.")
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-30 11:02:37 +00:00
Kevin Traynor
e8914353ce vswitch.xml: Add dpdkvhostuser group status.
Add group for dpdkvhostuser(/client) netdev.

Adding as a single group as they display the same status,
one of which is 'mode' to indicate if it's client or server.

Fixes: b2e8b12f8a82 ("netdev-dpdk: add vhost-user get_status.")
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Simon Horman <horms@ovn.org>
2023-10-30 11:02:15 +00:00
Ilya Maximets
594d145410 readthedocs: Use dirhtml builder.
We used this builder before, but from the project configuration
on the website.  ReadTheDocs doesn't allow to change it there
anymore and it doesn't allow to see the full name of the previously
used builder (!!), so I failed to migrate it to the config file.

The result is that older link like:
  https://docs.openvswitch.org/en/latest/howto/dpdk/
Now require .html:
  https://docs.openvswitch.org/en/latest/howto/dpdk.html

Fixing now by switching the builder back.

Fixes: e388bd73b70d ("readthedocs: Add the configuration file.")
Reported-by: Antonin Bas <abas@vmware.com>
Reported-by: David Marchand <david.marchand@redhat.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/310
Reviewed-by: Antonin Bas <abas@vmware.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-27 11:07:24 +02:00
Frode Nordahl
34ae81c1f4 tests: Use ping timeout instead of deadline.
Many system tests currently use ping with the combination of a
low packet count (-c 3), short interval between sends (-i 0.3)
and a _deadline_ of 2 seconds (-d 2).

This combination of options may lead to a situation where more
than count packets are sent however ping will stop when count
packets are received. This results in a failed test due to how
the result is checked, for example:

    ping6 -q -c 3 -i 0.3 -w 2 fc00::3 | FORMAT_PING
    @@ -1,2 +1,2 @@
    -3 packets transmitted, 3 received, 0% packet loss, time 0ms
    +4 packets transmitted, 3 received, 25% packet loss, time 0ms

To reiterate, in the above example there is no packet loss, but
ping stops after _receiving_ 3 packets, not bothering with
waiting for the response to the fourth packet it just sent out.

If we look at the iputils ping manual for the -w deadline option
we can read that this is expected behavior:

 > Specify a timeout, in seconds, before ping exits regardless of
 > how many packets have been sent or received. In this case ping
 > does not stop after count packet are sent, it waits either for
 > deadline expire or until count probes are answered or for some
 > error notification from network.

To avoid these kinds of failures in checks where a response is
expected, we replace ping -w with ping -W.

We keep ping -w for checks where it is expected to NOT get a
response.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-26 22:28:43 +02:00
Frode Nordahl
6cfb3d1ff5 tests/system-traffic: Ensure no name resolution for tcpdump.
Depending on system configuration, executing tcpdump without the
-n parameter, may prolong the execution time for tcpdump while it
attempts name resolution.

This delay may in turn lead to test failures due to contents of
tables to check being evicted.

We recently started to see this problem with the
"conntrack -IPv6 ICMP6 Related with SNAT" test.

For consistency, this patch adds the -n parameter to all tcpdump
calls in system-traffic.at.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Frode Nordahl <frode.nordahl@canonical.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-25 20:39:36 +02:00
Ilya Maximets
cc89bf8e22 README: Add documentation build status badge.
This should make it a little more visible that documentation
build fails on ReadTheDocs.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-25 16:42:55 +02:00
Ilya Maximets
e388bd73b7 readthedocs: Add the configuration file.
Since last month ReadTheDocs only supports building with a new
configuration file provided in the repository itself:
  https://blog.readthedocs.com/migrate-configuration-v2/

So, all our documentation builds are failing for quite some time.

Add the configuration file to unblock documentation updates.

Need to remove the upper restriction on the sphinx version.
sphinx 2.0 is very old at this point and pip fails to install
it along with other dependencies on the rtd server.

Note: Sphinx 2.0 moved from HTML4 to HTML5 renderer and tables
no longer have borders by default.  That should be addressed
via CSS file in the ovs-sphinx-theme.

Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-25 16:42:55 +02:00
Ilya Maximets
a413fed99b tc: Improve logging of mismatched actions.
Currently we log the 980-ish byte long tc_action structure as a
single long hex string.  That is very hard to read and hard to
spot the difference between two.  And most of the fields are zero.

Use the sparse hex dump instead as we do for keys already.

Ex.:

  Action 1 mismatch:
   - Expected Action:
  00000000  f0 3c 00 00 01 00 00 00-00 00 00 00 00 00 00 00
  000003d0  00 00 00 00 ff ff ff ff-
   - Received Action:
  00000000  f0 3c 00 00 01 01 00 00-00 00 00 00 00 00 00 00
  000003d0  00 00 00 00 ff ff ff ff-

Without the change, each action would be a 1900+ characters
long string of mostly zeroes.

Acked-by: Simon Horman <horms@ovn.org>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-20 23:33:18 +02:00
David Marchand
bd86266ea9 ofproto-dpif-upcall: Pause revalidators when purging.
This issue has been observed when running traffic tests with a dpdk
enabled userspace datapath (though those tests are added in a separate
series).
However, the described issue also affects the kernel datapath which is
why this patch is sent separately.

A main thread executing the 'revalidator/purge' command could race with
revalidator threads that can be dumping/sweeping the purged flows at the
same time.

This race can be reproduced (with dpif debug logs) by running the
conntrack - ICMP related unit tests with the userspace datapath:

2023-10-09T14:11:55.242Z|00177|unixctl|DBG|received request
	revalidator/purge[], id=0
2023-10-09T14:11:55.242Z|00044|dpif(revalidator17)|DBG|netdev@ovs-netdev:
	flow_dump ufid:68ff6817-fb3b-4b30-8412-9cf175318294 <empty>,
	packets:0, bytes:0, used:never
2023-10-09T14:11:55.242Z|00178|dpif|DBG|netdev@ovs-netdev: flow_del
	ufid:07046e91-30a6-4862-9048-1a76b5a88a5b
	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=a6:0a:bf:e2:f3:f2,dst=62:23:0f:f6:2c:75),
	eth_type(0x0800),ipv4(src=10.1.1.1,dst=10.1.1.2,proto=17,tos=0,
	ttl=64,frag=no),udp(src=37380,dst=10000), packets:0, bytes:0,
	used:never
...
2023-10-09T14:11:55.242Z|00049|dpif(revalidator17)|WARN|netdev@ovs-netdev:
	failed to flow_get (No such file or directory)
	ufid:07046e91-30a6-4862-9048-1a76b5a88a5b <empty>, packets:0,
	bytes:0, used:never
2023-10-09T14:11:55.242Z|00050|ofproto_dpif_upcall(revalidator17)|WARN|
	Failed to acquire udpif_key corresponding to unexpected flow
	(No such file or directory):
	ufid:07046e91-30a6-4862-9048-1a76b5a88a5b
...
2023-10-09T14:11:55.242Z|00183|unixctl|DBG|replying with success, id=0: ""

To avoid this race, a first part of the fix is to pause (if not already
paused) the revalidators while the main thread is purging the datapath
flows.

Then a second issue is observed by running the same unit test with the
kernel datapath. Its dpif implementation dumps flows via a netlink request
(see dpif_flow_dump_create(), dpif_netlink_flow_dump_create(),
nl_dump_start(), nl_sock_send__()) in the leader revalidator thread,
before pausing revalidators:

2023-10-09T14:44:28.742Z|00122|unixctl|DBG|received request
	revalidator/purge[], id=0
...
2023-10-09T14:44:28.742Z|00125|dpif|DBG|system@ovs-system: flow_del
	ufid:70102d81-30a1-44b9-aa76-3d02a9ffd2c9 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),eth(src=a6:0a:bf:e2:f3:f2,
	dst=ff:ff:ff:ff:ff:ff),eth_type(0x0806),arp(sip=10.1.1.1,
	tip=10.1.1.2,op=1,sha=a6:0a:bf:e2:f3:f2,tha=00:00:00:00:00:00),
	packets:0, bytes:0, used:never
...
2023-10-09T14:44:28.742Z|00129|unixctl|DBG|replying with success, id=0: ""
...
2023-10-09T14:44:28.742Z|00006|dpif(revalidator21)|DBG|system@ovs-system:
	flow_dump ufid:70102d81-30a1-44b9-aa76-3d02a9ffd2c9 <empty>,
	packets:0, bytes:0, used:never
...
2023-10-09T14:44:28.742Z|00012|dpif(revalidator21)|WARN|system@ovs-system:
	failed to flow_get (No such file or directory)
	ufid:70102d81-30a1-44b9-aa76-3d02a9ffd2c9 <empty>, packets:0,
	bytes:0, used:never
2023-10-09T14:44:28.742Z|00013|ofproto_dpif_upcall(revalidator21)|WARN|
	Failed to acquire udpif_key corresponding to unexpected flow
	(No such file or directory):
	ufid:70102d81-30a1-44b9-aa76-3d02a9ffd2c9

To avoid evaluating already deleted flows, the second part of the fix is
to ensure that dumping from the leader revalidator thread is done out of
any pause request.

As a result of this patch, the unit test "offloads - delete ufid mapping
if device not exist - offloads enabled" does not need to waive the random
warning logs when purging dp flows.

Fixes: 98bb4286970d ("tests: Add command to purge revalidators of flows.")
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-20 23:32:15 +02:00
Ilya Maximets
d581473cb3 AUTHORS: Add Zengyuan Wang.
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-18 23:01:29 +02:00
Zengyuan Wang
23a70e2866 db-ctl-base: Fix memory leak of db commands.
Variable "want_key" in function check_condition and variable "key"
in function set_column were not destroyed in exception branch.

This patch calls ovsdb_atom_destroy to release resources to avoid
memory leak.

Fixes: 79c1a00fb5a5 ("db-ctl-base: Don't die in set_column() on error.")
Fixes: e09b3af3e249 ("db-ctl-base: Don't die in is_condition_satisfied() on error")
Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Zengyuan Wang <wangzengyuan@huawei.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
2023-10-18 23:01:29 +02:00
Faicker Mo
c29ba54018 tc: Add IPIP/GRE protocols to offload in IP rewrite.
Currently checksum recalculation is not supported with TC offload for
IPIP and GRE packets. This patch adds support for TC offloading of
IPIP and GRE packets by adding the correct csum action.

Without this patch the following warning can be seen in the logging:
  Can't offload rewrite of IP/IPV6 with ip_proto: X.

Acked-by: Simon Horman <horms@ovn.org>
Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
2023-10-13 11:24:41 +02:00