Compare commits

...

70 Commits

Author SHA1 Message Date
Dave Barach
511ce2572a Clean up multi-thread barrier-sync hold-down timer
Main thread: don't bother with the barrier sync hold-down timer if
none of the worker threads are busy.

Worker threads: avoid epoll_pwait (10ms timeout) when the
control-plane has been active in the last half-second.

Cherry-pick a recent dangling reference fix: pool_elt_at_index after
e.g. rx callback is required, in case the unix file pool expands.

Manual feature backport to 18.07

Change-Id: I745fbb8a12aeda34b0ec7b6dcda66c0e25c3eee1
Signed-off-by: Dave Barach <dave@barachs.net>
2019-05-24 13:56:01 +00:00
Steven Luong
070b810a88 mp_safe SW_INTERFACE_DUMP, SW_INTERFACE_DETAILS, SW_INTERFACE_TAG_ADD_DEL,
BRIDGE_DOMAIN_DUMP, CONTROL_PING, CONTROL_PING_REPLY, and show interface CLI

Change-Id: I2927573b66bb5dd134b37ffb72af0e6676750917
Signed-off-by: Steven Luong <sluong@cisco.com>
(cherry picked from commit 15c31921a628c5500cbed2ebc588d7ddbaa970a3)
2019-05-02 19:54:37 +00:00
Igor Mikhailov (imichail)
19baa37762 Fix 'show interface span' field length
Allow to display longer interface names, e.g. VirtualEthernet0/0/0.102
The field length (32) is now the same as for 'show interface'.

Change-Id: I1cb1efd459acb800bfaeeec40b672c8b17cd8c3d
Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
(cherry picked from commit 0ac827e15c5ee2134a15bf5e023e03967ddcbaa8)
2019-03-05 19:51:25 +00:00
Steven Luong
783adb1527 vhost: VPP stalls with vhost performing control plane actions [VPP-1572]
Symptom
-------
With NDR traffic blasting at VPP, bringing up a new VM with vhost
connection to VPP causes packet drops. I am able to recreate this
problem easily using a simple setup like this.

TREX-------------- switch ---- VPP
    |---------------|  |-------|

Cause
-----
The reason for the packet drops is due to vhost holding onto the worker
barrier lock for too long in vhost_user_socket_read(). There are quite a
few of system calls inside the routine. At the end of the routine, it
unconditionally calls vhost_user_update_iface_state() for all message
types. vhost_user_update_iface_state() also unconditionally calls
vhost_user_rx_thread_placement() and vhost_user_tx_thread_placement().
vhost_user_rx_thread_placement scraps out all existing cpu/queue mappings
for the interface and creates brand new cpu/queue mappings for the
interface. This process is very disruptive and very expensive. In my
opinion, this area of code needs a makeover.

Fixes
-----
* vhost_user_socket_read() is rewritten that it should not hold
  onto the worker barrier lock for system calls, or at least minimize the
  need for doing it.
* Remove the call to vhost_user_update_iface_state as a default route at
  the end of vhost_user_socket_read(). There is only a couple of message
  types which really need to call vhost_user_update_iface_state(). We put
  the call to those message types which need it.
* Remove vhost_user_rx_thread_placement() and
  vhost_user_tx_thread_placement from vhost_user_update_iface_state().
  There is no need to repetatively change the cpu/queue mappings.
* vhost_user_rx_thread_placement() is actually quite expensive. It should
  be called only once per queue for the interface. There is no need to
  scrap the existing cpu/queue mappings and create new cpu/queue mappings
  when the additional queues becomes active/enable.
* Change to create the cpu/queue mappings for the first RX when the
  interface is created. Dont remove the cpu/queue mapping when the
  interface is disconnected. Remove the cpu/queue mapping only when the
  interface is deleted.

The create vhost user interface CLI also has some very expensive system
calls if the command is entered with the optional keyword "server"

As a bonus, This patch makes the create vhost user interface binary-api and
CLI thread safe. Do the protection for the small amount of code which is
thread unsafe.

Change-Id: I664c57d76dc92a116119221f3d91fa67914e440a
Signed-off-by: Steven Luong <sluong@cisco.com>
2019-02-21 16:10:57 -08:00
Steven
2b98236eaa bond: packet drops on VPP bond interface [VPP-1544]
We register callback for VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION and
VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION to add and remove the slave
interface from the bond interface accordingly. For static bonding without
lacp, one would think that it is good enough to put the slave interface into
the ective slave set as soon as it is configured. Wrong, sometimes the slave
interface is configured to be part of the bonding without ever bringing up the
hardware carrier or setting the admin state to up. In that case, we send
traffic to the "dead" slave interface.

The fix is to make sure both the carrier and admin state are up before we put
the slave into the active set for forwarding traffic.

Change-Id: I93b1c36d5481ca76cc8b87e8ca1b375ca3bd453b
Signed-off-by: Steven <sluong@cisco.com>
(cherry picked from commit e43278f75fe3188551580c7d7991958805756e2f)
2019-01-30 15:30:36 +00:00
Steven Luong
3f69a51658 install-dep: force osleap boost dep install
Triple commit this patch to stable/1807. Manually created it due to merge
conflict from cherrypicking the original patch 16631. This patch differs from
16631 that it skips the second chunk from the original patch, listed below,
because it has no significance which is also the source of the merge conflict.

@@ -309,7 +309,7 @@
 	@sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
 else ifeq ($(filter opensuse-leap,$(OS_ID)),$(OS_ID))
 	@sudo -E zypper refresh
-	@sudo -E zypper install -y $(RPM_SUSE_DEPENDS)
+	@sudo -E zypper install  -y $(RPM_SUSE_DEPENDS)
 else ifeq ($(filter opensuse,$(OS_ID)),$(OS_ID))
 	@sudo -E zypper refresh
 	@sudo -E zypper install -y $(RPM_SUSE_DEPENDS)

This patch is needed for stable/1807 because verify job failed for
https://gerrit.fd.io/r/#/c/17031/

Change-Id: Iab863ab57738179ec59d6cd088cc83354acada08
Signed-off-by: Steven Luong <sluong@cisco.com>
2019-01-24 10:08:44 -08:00
Neale Ranns
909ba93249 MPLS: buffer over-run with incorrectly init'd vector. fix VAT dump
Change-Id: Ifdbb4c4cffd90c4ec8b39513d284ebf7be39eca5
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 44cea225e2238a3c549f17f315cd1fbc6978c277)
2018-12-05 11:28:45 +00:00
Neale Ranns
3351801ce3 IPSEC-AH: fix packet drop
Change-Id: I45b97cfd0c3785bfbf6d142d362bd3d4d56bae00
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit ad5f2de9041070c007cedb87f94b72193125db17)
2018-12-05 06:29:23 +00:00
Juraj Sloboda
31aa6f267f vhost_user: Fix setting MTU using uninitialized variable
Change-Id: I0caa5fd584e3785f237d08f3d3be23e9bfee7605
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
(cherry picked from commit 83c46a2c5c97320e029b4dd154a45212530f221d)
2018-11-03 19:24:38 +00:00
mu.duojiao
c548f5df3f VPP-1448: Fix error when recurse on down the trie.
Change-Id: Idfed8243643780d3f52dfe6e6ec621c440daa6ae
Signed-off-by: mu.duojiao <mu.duojiao@zte.com.cn>
(cherry picked from commit 59a829533c1345945dc1b6decc3afe29494e85cd)
2018-10-17 15:13:06 +00:00
mu.duojiao
41b2ae7c1d VPP-1459:Ip4 lookup fail when exist prefix cover.
Change-Id: I4ba0aeb65219596475345e42b8cd34019f5594c6
Signed-off-by: mu.duojiao <mu.duojiao@zte.com.cn>
(cherry picked from commit 9744e6d0273c0d7d11ab4f271c8694f69d51ccf3)
(cherry picked from commit b3aff922ffbddd61b44df50271e4aaee2820a432)
2018-10-17 11:08:58 +00:00
Andrew Yourtchenko
da7bcd4bd6 acl-plugin: tuplemerge: refresh the pointer to hash-readied ACL entries per each collision in split_partition() (VPP-1458)
A pointer to hash-ready ACL rules is only set once, which might cause a crash if there are colliding entries
from more than one ACL applied.

Solution: reload the pointer based on the element being processed.

