vpp.git
2 years agonat: fix nat44 vrf handlers 77/38577/1 stable/2210
Daniel Béreš [Fri, 10 Mar 2023 10:35:24 +0000 (02:35 -0800)]
nat: fix nat44 vrf handlers

Change of enums used in REPLY_MACRO() to appropriate one
for handlers:
-vl_api_nat44_ed_add_del_vrf_table_t_handler
-vl_api_nat44_ed_add_del_vrf_route_t_handler

Type: fix

Change-Id: I58e97817b1678da7c025c0d03a8b938a4e0f7b6c
Signed-off-by: Daniel Béreš <[email protected]>
(cherry picked from commit 2c03879ce45c6568da015c01d85300eef147ece7)

2 years agomisc: VPP 22.10.1 Release Notes 43/38243/1 v22.10.1
Dave Wallace [Sat, 11 Feb 2023 00:20:28 +0000 (19:20 -0500)]
misc: VPP 22.10.1 Release Notes

Type: docs
Signed-off-by: Dave Wallace <[email protected]>
Change-Id: I70374ea376c895d92d5789debf4b437113e3d884

2 years agomisc: VPP 22.06.1 Release Notes 34/38234/2
Dave Wallace [Fri, 10 Feb 2023 18:28:46 +0000 (13:28 -0500)]
misc: VPP 22.06.1 Release Notes

Type: docs
Signed-off-by: Dave Wallace <[email protected]>
Change-Id: I8770a35c801126ffd2de8f58d79e6616642709a9
(cherry picked from commit 1513b381d8879d9d437bbbc9a270b4ff5f4b19ba)

2 years agoipsec: fix AES CBC IV generation (CVE-2022-46397) 51/38151/1
Benoît Ganne [Tue, 18 Jan 2022 14:56:41 +0000 (15:56 +0100)]
ipsec: fix AES CBC IV generation (CVE-2022-46397)

For AES-CBC, the IV must be unpredictable (see NIST SP800-38a Appendix
C). Chaining IVs like is done by ipsecmb and native backends for the
VNET_CRYPTO_OP_FLAG_INIT_IV is fully predictable.
Encrypt a counter as part of the message, making the (predictable)
counter-generated IV unpredictable.

Fixes: VPP-2037
Type: fix

Change-Id: If4f192d62bf97dda553e7573331c75efa11822ae
Signed-off-by: Benoît Ganne <[email protected]>
2 years agodpdk: link DPDK with MLX4/MLX5 libraries again 00/37800/1
Vladimir Ratnikov [Mon, 19 Dec 2022 08:45:35 +0000 (08:45 +0000)]
dpdk: link DPDK with MLX4/MLX5 libraries again

 Previously it was linked and worker properly. While rdma build
was simplified, link was lost so all encrypted data won't pass
via Mellanox interfaces(ipsec, ipip, ssh etc) and NetVSC taps
won't created the right way.

 Errors:
mlx5_common: Verbs device not found: 21a5:00:02.0
mlx5_common: Failed to initialize device context.
EAL: Requested device 21a5:00:02.0 cannot be used
 Tested on Azure. Same errors appears on physical machine with
Mellanox connect adapter

Type: fix

Signed-off-by: Vladimir Ratnikov <[email protected]>
Change-Id: Ib68976282e0ed91c016a7318db6b5eddf5510c47
(cherry picked from commit 413447451e3f842815f45bae5d3cd3f87a0876e5)

2 years agovapi: use the correct my_context_id when disconnecting API clients 99/37799/1
Mauro Sardara [Mon, 12 Dec 2022 14:04:09 +0000 (14:04 +0000)]
vapi: use the correct my_context_id when disconnecting API clients

While before the my_client_index variable was stored as global variable
in api_main_t, after commit 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f
the my_client_index becomes part of vapi_ctx_t.

Each API client (internal/external) connected to VPP stores its
client index in vapi_ctx_t.

The issue is in the client disconnection. The vapi_disconnect is
untouched in patch 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f,
so it keeps the behavior of using the my_client_index stored
in api_main_t.

Ticket: VPP-2069
Type: fix
Fixes: 2ca88ff97884ec9ed20a853b13cee6d86f9c9d0f

Signed-off-by: Mauro Sardara <[email protected]>
Change-Id: Idf8c1d1056cbd631cc3057cf7acc486216fa8303
(cherry picked from commit 8c626b41eaab5c74e7e023205f1c6cd655d40f44)

2 years agoipsec: Failure at the start of the batch should not invalidate the rest of the batch 33/37633/1
Neale Ranns [Fri, 18 Nov 2022 04:24:09 +0000 (04:24 +0000)]
ipsec: Failure at the start of the batch should not invalidate the rest of the batch

Type: fix

Signed-off-by: Neale Ranns <[email protected]>
Change-Id: Icd1e43a5764496784c355c93066273435f16dd35
(cherry picked from commit fe2d23f916d1991f4a1a8384eae41b5cceb80189)

2 years agomisc: VPP 22.10 Release Notes 82/37482/4 v22.10
Andrew Yourtchenko [Wed, 19 Oct 2022 09:23:03 +0000 (09:23 +0000)]
misc: VPP 22.10 Release Notes

Type: docs

Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: If0f2ca0344640b064fde52b8f2c09a340ed9c71b
Signed-off-by: Dave Wallace <[email protected]>
2 years agopacketforge: fix GTP-Extension header field data 72/37472/1
Ting Xu [Thu, 29 Sep 2022 05:50:55 +0000 (13:50 +0800)]
packetforge: fix GTP-Extension header field data

Fix the incorrect fields data of GTP-Extension header.

Type: fix
Signed-off-by: Ting Xu <[email protected]>
Change-Id: Iafc5e852910649afcf0e583a5513b1ab33f5b5e8
(cherry picked from commit c9d916c7cc312d2396985f5cb83bcfdb98c98a1f)

2 years agodocs: update cnat docs to current vpp version 71/37471/1
Miguel Borges de Freitas [Wed, 19 Oct 2022 22:21:20 +0000 (23:21 +0100)]
docs: update cnat docs to current vpp version

The documentation for the cnat plugin is highly outdated specially on
the snat section.

Type: docs

Signed-off-by: Miguel Borges de Freitas <[email protected]>
Change-Id: I30b0c6295d3c812b636374753af3c37f29b0cc53
(cherry picked from commit 938bff8084d6f79b368fabd4a60b49117cad11be)

2 years agovppinfra: fix incorrect sizeof() argument due to typo 70/37470/1
Andrew Yourtchenko [Fri, 21 Oct 2022 13:23:51 +0000 (13:23 +0000)]
vppinfra: fix incorrect sizeof() argument due to typo

fixes coverity 282527

Type: fix
Fixes: fecb2524ab
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I9ac72c3802e66369a8f24c92451e33f22c058f24
(cherry picked from commit 0d36720f8d28964be2df32d354583047b6194e14)

2 years agocrypto-sw-scheduler: fix queue iterator 65/37465/1
Vladimir Ratnikov [Mon, 17 Oct 2022 07:34:14 +0000 (07:34 +0000)]
crypto-sw-scheduler: fix queue iterator

 When there are several workers, iterator can and will skip
