2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-22 01:51:26 +00:00

19801 Commits

Author SHA1 Message Date
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
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