Change-Id: I7a701c2c3b4236d67293159f2a33c4f967168953
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
(cherry picked from commit 84112dd4f98e5a31a8c7340a741f89e77fd03363)
2018-10-17 07:59:19 +00:00
Marco Varlese
9c335ce8e7 Fix wrong dependencies
I was reported an issue affecting VPP build only with 1 thread (e.g. -j1
option to make). That is quite important from a reproducible build
perspective.
This patch addresses that issue.

Change-Id: Ia8e3b9a9716a260d8b6f1c2d92dd166eddf6716f
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
2018-10-02 12:30:39 +00:00
Neale Ranns
21064cec96 IGMP: handle (*,G) report with no source addresses
Change-Id: I363370b9d4a27b992bad55c48fc930a2fbea2165
Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-10-01 09:42:16 +00:00
Marco Varlese
bc0c8fe6ff SCTP: fix overflow issue with timestamp
Change-Id: I03bb47a2baa4375b7bf9347d95c4cc8de37fe510
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
2018-10-01 07:52:25 +00:00
Ole Troan
639f573dca IP ttl check in ip4-input missing for single packet path.
Change-Id: Idc17b2f8794d37cd3242a97395ab56bd633ca575
Signed-off-by: Ole Troan <ot@cisco.com>
2018-09-28 15:05:07 +00:00
Neale Ranns
6a5bc5173a MPLS tunnel dump fix
Change-Id: I9d3d5243841d5b888f079e3ea5dc1e2e8befd1dc
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-09-25 19:47:37 +00:00
Neale Ranns
d159e6f311 BIER; bi-dir to/from underlay
set and check a special RX interface value as the packet enters and
exits a BIER domain

Change-Id: I5ff2f0e2d1b3ce0f3598b935f518fc11eb0896ee
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
(cherry picked from commit fe4e48f617f3e0f62880adebdcfb5989aa4e6db7)
2018-09-25 15:27:05 +00:00
Neale Ranns
1e5a2c6f19 GRE: fix 4o6 and 6o4 adj stacking
Change-Id: I13dc5eab8835c4f3b95906816d42dccfeee8b092
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 2646c80db8d3d1a3cd7555328d5a0038798f861e)
2018-09-21 09:42:34 +00:00
Ed Warnicke
55fbdb9941
Fix AC_INIT to get same version as everything else.
When the version was being set manually in AC_INIT,
it would be different form the version in show ver
from vpp during releases.  This led to breakage
in merge jobs leading to the release.

This fixes that by having A_INIT use the same version
script as everything else.

Change-Id: I45c2857b28153ff52afff0ee753d4dea7c6f7f70
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-09-15 11:11:20 -05:00
Ed Warnicke
b3fceaa7ca
Updated 18.07.1 Release Notes
Change-Id: Ib3ce58ad54604407d72261ac992e88ce9a3fd1aa
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-09-14 14:33:45 -05:00
Ed Warnicke
9f624cacf3
Release notes and versions for 18.07.01 dot release
Change-Id: I57570eb3a2a397d88e8a223ba25cc04c68dfe736
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-09-13 09:50:46 -05:00
dongjuan
f0030614c3 nat: fix busy ports of each thread
which can create dead loop in
nat_alloc_addr_and_port_default function

Change-Id: I468c25ce0f0a0b3f881de564623dea208b2ca700
Signed-off-by: dongjuan <dong.juan1@zte.com.cn>
(cherry picked from commit 58f50f1bb64e962e5628e2c1867e07f238036c7b)
2018-09-12 10:10:09 +00:00
Ed Warnicke
a742315b78 Fix create memif socket
create interface memif [id <id>] [socket-id <socket-id>] ...

Can optionally take a socket-id.

You create a socket-id with:

create memif socket [id <id>] [filename <path>]

Unfortunately, this doesn't work because "create memif" was
deprecated.  It results in:

vpp# create memif socket id 0 filename /run/vpp/test.socket
command deprecated. Please use 'create interface memif' instead.

This fixes it by clipping out the

create memif

command entirely.

Change-Id: If503758706bf758b6cb46e958200527a5856c600
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-09-12 10:08:50 +00:00
Damjan Marion
7483694884 fix issue with missing sample_main in sample plugin
Change-Id: Ia17511e3997cdcf1d0991e62e8e2d3fb8812d133
Signed-off-by: Damjan Marion <damarion@cisco.com>
2018-09-11 17:24:33 +00:00
Steven
aec7297ba0 vlib: crash in linux_epoll_input_inline for accessing free file index [VPP-1412]
Under rare scenario, epoll may still post an event to VPP although the file
descriptor is already deleted via epoll_ctl (EPOLL_CTL_DEL) and the file
descriptor is close. VPP tries to access the free file index entry and crash.

The fix is to throw away the events which the file descriptor is already deleted.

Change-Id: Ieca3a1873aecb28630c3abc42c40341f27c2faa7
Signed-off-by: Steven <sluong@cisco.com>
2018-09-08 14:22:08 -07:00
Matus Fabian
d783d1d6bf NAT: fix maximum out of order fragments (VPP-1399)
All fragments should be dropped when max_frag is 1 and 2 non-initial fragments are received before first fragment.

Change-Id: Id0c968f45629698e347e8226c5926f27b48b82d6
Signed-off-by: Matus Fabian <matfabia@cisco.com>
(cherry picked from commit a7f8b228ff505acc052a77101b12e714ead26536)
2018-09-06 11:43:16 +00:00
Andrew Yourtchenko
f74b4d2b55 acl-plugin: VPP-1400: fix crash when removing a session entry
bihash deletion operation may in turn do underlying memory operations,
so ensure it is using the correct (private) heap.

Change-Id: Ibef7ad7f9db6fa83da02316bf7509072ce579bc0
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-09-06 11:08:30 +00:00
Marco Varlese
eabe79ca28 sctp: reduce the number of clients and mbytes (VPP-1396)
Reducing the number of clients and mbytes transferred to make the test a
functional test rather than a stress one.

Change-Id: I715ab5db087b96c40da37d4221f3030b10519fd0
Signed-off-by: Marco Varlese <marco.varlese@suse.com>
(cherry picked from commit 038d2614bffae707582703f116e52c516f51b26b)
2018-09-05 16:54:05 +00:00
Ed Warnicke
9a9ab594e8
Correct DPDK version in release notes
Change-Id: Ie4c86373fef7583276f68a8be125d372d4603a23
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-09-04 11:48:48 -05:00
Andrew Yourtchenko
1edc406da3 acl-plugin: VPP-1400: VPP may crash when performing ACL modifications on applied ACLs
The partition_split() did not increment the refcount when using a mask type index,
thus subsequent modifications potentially resulted in double frees and in the best case
immediate crash, in the worst case delayed crash in another place.

Introduce the lock_mask_type_index() and call it, move the mask type index
related functions closer to the top of the file.

Make the assignment of the new mask type indices
for the tuplemerge case to use the assign_mask_type_index().

Keep some debugs in case we need to investigate this further at some point.

Change-Id: Iae370f5cd92e1fe1442480db34656a8a3442dbc0
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-09-03 16:08:02 +00:00
Andrew Yourtchenko
d039281e11 acl-plugin: fix the memory leak with colliding entries storage
Change-Id: I634971f6376a7ea49de718ade9139e67eeed48e5
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2018-09-03 16:03:20 +00:00
Matus Fabian
e0fe0fd090 NAT44: fix nat44_ed_not_translate_output_feature for multiple VRF (VPP-1404)
Change-Id: I44acc5aeff59dc25d18369e29618bbe39d30a1b3
Signed-off-by: Matus Fabian <matfabia@cisco.com>
(cherry picked from commit f96d0a105d357a6b7bb4252b271fbcbab45bc9bd)
2018-09-02 11:37:15 +00:00
shubing guo
86f6d3e291 VPP-1387:foreach outside address vector to find correct index when free outside address and port
Change-Id: Ie5452350a8ebe2c1b62085fcab50dbc0138d3ae2
Signed-off-by: shubing guo <guo.shubing@zte.com.cn>
(cherry picked from commit 762a4938900abeedd42676ab2582fcceabdc07fa)
2018-09-02 11:37:03 +00:00
Yichen Wang
6b4b20318b vhost: Fix VPP crash when reloading VM with mixed-type ports [VPP-1406]
When VM is having mixed type of vhost-user and SRIOV ports, QEMU (RedHat
v2.10) will not send disconnect signal to VPP, and just gives the new
memory region directly. VPP is not able to handle new memory region
mapping without disconnect signal first, which will result in a SEGV.
The fix will handle the VM reboot scenario without explict disconnect
signal from QEMU.