head iterator and it will last until BARRIER_SYNC_TIMEOUT won't
expire and will cause SIGABRT with `worker thread deadlock`

Type: fix

Signed-off-by: Vladimir Ratnikov <[email protected]>
Change-Id: Id4def4d5894e077ae27592367b141ecd822e86af
Signed-off-by: Matthew Smith <[email protected]>
(cherry picked from commit 65bff88c3671ec6ee561e70f17c60ea9784a39dd)

2 years agovppinfra: send minimal needed mask to the set_mempolicy syscall 57/37457/1
Damjan Marion [Mon, 17 Oct 2022 15:27:28 +0000 (17:27 +0200)]
vppinfra: send minimal needed mask to the set_mempolicy syscall

Type: fix
fixes: 561ae5d

Change-Id: I0d98f5b43bc9ab5d31463b285177a11a10b864d2
Signed-off-by: Damjan Marion <[email protected]>
(cherry picked from commit fecb2524ab71b105422a9a4377429c1871220234)

2 years agovpp-swan: Add plugin for vpp-swan 13/37413/1
Gabriel Oginski [Wed, 29 Jun 2022 12:54:30 +0000 (12:54 +0000)]
vpp-swan: Add plugin for vpp-swan

Added plugin vpp-swan is a plugin that helps offloading
Strongswan IPsec ESP process from Linux Kernel to VPP.

Type: feature
Signed-off-by: Gabriel Oginski <[email protected]>
Change-Id: Iec77945892453fac1890d3c49d7d86fc6b09c893
(cherry picked from commit 4e88e041ad47bf422bbb2a0940f77aba11ea2178)

2 years agovlib: Counter free needs to NULL the allocated counter vector 06/37406/1
Neale Ranns [Thu, 13 Oct 2022 05:39:11 +0000 (05:39 +0000)]
vlib: Counter free needs to NULL the allocated counter vector

otherwise the next time the counter is validated this is dangling.

Type: fix
Fixes: 58fd481d73

Signed-off-by: Neale Ranns <[email protected]>
Change-Id: Ifa8d5ff27175cf6dfb30cbf023fa3251fe5c780e
(cherry picked from commit 80c0ae24378f249b3be9a02774d844c13143cd99)

2 years agodocs: fix memory traces command 98/37398/1
Benoît Ganne [Mon, 3 Oct 2022 18:00:45 +0000 (20:00 +0200)]
docs: fix memory traces command

Type: fix

Change-Id: I8fc949da209a5067c702952fbd0e6ce77b921d02
Signed-off-by: Benoît Ganne <[email protected]>
(cherry picked from commit 70892fcada81a4bef53dcd26c32cba5e26e1eb52)

2 years agobuild: retain dpdk_mlx_default setting for ci script 32/37332/1 v22.10-rc2
Dave Wallace [Wed, 5 Oct 2022 03:48:44 +0000 (23:48 -0400)]
build: retain dpdk_mlx_default setting for ci script

- tell git to ignore all build/external generated files

Type: make

Signed-off-by: Dave Wallace <[email protected]>
Change-Id: I4af26a76a0248939366cd09b577d422af801c0c3
(cherry picked from commit 14b118b4c7f5bd3927af48010092c5313884fbb2)

2 years agordma: unhackish build of rdma-core 29/37329/2
Mohammed Hawari [Tue, 20 Sep 2022 16:44:36 +0000 (18:44 +0200)]
rdma: unhackish build of rdma-core

Change-Id: I2040b560b2a00f8bd176ae6ad46035678a2b249e
Type: improvement
Signed-off-by: Mohammed Hawari <[email protected]>
(cherry picked from commit 45e4e9444d961351178ee108b20525a9c929902d)

2 years agobuild: mlx dpdk-rdma compatibility matrix 28/37328/1
Mohammed Hawari [Mon, 19 Sep 2022 14:26:25 +0000 (16:26 +0200)]
build: mlx dpdk-rdma compatibility matrix

- Verify mlx_rdma_dpdk_matrix.txt versions,
  build MLX drivers in dpdk if the versions match.
  Also output version comparison results to a file
  for CI job to send notification email when the
  versions do not match.

Change-Id: Id1384ba4ea4b1f855f4d77d1d8e2c38683abfe1f
Type: improvement
Signed-off-by: Mohammed Hawari <[email protected]>
Signed-off-by: Dave Wallace <[email protected]>
(cherry picked from commit 4e939ced65143fcfe9342dcccf3418a1018c8b0f)

2 years agovcl: repatch "align the RST behaviour with kernel" 79/37279/1
Yacan Liu [Mon, 26 Sep 2022 08:41:32 +0000 (16:41 +0800)]
vcl: repatch "align the RST behaviour with kernel"

The previous patch[37164] was a bit flawed.

Type: fix
Signed-off-by: Yacan Liu <[email protected]>
Change-Id: Ia9d8b9c7853e8f4b960ce7de26d0384243deb667
(cherry picked from commit ab15770ec63367498dd277c83a577a52594953e8)

2 years agomisc: Initial changes for stable/2210 branch 06/37206/1 v22.10-rc1
Andrew Yourtchenko [Wed, 21 Sep 2022 13:00:17 +0000 (13:00 +0000)]
misc: Initial changes for stable/2210 branch

Type: docs
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I5b0e4a503867d339b901ef1a5a9ebc938bcd068b

2 years agodocs: enhance install vpp docs 44/36344/4
fatelei [Wed, 8 Jun 2022 04:28:23 +0000 (12:28 +0800)]
docs: enhance install vpp docs

Type: docs

Change-Id: Ic1439ce658d9d53208b29d85440a6cc225ed5b74
Signed-off-by: fatelei <[email protected]>
Signed-off-by: Dave Wallace <[email protected]>
2 years agonat: adding docs for nat44-ed sub plugin 41/36241/6
Filip Varga [Thu, 26 May 2022 11:49:22 +0000 (13:49 +0200)]
nat: adding docs for nat44-ed sub plugin

Type: docs

Change-Id: Icfa2bdc9367f8438b53da7c89caec263ed6ab056
Signed-off-by: Filip Varga <[email protected]>
Signed-off-by: Dave Wallace <[email protected]>
2 years agofib: add cli support for explicit link type 96/37096/3
Benoît Ganne [Fri, 9 Sep 2022 15:02:31 +0000 (17:02 +0200)]
fib: add cli support for explicit link type

This adds the ability to specify we want an IPv4 route via an IPv6 adj
and vice-versa.

Type: improvement

Change-Id: I5f7f1ab89fc60244d31c26155bbd9b0db690257c
Signed-off-by: Benoît Ganne <[email protected]>
2 years agoarp: check for manually added proxy-arp entries 02/37102/5
Benoît Ganne [Mon, 12 Sep 2022 13:06:22 +0000 (15:06 +0200)]
arp: check for manually added proxy-arp entries

When manually adding neighbor entries for proxy-arp, those will be
fib-adj entries. Check for proxy-arp instead of dropping immediately.

Type: improvement

Change-Id: Id311159f2966c99719dc2a67d4d2bc92bf366029
Signed-off-by: Benoît Ganne <[email protected]>
2 years agomisc: experimental script to get the list of the reviewers for a commit 39/33139/4
Andrew Yourtchenko [Wed, 14 Jul 2021 20:44:05 +0000 (22:44 +0200)]
misc: experimental script to get the list of the reviewers for a commit