The fix is to invalidate the avail, desc, and used pointers in the txvq
when the new memory regions are received. This is because these pointers
are not valid anymore with the new memory regions. In the input node, check
to make sure the avail pointer is valid and punt if not.

Change-Id: Ieb8b427b202f4442a58907dab1661d63a03650de
Signed-off-by: Yichen Wang <yicwang@cisco.com>
2018-09-02 11:36:31 +00:00
shubing guo
2a12fb231b VPP-1381: Fix the incorrect if condition when delete session for static mapping
-- The session should not be deleted when either ip address or port doesn't same with static mapping.

Change-Id: I09ab7379947654d2780a8c40c5340ce430541b12
Signed-off-by: shubing guo <guo.shubing@zte.com.cn>
(cherry picked from commit 060c3a7e5a2d23189a8c6348e767cd2018a58dd6)
2018-08-31 16:01:38 +00:00
Matus Fabian
bd8b4f1a84 NAT44: fix next_src_nat (VPP-1384)
Use rx_fib_index instead of sm->inside_fib_index for session lookup key.

Change-Id: I2d6cce5b9376fa8ac4d75a9bbfa8498be0fd1493
Signed-off-by: Matus Fabian <matfabia@cisco.com>
(cherry picked from commit 182e37e33f80cc65f3cf27b69e74d855dd858a7e)
2018-08-31 10:23:31 +00:00
Neale Ranns
2da975c4dd SR-MPLS: fixes and tests
- the FIB path takes a vector of type fib_mpls_label_t not u32 so the untype safe vec_add did not work
- write som eSR-MPLS tests
- allow an MPLS tunnel to resolve through a SR BSID

Change-Id: I2a18b9a9bf43584100ac269c4ebc286c9e3b3ea5
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 7c922dc404c2c0a2d67d53ca05db1c1ae1598f44)
2018-08-31 09:03:07 +00:00
Steven
fe47e29fc6 lacp: issue with slave interface admin up after it is added to the bond group [VPP-1409]
When the slave interface is admin up after it is added to the bond group,
lacp does not send lacp pdu's to the interface because its periodic timer
is not running.

The issue was the slave interface's variables got reset after the state
machines were initialized.

Change-Id: I2942556ce29a4acc97db3be40293e69bed7b6679
Signed-off-by: Steven <sluong@cisco.com>
(cherry picked from commit bf21dc85053931bc597e0fab1112061aa60e986b)
2018-08-31 05:16:42 +00:00
Neale Ranns
ead8eb34e3 SR-mpls: do not pass empty label stack to fib
Change-Id: Ib1601d01a54296e72be3bbfa057fce965549b02b
Signed-off-by: Neale Ranns <nranns@cisco.com>
2018-08-29 21:54:51 +00:00
Matthew Smith
19d4ecddeb backport mlx patch for DPDK >= 18.05
Memory allocation changed in DPDK 18.05. The mlx4 and mlx5
PMDs did not support using externally allocated memory.

The patch for mlx5 was generated by Mellanox. That patch was
modified to apply to the mlx4 PMD and tested on Microsoft
Azure.

Patches were originally tested and used with VPP master
(prerelease 18.10). Then backported to VPP stable/1807.

Change-Id: I883e0d796e59702731bec06c96210f0b134188db
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
2018-08-29 13:30:37 -05:00
Neale Ranns
270e190085 Consolidate table->index conversion in fib-path CLI processing
Change-Id: I221cebddc45efbfdec428b7df2af96e2aedff2dd
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 77eb9073b178e8d4375bf0ef274246586f018ddc)
2018-08-29 12:06:41 +00:00
Neale Ranns
6da5d8d237 Adjacency walks protected by 'walk in progress' flag
Change-Id: I3281f65f7dec792d56de48afb39efcc2fed8578b
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 30d53645ded750db3cc84f6fb4a97df038b143a1)
2018-08-28 09:30:59 +00:00
Neale Ranns
ff83ce7b94 MPLS: allow 16 as a valid output label
Change-Id: I7e6045514d58010258889cadd220b7efcef7c1b9
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 9514fab0423725fddcb0a4f5ec070ac8d2764ac8)
2018-08-28 07:35:29 +00:00
Neale Ranns
2506190ab4 IPIP and SIXRD tunnels create API needs table-IDs not fib-indexes
Change-Id: Ifaef196a24fa9b6924f2b9692318f69763cee5e1
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-08-22 21:52:13 -07:00
Ole Troan
d1bf43c2aa VPP-1392: VXLAN fails with IP fragmentation
Not only is it wasteful to send all fragments back through ip4-lookup, but
it doesn't work with tunnel mechanisms that don't have IP enabled on their
payload side.

Change-Id: Ic92d95982dddaa70969a2a6ea2f98edec7614425
Signed-off-by: Ole Troan <ot@cisco.com>
(cherry picked from commit b3655e5592e3e8e48eb087632f3fa71915891a9f)
2018-08-17 21:40:02 +00:00
Florin Coras
4280bfc8c0 tcp_echo: fix server rx buffer
Change-Id: I7bb81259008f5d2da6e26405fd0774294181dc6b
Signed-off-by: Florin Coras <fcoras@cisco.com>
2018-08-13 15:21:02 +00:00
Yi He
332cc5a60b Fix undefined symbol: fformat_append_cr in vat plugins loading
Several test plugins report undefined symbol while being loaded
by load_one_vat_plugin. Fix this by adding VPP_API_TEST_BUILTIN
into CFLAGS for building these plugins.

Change-Id: I908720fd0d01da1ead30ba17027ba10358f6bdf1
Signed-off-by: Yi He <yi.he@arm.com>
(cherry picked from commit d05ce97724ed8681e80c32a948564d0163994365)
2018-08-09 17:26:02 +00:00
Matus Fabian
6c2dc9bab1 NAT44: fix bug in snat_interface_add_del (VPP-1380)
Should not enable nat44-hairpinning node in deterministic mode

Change-Id: I5790323a6842ee71a62c6c91c49166a2839eac12
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-08-09 13:45:05 +00:00
Dave Barach
21076e5d47 Fix dangling reference in l2fib_scan(...)
Deleting a bihash kvp frees the bucket's backing storage when the
bucket reference count reaches zero. l2fib_scan MUST check for that
condition, and stop scanning the bucket if it occurs. One of the L2
FIB extended "make test" vectors caused this issue 100% of the time.

Change-Id: I250bcc4c1518e16042120fbc4032227a759a602e
Signed-off-by: Dave Barach <dave@barachs.net>
(cherry picked from commit 28374cada08df61180044e24cb758fa570e73c9d)
2018-08-07 18:10:35 +00:00
Dave Barach
ab955b1b44 fix dangling reference in foreach_key_value_pair
When the user deletes the last entry in a bihash bucket, the bihash
infra frees the bucket's backing storage. If this happens under
clib_bihash_foreach_key_value_pair - and the freed bucket happens to
be the bucket being traversed - the resulting dangling reference can
easily make the wheels fall off.

Simple fix: if (bucket-is-now-empty) double-break.

Change-Id: Idc44247a82ed5d0ba548507b4a53d4c8503ba8bb
Signed-off-by: Dave Barach <dave@barachs.net>
(cherry picked from commit ca45ee73d7c49c7f659c5cd690d3403d440e50f9)
2018-08-06 11:28:38 -04:00
Neale Ranns
374819dd58 loop counter to prevent infiinte number of look ups per-packet
Change-Id: I59235d11baac18785a4c90cdaf14e8f3ddf06dab
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
2018-08-03 09:15:28 -04:00
Neale Ranns
78c7077634 fix 'sh vxlan tunnels'
this receipe:
  /* Get a line of input. */
  if (!unformat_user (input, unformat_line_input, line_input))
    return 0;
only works if there is more data following the registered command name.
So it is not so good for show commands...