The script accepts zero or one argument (the commit hash), and outputs
the detected components, the component maintainers,
and the final suggested reviewer list. See the script
for the example output.

Change-Id: Ief671fe837c6201bb11fd05d02af881822b0bb33
Type: docs
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agopacketforge: add packetforge for generic flow to extras 49/36149/21
Ting Xu [Sun, 24 Apr 2022 06:14:25 +0000 (06:14 +0000)]
packetforge: add packetforge for generic flow to extras

Add a new tool packetforge to extras. This tool is to support generic flow.
Packetforge is a library to translate naming or json profile format flow
pattern to the required input of generic flow, i.e. spec and mask. Using
python script flow_create.py, it can add and enable a new flow rule for
an interface via flow VAPI, and can delete an existed flow rule as well.
Command examples are shown below. Json profile examples can be found in
./parsegraph/samples.

Naming format input:
python flow_create.py --add -p "mac()/ipv4(src=1.1.1.1,dst=2.2.2.2)/udp()"
-a "redirect-to-queue 3" -i 1
python flow_create.py --del -i 1 -I 0

Json profile format input:
python flow_create.py -f "./flow_rule_examples/mac_ipv4.json" -i 1

With this command, flow rule can be added or deleted, and the flow
entry can be listed with "show flow entry" command in VPP CLI.

Packetforge is based on a parsegraph. The parsegraph can be built by
users. A Spec can be found in ./parsegraph as guidance. More details
about packetforge are in README file.

Type: feature

Signed-off-by: Ting Xu <[email protected]>
Change-Id: Ia9f539741c5dca27ff236f2bcc493c5dd48c0df1

2 years agovcl: align the RST behaviour with kernel 64/37164/3
Yacan Liu [Tue, 20 Sep 2022 06:19:19 +0000 (14:19 +0800)]
vcl: align the RST behaviour with kernel

When ESTABLISHED TCP connection is terminated by an RST packet,
EPOLLHUP + EPOLLRDHUP would be updeliever by VCL. If not using
VPP, app would receive EPOLLHUP + EPOLLERR + EPOLLIN(if requested) +
EPOLLRDHUP(if requested).

libevent will interpret the two cases as different EV combinations.

Below is the code snippet for libevent v2.12:

  if (what & EPOLLERR) {
    ev = EV_READ | EV_WRITE;
  } else if ((what & EPOLLHUP) && !(what & EPOLLRDHUP)) {
    ev = EV_READ | EV_WRITE;
  } else {
    if (what & EPOLLIN)
      ev |= EV_READ;
    if (what & EPOLLOUT)
      ev |= EV_WRITE;
    if (what & EPOLLRDHUP)
      ev |= EV_CLOSED;
 }

Type: fix
Signed-off-by: Yacan Liu <[email protected]>
Change-Id: Ice3d2861183b6ea499f66b727bbe175eeae5cb05

2 years agotests: run tests against a running VPP 64/37064/5
Naveen Joy [Tue, 30 Aug 2022 20:59:03 +0000 (13:59 -0700)]
tests: run tests against a running VPP

Usage:
test/run.py -r  -t {test_filter}
Instead of starting a new instance of VPP, when the -r argument
is provided, test is run against a running VPP instance. Optionally,
one can also set the VPP socket directory using the -d
argument. The default location for socket files is
/var/run/user/${uid}/vpp and /var/run/vpp if VPP is started
as root.

Type: improvement

Change-Id: I05e57a067fcb90fb49973f8159fc17925b741f1a
Signed-off-by: Naveen Joy <[email protected]>
2 years agomisc: add test framework for host stack 29/36829/7
Filip Tehlar [Tue, 9 Aug 2022 14:44:47 +0000 (14:44 +0000)]
misc: add test framework for host stack

Type: feature

Signed-off-by: Filip Tehlar <[email protected]>
Change-Id: I5a64a2c095cae3a4d5f8fdc73e624b010339ec8e

2 years agocnat: coverity fix 34/37134/2
Nathan Skrzypczak [Fri, 16 Sep 2022 12:12:08 +0000 (14:12 +0200)]
cnat: coverity fix

Type: fix

Change-Id: Ib127331507724f853071e66ca1ddfc773a8ed200
Signed-off-by: Nathan Skrzypczak <[email protected]>
2 years agotests: skip tests failing on ubuntu 22.04 44/37144/2
Dave Wallace [Mon, 19 Sep 2022 02:28:44 +0000 (22:28 -0400)]
tests: skip tests failing on ubuntu 22.04

Type: test

Signed-off-by: Dave Wallace <[email protected]>
Change-Id: I218059de5d05680d661f302293475b6c2a7bf81d

2 years agoigmp: validate ip router alert option length 36/37136/5
Vladislav Grishenko [Fri, 16 Sep 2022 17:01:00 +0000 (17:01 +0000)]
igmp: validate ip router alert option length

It's known there're one or more 32-bit increments in the ip
header. So just check ip router alert option length with minimal
performance impact, and don't care of the total options length.

Type: fix
Signed-off-by: Vladislav Grishenko <[email protected]>
Signed-off-by: Dmitry Valter <[email protected]>
Change-Id: I46dd06516f793846b931a1dc8612f2735f8d24d3

2 years agoabf: add API parameter n_paths range checks 07/37107/2
Jon Loeliger [Mon, 12 Sep 2022 17:41:06 +0000 (12:41 -0500)]
abf: add API parameter n_paths range checks

Also check for non-zero rpath length in CLI cmd.
While there, no need to use "else" after a return.
Also while there, notice and fix numerous input_line
buffer leaks and fix them.

Type: fix
Fixes: 669d07dc016757b856e1014a415996cf9f0ebc58

Signed-off-by: Jon Loeliger <[email protected]>
Change-Id: I18ea44b7b82e8938c3e793e7c2a04dfe157076d8

2 years agobuild: install missing headers 49/37049/2
Benoît Ganne [Wed, 31 Aug 2022 10:05:43 +0000 (12:05 +0200)]
build: install missing headers

Type: fix

Change-Id: I4eb2a7190de90553c91133f940e068ed649120cb
Signed-off-by: Benoît Ganne <[email protected]>
2 years agoteib: fix segv during failed deletion of entry 94/37094/2
Matthew Smith [Thu, 8 Sep 2022 21:03:10 +0000 (21:03 +0000)]
teib: fix segv during failed deletion of entry

Type: fix

If an attempt is made to delete a teib entry and the entry does not
exist, a message is logged. The format string contained an extra "%U",
which results in a segv.

Change-Id: I9b1d6ba63601982ba6ac8607cf710e34c311702a
Signed-off-by: Matthew Smith <[email protected]>
2 years agoarp: update error reason when checking for proxy-arp 06/37106/2
Benoît Ganne [Mon, 12 Sep 2022 15:56:16 +0000 (17:56 +0200)]
arp: update error reason when checking for proxy-arp

When we follow arp feature arc for proxy-arp, we should still update
the error reason in case proxy-arp cannot handle the arp request and
drops it.

Type: improvement