Change-Id: I54249865a44526ade4b40e2d6207138a2d056e40
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
(cherry picked from commit 16be62e3846750b5b7921c0b4d6408477be434f7)
2018-08-01 07:38:16 +00:00
Ed Warnicke
db6d6b3058
Update Release Notes for 18.07 Release
Change-Id: I2b58bca6d360badb4fd17022121e244aee5713b8
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-07-30 14:29:08 -05:00
Rajesh Saluja
17ee6f08d4 Reverse the logic of flagging malformed packet in fragmentation code to allow padding
Change-Id: I051c137ae18fd436a798a12a56a9d12f8eaa2e08
Signed-off-by: Rajesh Saluja <rajsaluj@cisco.com>
(cherry picked from commit 1f895c9a40f446ca9f1b7803f350c70ebb3ad0fa)
2018-07-30 11:24:54 +00:00
Juraj Sloboda
3c723f3812 Fix memory leak in processing of ICMPv6 RA event (VPP-1360)
Change-Id: I7c3e5e91391b1c9b36e8ea8bacee9a107da1ae96
Signed-off-by: Juraj Sloboda <jsloboda@cisco.com>
2018-07-27 11:33:34 +02:00
Lukasz Majczak
c1ebcc4022 VPP-1359 Wrong vl_msg_id
Wrong vl_msg_id set in vl_api_stats_get_poller_delay_t_handler while reporting stats delay.

Change-Id: I7d6ad14359e41c717b976390c58e254e3602e0ff
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
2018-07-26 14:15:56 +00:00
Jakub Grajciar
258a189d18 avf: api fix
avf_create_reply returns software index for the new interface

Change-Id: I8a6b1a1985b072efafa24eb258b1f2cb1bea1110
Signed-off-by: Jakub Grajciar <jgrajcia@cisco.com>
(cherry picked from commit 4e6014fc9e8611eef16d9267151f1039ff00c190)
2018-07-26 08:37:15 +00:00
Eyal Bari
456ded496f fix vector index range checks (VPP-1353)
Change-Id: I63c36644c9d93f2c3ec6606ca0205b407499de4e
Signed-off-by: Eyal Bari <ebari@cisco.com>
(cherry picked from commit cd30774fa9280736ffaea3e9a51948593e8eebc2)
Signed-off-by: John Lo <loj@cisco.com>
2018-07-24 15:15:25 +00:00
Matus Fabian
c16a23c596 NAT44: fix forwarding feature bug (VPP-1349)
Change-Id: I5009fcfde5c627d59dea3edda15486b9392134a2
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2018-07-23 19:39:02 +00:00
Neale Ranns
6f9bc4e4d8 QOS: mark/record fix feature ordering c-n-p error
vnet_feature_arc_init:215: feature node 'mpls-qos-mark' not found (after 'vlan-mpls-qos-record', arc 'mpls-input')
vnet_feature_arc_init:215: feature node 'ip6-qos-mark' not found (after 'vlan-ip6-qos-record', arc 'ip6-multicast')
...etc...

Change-Id: I22cb98d57e2480f5978fff315b77b9cbb6a9f9dd
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
(cherry picked from commit 8d753f906ecdd152af1e524919e99bd9ab45de46)
2018-07-23 10:28:43 +00:00
Neale Ranns
9df8ffa0dc QoS: marking and recording for MPLS and VLAN
Change-Id: Icec79aa9039d5d7835d311fde0b7c1a0c76c9eb1
Signed-off-by: Neale Ranns <nranns@cisco.com>
(cherry picked from commit 0809f6c0300f85cf5cf5d49df1aa8f1e2d080f6c)
2018-07-23 08:34:24 +00:00
Dave Barach
ca23c3ea16 Loopback tx: support multiple tx intfcs per frame
Can happen if code bypasses the per-interface output node, and
dispatches packets directly to the tx node.

Switch to vlib_get_buffers(...) ... vlib_buffer_enqueue_to_next (...),
quad/single loop coding pattern.

Change-Id: Ic0e5d3b9748230f4e545a54186e6e64e7a782bb1
Signed-off-by: Dave Barach <dave@barachs.net>
(cherry picked from commit 78451a6a660cd26a67d2284219f48878a2dfe2c3)
2018-07-22 00:53:04 +00:00
Neale Ranns
2ed681f5b0 ip4-input and ip4-input-no-checksum should be siblings
each edge/arc from these nodes must be the same.

Change-Id: Id5dace61bca0af71ad1df98583425226e81fd0de
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
(cherry picked from commit 8a03e4f97952d84e152f5b17d5325583604c4fd3)
2018-07-19 15:50:28 +00:00
Mohsin Kazmi
d61105656b gbp: Add support for ACL
Change-Id: I7513c41307e62068ab5d9739cac393675c6066f8
Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
(cherry picked from commit 22b3b846822df2701bb6cb508fa4e023526e5717)
2018-07-19 07:51:39 +00:00
Eyal Bari
692250bedf qos mark/record: fix disable-sw_if_index range check
Change-Id: I2abb3ceebae3a32cee9aa2a999bd47c37719d3ac
Signed-off-by: Eyal Bari <ebari@cisco.com>
Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
(cherry picked from commit 07f3586c5a9868ccee381af528de39b373d7720a)
2018-07-18 21:17:58 +00:00
Eyal Bari
e4b49c738b loopback:fix delete to check interface class
Change-Id: Ia563b279e85b5da93f79db5a2a4d9b8c04f5be99
Signed-off-by: Eyal Bari <ebari@cisco.com>
(cherry picked from commit b52c034c7d53014e9d5c1dfc3501e9adfb0c6391)
2018-07-18 04:50:38 +00:00
Neale Ranns
ee8b973de9 VOM: support for pipes
Change-Id: I5c381dfe2f926f94a34ee8ed8f1b9ec6038d5fe2
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
(cherry picked from commit 208c29aac523231af2420a95ba7e5d361698780b)
2018-07-18 04:48:34 +00:00
Hongjun Ni
b4b2488202 VPP crash when run "lb set interface nat4 in <intc>" VPP-1343
Change-Id: I23be9c29227e7dd1bb11b5b7fa910bb61c2be6c9
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2018-07-18 00:17:44 +08:00
Ed Warnicke
e400a6d1a5
Update .gitreview for stable/1807
Change-Id: I6e405e9d729990bb57aaaa4aab01a1d4f54f4ee4
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2018-07-16 12:11:28 -05:00
223 changed files with 5017 additions and 1392 deletions

View File

@ -2,3 +2,4 @@
host=gerrit.fd.io
port=29418
project=vpp
defaultbranch=stable/1807

View File

@ -127,14 +127,14 @@ RPM_SUSE_PLATFORM_DEPS = distribution-release shadow rpm-build
ifeq ($(OS_ID),opensuse)
ifeq ($(SUSE_NAME),Tumbleweed)
RPM_SUSE_DEVEL_DEPS = libboost_headers-devel libboost_thread-devel gcc
RPM_SUSE_DEVEL_DEPS = libboost_headers1_68_0-devel-1.68.0 libboost_thread1_68_0-devel-1.68.0 gcc
RPM_SUSE_PYTHON_DEPS += python2-ply python2-virtualenv
endif
ifeq ($(SUSE_ID),15.0)
RPM_SUSE_DEVEL_DEPS = libboost_headers-devel libboost_thread-devel gcc6
RPM_SUSE_DEVEL_DEPS = libboost_headers1_68_0-devel-1.68.0 libboost_thread1_68_0-devel-1.68.0 gcc6
RPM_SUSE_PYTHON_DEPS += python2-ply python2-virtualenv
else
RPM_SUSE_DEVEL_DEPS += boost_1_61-devel gcc6
RPM_SUSE_DEVEL_DEPS += libboost_headers1_68_0-devel-1.68.0 gcc6
RPM_SUSE_PYTHON_DEPS += python-virtualenv
endif
endif

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@ DPDK_FAILSAFE_PMD ?= n
B := $(DPDK_BUILD_DIR)
I := $(DPDK_INSTALL_DIR)
DPDK_VERSION ?= 18.05
PKG_SUFFIX ?= vpp2
PKG_SUFFIX ?= vpp3
DPDK_BASE_URL ?= http://fast.dpdk.org/rel
DPDK_TARBALL := dpdk-$(DPDK_VERSION).tar.xz
DPDK_TAR_URL := $(DPDK_BASE_URL)/$(DPDK_TARBALL)

View File