Change-Id: I046df017ca2056cfc12af0f0a968b401058bcd6d
Signed-off-by: Benoît Ganne <[email protected]>
2 years agolinux-cp: fix some CLI error messages 09/37109/2
Matthew Smith [Mon, 12 Sep 2022 19:54:43 +0000 (19:54 +0000)]
linux-cp: fix some CLI error messages

Type: fix

If unrecognized input was provided to the commands which add or delete a
pair, the error message was being created incorrectly and only displayed
something like "unknown input `'". Provide the correct argument to
format_unformat_error so that the actual unrecognized input is printed.

There also was no error or useful information printed if only the base
command were provided without any additional arguments. This should
print a warning about what required data was missing. Reorganize code to
handle this and to make sure that memory gets freed appropriately.

Change-Id: If454714f50cf41b3b56cfadfbf017f1d160e13a4
Signed-off-by: Matthew Smith <[email protected]>
2 years agolisp: fix coverity 277315 30/37130/4
Andrew Yourtchenko [Thu, 15 Sep 2022 12:11:06 +0000 (12:11 +0000)]
lisp: fix coverity 277315

Handle the case of the mapping not being found by GID.

Type: fix
Change-Id: Ibce3b9e8419c0dddca97b4d0d5a71f25dfd529d8
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agovirtio: add support for per queue packet counter 23/37123/3
Mohsin Kazmi [Wed, 14 Sep 2022 11:25:54 +0000 (11:25 +0000)]
virtio: add support for per queue packet counter

Type: improvement

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: I21a701a556b88a9d81f0e074a59fa34b3746b1d9

2 years agovcl: add hugepage for vcl configure and svm 48/36948/14
Junfeng Wang [Fri, 12 Aug 2022 08:24:46 +0000 (16:24 +0800)]
vcl: add hugepage for vcl configure and svm

add hugepage for vcl configure and svm

Type: feature

Signed-off-by: Junfeng Wang <[email protected]>
Change-Id: I6a8905e3fec23d840e629114b1e5a403d0a258ef

2 years agosession: support dma option 49/36949/24
Marvin Liu [Tue, 16 Aug 2022 06:49:09 +0000 (06:49 +0000)]
session: support dma option

add dma support to session, acclerate host-stack with dma

Type: feature

Signed-off-by: Marvin Liu <[email protected]>
Signed-off-by: Junfeng Wang <[email protected]>
Change-Id: I3d492921d69d9e3e0b34d33adc33fba3bde9e1cc

2 years agoprom: fix coverity 277312, 277317 28/37128/1
Andrew Yourtchenko [Thu, 15 Sep 2022 11:46:30 +0000 (11:46 +0000)]
prom: fix coverity 277312, 277317

If one attempts to add a pattern with zero length, first time
it will succeed, and the second time it will cause an invalid memcmp call.

Solution: do not allow to add zero-length patterns.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: Ic08e021486153be605a4b12a2fe4422307bf68d2

2 years agonat: fix nat44-ed port range with multiple workers 62/36962/2
Vladislav Grishenko [Fri, 19 Aug 2022 15:42:22 +0000 (20:42 +0500)]
nat: fix nat44-ed port range with multiple workers

The number of available dynamic ports is set to (0xffff - 1024) =
64511, which is not divisable by the pow2 number of workers - the
only integer divisors are 31 and 2081.
So, total dynamic port range of all workers will be less than it:
    1 wrk: n = (port_per_thread = 64511/1)*1 = 64511 + 1025 = 65536
    2 wrk: n = (port_per_thread = 64511/2)*2 = 64510 + 1025 = 65535
    4 wrk: n = (port_per_thread = 64511/4)*4 = 64508 + 1025 = 65533
    8 wrk: n = (port_per_thread = 64511/8)*8 = 64504 + 1025 = 65529
    ...
As seen, with multiple workers there are unused trailing ports for every
nat pool address and that is the reason of out-of-bound index in the
worker array on out2in path due (port - 1024) / port_per_thread math.
This was fixed in 5c9f9968de63fa627b4a72b344df36cdc686d18a, so packets
to unused ports will go to existing worker and dropped there.

Per RFC 6335 https://www.rfc-editor.org/rfc/rfc6335#section-6:
6.  Port Number Ranges
   o  the System Ports, also known as the Well Known Ports, from 0-1023
      (assigned by IANA)
   o  the User Ports, also known as the Registered Ports, from 1024-
      49151 (assigned by IANA)
   o  the Dynamic Ports, also known as the Private or Ephemeral Ports,
      from 49152-65535 (never assigned)

According that let's allocate dynamic ports from 1024 and have full port
range with a wide range of the workers number - 64 integer divisors in
total, including pow2 ones:
    1 wrk: n = (port_per_thread = 64512/1)*1 = 64512 + 1024 = 65536
    2 wrk: n = (port_per_thread = 64512/2)*2 = 64512 + 1024 = 65536
    3 wrk: n = (port_per_thread = 64512/3)*3 = 64512 + 1024 = 65536
    4 wrk: n = (port_per_thread = 64512/4)*4 = 64512 + 1024 = 65536
    5 wrk: n = (port_per_thread = 64512/5)*5 = 64510 + 1024 = 65534
    6 wrk: n = (port_per_thread = 64512/6)*6 = 64512 + 1024 = 65536
    7 wrk: n = (port_per_thread = 64512/7)*7 = 64512 + 1024 = 65536
    8 wrk: n = (port_per_thread = 64512/8)*8 = 64512 + 1024 = 65536
    ...
Modulo from 5c9f9968de63fa627b4a72b344df36cdc686d18a is still required
when the numbers of workers is not the integer divisor of 64512.

Type: fix
Fixes: 5c9f9968de63fa627b4a72b344df36cdc686d18a
Change-Id: I9edaea07e58ff4888812b0d86cbf41a3784b189e
Signed-off-by: Vladislav Grishenko <[email protected]>
2 years agoip-neighbor: fix debug log format output 74/37074/3
luoyaozu [Mon, 5 Sep 2022 14:16:01 +0000 (22:16 +0800)]
ip-neighbor: fix debug log format output

Type: fix

Signed-off-by: luoyaozu <[email protected]>
Change-Id: Ibfebe4da0197d1f60bf9edd3873fe1f776b680a4

2 years agoip: show fib index in ip4 reassembly trace 22/37122/2
Damjan Marion [Wed, 14 Sep 2022 14:00:09 +0000 (16:00 +0200)]
ip: show fib index in ip4 reassembly trace

Type: improvement
Change-Id: I371237803e2c3cb0e1b42b94f422867465e2bff6
Signed-off-by: Damjan Marion <[email protected]>
2 years agoipsec: make chacha20-poly1305 available via API 16/37116/6
Vladimir Ratnikov [Tue, 13 Sep 2022 13:09:53 +0000 (13:09 +0000)]
ipsec: make chacha20-poly1305 available via API

Type: feature

Signed-off-by: Vladimir Ratnikov <[email protected]>
Change-Id: I4e03f60f34acd7809ddc5a743650bedbb95b2e98

2 years agovlib: add vlib_frame_bitmap_is_bit_set 98/37098/2
Damjan Marion [Thu, 8 Sep 2022 16:59:03 +0000 (18:59 +0200)]
vlib: add vlib_frame_bitmap_is_bit_set

Type: improvement
Change-Id: I2f3fab893a10b060f91b07ee17b8727d241830ea
Signed-off-by: Damjan Marion <[email protected]>
2 years agoipsec: introduce fast path ipv4 inbound matching 52/37052/3
Piotr Bronowski [Wed, 31 Aug 2022 13:48:14 +0000 (13:48 +0000)]
ipsec: introduce fast path ipv4 inbound matching

This patch introduces fast path matching for inbound traffic ipv4.
Fast path uses bihash tables in order to find matching policy. Adding
and removing policies in fast path is much faster than in current
implementation. It is still new feature and further work needs
and can be done in order to improve perfromance.

Type: feature

Signed-off-by: Piotr Bronowski <[email protected]>
Change-Id: Ifbd5bfecc21b76ddf8363f5dc089d77595196675

2 years agofib: fix path copy function to deal with provided DPO in exclusive path 86/37086/2
Damjan Marion [Wed, 7 Sep 2022 15:54:39 +0000 (17:54 +0200)]
fib: fix path copy function to deal with provided DPO in exclusive path

DPO in the new copy was not locked ...

Type: fix
Fixes: 0bfe5d8

Change-Id: I39f1368de459af91c4bb857d98a4b531bd5692a6
Signed-off-by: Damjan Marion <[email protected]>
2 years agovlib: don't leak node frames on refork 75/37075/5
Dmitry Valter [Mon, 5 Sep 2022 15:30:18 +0000 (15:30 +0000)]
vlib: don't leak node frames on refork

Free node frames in worker mains on refork. Otherwise these frames are
never returned to free pool and it causes massive memory leaks if
performed under traffic load

Type: fix
Signed-off-by: Dmitry Valter <[email protected]>
Change-Id: I15cbf024a3f4b4082445fd5e5aaa10bfcf77f363

2 years agovppinfra: add clib_array_mask_set_u32() 97/37097/1
Damjan Marion [Thu, 8 Sep 2022 17:00:06 +0000 (19:00 +0200)]
vppinfra: add clib_array_mask_set_u32()

Type: improvement
Change-Id: Idf1fb054d5ff495d772d01a79cbc6cd1b409d377
Signed-off-by: Damjan Marion <[email protected]>
2 years agonat: fix nat44-ed-in2out fast path next node 43/36643/4
Jing Peng [Fri, 8 Jul 2022 16:52:01 +0000 (12:52 -0400)]
nat: fix nat44-ed-in2out fast path next node

When a session is found expired, the next node of in2out fast path
should be in2out slow path instead of out2in slow path.

Type: fix
Signed-off-by: Jing Peng <[email protected]>
Change-Id: If1dd920502089c25b33bea5434823b0496a44499

2 years agofib: missing headers 87/37087/2
Damjan Marion [Wed, 7 Sep 2022 16:52:18 +0000 (18:52 +0200)]
fib: missing headers

Type: improvement
Change-Id: I7f52222706200c31a731fadfb84513549ccb532d
Signed-off-by: Damjan Marion <[email protected]>
2 years agowireguard: eliminate some calls to main thread 81/37081/2
Matthew Smith [Fri, 2 Sep 2022 14:34:38 +0000 (14:34 +0000)]
wireguard: eliminate some calls to main thread

Type: improvement

Roaming functionality allows the peer address to change. The main thread
was being called to update a peer's address if necessary after
processing a received packet. Check in the worker whether this is
necessary before incurring the overhead of the RPC to the main thread.

Signed-off-by: Matthew Smith <[email protected]>
Change-Id: I02184b92dc658e0f57dd39993a3b2f9944187b45

2 years agoavf: check for VLAN_TOGGLE capability 79/37079/2
Mohammed Hawari [Tue, 6 Sep 2022 16:08:12 +0000 (18:08 +0200)]
avf: check for VLAN_TOGGLE capability

The ability to modify the vlan setting must be checked prior to using
VIRTCHNL_OP_DISABLE_VLAN_STRIPPING_V2 both for inner and outer vlan
stripping

Change-Id: Iffe306c34b81a6077ad6ba5deb3f5b61b5475897
Type: fix
Signed-off-by: Mohammed Hawari <[email protected]>
2 years agodpdk-cryptodev: reduce request to enable async 82/37082/2
Gabriel Oginski [Tue, 6 Sep 2022 08:59:16 +0000 (08:59 +0000)]
dpdk-cryptodev: reduce request to enable async

Originally initialization cryptodev device(s) calls double request
to enabled async mode and increased ref count twice for async mode.
Due to this cannot be change any assigned async handlers to other
async crypto engine.

The fixes reduce double request to enable async mode in initialization
cryptodev device(s) and VPP can be change assigned async handlers
to other crypto engine after disabled all async feature, for example:
ipsec, wireguard.

Type: fix

Signed-off-by: Gabriel Oginski <[email protected]>
Change-Id: If22e682c3c10de781d05c2e09b5420f75be151c3

2 years agobuild: Cleanup python2 from suse build and uplift opensuse version 67/37067/5
Laszlo Kiraly [Fri, 2 Sep 2022 12:08:36 +0000 (14:08 +0200)]
build: Cleanup python2 from suse build and uplift opensuse version

 - default to opensuse-leap 15.4, no python2 support in this version
 - deprecate version openSUSE 15.0, openSUSE 15.3 still supported

Type: make

Signed-off-by: Laszlo Kiraly <[email protected]>
Change-Id: Ic7178ff5238e2669bc45166c1f13d3f077f6069b
Signed-off-by: Laszlo Kiraly <[email protected]>
2 years agovrrp: fix cli functions according to short_help 69/37069/3
luoyaozu [Fri, 2 Sep 2022 12:32:13 +0000 (20:32 +0800)]
vrrp: fix cli functions according to short_help