@ -0,0 +1,270 @@
From bd42c77c457146bede32333558b4e0414b30683e Mon Sep 17 00:00:00 2001
From: Yongseok Koh <yskoh@mellanox.com>
Date: Fri, 24 Aug 2018 16:46:49 -0700
Subject: [PATCH] net/mlx5: support externally allocated mempool
When MLX PMD registers memory for DMA, it accesses the global memseg list
of DPDK to maximize the range of registration so that LKey search can be
more efficient. Granularity of MR registration is per page.
Externally allocated memory shouldn't be used for DMA because it can't be
searched in the memseg list and free event can't be tracked by DPDK.
However, if the external memory is static (allocated on startup and never
freed), such memory can also be registered by little tweak in the code.
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
drivers/net/mlx5/mlx5_mr.c | 155 +++++++++++++++++++++++++++++++++++++++++++
drivers/net/mlx5/mlx5_rxtx.h | 35 +++++++++-
2 files changed, 189 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_mr.c b/drivers/net/mlx5/mlx5_mr.c
index 08105a443..876622e91 100644
--- a/drivers/net/mlx5/mlx5_mr.c
+++ b/drivers/net/mlx5/mlx5_mr.c
@@ -277,6 +277,23 @@ mr_find_next_chunk(struct mlx5_mr *mr, struct mlx5_mr_cache *entry,
uintptr_t end = 0;
uint32_t idx = 0;
+ /* MR for external memory doesn't have memseg list. */
+ if (mr->msl == NULL) {
+ struct ibv_mr *ibv_mr = mr->ibv_mr;
+
+ assert(mr->ms_bmp_n == 1);
+ assert(mr->ms_n == 1);
+ assert(base_idx == 0);
+ /*
+ * Can't search it from memseg list but get it directly from
+ * verbs MR as there's only one chunk.
+ */
+ entry->start = (uintptr_t)ibv_mr->addr;
+ entry->end = (uintptr_t)ibv_mr->addr + mr->ibv_mr->length;
+ entry->lkey = rte_cpu_to_be_32(mr->ibv_mr->lkey);
+ /* Returning 1 ends iteration. */
+ return 1;
+ }
for (idx = base_idx; idx < mr->ms_bmp_n; ++idx) {
if (rte_bitmap_get(mr->ms_bmp, idx)) {
const struct rte_memseg_list *msl;
@@ -818,6 +835,7 @@ mlx5_mr_mem_event_free_cb(struct rte_eth_dev *dev, const void *addr, size_t len)
mr = mr_lookup_dev_list(dev, &entry, start);
if (mr == NULL)
continue;
+ assert(mr->msl); /* Can't be external memory. */
ms = rte_mem_virt2memseg((void *)start, msl);
assert(ms != NULL);
assert(msl->page_sz == ms->hugepage_sz);
@@ -1070,6 +1088,139 @@ mlx5_mr_flush_local_cache(struct mlx5_mr_ctrl *mr_ctrl)
(void *)mr_ctrl, mr_ctrl->cur_gen);
}
+/**
+ * Called during rte_mempool_mem_iter() by mlx5_mr_update_ext_mp().
+ *
+ * Externally allocated chunk is registered and a MR is created for the chunk.
+ * The MR object is added to the global list. If memseg list of a MR object
+ * (mr->msl) is null, the MR object can be regarded as externally allocated
+ * memory.
+ *
+ * Once external memory is registered, it should be static. If the memory is
+ * freed and the virtual address range has different physical memory mapped
+ * again, it may cause crash on device due to the wrong translation entry. PMD
+ * can't track the free event of the external memory for now.
+ */
+static void
+mlx5_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque,
+ struct rte_mempool_memhdr *memhdr,
+ unsigned mem_idx __rte_unused)
+{
+ struct mr_update_mp_data *data = opaque;
+ struct rte_eth_dev *dev = data->dev;
+ struct priv *priv = dev->data->dev_private;
+ struct mlx5_mr_ctrl *mr_ctrl = data->mr_ctrl;
+ struct mlx5_mr *mr = NULL;
+ uintptr_t addr = (uintptr_t)memhdr->addr;
+ size_t len = memhdr->len;
+ struct mlx5_mr_cache entry;
+ uint32_t lkey;
+
+ /* If already registered, it should return. */
+ rte_rwlock_read_lock(&priv->mr.rwlock);
+ lkey = mr_lookup_dev(dev, &entry, addr);
+ rte_rwlock_read_unlock(&priv->mr.rwlock);
+ if (lkey != UINT32_MAX)
+ return;
+ mr = rte_zmalloc_socket(NULL,
+ RTE_ALIGN_CEIL(sizeof(*mr),
+ RTE_CACHE_LINE_SIZE),
+ RTE_CACHE_LINE_SIZE, mp->socket_id);
+ if (mr == NULL) {
+ DRV_LOG(WARNING,
+ "port %u unable to allocate memory for a new MR of"
+ " mempool (%s).",
+ dev->data->port_id, mp->name);
+ data->ret = -1;
+ return;
+ }
+ DRV_LOG(DEBUG, "port %u register MR for chunk #%d of mempool (%s)",
+ dev->data->port_id, mem_idx, mp->name);
+ mr->ibv_mr = mlx5_glue->reg_mr(priv->pd, (void *)addr, len,
+ IBV_ACCESS_LOCAL_WRITE);
+ if (mr->ibv_mr == NULL) {
+ DRV_LOG(WARNING,
+ "port %u fail to create a verbs MR for address (%p)",
+ dev->data->port_id, (void *)addr);
+ rte_free(mr);
+ data->ret = -1;
+ return;
+ }
+ mr->msl = NULL; /* Mark it is external memory. */
+ mr->ms_bmp = NULL;
+ mr->ms_n = 1;
+ mr->ms_bmp_n = 1;
+ rte_rwlock_write_lock(&priv->mr.rwlock);
+ LIST_INSERT_HEAD(&priv->mr.mr_list, mr, mr);
+ DRV_LOG(DEBUG,
+ "port %u MR CREATED (%p) for external memory %p:\n"
+ " [0x%" PRIxPTR ", 0x%" PRIxPTR "),"
+ " lkey=0x%x base_idx=%u ms_n=%u, ms_bmp_n=%u",
+ dev->data->port_id, (void *)mr, (void *)addr,
+ addr, addr + len, rte_cpu_to_be_32(mr->ibv_mr->lkey),
+ mr->ms_base_idx, mr->ms_n, mr->ms_bmp_n);
+ /* Insert to the global cache table. */
+ mr_insert_dev_cache(dev, mr);
+ rte_rwlock_write_unlock(&priv->mr.rwlock);
+ /* Insert to the local cache table */
+ mlx5_mr_addr2mr_bh(dev, mr_ctrl, addr);
+}
+
+/**
+ * Register MR for entire memory chunks in a Mempool having externally allocated
+ * memory and fill in local cache.
+ *
+ * @param dev
+ * Pointer to Ethernet device.
+ * @param mr_ctrl
+ * Pointer to per-queue MR control structure.
+ * @param mp
+ * Pointer to registering Mempool.
+ *
+ * @return
+ * 0 on success, -1 on failure.
+ */
+static uint32_t
+mlx5_mr_update_ext_mp(struct rte_eth_dev *dev, struct mlx5_mr_ctrl *mr_ctrl,
+ struct rte_mempool *mp)
+{
+ struct mr_update_mp_data data = {
+ .dev = dev,
+ .mr_ctrl = mr_ctrl,
+ .ret = 0,
+ };
+
+ rte_mempool_mem_iter(mp, mlx5_mr_update_ext_mp_cb, &data);
+ return data.ret;
+}
+
+/**
+ * Register MR entire memory chunks in a Mempool having externally allocated
+ * memory and search LKey of the address to return.
+ *
+ * @param dev
+ * Pointer to Ethernet device.
+ * @param addr
+ * Search key.
+ * @param mp
+ * Pointer to registering Mempool where addr belongs.
+ *
+ * @return
+ * LKey for address on success, UINT32_MAX on failure.
+ */
+uint32_t
+mlx5_tx_update_ext_mp(struct mlx5_txq_data *txq, uintptr_t addr,
+ struct rte_mempool *mp)
+{
+ struct mlx5_txq_ctrl *txq_ctrl =
+ container_of(txq, struct mlx5_txq_ctrl, txq);
+ struct mlx5_mr_ctrl *mr_ctrl = &txq->mr_ctrl;
+ struct priv *priv = txq_ctrl->priv;
+
+ mlx5_mr_update_ext_mp(ETH_DEV(priv), mr_ctrl, mp);
+ return mlx5_tx_addr2mr_bh(txq, addr);
+}
+
/* Called during rte_mempool_mem_iter() by mlx5_mr_update_mp(). */
static void
mlx5_mr_update_mp_cb(struct rte_mempool *mp __rte_unused, void *opaque,
@@ -1113,6 +1264,10 @@ mlx5_mr_update_mp(struct rte_eth_dev *dev, struct mlx5_mr_ctrl *mr_ctrl,
};
rte_mempool_mem_iter(mp, mlx5_mr_update_mp_cb, &data);
+ if (data.ret < 0 && rte_errno == ENXIO) {
+ /* Mempool may have externally allocated memory. */
+ return mlx5_mr_update_ext_mp(dev, mr_ctrl, mp);
+ }
return data.ret;
}
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index f53bb43c3..b61c23b33 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -347,6 +347,8 @@ uint16_t mlx5_rx_burst_vec(void *dpdk_txq, struct rte_mbuf **pkts,
void mlx5_mr_flush_local_cache(struct mlx5_mr_ctrl *mr_ctrl);
uint32_t mlx5_rx_addr2mr_bh(struct mlx5_rxq_data *rxq, uintptr_t addr);
uint32_t mlx5_tx_addr2mr_bh(struct mlx5_txq_data *txq, uintptr_t addr);
+uint32_t mlx5_tx_update_ext_mp(struct mlx5_txq_data *txq, uintptr_t addr,
+ struct rte_mempool *mp);
#ifndef NDEBUG
/**
@@ -534,6 +536,24 @@ mlx5_tx_complete(struct mlx5_txq_data *txq)
}
/**
+ * Get Memory Pool (MP) from mbuf. If mbuf is indirect, the pool from which the
+ * cloned mbuf is allocated is returned instead.
+ *
+ * @param buf
+ * Pointer to mbuf.
+ *
+ * @return
+ * Memory pool where data is located for given mbuf.
+ */
+static struct rte_mempool *
+mlx5_mb2mp(struct rte_mbuf *buf)
+{
+ if (unlikely(RTE_MBUF_INDIRECT(buf)))
+ return rte_mbuf_from_indirect(buf)->pool;
+ return buf->pool;
+}
+
+/**
* Query LKey from a packet buffer for Rx. No need to flush local caches for Rx
* as mempool is pre-configured and static.
*
@@ -591,7 +611,20 @@ mlx5_tx_addr2mr(struct mlx5_txq_data *txq, uintptr_t addr)
return mlx5_tx_addr2mr_bh(txq, addr);
}
-#define mlx5_tx_mb2mr(rxq, mb) mlx5_tx_addr2mr(rxq, (uintptr_t)((mb)->buf_addr))
+static __rte_always_inline uint32_t
+mlx5_tx_mb2mr(struct mlx5_txq_data *txq, struct rte_mbuf *mb)
+{
+ uintptr_t addr = (uintptr_t)mb->buf_addr;
+ uint32_t lkey = mlx5_tx_addr2mr(txq, addr);
+
+ if (likely(lkey != UINT32_MAX))
+ return lkey;
+ if (rte_errno == ENXIO) {
+ /* Mempool may have externally allocated memory. */
+ lkey = mlx5_tx_update_ext_mp(txq, addr, mlx5_mb2mp(mb));
+ }
+ return lkey;
+}
/**
* Ring TX queue doorbell and flush the update if requested.
--
2.11.0

View File

@ -0,0 +1,250 @@
From c947fd2ec67e9bbacb8b106f320f6e6bae5a9731 Mon Sep 17 00:00:00 2001
From: Matthew Smith <mgsmith@netgate.com>
Date: Tue, 28 Aug 2018 13:21:04 -0500
Subject: [PATCH] mlx4: support externally allocated mempool
Port Mellanox mlx5 PMD patch to work for mlx4 PMD.
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
---
drivers/net/mlx4/mlx4_mr.c | 150 +++++++++++++++++++++++++++++++++++++++++++
drivers/net/mlx4/mlx4_rxtx.h | 35 +++++++++-
2 files changed, 184 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx4/mlx4_mr.c b/drivers/net/mlx4/mlx4_mr.c
index d23d3c613..55e5555ce 100644
--- a/drivers/net/mlx4/mlx4_mr.c
+++ b/drivers/net/mlx4/mlx4_mr.c
@@ -289,6 +289,23 @@ mr_find_next_chunk(struct mlx4_mr *mr, struct mlx4_mr_cache *entry,
uintptr_t end = 0;
uint32_t idx = 0;
+ /* MR for external memory doesn't have memseg list. */
+ if (mr->msl == NULL) {
+ struct ibv_mr *ibv_mr = mr->ibv_mr;
+
+ assert(mr->ms_bmp_n == 1);
+ assert(mr->ms_n == 1);
+ assert(base_idx == 0);
+ /*
+ * Can't search it from memseg list but get it directly from
+ * verbs MR as there's only one chunk.
+ */
+ entry->start = (uintptr_t)ibv_mr->addr;
+ entry->end = (uintptr_t)ibv_mr->addr + mr->ibv_mr->length;
+ entry->lkey = rte_cpu_to_be_32(mr->ibv_mr->lkey);
+ /* Returning 1 ends iteration. */
+ return 1;
+ }
for (idx = base_idx; idx < mr->ms_bmp_n; ++idx) {
if (rte_bitmap_get(mr->ms_bmp, idx)) {
const struct rte_memseg_list *msl;
@@ -809,6 +826,7 @@ mlx4_mr_mem_event_free_cb(struct rte_eth_dev *dev, const void *addr, size_t len)
mr = mr_lookup_dev_list(dev, &entry, start);
if (mr == NULL)
continue;
+ assert(mr->msl); /* Can't be external memory. */
ms = rte_mem_virt2memseg((void *)start, msl);
assert(ms != NULL);
assert(msl->page_sz == ms->hugepage_sz);
@@ -1055,6 +1073,134 @@ mlx4_mr_flush_local_cache(struct mlx4_mr_ctrl *mr_ctrl)
(void *)mr_ctrl, mr_ctrl->cur_gen);
}
+/**
+ * Called during rte_mempool_mem_iter() by mlx4_mr_update_ext_mp().
+ *
+ * Externally allocated chunk is registered and a MR is created for the chunk.
+ * The MR object is added to the global list. If memseg list of a MR object
+ * (mr->msl) is null, the MR object can be regarded as externally allocated
+ * memory.
+ *
+ * Once external memory is registered, it should be static. If the memory is
+ * freed and the virtual address range has different physical memory mapped
+ * again, it may cause crash on device due to the wrong translation entry. PMD
+ * can't track the free event of the external memory for now.
+ */
+static void
+mlx4_mr_update_ext_mp_cb(struct rte_mempool *mp, void *opaque,
+ struct rte_mempool_memhdr *memhdr,
+ unsigned mem_idx __rte_unused)
+{
+ struct mr_update_mp_data *data = opaque;
+ struct rte_eth_dev *dev = data->dev;
+ struct priv *priv = dev->data->dev_private;
+ struct mlx4_mr_ctrl *mr_ctrl = data->mr_ctrl;
+ struct mlx4_mr *mr = NULL;
+ uintptr_t addr = (uintptr_t)memhdr->addr;
+ size_t len = memhdr->len;
+ struct mlx4_mr_cache entry;
+ uint32_t lkey;
+
+ /* If already registered, it should return. */
+ rte_rwlock_read_lock(&priv->mr.rwlock);
+ lkey = mr_lookup_dev(dev, &entry, addr);
+ rte_rwlock_read_unlock(&priv->mr.rwlock);
+ if (lkey != UINT32_MAX)
+ return;
+ mr = rte_zmalloc_socket(NULL,
+ RTE_ALIGN_CEIL(sizeof(*mr),
+ RTE_CACHE_LINE_SIZE),
+ RTE_CACHE_LINE_SIZE, mp->socket_id);
+ if (mr == NULL) {
+ WARN("port %u unable to allocate memory for a new MR of"
+ " mempool (%s).",
+ dev->data->port_id, mp->name);
+ data->ret = -1;
+ return;
+ }
+ DEBUG("port %u register MR for chunk #%d of mempool (%s)",
+ dev->data->port_id, mem_idx, mp->name);
+ mr->ibv_mr = mlx4_glue->reg_mr(priv->pd, (void *)addr, len,
+ IBV_ACCESS_LOCAL_WRITE);
+ if (mr->ibv_mr == NULL) {
+ WARN("port %u fail to create a verbs MR for address (%p)",
+ dev->data->port_id, (void *)addr);
+ rte_free(mr);
+ data->ret = -1;
+ return;
+ }
+ mr->msl = NULL; /* Mark it is external memory. */
+ mr->ms_bmp = NULL;
+ mr->ms_n = 1;
+ mr->ms_bmp_n = 1;
+ rte_rwlock_write_lock(&priv->mr.rwlock);
+ LIST_INSERT_HEAD(&priv->mr.mr_list, mr, mr);
+ DEBUG("port %u MR CREATED (%p) for external memory %p:\n"
+ " [0x%" PRIxPTR ", 0x%" PRIxPTR "),"
+ " lkey=0x%x base_idx=%u ms_n=%u, ms_bmp_n=%u",
+ dev->data->port_id, (void *)mr, (void *)addr,
+ addr, addr + len, rte_cpu_to_be_32(mr->ibv_mr->lkey),
+ mr->ms_base_idx, mr->ms_n, mr->ms_bmp_n);
+ /* Insert to the global cache table. */
+ mr_insert_dev_cache(dev, mr);
+ rte_rwlock_write_unlock(&priv->mr.rwlock);
+ /* Insert to the local cache table */
+ mlx4_mr_addr2mr_bh(dev, mr_ctrl, addr);
+}
+
+/**
+ * Register MR for entire memory chunks in a Mempool having externally allocated
+ * memory and fill in local cache.
+ *
+ * @param dev
+ * Pointer to Ethernet device.
+ * @param mr_ctrl
+ * Pointer to per-queue MR control structure.
+ * @param mp
+ * Pointer to registering Mempool.
+ *
+ * @return
+ * 0 on success, -1 on failure.
+ */
+static uint32_t
+mlx4_mr_update_ext_mp(struct rte_eth_dev *dev, struct mlx4_mr_ctrl *mr_ctrl,
+ struct rte_mempool *mp)
+{
+ struct mr_update_mp_data data = {
+ .dev = dev,
+ .mr_ctrl = mr_ctrl,
+ .ret = 0,
+ };
+
+ rte_mempool_mem_iter(mp, mlx4_mr_update_ext_mp_cb, &data);
+ return data.ret;
+}
+
+/**
+ * Register MR entire memory chunks in a Mempool having externally allocated
+ * memory and search LKey of the address to return.
+ *
+ * @param dev
+ * Pointer to Ethernet device.
+ * @param addr
+ * Search key.
+ * @param mp
+ * Pointer to registering Mempool where addr belongs.
+ *
+ * @return
+ * LKey for address on success, UINT32_MAX on failure.
+ */
+uint32_t
+mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t addr,
+ struct rte_mempool *mp)
+{
+ struct mlx4_mr_ctrl *mr_ctrl = &txq->mr_ctrl;
+ struct priv *priv = txq->priv;
+
+ mlx4_mr_update_ext_mp(priv->dev, mr_ctrl, mp);
+ return mlx4_tx_addr2mr_bh(txq, addr);
+}
+
/* Called during rte_mempool_mem_iter() by mlx4_mr_update_mp(). */
static void
mlx4_mr_update_mp_cb(struct rte_mempool *mp __rte_unused, void *opaque,
@@ -1098,6 +1244,10 @@ mlx4_mr_update_mp(struct rte_eth_dev *dev, struct mlx4_mr_ctrl *mr_ctrl,
};
rte_mempool_mem_iter(mp, mlx4_mr_update_mp_cb, &data);
+ if (data.ret < 0 && rte_errno == ENXIO) {
+ /* Mempool may have externally allocated memory. */
+ return mlx4_mr_update_ext_mp(dev, mr_ctrl, mp);
+ }
return data.ret;
}
diff --git a/drivers/net/mlx4/mlx4_rxtx.h b/drivers/net/mlx4/mlx4_rxtx.h
index ffa8abfca..1be060cda 100644
--- a/drivers/net/mlx4/mlx4_rxtx.h
+++ b/drivers/net/mlx4/mlx4_rxtx.h
@@ -163,6 +163,26 @@ void mlx4_tx_queue_release(void *dpdk_txq);
void mlx4_mr_flush_local_cache(struct mlx4_mr_ctrl *mr_ctrl);
uint32_t mlx4_rx_addr2mr_bh(struct rxq *rxq, uintptr_t addr);
uint32_t mlx4_tx_addr2mr_bh(struct txq *txq, uintptr_t addr);
+uint32_t mlx4_tx_update_ext_mp(struct txq *txq, uintptr_t addr,
+ struct rte_mempool *mp);
+
+/**
+ * Get Memory Pool (MP) from mbuf. If mbuf is indirect, the pool from which the
+ * cloned mbuf is allocated is returned instead.
+ *
+ * @param buf
+ * Pointer to mbuf.
+ *
+ * @return
+ * Memory pool where data is located for given mbuf.
+ */
+static struct rte_mempool *
+mlx4_mb2mp(struct rte_mbuf *buf)
+{
+ if (unlikely(RTE_MBUF_INDIRECT(buf)))
+ return rte_mbuf_from_indirect(buf)->pool;
+ return buf->pool;
+}
/**
* Query LKey from a packet buffer for Rx. No need to flush local caches for Rx
@@ -222,6 +242,19 @@ mlx4_tx_addr2mr(struct txq *txq, uintptr_t addr)
return mlx4_tx_addr2mr_bh(txq, addr);
}
-#define mlx4_tx_mb2mr(rxq, mb) mlx4_tx_addr2mr(rxq, (uintptr_t)((mb)->buf_addr))
+static __rte_always_inline uint32_t
+mlx4_tx_mb2mr(struct txq *txq, struct rte_mbuf *mb)
+{
+ uintptr_t addr = (uintptr_t)mb->buf_addr;
+ uint32_t lkey = mlx4_tx_addr2mr(txq, addr);
+
+ if (likely(lkey != UINT32_MAX))
+ return lkey;
+ if (rte_errno == ENXIO) {
+ /* Mempool may have externally allocated memory. */
+ lkey = mlx4_tx_update_ext_mp(txq, addr, mlx4_mb2mp(mb));
+ }
+ return lkey;
+}
#endif /* MLX4_RXTX_H_ */
--
2.15.2 (Apple Git-101.1)

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python
import os, fnmatch, subprocess
starttag = 'v18.04-rc0'
endtag = 'v18.04-rc2'
starttag = 'v18.07-rc0'
endtag = 'v18.07'
emit_md = True
apifiles = []

View File

@ -127,6 +127,8 @@ libvom_la_SOURCES = \
neighbour_cmds.cpp \
object_base.cpp \
om.cpp \
pipe.cpp \
pipe_cmds.cpp \
prefix.cpp \
ra_config.cpp \
ra_prefix.cpp \
@ -214,6 +216,7 @@ vominclude_HEADERS = \
neighbour.hpp \
object_base.hpp \
om.hpp \
pipe.hpp \
prefix.hpp \
ra_config.hpp \
ra_prefix.hpp \

View File

@ -34,9 +34,7 @@ l3_bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
template <>
@ -64,9 +62,7 @@ l3_unbind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
template <>
@ -116,9 +112,7 @@ l2_bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
template <>
@ -145,9 +139,7 @@ l2_unbind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
template <>

View File

@ -29,7 +29,7 @@ namespace binding_cmds {
* A command class that binds the ACL to the interface
*/
template <typename BIND>
class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
class bind_cmd : public rpc_cmd<HW::item<bool>, BIND>
{
public:
/**
@ -39,7 +39,7 @@ public:
const direction_t& direction,
const handle_t& itf,
const handle_t& acl)
: rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
: rpc_cmd<HW::item<bool>, BIND>(item)
, m_direction(direction)
, m_itf(itf)
, m_acl(acl)
@ -85,7 +85,7 @@ private:
* A command class that binds the ACL to the interface
*/
template <typename BIND>
class unbind_cmd : public rpc_cmd<HW::item<bool>, rc_t, BIND>
class unbind_cmd : public rpc_cmd<HW::item<bool>, BIND>
{
public:
/**
@ -95,7 +95,7 @@ public:
const direction_t& direction,
const handle_t& itf,
const handle_t& acl)
: rpc_cmd<HW::item<bool>, rc_t, BIND>(item)
: rpc_cmd<HW::item<bool>, BIND>(item)
, m_direction(direction)
, m_itf(itf)
, m_acl(acl)

View File

@ -58,9 +58,7 @@ bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -28,9 +28,8 @@ namespace acl_ethertype_cmds {
/**
* A command class that binds the ethertype list to the interface
*/
class bind_cmd : public rpc_cmd<HW::item<bool>,
rc_t,
vapi::Acl_interface_set_etype_whitelist>
class bind_cmd
: public rpc_cmd<HW::item<bool>, vapi::Acl_interface_set_etype_whitelist>
{
public:
/**
@ -69,9 +68,8 @@ private:
/**
* A command class that unbinds the ethertype list to the interface
*/
class unbind_cmd : public rpc_cmd<HW::item<bool>,
rc_t,
vapi::Acl_interface_set_etype_whitelist>
class unbind_cmd
: public rpc_cmd<HW::item<bool>, vapi::Acl_interface_set_etype_whitelist>
{
public:
/**

View File

@ -74,7 +74,8 @@ l3_update_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item = wait();
wait();
if (m_hw_item.rc() == rc_t::OK)
insert_acl();
@ -140,7 +141,8 @@ l2_update_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item = wait();
wait();
if (m_hw_item.rc() == rc_t::OK)
insert_acl();

View File

@ -29,8 +29,7 @@ namespace list_cmds {
* A command class that Create the list
*/
template <typename RULE, typename UPDATE>
class update_cmd
: public rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>
class update_cmd : public rpc_cmd<HW::item<handle_t>, UPDATE>
{
public:
typedef typename list<RULE>::rules_t cmd_rules_t;
@ -42,7 +41,7 @@ public:
update_cmd(HW::item<handle_t>& item,
const cmd_key_t& key,
const cmd_rules_t& rules)
: rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>(item)
: rpc_cmd<HW::item<handle_t>, UPDATE>(item)
, m_key(key)
, m_rules(rules)
{
@ -78,7 +77,7 @@ public:
void succeeded()
{
rpc_cmd<HW::item<handle_t>, HW::item<handle_t>, UPDATE>::succeeded();
rpc_cmd<HW::item<handle_t>, UPDATE>::succeeded();
list<RULE>::add(m_key, this->item());
}
@ -124,14 +123,14 @@ private:
* A cmd class that Deletes an ACL
*/
template <typename RULE, typename DELETE>
class delete_cmd : public rpc_cmd<HW::item<handle_t>, rc_t, DELETE>
class delete_cmd : public rpc_cmd<HW::item<handle_t>, DELETE>
{
public:
/**
* Constructor
*/
delete_cmd(HW::item<handle_t>& item)
: rpc_cmd<HW::item<handle_t>, rc_t, DELETE>(item)
: rpc_cmd<HW::item<handle_t>, DELETE>(item)
{
}

View File

@ -41,9 +41,7 @@ bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -27,7 +27,7 @@ namespace arp_proxy_binding_cmds {
* A command class that binds the LLDP config to the interface
*/
class bind_cmd
: public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
: public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_intfc_enable_disable>
{
public:
/**
@ -60,7 +60,7 @@ private:
* A cmd class that Unbinds ArpProxy Config from an interface
*/
class unbind_cmd
: public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_intfc_enable_disable>
: public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_intfc_enable_disable>
{
public:
/**

View File

@ -48,7 +48,7 @@ config_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
wait();
return (rc_t::OK);
}

View File

@ -27,7 +27,7 @@ namespace arp_proxy_config_cmds {
/**
* A command class that adds the ARP Proxy config
*/
class config_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
class config_cmd : public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_add_del>
{
public:
/**
@ -62,8 +62,7 @@ private:
/**
* A cmd class that Unconfigs ArpProxy Config from an interface
*/
class unconfig_cmd
: public rpc_cmd<HW::item<bool>, rc_t, vapi::Proxy_arp_add_del>
class unconfig_cmd : public rpc_cmd<HW::item<bool>, vapi::Proxy_arp_add_del>
{
public:
/**

View File

@ -161,7 +161,7 @@ bond_group_binding::event_handler::order() const
* We want enslaved interfaces bind to bond after interface
* but before anything else.
*/
return (dependency_t::BOND_BINDING);
return (dependency_t::VIRTUAL_INTERFACE);
}
void

View File

@ -45,9 +45,7 @@ bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -26,7 +26,7 @@ namespace bond_group_binding_cmds {
/**
* A command class that binds the slave interface to the bond interface
*/
class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bond_enslave>
class bind_cmd : public rpc_cmd<HW::item<bool>, vapi::Bond_enslave>
{
public:
/**
@ -65,7 +65,7 @@ private:
/**
* A cmd class that detach slave from a bond interface
*/
class unbind_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bond_detach_slave>
class unbind_cmd : public rpc_cmd<HW::item<bool>, vapi::Bond_detach_slave>
{
public:
/**

View File

@ -51,7 +51,8 @@ create_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item = wait();
wait();
if (m_hw_item.rc() == rc_t::OK) {
insert_interface();
}

View File

@ -49,9 +49,7 @@ create_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -27,7 +27,7 @@ namespace bridge_domain_arp_entry_cmds {
/**
* A command class that creates or updates the bridge domain ARP Entry
*/
class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
class create_cmd : public rpc_cmd<HW::item<bool>, vapi::Bd_ip_mac_add_del>
{
public:
/**
@ -62,7 +62,7 @@ private:
/**
* A cmd class that deletes a bridge domain ARP entry
*/
class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Bd_ip_mac_add_del>
class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::Bd_ip_mac_add_del>
{
public:
/**

View File

@ -55,9 +55,7 @@ create_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return (rc_t::OK);
return (wait());
}
std::string

View File

@ -28,7 +28,7 @@ namespace bridge_domain_cmds {
* A command class that creates an Bridge-Domain
*/
class create_cmd
: public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
: public rpc_cmd<HW::item<uint32_t>, vapi::Bridge_domain_add_del>
{
public:
/**
@ -77,7 +77,7 @@ private:
* A cmd class that Delete an Bridge-Domain
*/
class delete_cmd
: public rpc_cmd<HW::item<uint32_t>, rc_t, vapi::Bridge_domain_add_del>
: public rpc_cmd<HW::item<uint32_t>, vapi::Bridge_domain_add_del>
{
public:
/**

View File

@ -51,9 +51,7 @@ create_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -28,7 +28,7 @@ namespace bridge_domain_entry_cmds {
/**
* A command class that creates or updates the bridge_domain
*/
class create_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
class create_cmd : public rpc_cmd<HW::item<bool>, vapi::L2fib_add_del>
{
public:
/**
@ -65,7 +65,7 @@ private:
/**
* A cmd class that deletes a bridge_domain
*/
class delete_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::L2fib_add_del>
class delete_cmd : public rpc_cmd<HW::item<bool>, vapi::L2fib_add_del>
{
public:
/**

View File

@ -63,9 +63,7 @@ bind_cmd::issue(connection& con)
VAPI_CALL(req.execute());
m_hw_item.set(wait());
return rc_t::OK;
return (wait());
}
std::string

View File

@ -29,7 +29,7 @@ namespace dhcp_client_cmds {
/**
* A command class that binds the DHCP config to the interface
*/
class bind_cmd : public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
class bind_cmd : public rpc_cmd<HW::item<bool>, vapi::Dhcp_client_config>
{
public:
/**
@ -80,8 +80,7 @@ private:
/**
* A cmd class that Unbinds Dhcp Config from an interface
*/
class unbind_cmd
: public rpc_cmd<HW::item<bool>, rc_t, vapi::Dhcp_client_config>
class unbind_cmd : public rpc_cmd<HW::item<bool>, vapi::Dhcp_client_config>
{
public:
/**

Some files were not shown because too many files have changed in this diff Show More