test output before fix:
  DBGvpp# vrrp proto start sw_if_index 1 vr_id 1
  vrrp proto: unknown input `sw_if_index 1 vr_id 1'
  DBGvpp# vrrp vr track-if add sw_if_index 1 vr_id 1 track-index 1
priority 30
  vrrp vr track-if: Please specify an interface

Type: fix

Signed-off-by: luoyaozu <[email protected]>
Change-Id: Ib8ba67e920b23008d9246318ec8f8f17bf0bea95

2 years agoip: fix punt socket overflow 46/34046/6
Benoît Ganne [Tue, 12 Oct 2021 08:14:30 +0000 (10:14 +0200)]
ip: fix punt socket overflow

client_pathname is usually smaller than pc->caddr.sun_path. snprint()
ensures we stop at the NULL character or sizeof(sun_path) whichever
comes 1st. It also guarantees NULL character termination.

Type: fix

Change-Id: I9fc2a706beab931d50d32d03f7fafca7c6c2fb0b
Signed-off-by: Benoît Ganne <[email protected]>
2 years agobuild: set OS_ID_LIKE only if unset 50/37050/2
Benoît Ganne [Wed, 31 Aug 2022 09:45:17 +0000 (11:45 +0200)]
build: set OS_ID_LIKE only if unset

cmake MATCHES directive with the empty regex "" always match, including
non-empty strings.

Type: fix
Fixes: 534dfc1f18db74f4a2c78d62fe6893daba56dc86

Change-Id: If085b29da15a6d7fc680cebb823183fd3c7eea68
Signed-off-by: Benoît Ganne <[email protected]>
2 years agoipsec: fix coverity 249212 56/37056/3
Andrew Yourtchenko [Wed, 31 Aug 2022 14:37:36 +0000 (14:37 +0000)]
ipsec: fix coverity 249212

zero-initialize the variables

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I51c3856865eab037f646a0d184e82ecb3b5b3216

2 years agobuild: remove lto flags in dpdk build 36/37036/3
Dave Wallace [Tue, 30 Aug 2022 02:45:03 +0000 (22:45 -0400)]
build: remove lto flags in dpdk build

- Ubuntu 22.04 enables LTO by default and dpdk
  adds lto flags to CFLAGS. This CI jobs to fail
  with OOM-Kill (especially on ARM64) due to lto
  consuming large amounts of memory.

Type: make

Signed-off-by: Dave Wallace <[email protected]>
Change-Id: I5a3d3a08e2caddb4790b281b80b16081567aed5b

2 years agoudp: store mss and sw_if_index to udp_connection_t 30/36730/4
Steven Luong [Mon, 25 Jul 2022 16:29:23 +0000 (09:29 -0700)]
udp: store mss and sw_if_index to udp_connection_t

Store mss and sw_if_index to udp_connection_t and display them via
show sessipn verbose 2

Type: fix

Signed-off-by: Steven Luong <[email protected]>
Change-Id: I32928f3f4195b178873dc1bada702e035d99c464

2 years agonat: fix coverity 249194 53/37053/2
Andrew Yourtchenko [Wed, 31 Aug 2022 14:11:59 +0000 (14:11 +0000)]
nat: fix coverity 249194

Zero-initialize a variable.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: Iccf2eb4bf26755d6cd93fc70df3c5481d69ce7eb

2 years agonat: fix coverity 249178 54/37054/2
Andrew Yourtchenko [Wed, 31 Aug 2022 14:16:10 +0000 (14:16 +0000)]
nat: fix coverity 249178

Zero-initialize the variable

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I4ee127ac3e2a3beffa11bbc96db1f3254b3f7c5d

2 years agopppoe: fix coverity 218437, 218401 55/37055/3
Andrew Yourtchenko [Wed, 31 Aug 2022 14:20:40 +0000 (14:20 +0000)]
pppoe: fix coverity 218437, 218401

Initialize the session index in case of error to ~0,
so is defined in case trace needs to copy it.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: Iddf6df42c09d2abc11e5821944eb4f41692e6e3e

2 years agogso: zero-initialize gho struct 24/35724/4
Vladislav Grishenko [Sat, 20 Nov 2021 09:52:53 +0000 (14:52 +0500)]
gso: zero-initialize gho struct

It may contain garbage in debug builds resulting in wrong
gho detected flags and offsets.

Type: fix
Signed-off-by: Vladislav Grishenko <[email protected]>
Change-Id: Ia79633262185016f527e7dc6c67334cda6f055f2

2 years agodevices: fix coverity warning 47/37047/1
Mohsin Kazmi [Wed, 31 Aug 2022 11:14:28 +0000 (11:14 +0000)]
devices: fix coverity warning

Type: fix

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: I0a58c0f54d8be31a0a78bef00152fb2cc193840e

2 years agodevices: add support for polling mode 40/37040/2
Mohsin Kazmi [Tue, 30 Aug 2022 13:29:06 +0000 (13:29 +0000)]
devices: add support for polling mode

Type: improvement

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: I8d84dc8b7f5c5e863c32838cfafc3d366e2a7e00

2 years agodpdk: fix arm iavf rx vector path on 22.03 64/36964/2
Tianyu Li [Fri, 19 Aug 2022 10:19:07 +0000 (10:19 +0000)]
dpdk: fix arm iavf rx vector path on 22.03

dpdk 22.03 introduces iavf driver but misses rx vector path on Arm.
This causes VF fail to receive packet when running VPP device test
with no-multi-seg configuration.

Add iavf basic Neon RX support to fix this.

Type: fix
Fixes: 2f132efc3caf ("dpdk: bump to DPDK v22.03")

Signed-off-by: Tianyu Li <[email protected]>
Change-Id: I75ae74c8060428cee0e1c235feab1246c014801e

2 years agol2: skip arp term for locally originated packets 17/36117/4
Stanislav Zaikin [Tue, 10 May 2022 18:50:36 +0000 (20:50 +0200)]
l2: skip arp term for locally originated packets

Mark arp packet as locally originated when probing/replying and don't apply any
arp-term logic against it.

Type: fix
Signed-off-by: Stanislav Zaikin <[email protected]>
Change-Id: I305ff5cac8cac456decf92f21b961aa4ce286079

2 years agotcp: do not overcount ooo bytes 34/37034/2
Florin Coras [Mon, 29 Aug 2022 18:35:53 +0000 (11:35 -0700)]
tcp: do not overcount ooo bytes

Type: fix

Signed-off-by: Florin Coras <[email protected]>
Change-Id: Ic81702bffb5b3189db48efe1ab3b237fa2bf75f2

2 years agodma_intel: fix the wrong unformat type 37/37037/2
Haiyue Wang [Tue, 30 Aug 2022 06:33:02 +0000 (14:33 +0800)]
dma_intel: fix the wrong unformat type

The unformat type for "%d" should be u32 or int, otherwise the 'did' in
high stack address will be overflow to zero by the 'qid' which is in the
low stack address.

Like input "dev wq3.2" will return "did=0, qid=2".

Type: fix
Signed-off-by: Haiyue Wang <[email protected]>
Change-Id: I0fe1d5b03e2c47e0a7925193e2c2f1ccc31d3e90

2 years agomemif: Process bad descriptors correctly in memif_process_desc 31/37031/3
Steven Luong [Mon, 29 Aug 2022 17:00:31 +0000 (10:00 -0700)]
memif: Process bad descriptors correctly in memif_process_desc

When there is a bad descriptor, it may in the beginning, in the middle,
or at the end of the batch if the batch has more than 3 descriptors.
When processing a bad descriptor is encountered in the batch, we need to
rollback n_buffers in memif_process_desc(), or the statement in the same
function
    memif_add_copy_op (ptd, mb0 + src_off, bytes_to_copy,
                               dst_off, n_buffers - 1);
is wrong because it picks up the wrong buffer_vec_index of the bad
descriptor while parsing a good descriptor immediately following the
bad descriptor. n_buffers was incremented in the beginning of
while (n_left) loop.

The other problem is we should count the number of bad packets and
reduce ptd->n_packets to get the correct number of packets for subsequent
processing in device_input.

The last fix is to check if n_buffers == 0 in device_input and skip
doing any descriptor copy. This case can happen when all the descriptors
are bad in the batch.

Type: fix

Signed-off-by: Steven Luong <[email protected]>
Change-Id: I28ed1d87236b045657006755747b5750a9a733be

2 years agoethernet: fix coverity 214973 99/36999/3
Andrew Yourtchenko [Tue, 23 Aug 2022 15:48:59 +0000 (15:48 +0000)]
ethernet: fix coverity 214973

Ensure that the ethernet_input_inline_dmac_check which directly derefererences ei,
is called only if ei is set.

Type: fix
Change-Id: I2d3bce63ee457825a5d375a6102225f3abf67703
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agovlib: fix coverity 274750, part 2 25/37025/2
Andrew Yourtchenko [Fri, 26 Aug 2022 13:46:44 +0000 (13:46 +0000)]
vlib: fix coverity 274750, part 2

Add another missing null check.

Type: fix
Change-Id: Iec4de548810efe369a6e61b8787131230506cff6
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agovlib: fix coverity 277203 24/37024/2
Andrew Yourtchenko [Fri, 26 Aug 2022 13:13:20 +0000 (13:13 +0000)]
vlib: fix coverity 277203

Fix integer overflow.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I72de6f88be064f188204d0f6d3167a3a8d7de58d

2 years agodpdk: bump to 22.07 85/36785/3
Fan Zhang [Tue, 2 Aug 2022 10:17:08 +0000 (10:17 +0000)]
dpdk: bump to 22.07

Type: feature

This patch bumps DPDK version to 22.07.

Signed-off-by: Fan Zhang <[email protected]>
Change-Id: I72ecb31ca15774aed4453778042120610020a0c1

2 years agoethernet: refactor the redundant code 39/37039/2
Andrew Yourtchenko [Tue, 30 Aug 2022 11:22:09 +0000 (11:22 +0000)]
ethernet: refactor the redundant code

Following the discussion during the review
of  b46a4e69e5db18ef792415439d04a0ab22c59386,
remove the redundant ei0. This resulted in realization
that in order for this code to do anything useful,
the ei must be always non-zero, so rewrite the logical
condition for it. Also, make it a conjunction which seems simpler
to understand.

Type: improvement
Change-Id: Ibd7b2a63e4aeaf97eb1a98af8e69aed2ff7dd577
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agovlib: use error description when dropping packets 23/37023/2
Arthur de Kerhor [Fri, 26 Aug 2022 08:57:35 +0000 (10:57 +0200)]
vlib: use error description when dropping packets

Using the error name makes it less explicit in the packet trace than
the error description when a packet is dropped. Example of the trace
when the TTL is <=1:

01:03:17:015278: drop
  ip4-input: time_expired

We should have "ip4 ttl <= 1" instead of "time_expired"

Type: fix
Change-Id: Ic9decf10d609cc938e39d0f449359e41c406267e
Signed-off-by: Arthur de Kerhor <[email protected]>
2 years agoethernet: fix mac address increment error 28/37028/2
Jieqiang Wang [Sun, 14 Aug 2022 09:49:44 +0000 (17:49 +0800)]
ethernet: fix mac address increment error

Using "ip neighbor <ip-addr> <mac-addr> static count <count>" to add
static ARP entries will output wrong mac addresses due to lack of
big/little endian conversion. Fix this error by converting mac address
from big endian to little endian before doing the self-increment.

Before patched:

vpp# ip neighbor rdma-0 198.18.1.1 01:aa:bb:cc:dd:e0 static count 5
vpp# show ip neighbor
    Time                       IP                    Flags      Ethernet              Interface
      4.4400               198.18.1.5                  S    05:aa:bb:cc:dd:e0  rdma-0
      4.4399               198.18.1.4                  S    04:aa:bb:cc:dd:e0  rdma-0
      4.4399               198.18.1.3                  S    03:aa:bb:cc:dd:e0  rdma-0
      4.4399               198.18.1.2                  S    02:aa:bb:cc:dd:e0  rdma-0
      4.4399               198.18.1.1                  S    01:aa:bb:cc:dd:e0  rdma-0

After patched:

vpp# ip neighbor rdma-0 198.18.1.1 01:aa:bb:cc:dd:e0 static count 5
vpp# show ip neighbor
    Time                       IP                    Flags      Ethernet              Interface
      4.4528               198.18.1.5                  S    01:aa:bb:cc:dd:e4  rdma-0
      4.4528               198.18.1.4                  S    01:aa:bb:cc:dd:e3  rdma-0
      4.4528               198.18.1.3                  S    01:aa:bb:cc:dd:e2  rdma-0
      4.4527               198.18.1.2                  S    01:aa:bb:cc:dd:e1  rdma-0
      4.4527               198.18.1.1                  S    01:aa:bb:cc:dd:e0  rdma-0

Type: fix
Signed-off-by: Jieqiang Wang <[email protected]>
Change-Id: Iec1e00e381e4aba96639f831e7e42e070be3f278

2 years agofib: fix coverity 249175 05/37005/2
Andrew Yourtchenko [Tue, 23 Aug 2022 17:29:00 +0000 (17:29 +0000)]
fib: fix coverity 249175

Add an assert to express the constraint to coverity without
incurring the overhead in release builds.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I2c22f8b2565c645d95c9c0be37381060e151420f

2 years agofib: fix coverity 253539 04/37004/3
Andrew Yourtchenko [Tue, 23 Aug 2022 17:23:47 +0000 (17:23 +0000)]
fib: fix coverity 253539

Add an ASSERT so coverity is aware of the assumption taken,
without incurring any penalty in release build.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I3e7e1e77059492315409efbed47657f9e56d167c
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agoethernet: fix coverity 218549 98/36998/4
Andrew Yourtchenko [Tue, 23 Aug 2022 15:38:05 +0000 (15:38 +0000)]
ethernet: fix coverity 218549

Check that the pointer is non-null before dereferencing it.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I611a1042d08bbe455dd09a4fa5711fe86c440240

2 years agonat: fix coverity 249202 30/37030/1
Benoît Ganne [Mon, 29 Aug 2022 09:56:08 +0000 (11:56 +0200)]
nat: fix coverity 249202

In case of a bad packet, the bihash kv is not initialized before being
copied in the trace. Make sure it is initialized to 0.

Type: fix

Change-Id: I22fcfe99f3586d0fa128493059547a56557b8fb5
Signed-off-by: Benoît Ganne <[email protected]>
2 years agolibmemif: fix the buffer size 64/36764/2
Mohsin Kazmi [Wed, 27 Jul 2022 13:43:07 +0000 (13:43 +0000)]
libmemif: fix the buffer size

Type: fix

Previously, libmemif can only use buffer size which
have to be power of 2. memif protocol does not enforce
this. This patch fixes this issue.

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: Ic71e6a51685e2c2228c744920797064d4c7c65c9

2 years agolibmemif: add support for custom buffer-size and headroom in icmp example app 67/36767/2
Mohsin Kazmi [Wed, 27 Jul 2022 15:04:01 +0000 (15:04 +0000)]
libmemif: add support for custom buffer-size and headroom in icmp example app

Type: improvement

Signed-off-by: Mohsin Kazmi <[email protected]>
Change-Id: I2bdaee7938a3747e3217d6901ec3c66f1ee3da61

2 years agolinux-cp: fix coverity 216937 26/37026/3
Andrew Yourtchenko [Fri, 26 Aug 2022 13:59:35 +0000 (13:59 +0000)]
linux-cp: fix coverity 216937

Initialize the host_sw_if_index to ~0 so in the error cases
the variable is set to something predictable.

Type: fix
Change-Id: Ic55e4f0cbfa286e85dfb54b89b5321af18a439a1
Signed-off-by: Andrew Yourtchenko <[email protected]>
2 years agonsh: fix coverity 249201 02/37002/3
Andrew Yourtchenko [Tue, 23 Aug 2022 16:54:53 +0000 (16:54 +0000)]
nsh: fix coverity 249201

Zero-initialize the temporary struct, else a->map.adj_index is being used unset.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: Ia02636ea1e911250d6aa5e413de48e1e09863880

2 years agobuild: disable gcc warning stringop-overflow for gcc-10 or greater 22/37022/2
Dave Wallace [Thu, 25 Aug 2022 21:42:24 +0000 (17:42 -0400)]
build: disable gcc warning stringop-overflow for gcc-10 or greater

- this warning causes build errors with gcc on ubuntu 22.04

Type: make

Change-Id: Id8f6ab44b2315ce8a4564ea924d799ecb6f57fdf
Signed-off-by: Dave Wallace <[email protected]>
2 years agovlib: introduce DMA infrastructure 14/36914/5
Marvin Liu [Wed, 17 Aug 2022 01:38:40 +0000 (09:38 +0800)]
vlib: introduce DMA infrastructure

This patch introduces DMA infrastructure into vlib. This is well known
that large amount of memory movements will drain core resource. Nowadays
more and more hardware accelerators were designed out for freeing core
from this burden. Meanwhile some restrictions still remained when
utilizing hardware accelerators, e.g. cross numa throughput will have a
significant drop compared to same node. Normally the number of hardware
accelerator instances will less than cores number, not to mention that
applications number will even beyond the number of cores. Some hardware
may support share virtual address with cores, while others are not.

Here we introduce new DMA infrastructure which can fulfill the
requirements of vpp applications like session and memif and in the
meantime dealing with hardware limitations.

Here is some design backgrounds:

  Backend is the abstract of resource which allocated from DMA device
  and can do some basic operations like configuration, DMA copy and
  result query.

  Config is the abstract of application DMA requirement. Application
  need to request an unique config index from DMA infrastructure. This
  unique config index is associated with backend resource. Two options
  cpu fallback and barrier before last can be specified in config.
  DMA transfer will be performed by CPU when backend is busy if cpu
  fallback option is enabled. DMA transfer callback will be in order
  if barrier before last option is enabled.

  We constructs all the stuffs that DMA transfer request needed into
  DMA batch. It contains the pattern of DMA descriptors and function
  pointers for submission and callback. One DMA transfer request need
  multiple times batch update and one time batch submission.

  DMA backends will assigned to config's workers threads equally. Lock
  will be used for thread-safety if same backends assigned to multiple
  threads. Backend node will check all the pending requests in worker
  thread and do callback with the pointer of DMA batch if transfer
  completed. Application can utilize cookie in DMA batch for selves
  usage.

DMA architecture:

   +----------+   +----------+           +----------+   +----------+
   | Config1  |   | Config2  |           | Config1  |   | Config2  |
   +----------+   +----------+           +----------+   +----------+
        ||             ||                     ||             ||
   +-------------------------+           +-------------------------+
   |  DMA polling thread A   |           |  DMA polling thread B   |
   +-------------------------+           +-------------------------+
               ||                                     ||
           +----------+                          +----------+
           | Backend1 |                          | Backend2 |
           +----------+                          +----------+

Type: feature

Signed-off-by: Marvin Liu <[email protected]>
Change-Id: I1725e0c26687985aac29618c9abe4f5e0de08ebf

2 years agowireguard: fix ipv6 payload_length computation 18/37018/1
Aloys Augustin [Thu, 25 Aug 2022 11:00:31 +0000 (13:00 +0200)]
wireguard: fix ipv6 payload_length computation

The ipv6 header length should not be counted in the ipv6 payload length.
This is similar to https://gerrit.fd.io/r/c/vpp/+/36945.

Type: fix
Change-Id: I22de0ff828175829102a85288513ee3f55709108
Signed-off-by: Aloys Augustin <[email protected]>
2 years agovlib: allow longer version string 06/37006/2
Matthew Smith [Tue, 23 Aug 2022 15:46:25 +0000 (15:46 +0000)]
vlib: allow longer version string

Type: improvement

When trying to use a version string in a downstream build that appends a
timestamp to the standard version string, compiling fails because the
version string is too long for the version and version_required fields
in vlib_plugin_registration_t. Increase the size of those arrays from 32
to 64 chars.

Signed-off-by: Matthew Smith <[email protected]>
Change-Id: I3632139e5ae7110aa4769359f380ad29522ad4ed

2 years agoipsec: fix coverity 249204 03/37003/2
Andrew Yourtchenko [Tue, 23 Aug 2022 17:09:25 +0000 (17:09 +0000)]
ipsec: fix coverity 249204

Zero-initialize the temporary struct, else coverity complains about a bunch of uninitialized fields.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I45dc42134f06917a7459d615804f978a175bec0f

2 years agolinux-cp: handle AF_BRIDGE neighbors 61/36961/2
Matthew Smith [Fri, 19 Aug 2022 19:54:40 +0000 (19:54 +0000)]
linux-cp: handle AF_BRIDGE neighbors

Type: improvement

VPP crashes when a linux-cp tap is added to a bridge on the host system
because rtnl_neigh_get_dst() returns NULL for the neighbor message that
is sent by the kernel.

Check for NULL before trying to use the address from a neighbor in a
netlink message.

Signed-off-by: Matthew Smith <[email protected]>
Change-Id: I8a683d815a09620df9c0cc76e18df39828428e2c
Signed-off-by: Matthew Smith <[email protected]>
2 years agolisp: address the issues raised by coverity 249165 01/37001/2
Andrew Yourtchenko [Tue, 23 Aug 2022 16:51:12 +0000 (16:51 +0000)]
lisp: address the issues raised by coverity 249165

Add the error checks in parsing, aimed to avoid parser walking past the end of packet in case the data
is garbage.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I9541b555a18baf63cb8081bcd7a4c2750f2ed012

2 years agordma: fix coverity 249197 97/36997/2
Benoît Ganne [Tue, 23 Aug 2022 15:05:58 +0000 (17:05 +0200)]
rdma: fix coverity 249197

flags is u64, makes sure we do not overflow when shifting.

Type: fix

Change-Id: Ieea34187c0b568dc4d24c9415b9cff36907a5a87
Signed-off-by: Benoît Ganne <[email protected]>
2 years agovppinfra: fix coverity 249217 27/36927/2
Andrew Yourtchenko [Wed, 17 Aug 2022 13:48:11 +0000 (13:48 +0000)]
vppinfra: fix coverity 249217

Zero-initialize the temporary struct.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I8d73feae427a17470c47d1551ba7078213b589fc

2 years agoclassify: fix coverity 249223 42/36942/2
Andrew Yourtchenko [Thu, 18 Aug 2022 12:38:00 +0000 (12:38 +0000)]
classify: fix coverity 249223

Day1 latent integer overflow.

vnet_classify_add_del defines new_hash as u32 - so replace a u64 type with u32
in split_and_rehash as well.

Type: fix
Signed-off-by: Andrew Yourtchenko <[email protected]>
Change-Id: I51384a2db1caa4099b4d2ac25cd185bd108da037