Compare commits

...

35 Commits

Author SHA1 Message Date
Neale Ranns
f4f635e7c0 17.07 Release Note
Change-Id: Iffbfffac1c508b000451e9f0e0b688d80785f7f5
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-07-19 08:58:13 -07:00
Neale Ranns
f302825005 DHCP complete event sends mask length
Change-Id: I4a529dfab5d0ce6b0bbc0ccbbd89c6b109dbf917
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-07-15 15:52:01 +00:00
Eyal Bari
ed8a105ee3 L2INPUT:fix features mask cailculation
Change-Id: I84cea7530b01302a0adeef95b4924f54dc2e41ec
Signed-off-by: Eyal Bari <ebari@cisco.com>
(cherry picked from commit 8af1b2fdecc883eadfec6b91434adc6044e24cb2)
2017-07-13 12:11:44 +00:00
John Lo
bea5ebf205 Fix crash with worker threads on 4K VXLAN/BD setup (VPP-907)
Cleanup mapping of interface output node for the l2-output node
when interface is configured to L2 or L3 modes. The mapping is
now always done in the main thread as part of API/CLI processing,
instead of initiate mapping in the forwarding path which can be
in the worker threads.

Change-Id: Ia789493e7d9f5c76d68edfaf34db43f3e3f53506
Signed-off-by: John Lo <loj@cisco.com>
2017-07-13 11:42:29 +00:00
Damjan Marion
e0c6670eba memif: avoid double buffer free
Change-Id: I902f54618c4e1f649af11497c1cb10922e43755a
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-12 21:00:53 +00:00
Damjan Marion
18ee167809 memif: mask interrupts on startup if we are in the polling mode
Change-Id: Ief02eb1109a1bc463665d9747e9fa4e0c0e3d7e0
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-12 21:00:42 +00:00
Damjan Marion
50e28107bf vlib: fix issues with PCI handling code
- PCI devices not properly discovered
- vlib_pci_bus_master_enable () not working

Change-Id: I7433ab1b19b890b8900635b43037b9a2017a1921
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-12 21:00:31 +00:00
Damjan Marion
0d3b355290 dpdk: add FiftyGigabitEtherenet interface support
Change-Id: Ied8b26179cdf4add34440a9c396cb821716cfb8e
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-12 21:00:20 +00:00
Damjan Marion
331f66a5b4 vppinfra: revert clib_memcpy optimization
Looks like some compiler versions are producing wrong code when we are
copying 9-16 bytes so reverting back to the original code.

Change-Id: I74b5fa54a3b01f6288648f1cb0926030edd3b26f
Signed-off-by: Damjan Marion <damarion@cisco.com>
2017-07-12 21:20:11 +02:00
Igor Mikhailov (imichail)
02989064e4 VPP-895 multi-thread: fix vpp crash on show runtime
In multi-threaded model (e.g. 1 main and 1 worker threads),
after an ethernet interface is deleted (e.g. vhost-user interface),
'show runtime' command produces garbled output and sometimes
leads to vpp crash.

The reason is because vlib_node_rename() frees and reallocates node's
'n->name' vector, however the change is not propagated into copies
of the node on worker threads.

Change-Id: Ibf22422913b7f2df22f70f3b2fe8dafd34c1dd06
Signed-off-by: Igor Mikhailov (imichail) <imichail@cisco.com>
2017-07-11 15:35:57 +00:00
Ed Warnicke
d6a11c430b Fix vppctl error messages to handle lack off permissions
Change-Id: Ia35edcb14eb8d786065ee4ab394f4f1aa52e1625
Signed-off-by: Ed Warnicke <hagbard@gmail.com>
2017-07-11 08:03:16 +00:00
Steve Shin
cdb8514ac0 lldp packet transmission on a bonded interface
LLDP packets are dropped at interface output node if each slave's link
is configured as the LLDP interface. The admin state is configured and
managed by the bonded interface, so slave link's state is down by default.
The checking for the admin state UP should be ignored for the slave link.

Change-Id: I06ca250f42fcb8cc50e0ea3a3817a2c5b56865df
Signed-off-by: Steve Shin <jonshin@cisco.com>
(cherry picked from commit 042a621b90c9f521b546cbbf724bb908e36f3b25)
2017-07-10 21:45:54 +00:00
Alexander Kotov
e6fa2e3d5a VPP-904: fixes zero length CLI parameters parse
Change-Id: I21fbc9aff2b97a8b3f4cbed202c00b6d84557a6e
Signed-off-by: Alexander Kotov <kot@yandex.ru>
(cherry picked from commit 28160f38488743b8cee0a7bd62b432a9dd8f4bfd)
2017-07-10 17:04:35 +00:00
Chris Luke
24a97d6c27 format: Check for NaN when rendering doubles
- The result of 0.0/0.0 was being rendered as a lot of
  zeroes in the integer portion, as in this example:

  DBGvpp# show physmem
  0: 16 objects, 576k of 582k used, 3k free, 0 reclaimed, 2k overhead,
  16380k capacity
       alloc. from small object cache: 0 hits 0 attempts (0.00%) replacements 0
       alloc. from free-list: 0 attempts, 0 hits (0.00%), 0 considered (per-attempt 0.00)
       alloc. from vector-expand: 16
       allocs: 16 73643.06 clocks/call
       frees: 0 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.00 clocks/call

- Add two macros to vppinfra/math.h that use compiler builtins to check
  for NaN and Infinity and then use them in format_float().

Change-Id: Iccc03997e6e33d6b888d1e7e20cd78df0cfd02e8
Signed-off-by: Chris Luke <chrisy@flirble.org>
(cherry picked from commit bb18ee6f1c7c172d30cb0c98153499af571777ee)
2017-07-09 19:43:54 +00:00
Klement Sekera
b2a241ca40 LLDP: properly parse lldp cmds from startup config
Change-Id: I0e6c86bd923fcf7cf16f948b9869a5927e6d3745
Signed-off-by: Klement Sekera <ksekera@cisco.com>
(cherry picked from commit 3d62a7f0b9a4b967ad53f5990729acca932f90b4)
2017-07-08 20:10:23 +00:00
Steve Shin
262ca683be Add API support for LLDP config/interface set
Add API methods to configure LLDP and set interface to enable/disable.
Also add port description TLV for LLDP.

Change-Id: Ib959d488c2ab8a0069f143558871f41fcc43a5d3
Signed-off-by: Steve Shin <jonshin@cisco.com>
(cherry picked from commit 99a0e60eb6f6acd7eabd5a4cb7ded1e0419ccd54)
2017-07-08 12:34:04 +00:00
Jan Gelety
6922bd37be Update CSIT tests 170622 -> 170706
- update of CSIT operational branch to be used for VPP-patch test

Change-Id: I6bd86ea60f323b524f2de1a2236f1af48184a99f
Signed-off-by: Jan Gelety <jgelety@cisco.com>
2017-07-07 10:25:03 +02:00
John Lo
dc30c6d3d6 Send GARP/NA on bonded intf slave up/down if in active-backup mode
If a bonded interface is in active-backup mode and configured with
IPv4 and/or IPv6 addresses, on slave interface link up/down, send
a GARP packet if configured with an IPv4 address and an unsolcited
NA if configured with an IPv6 address. These packets can help with
faster route convergence in the next hop router/switch.

Change-Id: I68ccb11a4a40cda414704fa08ee0171c952befa2
Signed-off-by: John Lo <loj@cisco.com>
(cherry picked from commit 8b81cb43359380e50d3fc216d93ff05894149939)
2017-07-06 18:06:06 +00:00
Ole Troan
0786710856 VPP-902: LISP-CP: Wrong size in one_l2_arp_entries_get message.
Change-Id: I56bf6b46527f9465d78ed7c08b6e216e50c135ec
Signed-off-by: Ole Troan <ot@cisco.com>
2017-07-06 17:01:09 +00:00
Ed Warnicke
6a98580c70 Remove autosudo from pythonic vppctl
Change-Id: Iaea91a95d58678b8b3c56f3fceab76817e0f63ff
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2017-07-06 07:43:17 -07:00
Chris Luke
6c645ed01c Buffer name inconsistently used a cstring/vec (VPP-901)
Spotted in the output of CLI command "show buffers", the name field
sometimes had trailing garbage, the hall sign of a string not being
terminated. In this case it was being inconsistently used as a cstring
or a vec.

- CLI printf needs %v to print the vec srring
- vlib_buffer_create_free_list_helper tried to use
  clib_mem_is_heap_object() to detect a vec object, wheras it should
  use clib_mem_is_vec()

Change-Id: Ib8b242a0c5a18924b8af7e8e1432784eebcf572c
Signed-off-by: Chris Luke <chrisy@flirble.org>
2017-07-05 13:15:03 -04:00
Billy McFall
01d2b4b13a VPP-900: VPP is released under the Apache 2.0 License (ASL 2.0). Update RPM specfile to reflect the proper license.
Change-Id: I9e8d1643ea65afd91a0cd5ad9545248575e32617
Signed-off-by: Billy McFall <bmcfall@redhat.com>
2017-07-05 09:49:59 -04:00
Klement Sekera
c156dda8cb Refactor API message handling code
This is preparation for new C API. Moving common stuff to separate
headers reduces dependency issues.

Change-Id: Ie7adb23398de72448e5eba6c1c1da4e1bc678725
Signed-off-by: Klement Sekera <ksekera@cisco.com>
(cherry picked from commit 58eb866b15a45514dc356170f28640d6c9db8034)
2017-07-04 07:31:48 +00:00
Andrew Yourtchenko
be055bd719 acl-plugin: fix acl plugin test failing sporadically (VPP-898)
The "acl_plugin" tests has one of the tests sporadically fail with the following traceback:

r.reply.decode().rstrip('\x00') UnicodeDecodeError: 'ascii' codec can't decode byte
0xd8 in position 20666: ordinal not in range(128)

This occurs in the newly added "show acl-plugin table" debug CLI.
This CLI has only the numeric outputs, so the conclusion is that it is
the incorrect termination (trailing zero) that might be most probably
causing it. The other acl-plugins show commands also
lack the zero-termination termination, so fix all of them.
The particularity of this command vs. the other acl-plugin debug CLIs
is that the accumulator is freed and allocated multiple times,
this might explain the issue is not seen with them.

Change-Id: I87b5c0d6152fbebcae9c7d0ce97155c1ae6666db
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-07-04 07:30:26 +00:00
Matus Fabian
860af5ad2b SNAT: fix failing test_session_limit_per_user (VPP-896)
Change-Id: Idf46a03803125babd9bb880363686359fbcca27d
Signed-off-by: Matus Fabian <matfabia@cisco.com>
2017-07-03 17:23:41 +00:00
Andrew Yourtchenko
204cf74aed acl-plugin: VPP-897: applying of large number of ACEs is slow
When applying ACEs, in the new hash-based scheme, for each ACE
the lookup in the hash table is done, and either that ACE is added
to the end of the existing list if there is a match,
or a new list is created if there is no match.

Usually ACEs do not overlap, so this operation is fast, however,
the fragment-permit entries in case of a large number of ACLs
create a huge list which needs to be traversed for every other
ACE being added, slowing down the process dramatically.

The solution is to add an explicit flag to denote the first
element of the chain, and use the "prev" index of that
element to point to the tail element. The "next" field
of the last element is still ~0 and if we touch that
one, we do the linear search to find the first one,
but that is a relatively infrequent operation.

Change-Id: I352a3becd7854cf39aae65f0950afad7d18a70aa
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-07-03 12:52:04 +02:00
Steven
bafa4d0484 devices: show interface rx-placement displays the wrong information (VPP-894)
show interface rx-placement somtimes displays the wrong interface names.
This happens when there exists subinterfaces in VPP.

The problem is due to the function show_interface_rx_placement_fn is calling
format_vnet_sw_if_index_name with hw_if_index instead of sw_if_index.

VPP has the concept of sw_if_index and hw_if_index. Each serves a different
purpose. When there is no subinterfaces, both hw_if_index and sw_if_index
may happen to have the same value.But don't count on it. When the API calls
for sw_if_index, we must pass the sw_if_index although the hw_if_index has
the same type which the compiler does not catch. Passing hw_if_index for an
API which requires sw_if_index may have an unpredictable result such as
described in the VPP-894 and sometimes it may even crash if the particular
index does not exist.

Change-Id: I76c4834f79b88a1c20684fcba64f14b2da142d77
Signed-off-by: Steven <sluong@cisco.com>
2017-07-01 07:02:08 +00:00
Dave Barach
85e5b8da28 VPP-893: handle multiple simultaneous event registrations
Change-Id: I8cd90820624987dbef848935e2de86fa66a86c17
Signed-off-by: Dave Barach <dave@barachs.net>
2017-06-30 09:12:43 -04:00
Pavel Kotucek
f45bc738aa IP4/IP6 FIB: fix crash during interface delete
after deleting a sub interface with IP4/IP6 address vpp crash

Change-Id: Ie768ca845b9e2394f61e2a8e9722a80a788746e7
Signed-off-by: Pavel Kotucek <pkotucek@cisco.com>
(cherry picked from commit 9f5a2b6310ce5c8e59c32ca6f27d8a187b0e4346)
2017-06-30 11:29:44 +00:00
Neale Ranns
c02bd03ddf VPP debug image with worker threads hit assert on adding IP route with traffic (VPP-892)
When stacking DPOs the VLIB graph is also updated to add the edge between the nodes, if this edge does not yet exist. This addition should be done with the workers stopped.

Change-Id: I327e4d7d26f0b23eb280f17e4619ff2093ff7940
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-06-29 00:19:13 -07:00
Eyal Bari
25ff2ea3a3 L2-LEARN:fix l2fib entry seq num not updated on hit (VPP-888)
fixed instability in l2bd_multi_instnce test - sometimes failing with extra
packets captured

it appears l2-learn was not updating hit entries but rather a copy of them.

if the ager did not have a chance to run before the test was running the
learning cycle - entries were not updated with the packet's seq num - causing
packets to flood when hitting the stale seq_num in l2-fwd - hence the extra
packets

fixed handling of filter entries

revert workaround for instability in test

Change-Id: I16d918e6310a5bf40bad5b7335b2140c2867cb71
Signed-off-by: Eyal Bari <ebari@cisco.com>
2017-06-27 12:41:56 +00:00
Ole Troan
e2547ab574 VPP-889: MAP Stats API/CLI crashes when no domains.
Change-Id: Ib7824bfc08cb3c8f20258379e1a1f2c159c4f687
Signed-off-by: Ole Troan <ot@cisco.com>
2017-06-26 17:53:10 +00:00
Hongjun Ni
272351a2d4 Add Maintainers for Vxlan-gpe feature
Change-Id: I3f42e9bbd816a6e2192cc65eeb10a4681cf9e29a
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
(cherry picked from commit fcfa38d68007418d9460533d248adf34aca88ec1)
2017-06-25 17:40:10 +00:00
Hongjun Ni
4857f00a5f VPP crash on creating vxlan gpe interface. VPP-875
Change-Id: I6b19634ecb03860a7624d9408e09b52e95f47aef
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
(cherry picked from commit 04ffd0ad83b2d87edb669a9d76eee85f5c589564)
2017-06-25 08:52:10 +00:00
Neale Ranns
ea89b8cf66 17.07 change default branch in gitreview
Change-Id: I7d0a27c4d103dd11561ac7ae4d59592ba77ab899
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-06-22 12:04:27 -07:00
83 changed files with 1879 additions and 921 deletions

View File

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

View File

@ -112,6 +112,11 @@ VNET VXLAN
M: John Lo <loj@cisco.com>
F: src/vnet/vxlan/
VNET VXLAN-GPE
M: Keith Burns <alagalah@gmail.com>
M: Hongjun Ni <hongjun.ni@intel.com>
F: src/vnet/vxlan-gpe/
Plugin - flowprobe
M: Ole Troan <otroan@employees.org>
F: src/plugins/flowprobe/
@ -123,9 +128,9 @@ F: src/plugins/sixrd/
F: src/plugins/sixrd.am
Plugin - GTPU
M: Hongjun Ni <hongjun.ni@intel.com>
F: src/plugins/gtpu/
F: src/plugins/gtpu.am
M: Hongjun Ni <hongjun.ni@intel.com>
F: src/plugins/gtpu/
F: src/plugins/gtpu.am
Test Infrastructure
M: Klement Sekera <ksekera@cisco.com>

View File

@ -1,11 +1,75 @@
# Release Notes {#release_notes}
* @subpage release_notes_1707
* @subpage release_notes_1704
* @subpage release_notes_17011
* @subpage release_notes_1701
* @subpage release_notes_1609
* @subpage release_notes_1606
@page release_notes_1707 Release notes for VPP 17.07
More than 400 commits since the 1704 release.
## Features
- Infrastructure
- make test; improved debuggability.
- TAB auto-completion on the CLI
- DPDK 17.05
- python 3 support in test infra
- Host stack
- Improved Linux TCP stack compatibility using IWL test suite (https://jira.fd.io/browse/VPP-720)
- Improved loss recovery (RFC5681, RFC6582, RF6675)
- Basic implementation of Eifel detection algorithm (RFC3522)
- Basic support for buffer chains
- Refactored session layer API
- Overall performance, scale and hardening
- Interfaces
- memif: IP mode, jumbo frames, multi queue
- virtio-user support
- vhost-usr; adaptive (poll/interupt) support.
- Network features
- MPLS Multicast FIB
- BFD FIB integration
- NAT64 support
- GRE over IPv6
- Segement routing MPLS
- IOAM configuration for SRv6 localsid
- LISP
- NSH support
- native forward static routes
- L2 ARP
- ACL multi-core suuport
- Flowprobe:
- Add flowstartns, flowendns and tcpcontrolbits
- Stateful flows and IPv6, L4 recording
- GTP-U support
- VXLAN GPE support for FIB2.0 and bypass.
## Known issues
For the full list of issues please reffer to fd.io [JIRA](https://jira.fd.io).
## Issues fixed
For the full list of fixed issues please reffer to:
- fd.io [JIRA](https://jira.fd.io)
- git [commit log](https://git.fd.io/vpp/log/?h=stable/1707)
@page release_notes_1704 Release notes for VPP 17.04
More than 500 commits since the 1701 release.

View File

@ -1,2 +1,2 @@
#!/bin/sh
echo oper-170622
echo oper-rls1707-170706

View File

@ -24,7 +24,7 @@
Name: vpp
Summary: Vector Packet Processing
License: MIT
License: ASL 2.0
Version: %{_version}
Release: %{_release}
Requires: vpp-lib = %{_version}-%{_release}, net-tools, pciutils, python

View File

@ -1974,6 +1974,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
#define _(cnt, desc) out0 = format(out0, " %20lu: %s\n", am->cnt, desc);
foreach_fa_cleaner_counter;
#undef _
vec_terminate_c_string(out0);
vlib_cli_output(vm, "\n\n%s\n\n", out0);
vlib_cli_output(vm, "Sessions per interval: min %lu max %lu increment: %f ms current: %f ms",
am->fa_min_deleted_sessions_per_interval, am->fa_max_deleted_sessions_per_interval,
@ -2011,6 +2012,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
}
}
vec_terminate_c_string(out0);
vlib_cli_output(vm, "\n%s\n", out0);
vec_free(out0);
}
@ -2067,6 +2069,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
out0 = format(out0, "\n");
}
}
vec_terminate_c_string(out0);
vlib_cli_output(vm, "\n%s\n", out0);
vec_free(out0);
}
@ -2138,6 +2141,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
pa->src_portrange_not_powerof2, pa->dst_portrange_not_powerof2);
}
}
vec_terminate_c_string(out0);
vlib_cli_output(vm, "\n%s\n", out0);
vec_free(out0);
}
@ -2184,6 +2188,7 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
}
}
vec_terminate_c_string(out0);
vlib_cli_output(vm, "\n%s\n", out0);
vec_free(out0);
}

View File

@ -216,26 +216,26 @@ activate_applied_ace_hash_entry(acl_main_t *am,
int res = BV (clib_bihash_search) (&am->acl_lookup_hash, &kv, &result);
if (res == 0) {
/* There already exists an entry or more. Append at the end. */
u32 existing_index = result_val->applied_entry_index;
u32 first_index = result_val->applied_entry_index;
DBG("A key already exists, with applied entry index: %d", existing_index);
ASSERT(existing_index != ~0);
applied_hash_ace_entry_t *existing_pae = &((*applied_hash_aces)[existing_index]);
/* walk the list to the last element */
while (existing_pae->next_applied_entry_index != ~0) {
if (existing_index == existing_pae->next_applied_entry_index) {
DBG("existing and next index of entry %d are the same, abort", existing_index);
ASSERT(existing_index != existing_pae->next_applied_entry_index);
}
existing_index = existing_pae->next_applied_entry_index;
existing_pae = &((*applied_hash_aces)[existing_index]);
DBG("...advance to chained entry index: %d", existing_index);
}
ASSERT(first_index != ~0);
applied_hash_ace_entry_t *first_pae = &((*applied_hash_aces)[first_index]);
/* move to "prev" by one, this should land us in the end of the list */
u32 last_index = first_pae->prev_applied_entry_index;
ASSERT(last_index != ~0);
applied_hash_ace_entry_t *last_pae = &((*applied_hash_aces)[last_index]);
ASSERT(last_pae->next_applied_entry_index == ~0);
/* link ourseves in */
existing_pae->next_applied_entry_index = new_index;
pae->prev_applied_entry_index = existing_index;
last_pae->next_applied_entry_index = new_index;
pae->prev_applied_entry_index = last_index;
/* make a new reference from the very first element to new tail */
first_pae->prev_applied_entry_index = new_index;
} else {
/* It's the very first entry */
hashtable_add_del(am, &kv, 1);
pae->is_first_entry = 1;
/* we are the tail */
pae->prev_applied_entry_index = new_index;
}
}
@ -306,6 +306,7 @@ hash_acl_apply(acl_main_t *am, u32 sw_if_index, u8 is_input, int acl_index)
for(i=0; i < vec_len(ha->rules); i++) {
u32 new_index = base_offset + i;
applied_hash_ace_entry_t *pae = &((*applied_hash_aces)[new_index]);
pae->is_first_entry = 0;
pae->acl_index = acl_index;
pae->ace_index = ha->rules[i].ace_index;
pae->action = ha->rules[i].action;
@ -324,14 +325,13 @@ move_applied_ace_hash_entry(acl_main_t *am,
applied_hash_ace_entry_t **applied_hash_aces,
u32 old_index, u32 new_index)
{
/* move the entry */
(*applied_hash_aces)[new_index] = (*applied_hash_aces)[old_index];
/* update the linkage and hash table if necessary */
applied_hash_ace_entry_t *pae = &((*applied_hash_aces)[old_index]);
if (pae->prev_applied_entry_index != ~0) {
if (!pae->is_first_entry) {
applied_hash_ace_entry_t *prev_pae = &((*applied_hash_aces)[pae->prev_applied_entry_index]);
ASSERT(prev_pae->next_applied_entry_index == old_index);
prev_pae->next_applied_entry_index = new_index;
@ -344,6 +344,20 @@ move_applied_ace_hash_entry(acl_main_t *am,
applied_hash_ace_entry_t *next_pae = &((*applied_hash_aces)[pae->next_applied_entry_index]);
ASSERT(next_pae->prev_applied_entry_index == old_index);
next_pae->prev_applied_entry_index = new_index;
} else {
/*
* Moving the very last entry, so we need to update the tail pointer in the first one.
* find back the first entry. Inefficient so might need to be a bit cleverer
* if this proves to be a problem..
*/
u32 an_index = pae->prev_applied_entry_index;
applied_hash_ace_entry_t *head_pae = &((*applied_hash_aces)[pae->prev_applied_entry_index]);
while(!head_pae->is_first_entry) {
an_index = head_pae->prev_applied_entry_index;
head_pae = &((*applied_hash_aces)[an_index]);
}
ASSERT(head_pae->prev_applied_entry_index == old_index);
head_pae->prev_applied_entry_index = new_index;
}
/* invalidate the old entry */
pae->prev_applied_entry_index = ~0;
@ -364,13 +378,20 @@ deactivate_applied_ace_hash_entry(acl_main_t *am,
next_pae->prev_applied_entry_index = pae->prev_applied_entry_index;
}
if (pae->prev_applied_entry_index != ~0) {
if (!pae->is_first_entry) {
applied_hash_ace_entry_t *prev_pae = &((*applied_hash_aces)[pae->prev_applied_entry_index]);
ASSERT(prev_pae->next_applied_entry_index == old_index);
prev_pae->next_applied_entry_index = pae->next_applied_entry_index;
} else {
/* It was the first entry. We need either to reset the hash entry or delete it */
pae->is_first_entry = 0;
if (pae->next_applied_entry_index != ~0) {
/* a custom case of relinking for the first node, with the tail not forward linked to it */
applied_hash_ace_entry_t *next_pae = &((*applied_hash_aces)[pae->next_applied_entry_index]);
/* this is the tail the new head should be aware of */
next_pae->prev_applied_entry_index = pae->prev_applied_entry_index;
next_pae->is_first_entry = 1;
add_del_hashtable_entry(am, sw_if_index, is_input,
applied_hash_aces, pae->next_applied_entry_index, 1);
} else {

View File

@ -53,10 +53,14 @@ typedef struct {
*/
u32 next_applied_entry_index;
/*
* previous entry in the list of the chained ones,
* if ~0 then this is entry in the hash.
* previous entry in the ring list of the chained ones.
*/
u32 prev_applied_entry_index;
/*
* 1 if it is the very first entry in the list,
* referenced from the hash.
*/
u8 is_first_entry;
/*
* Action of this applied ACE
*/

View File

@ -12,13 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
#include <vlib/unix/cj.h>
#include <assert.h>
#include <vnet/ip/ip.h>
#include <vnet/ethernet/ethernet.h>
#include <vnet/ethernet/arp_packet.h>
#include <dpdk/device/dpdk.h>
#include <dpdk/device/dpdk_priv.h>
@ -178,6 +181,65 @@ dpdk_device_stop (dpdk_device_t * xd)
}
}
void
dpdk_port_state_callback (uint8_t port_id,
enum rte_eth_event_type type, void *param)
{
struct rte_eth_link link;
vlib_main_t *vm = vlib_get_main ();
dpdk_device_t *xd = &dpdk_main.devices[port_id];
RTE_SET_USED (param);
if (type != RTE_ETH_EVENT_INTR_LSC)
{
clib_warning ("Unknown event %d received for port %d", type, port_id);
return;
}
rte_eth_link_get_nowait (port_id, &link);
u8 link_up = link.link_status;
if (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE)
{
u8 bd_port = xd->bond_port;
int bd_mode = rte_eth_bond_mode_get (bd_port);
if ((link_up && !(xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE_UP)) ||
(!link_up && (xd->flags & DPDK_DEVICE_FLAG_BOND_SLAVE_UP)))
{
clib_warning ("Port %d state to %s, "
"slave of port %d BondEthernet%d in mode %d",
port_id, (link_up) ? "UP" : "DOWN",
bd_port, xd->port_id, bd_mode);
if (bd_mode == BONDING_MODE_ACTIVE_BACKUP)
{
rte_eth_link_get_nowait (bd_port, &link);
if (link.link_status) /* bonded interface up */
{
u32 hw_if_index = dpdk_main.devices[bd_port].hw_if_index;
vlib_process_signal_event
(vm, send_garp_na_process_node_index, SEND_GARP_NA,
hw_if_index);
}
}
}
if (link_up) /* Update slave link status */
xd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
else
xd->flags &= ~DPDK_DEVICE_FLAG_BOND_SLAVE_UP;
}
else /* Should not happen as callback not setup for "normal" links */
{
if (link_up)
clib_warning ("Port %d Link Up - speed %u Mbps - %s",
port_id, (unsigned) link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
"full-duplex" : "half-duplex");
else
clib_warning ("Port %d Link Down\n\n", port_id);
}
}
/*
* fd.io coding-style-patch-verification: ON
*

View File

@ -92,6 +92,7 @@ typedef enum
VNET_DPDK_PORT_TYPE_ETH_10G,
VNET_DPDK_PORT_TYPE_ETH_25G,
VNET_DPDK_PORT_TYPE_ETH_40G,
VNET_DPDK_PORT_TYPE_ETH_50G,
VNET_DPDK_PORT_TYPE_ETH_100G,
VNET_DPDK_PORT_TYPE_ETH_BOND,
VNET_DPDK_PORT_TYPE_ETH_SWITCH,
@ -173,6 +174,8 @@ typedef struct
#define DPDK_DEVICE_FLAG_MAYBE_MULTISEG (1 << 4)
#define DPDK_DEVICE_FLAG_HAVE_SUBIF (1 << 5)
#define DPDK_DEVICE_FLAG_HQOS (1 << 6)
#define DPDK_DEVICE_FLAG_BOND_SLAVE (1 << 7)
#define DPDK_DEVICE_FLAG_BOND_SLAVE_UP (1 << 8)
u16 nb_tx_desc;
CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
@ -197,6 +200,10 @@ typedef struct
/* af_packet or BondEthernet instance number */
u8 port_id;
/* Bonded interface port# of a slave -
only valid if DPDK_DEVICE_FLAG_BOND_SLAVE bit is set */
u8 bond_port;
struct rte_eth_link link;
f64 time_last_link_update;
@ -408,6 +415,8 @@ typedef struct
void dpdk_device_setup (dpdk_device_t * xd);
void dpdk_device_start (dpdk_device_t * xd);
void dpdk_device_stop (dpdk_device_t * xd);
void dpdk_port_state_callback (uint8_t port_id,
enum rte_eth_event_type type, void *param);
#define foreach_dpdk_error \
_(NONE, "no error") \

View File

@ -186,6 +186,10 @@ format_dpdk_device_name (u8 * s, va_list * args)
device_name = "FortyGigabitEthernet";
break;
case VNET_DPDK_PORT_TYPE_ETH_50G:
device_name = "FiftyGigabitEthernet";
break;
case VNET_DPDK_PORT_TYPE_ETH_100G:
device_name = "HundredGigabitEthernet";
break;

View File

@ -61,6 +61,8 @@ port_type_from_speed_capa (struct rte_eth_dev_info *dev_info)
if (dev_info->speed_capa & ETH_LINK_SPEED_100G)
return VNET_DPDK_PORT_TYPE_ETH_100G;
else if (dev_info->speed_capa & ETH_LINK_SPEED_50G)
return VNET_DPDK_PORT_TYPE_ETH_50G;
else if (dev_info->speed_capa & ETH_LINK_SPEED_40G)
return VNET_DPDK_PORT_TYPE_ETH_40G;
else if (dev_info->speed_capa & ETH_LINK_SPEED_25G)
@ -1270,9 +1272,9 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now)
ed->new_link_state = (u8) xd->link.link_status;
}
if ((xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP) &&
((xd->link.link_status != 0) ^
vnet_hw_interface_is_link_up (vnm, xd->hw_if_index)))
if ((xd->flags & (DPDK_DEVICE_FLAG_ADMIN_UP | DPDK_DEVICE_FLAG_BOND_SLAVE))
&& ((xd->link.link_status != 0) ^
vnet_hw_interface_is_link_up (vnm, xd->hw_if_index)))
{
hw_flags_chg = 1;
hw_flags |= (xd->link.link_status ? VNET_HW_INTERFACE_FLAG_LINK_UP : 0);
@ -1373,8 +1375,10 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
/*
* Extra set up for bond interfaces:
* 1. Setup MACs for bond interfaces and their slave links which was set
* in dpdk_device_setup() but needs to be done again here to take effect.
* 2. Set up info for bond interface related CLI support.
* in dpdk_device_setup() but needs to be done again here to take
* effect.
* 2. Set up info and register slave link state change callback handling.
* 3. Set up info for bond interface related CLI support.
*/
int nports = rte_eth_dev_count ();
if (nports > 0)
@ -1399,7 +1403,8 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
(slink[0], (struct ether_addr *) addr);
/* Set MAC of bounded interface to that of 1st slave link */
clib_warning ("Set MAC for bond dev# %d", i);
clib_warning ("Set MAC for bond port %d BondEthernet%d",
i, xd->port_id);
rv = rte_eth_bond_mac_address_set
(i, (struct ether_addr *) addr);
if (rv)
@ -1428,34 +1433,38 @@ dpdk_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
/* Add MAC to all slave links except the first one */
if (nlink)
{
clib_warning ("Add MAC for slave dev# %d", slave);
clib_warning ("Add MAC for slave port %d", slave);
rv = rte_eth_dev_mac_addr_add
(slave, (struct ether_addr *) addr, 0);
if (rv)
clib_warning ("Add MAC addr failure rv=%d", rv);
}
/* Setup slave link state change callback handling */
rte_eth_dev_callback_register
(slave, RTE_ETH_EVENT_INTR_LSC,
dpdk_port_state_callback, NULL);
dpdk_device_t *sxd = &dm->devices[slave];
sxd->flags |= DPDK_DEVICE_FLAG_BOND_SLAVE;
sxd->bond_port = i;
/* Set slaves bitmap for bonded interface */
bhi->bond_info = clib_bitmap_set
(bhi->bond_info, sdev->hw_if_index, 1);
/* Set slave link flags on slave interface */
/* Set MACs and slave link flags on slave interface */
shi = vnet_get_hw_interface (vnm, sdev->hw_if_index);
ssi = vnet_get_sw_interface
(vnm, sdev->vlib_sw_if_index);
sei = pool_elt_at_index
(em->interfaces, shi->hw_instance);
shi->bond_info = VNET_HW_INTERFACE_BOND_INFO_SLAVE;
ssi->flags |= VNET_SW_INTERFACE_FLAG_BOND_SLAVE;
clib_memcpy (shi->hw_address, addr, 6);
clib_memcpy (sei->address, addr, 6);
/* Set l3 packet size allowed as the lowest of slave */
if (bhi->max_l3_packet_bytes[VLIB_RX] >
shi->max_l3_packet_bytes[VLIB_RX])
bhi->max_l3_packet_bytes[VLIB_RX] =
bhi->max_l3_packet_bytes[VLIB_TX] =
shi->max_l3_packet_bytes[VLIB_RX];
/* Set max packet size allowed as the lowest of slave */
if (bhi->max_packet_bytes > shi->max_packet_bytes)
bhi->max_packet_bytes = shi->max_packet_bytes;

View File

@ -245,7 +245,6 @@ memif_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
{
vlib_error_count (vm, node->node_index, MEMIF_TX_ERROR_NO_FREE_SLOTS,
n_left);
vlib_buffer_free (vm, buffers, n_left);
}
vlib_buffer_free (vm, vlib_frame_args (frame), frame->n_vectors);

View File

@ -227,6 +227,14 @@ memif_connect (memif_if_t * mif)
clib_warning
("Warning: unable to set rx mode for interface %d queue %d: "
"rc=%d", mif->hw_if_index, i, rv);
else
{
vnet_hw_interface_rx_mode rxmode;
vnet_hw_interface_get_rx_mode (vnm, mif->hw_if_index, i, &rxmode);
if (rxmode == VNET_HW_INTERFACE_RX_MODE_POLLING)
mq->ring->flags |= MEMIF_RING_FLAG_MASK_INT;
}
}
mif->flags &= ~MEMIF_IF_FLAG_CONNECTING;

View File

@ -21,6 +21,8 @@ import subprocess
import re
import sys
from optparse import OptionParser
from errno import EACCES, EPERM, ENOENT
try:
import readline
@ -43,6 +45,30 @@ class Vppctl(Cmd):
readline.set_history_length(persishist_size)
readline.write_history_file(persishist)
def print_file_error_message(self,e, file_name):
#PermissionError
if e.errno==EPERM or e.errno==EACCES:
print("PermissionError error({0}): {1} for:\n{2}".format(e.errno, e.strerror, file_name))
#FileNotFoundError
elif e.errno==ENOENT:
print("FileNotFoundError error({0}): {1} as:\n{2}".format(e.errno, e.strerror, file_name))
elif IOError:
print("I/O error({0}): {1} as:\n{2}".format(e.errno, e.strerror, file_name))
elif OSError:
print("OS error({0}): {1} as:\n{2}".format(e.errno, e.strerror, file_name))
def testPermissions(self):
if(self.api_prefix is None):
filename = "/dev/shm/vpe-api"
else:
filename = "/dev/shm/%s-vpe-api" % self.api_prefix
try:
file = open(filename)
file.close()
except (IOError, OSError) as e:
self.print_file_error_message(e,filename)
sys.exit()
def runVat(self, line):
input_prefix = "exec "
input_command = input_prefix + line
@ -53,9 +79,7 @@ class Vppctl(Cmd):
else:
command = ['vpp_api_test',"chroot prefix %s " % self.api_prefix]
if os.geteuid() != 0:
command = ['sudo'] + command
self.testPermissions()
vpp_process = subprocess.Popen(command,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,

View File

@ -13,7 +13,7 @@
bin_PROGRAMS += svmtool svmdbtool
nobase_include_HEADERS += svm/svm.h svm/ssvm.h svm/svmdb.h \
nobase_include_HEADERS += svm/svm.h svm/svm_common.h svm/ssvm.h svm/svmdb.h \
svm/svm_fifo.h svm/svm_fifo_segment.h
lib_LTLIBRARIES += libsvm.la libsvmdb.la

View File

@ -24,106 +24,10 @@
#include <pthread.h>
#include <vppinfra/clib.h>
#include <vppinfra/mem.h>
#include <svm/svm_common.h>
#define MMAP_PAGESIZE (clib_mem_get_page_size())
#define SVM_VERSION ((1<<16) | 1) /* set to declare region ready. */
#define SVM_FLAGS_MHEAP (1<<0) /* region contains an mheap */
#define SVM_FLAGS_FILE (1<<1) /* region backed by one or more files */
#define SVM_FLAGS_NODATA (1<<2) /* region will be further subdivided */
#define SVM_FLAGS_NEED_DATA_INIT (1<<3)
#define SVM_PVT_MHEAP_SIZE (128<<10) /* region's private mheap (128k) */
typedef struct svm_region_
{
volatile uword version;
pthread_mutex_t mutex;
pthread_cond_t condvar;
int mutex_owner_pid; /* in case of trouble */
int mutex_owner_tag;
uword flags;
uword virtual_base; /* base of the region object */
uword virtual_size;
void *region_heap;
void *data_base; /* data portion base address */
void *data_heap; /* data heap, if any */
volatile void *user_ctx; /* user context pointer */
/* stuff allocated in the region's heap */
uword bitmap_size; /* nbits in virtual alloc bitmap */
uword *bitmap; /* the bitmap */
char *region_name;
char *backing_file;
char **filenames;
uword *client_pids;
/* pad */
/* next page:
* (64K) clib heap for the region itself
*
* data_base -> whatever is in this region
*/
} svm_region_t;
typedef struct svm_map_region_args_
{
const char *root_path; /* NULL means use the truly global arena */
const char *name;
u64 baseva;
u64 size;
u64 pvt_heap_size;
uword flags;
char *backing_file;
uword backing_mmap_size;
/* uid, gid to own the svm region(s) */
int uid;
int gid;
} svm_map_region_args_t;
/*
* Memory shared across all router instances. Packet buffers, etc
* Base should be "out of the way," and size should be big enough to
* cover everything we plan to put here.
*/
#define SVM_GLOBAL_REGION_BASEVA 0x30000000
#define SVM_GLOBAL_REGION_SIZE (64<<20)
#define SVM_GLOBAL_REGION_NAME "/global_vm"
/*
* Memory shared across individual router instances.
*/
#define SVM_OVERLAY_REGION_BASEVA \
(SVM_GLOBAL_REGION_BASEVA + SVM_GLOBAL_REGION_SIZE)
#define SVM_OVERLAY_REGION_SIZE (1<<20)
#define SVM_OVERLAY_REGION_BASENAME "/overlay_vm"
typedef struct
{
u8 *subregion_name;
} svm_subregion_t;
typedef struct
{
svm_subregion_t *subregions; /* subregion pool */
uword *name_hash;
u8 *root_path;
} svm_main_region_t;
void *svm_region_find_or_create (svm_map_region_args_t * a);
void svm_region_init (void);
void svm_region_init_chroot (const char *root_path);
void svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid);
void svm_region_init_args (svm_map_region_args_t * a);
void svm_region_exit (void);
void svm_region_unmap (void *rp_arg);
void svm_client_scan (const char *root_path);
void svm_client_scan_this_region_nolock (svm_region_t * rp);
u8 *shm_name_from_svm_map_region_args (svm_map_region_args_t * a);
static inline void *
svm_mem_alloc (svm_region_t * rp, uword size)
{
@ -192,10 +96,6 @@ svm_pop_heap (void *oldheap)
clib_mem_set_heap (oldheap);
}
u8 *format_svm_region (u8 * s, va_list * args);
svm_region_t *svm_get_root_rp (void);
#endif /* __included_svm_h__ */
/*

133
src/svm/svm_common.h Normal file
View File

@ -0,0 +1,133 @@
/*
*------------------------------------------------------------------
* Copyright (c) 2009 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*------------------------------------------------------------------
*/
#ifndef __included_svm_common_h__
#define __included_svm_common_h__
#include <stdarg.h>
#include <pthread.h>
#include <vppinfra/types.h>
#define SVM_VERSION ((1<<16) | 1) /* set to declare region ready. */
#define SVM_FLAGS_MHEAP (1<<0) /* region contains an mheap */
#define SVM_FLAGS_FILE (1<<1) /* region backed by one or more files */
#define SVM_FLAGS_NODATA (1<<2) /* region will be further subdivided */
#define SVM_FLAGS_NEED_DATA_INIT (1<<3)
#define SVM_PVT_MHEAP_SIZE (128<<10) /* region's private mheap (128k) */
typedef struct svm_region_
{
volatile uword version;
pthread_mutex_t mutex;
pthread_cond_t condvar;
int mutex_owner_pid; /* in case of trouble */
int mutex_owner_tag;
uword flags;
uword virtual_base; /* base of the region object */
uword virtual_size;
void *region_heap;
void *data_base; /* data portion base address */
void *data_heap; /* data heap, if any */
volatile void *user_ctx; /* user context pointer */
/* stuff allocated in the region's heap */
uword bitmap_size; /* nbits in virtual alloc bitmap */
uword *bitmap; /* the bitmap */
char *region_name;
char *backing_file;
char **filenames;
uword *client_pids;
/* pad */
/* next page:
* (64K) clib heap for the region itself
*
* data_base -> whatever is in this region
*/
} svm_region_t;
typedef struct svm_map_region_args_
{
const char *root_path; /* NULL means use the truly global arena */
const char *name;
u64 baseva;
u64 size;
u64 pvt_heap_size;
uword flags;
char *backing_file;
uword backing_mmap_size;
/* uid, gid to own the svm region(s) */
int uid;
int gid;
} svm_map_region_args_t;
/*
* Memory shared across all router instances. Packet buffers, etc
* Base should be "out of the way," and size should be big enough to
* cover everything we plan to put here.
*/
#define SVM_GLOBAL_REGION_BASEVA 0x30000000
#define SVM_GLOBAL_REGION_SIZE (64<<20)
#define SVM_GLOBAL_REGION_NAME "/global_vm"
/*
* Memory shared across individual router instances.
*/
#define SVM_OVERLAY_REGION_BASEVA \
(SVM_GLOBAL_REGION_BASEVA + SVM_GLOBAL_REGION_SIZE)
#define SVM_OVERLAY_REGION_SIZE (1<<20)
#define SVM_OVERLAY_REGION_BASENAME "/overlay_vm"
typedef struct
{
u8 *subregion_name;
} svm_subregion_t;
typedef struct
{
svm_subregion_t *subregions; /* subregion pool */
uword *name_hash;
u8 *root_path;
} svm_main_region_t;
void *svm_region_find_or_create (svm_map_region_args_t * a);
void svm_region_init (void);
void svm_region_init_chroot (const char *root_path);
void svm_region_init_chroot_uid_gid (const char *root_path, int uid, int gid);
void svm_region_init_args (svm_map_region_args_t * a);
void svm_region_exit (void);
void svm_region_unmap (void *rp_arg);
void svm_client_scan (const char *root_path);
void svm_client_scan_this_region_nolock (svm_region_t * rp);
u8 *shm_name_from_svm_map_region_args (svm_map_region_args_t * a);
u8 *format_svm_region (u8 * s, va_list * args);
svm_region_t *svm_get_root_rp (void);
#endif /* __included_svm_common_h__ */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

File diff suppressed because it is too large Load Diff

View File

@ -30,7 +30,10 @@ libvlibmemory_la_SOURCES = \
vlibmemory/vl_memory_api_h.h \
vlibmemory/vl_memory_msg_enum.h
nobase_include_HEADERS += vlibapi/api.h vlibapi/api_helper_macros.h vlibapi/vat_helper_macros.h
nobase_include_HEADERS += vlibapi/api.h \
vlibapi/api_common.h \
vlibapi/api_helper_macros.h \
vlibapi/vat_helper_macros.h
libvlibmemoryclient_la_DEPENDENCIES = libvppinfra.la libsvm.la
libvlibmemoryclient_la_LIBADD = $(libvlibmemoryclient_la_DEPENDENCIES) -lpthread
@ -49,6 +52,7 @@ libvlibmemoryclient_la_SOURCES = \
nobase_include_HEADERS += \
vlibmemory/api.h \
vlibmemory/api_common.h \
vlibmemory/vl_memory_api_h.h \
vlibmemory/vl_memory_msg_enum.h \
vlibmemory/unix_shared_memory_queue.h \

View File

@ -383,7 +383,7 @@ vlib_buffer_create_free_list_helper (vlib_main_t * vm,
f->index = f - bm->buffer_free_list_pool;
f->n_data_bytes = vlib_buffer_round_size (n_data_bytes);
f->min_n_buffers_each_physmem_alloc = VLIB_FRAME_SIZE;
f->name = clib_mem_is_heap_object (name) ? name : format (0, "%s", name);
f->name = clib_mem_is_vec (name) ? name : format (0, "%s", name);
/* Setup free buffer template. */
f->buffer_init_template.free_list_index = f->index;
@ -774,7 +774,7 @@ vlib_packet_template_init (vlib_main_t * vm,
{
vlib_buffer_main_t *bm = vm->buffer_main;
va_list va;
__attribute__ ((unused)) u8 *name;
u8 *name;
vlib_buffer_free_list_t *fl;
va_start (va, fmt);
@ -962,7 +962,7 @@ format_vlib_buffer_free_list (u8 * s, va_list * va)
bytes_alloc = size * f->n_alloc;
bytes_free = size * n_free;
s = format (s, "%7d%30s%12d%12d%=12U%=12U%=12d%=12d", threadnum,
s = format (s, "%7d%30v%12d%12d%=12U%=12U%=12d%=12d", threadnum,
f->name, f->index, f->n_data_bytes,
format_memory_size, bytes_alloc,
format_memory_size, bytes_free, f->n_alloc, n_free);

View File

@ -72,6 +72,32 @@ node_set_elog_name (vlib_main_t * vm, uword node_index)
n->name_elog_string = elog_string (&vm->elog_main, "%v%c", n->name, 0);
}
static void
vlib_worker_thread_node_rename (u32 node_index)
{
int i;
vlib_main_t *vm;
vlib_node_t *n;
if (vec_len (vlib_mains) == 1)
return;
vm = vlib_mains[0];
n = vlib_get_node (vm, node_index);
ASSERT (vlib_get_thread_index () == 0);
ASSERT (*vlib_worker_threads->wait_at_barrier == 1);
for (i = 1; i < vec_len (vlib_mains); i++)
{
vlib_main_t *vm_worker = vlib_mains[i];
vlib_node_t *n_worker = vlib_get_node (vm_worker, node_index);
n_worker->name = n->name;
n_worker->name_elog_string = n->name_elog_string;
}
}
void
vlib_node_rename (vlib_main_t * vm, u32 node_index, char *fmt, ...)
{
@ -87,6 +113,9 @@ vlib_node_rename (vlib_main_t * vm, u32 node_index, char *fmt, ...)
hash_set (nm->node_by_name, n->name, n->index);
node_set_elog_name (vm, node_index);
/* Propagate the change to all worker threads */
vlib_worker_thread_node_rename (node_index);
}
static void
@ -151,6 +180,26 @@ vlib_node_runtime_update (vlib_main_t * vm, u32 node_index, u32 next_index)
vlib_worker_thread_barrier_release (vm);
}
uword
vlib_node_get_next (vlib_main_t * vm, uword node_index, uword next_node_index)
{
vlib_node_main_t *nm = &vm->node_main;
vlib_node_t *node;
uword *p;
node = vec_elt (nm->nodes, node_index);
/* Runtime has to be initialized. */
ASSERT (nm->flags & VLIB_NODE_MAIN_RUNTIME_STARTED);
if ((p = hash_get (node->next_slot_by_node, next_node_index)))
{
return p[0];
}
return (~0);
}
/* Add next node to given node in given slot. */
uword
vlib_node_add_next_with_slot (vlib_main_t * vm,

View File

@ -1068,6 +1068,9 @@ vlib_node_vectors_per_main_loop_as_integer (vlib_main_t * vm, u32 node_index)
void
vlib_frame_free (vlib_main_t * vm, vlib_node_runtime_t * r, vlib_frame_t * f);
/* Return the edge index if present, ~0 otherwise */
uword vlib_node_get_next (vlib_main_t * vm, uword node, uword next_node);
/* Add next node to given node in given slot. */
uword
vlib_node_add_next_with_slot (vlib_main_t * vm,

View File

@ -562,8 +562,6 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
hash_set (pm->pci_dev_index_by_pci_addr, dev->bus_address.as_u32,
dev - pm->pci_devs);
error = init_device (vm, dev, &pdev);
vec_reset_length (f);
f = format (f, "%v/vpd%c", dev_dir_name, 0);
fd = open ((char *) f, O_RDONLY);
@ -601,10 +599,6 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
close (fd);
}
vec_reset_length (f);
f = format (f, "%v/driver%c", dev_dir_name, 0);
dev->driver_name = vlib_sysfs_link_to_name ((char *) f);
dev->numa_node = -1;
vec_reset_length (f);
f = format (f, "%v/numa_node%c", dev_dir_name, 0);
@ -625,6 +619,12 @@ scan_device (void *arg, u8 * dev_dir_name, u8 * ignored)
vlib_sysfs_read ((char *) f, "0x%x", &tmp);
dev->device_id = tmp;
error = init_device (vm, dev, &pdev);
vec_reset_length (f);
f = format (f, "%v/driver%c", dev_dir_name, 0);
dev->driver_name = vlib_sysfs_link_to_name ((char *) f);
done:
vec_free (f);
return error;

View File

@ -215,7 +215,7 @@ vlib_pci_bus_master_enable (vlib_pci_device_t * dev)
if (err)
return err;
if (!(command & PCI_COMMAND_BUS_MASTER))
if (command & PCI_COMMAND_BUS_MASTER)
return 0;
command |= PCI_COMMAND_BUS_MASTER;

File diff suppressed because it is too large Load Diff

268
src/vlibapi/api_common.h Normal file
View File

@ -0,0 +1,268 @@
/*
*------------------------------------------------------------------
* api_common.h
*
* Copyright (c) 2009-2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*------------------------------------------------------------------
*/
#ifndef included_api_common_h
#define included_api_common_h
#include <vppinfra/clib_error.h>
#include <svm/svm_common.h>
#include <vlibmemory/unix_shared_memory_queue.h>
typedef enum
{
REGISTRATION_TYPE_FREE = 0,
REGISTRATION_TYPE_SHMEM,
REGISTRATION_TYPE_SOCKET_LISTEN,
REGISTRATION_TYPE_SOCKET_SERVER,
REGISTRATION_TYPE_SOCKET_CLIENT,
} vl_registration_type_t;
typedef struct vl_api_registration_
{
vl_registration_type_t registration_type;
/* Index in VLIB's brain (not shared memory). */
u32 vl_api_registration_pool_index;
u8 *name;
/*
* The following groups of data could be unioned, but my fingers are
* going to be sore enough.
*/
/* shared memory only */
unix_shared_memory_queue_t *vl_input_queue;
/* socket server and client */
u32 unix_file_index;
i8 *unprocessed_input;
u32 unprocessed_msg_length;
u8 *output_vector;
/* socket client only */
u32 server_handle;
u32 server_index;
} vl_api_registration_t;
/* Trace configuration for a single message */
typedef struct
{
int size;
int trace_enable;
int replay_enable;
} trace_cfg_t;
/*
* API recording
*/
typedef struct
{
u8 endian;
u8 enabled;
u8 wrapped;
u8 pad;
u32 nitems;
u32 curindex;
u8 **traces;
} vl_api_trace_t;
typedef enum
{
VL_API_TRACE_TX,
VL_API_TRACE_RX,
} vl_api_trace_which_t;
#define VL_API_LITTLE_ENDIAN 0x00
#define VL_API_BIG_ENDIAN 0x01
typedef struct
{
u8 *name;
u16 first_msg_id;
u16 last_msg_id;
} vl_api_msg_range_t;
typedef struct
{
int id;
char *name;
u32 crc;
void *handler;
void *cleanup;
void *endian;
void *print;
int size;
int traced;
int replay;
int message_bounce;
int is_mp_safe;
} vl_msg_api_msg_config_t;
typedef struct msgbuf_
{
unix_shared_memory_queue_t *q;
u32 data_len;
u32 gc_mark_timestamp;
u8 data[0];
} msgbuf_t;
/* api_shared.c prototypes */
void vl_msg_api_handler (void *the_msg);
void vl_msg_api_handler_no_free (void *the_msg);
void vl_msg_api_handler_no_trace_no_free (void *the_msg);
void vl_msg_api_trace_only (void *the_msg);
void vl_msg_api_cleanup_handler (void *the_msg);
void vl_msg_api_replay_handler (void *the_msg);
void vl_msg_api_socket_handler (void *the_msg);
void vl_msg_api_set_handlers (int msg_id, char *msg_name,
void *handler,
void *cleanup,
void *endian,
void *print, int msg_size, int traced);
void vl_msg_api_config (vl_msg_api_msg_config_t *);
void vl_msg_api_set_cleanup_handler (int msg_id, void *fp);
void vl_msg_api_queue_handler (unix_shared_memory_queue_t * q);
void vl_msg_api_barrier_sync (void) __attribute__ ((weak));
void vl_msg_api_barrier_release (void) __attribute__ ((weak));
void vl_msg_api_free (void *);
void vl_noop_handler (void *mp);
void vl_msg_api_increment_missing_client_counter (void);
void vl_msg_api_post_mortem_dump (void);
void vl_msg_api_post_mortem_dump_enable_disable (int enable);
void vl_msg_api_register_pd_handler (void *handler,
u16 msg_id_host_byte_order);
int vl_msg_api_pd_handler (void *mp, int rv);
void vl_msg_api_set_first_available_msg_id (u16 first_avail);
u16 vl_msg_api_get_msg_ids (const char *name, int n);
u32 vl_api_get_msg_index (u8 * name_and_crc);
typedef clib_error_t *(vl_msg_api_init_function_t) (u32 client_index);
typedef struct _vl_msg_api_init_function_list_elt
{
struct _vl_msg_api_init_function_list_elt *next_init_function;
vl_msg_api_init_function_t *f;
} _vl_msg_api_function_list_elt_t;
typedef struct
{
void (**msg_handlers) (void *);
int (**pd_msg_handlers) (void *, int);
void (**msg_cleanup_handlers) (void *);
void (**msg_endian_handlers) (void *);
void (**msg_print_handlers) (void *, void *);
const char **msg_names;
u8 *message_bounce;
u8 *is_mp_safe;
struct ring_alloc_ *arings;
u32 ring_misses;
u32 garbage_collects;
u32 missing_clients;
vl_api_trace_t *rx_trace;
vl_api_trace_t *tx_trace;
int msg_print_flag;
trace_cfg_t *api_trace_cfg;
int our_pid;
svm_region_t *vlib_rp;
svm_region_t **mapped_shmem_regions;
struct vl_shmem_hdr_ *shmem_hdr;
vl_api_registration_t **vl_clients;
u8 *serialized_message_table_in_shmem;
/* For plugin msg allocator */
u16 first_available_msg_id;
/* message range by name hash */
uword *msg_range_by_name;
/* vector of message ranges */
vl_api_msg_range_t *msg_ranges;
/* uid for the api shared memory region */
int api_uid;
/* gid for the api shared memory region */
int api_gid;
/* base virtual address for global VM region */
u64 global_baseva;
/* size of the global VM region */
u64 global_size;
/* size of the API region */
u64 api_size;
/* size of the global VM private mheap */
u64 global_pvt_heap_size;
/* size of the api private mheap */
u64 api_pvt_heap_size;
/* Client-only data structures */
unix_shared_memory_queue_t *vl_input_queue;
/*
* All VLIB-side message handlers use my_client_index to identify
* the queue / client. This works in sim replay.
*/
int my_client_index;
/*
* This is the (shared VM) address of the registration,
* don't use it to id the connection since it can't possibly
* work in simulator replay.
*/
vl_api_registration_t *my_registration;
i32 vlib_signal;
/* vlib input queue length */
u32 vlib_input_queue_length;
/* client side message index hash table */
uword *msg_index_by_name_and_crc;
const char *region_name;
const char *root_path;
/* Replay in progress? */
int replay_in_progress;
/* List of API client reaper functions */
_vl_msg_api_function_list_elt_t *reaper_function_registrations;
} api_main_t;
extern api_main_t api_main;
#endif /* included_api_common_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

View File

@ -20,81 +20,12 @@
#ifndef included_vlibmemory_api_h
#define included_vlibmemory_api_h
#include <vppinfra/error.h>
#include <svm/svm.h>
#include <vlib/vlib.h>
#include <vlibmemory/unix_shared_memory_queue.h>
#include <vlib/unix/unix.h>
#include <vlibapi/api.h>
/* Allocated in shared memory */
/*
* Ring-allocation scheme for client API messages
*
* Only one proc/thread has control of a given message buffer.
* To free a buffer allocated from one of these rings, we clear
* a field in the buffer (header), and leave.
*
* No locks, no hits, no errors...
*/
typedef struct ring_alloc_
{
unix_shared_memory_queue_t *rp;
u16 size;
u16 nitems;
u32 hits;
u32 misses;
} ring_alloc_t;
/*
* Initializers for the (shared-memory) rings
* _(size, n). Note: each msg has an 8 byte header.
* Might want to change that to an index sometime.
*/
#define foreach_vl_aring_size \
_(64+8, 1024) \
_(256+8, 128) \
_(1024+8, 64)
#define foreach_clnt_aring_size \
_(1024+8, 1024) \
_(2048+8, 128) \
_(4096+8, 8)
typedef struct vl_shmem_hdr_
{
int version;
/* getpid () for the VLIB client process */
volatile int vl_pid;
/* Client sends VLIB msgs here. */
unix_shared_memory_queue_t *vl_input_queue;
/* Vector of rings; one for each size. */
/* VLIB allocates buffers to send msgs to clients here. */
ring_alloc_t *vl_rings;
/* Clients allocate buffer to send msgs to VLIB here. */
ring_alloc_t *client_rings;
/* Number of detected application restarts */
u32 application_restarts;
/* Number of messages reclaimed during application restart */
u32 restart_reclaims;
/* Number of garbage-collected messages */
u32 garbage_collects;
} vl_shmem_hdr_t;
#define VL_SHM_VERSION 2
#define VL_API_EPOCH_MASK 0xFF
#define VL_API_EPOCH_SHIFT 8
#include <vlibmemory/api_common.h>
static inline u32
vl_msg_api_handle_get_epoch (u32 index)
@ -118,43 +49,7 @@ vl_msg_api_handle_from_index_and_epoch (u32 index, u32 epoch)
return handle;
}
void *vl_msg_api_alloc (int nbytes);
void *vl_msg_api_alloc_or_null (int nbytes);
void *vl_msg_api_alloc_as_if_client (int nbytes);
void *vl_msg_api_alloc_as_if_client_or_null (int nbytes);
void vl_msg_api_free (void *a);
int vl_map_shmem (const char *region_name, int is_vlib);
void vl_register_mapped_shmem_region (svm_region_t * rp);
void vl_unmap_shmem (void);
void vl_msg_api_send_shmem (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send_shmem_nolock (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send (vl_api_registration_t * rp, u8 * elem);
int vl_client_connect (const char *name, int ctx_quota, int input_queue_size);
void vl_client_disconnect (void);
unix_shared_memory_queue_t *vl_api_client_index_to_input_queue (u32 index);
vl_api_registration_t *vl_api_client_index_to_registration (u32 index);
int vl_client_api_map (const char *region_name);
void vl_client_api_unmap (void);
void vl_set_memory_region_name (const char *name);
void vl_set_memory_root_path (const char *root_path);
void vl_set_memory_uid (int uid);
void vl_set_memory_gid (int gid);
void vl_set_global_memory_baseva (u64 baseva);
void vl_set_global_memory_size (u64 size);
void vl_set_api_memory_size (u64 size);
void vl_set_global_pvt_heap_size (u64 size);
void vl_set_api_pvt_heap_size (u64 size);
void vl_enable_disable_memory_api (vlib_main_t * vm, int yesno);
void vl_client_disconnect_from_vlib (void);
int vl_client_connect_to_vlib (const char *svm_name,
const char *client_name, int rx_queue_size);
int vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
const char *client_name,
int rx_queue_size);
u16 vl_client_get_first_plugin_msg_id (const char *plugin_name);
void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
#endif /* included_vlibmemory_api_h */
/*

138
src/vlibmemory/api_common.h Normal file
View File

@ -0,0 +1,138 @@
/*
*------------------------------------------------------------------
* Copyright (c) 2009 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*------------------------------------------------------------------
*/
#ifndef included_vlibmemory_api_common_h
#define included_vlibmemory_api_common_h
#include <svm/svm_common.h>
#include <vlibapi/api_common.h>
#include <vlibmemory/unix_shared_memory_queue.h>
/* Allocated in shared memory */
/*
* Ring-allocation scheme for client API messages
*
* Only one proc/thread has control of a given message buffer.
* To free a buffer allocated from one of these rings, we clear
* a field in the buffer (header), and leave.
*
* No locks, no hits, no errors...
*/
typedef struct ring_alloc_
{
unix_shared_memory_queue_t *rp;
u16 size;
u16 nitems;
u32 hits;
u32 misses;
} ring_alloc_t;
/*
* Initializers for the (shared-memory) rings
* _(size, n). Note: each msg has an 8 byte header.
* Might want to change that to an index sometime.
*/
#define foreach_vl_aring_size \
_(64+8, 1024) \
_(256+8, 128) \
_(1024+8, 64)
#define foreach_clnt_aring_size \
_(1024+8, 1024) \
_(2048+8, 128) \
_(4096+8, 8)
typedef struct vl_shmem_hdr_
{
int version;
/* getpid () for the VLIB client process */
volatile int vl_pid;
/* Client sends VLIB msgs here. */
unix_shared_memory_queue_t *vl_input_queue;
/* Vector of rings; one for each size. */
/* VLIB allocates buffers to send msgs to clients here. */
ring_alloc_t *vl_rings;
/* Clients allocate buffer to send msgs to VLIB here. */
ring_alloc_t *client_rings;
/* Number of detected application restarts */
u32 application_restarts;
/* Number of messages reclaimed during application restart */
u32 restart_reclaims;
/* Number of garbage-collected messages */
u32 garbage_collects;
} vl_shmem_hdr_t;
#define VL_SHM_VERSION 2
#define VL_API_EPOCH_MASK 0xFF
#define VL_API_EPOCH_SHIFT 8
void *vl_msg_api_alloc (int nbytes);
void *vl_msg_api_alloc_or_null (int nbytes);
void *vl_msg_api_alloc_as_if_client (int nbytes);
void *vl_msg_api_alloc_as_if_client_or_null (int nbytes);
void vl_msg_api_free (void *a);
int vl_map_shmem (const char *region_name, int is_vlib);
void vl_register_mapped_shmem_region (svm_region_t * rp);
void vl_unmap_shmem (void);
void vl_msg_api_send_shmem (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send_shmem_nolock (unix_shared_memory_queue_t * q, u8 * elem);
void vl_msg_api_send (vl_api_registration_t * rp, u8 * elem);
int vl_client_connect (const char *name, int ctx_quota, int input_queue_size);
void vl_client_disconnect (void);
unix_shared_memory_queue_t *vl_api_client_index_to_input_queue (u32 index);
vl_api_registration_t *vl_api_client_index_to_registration (u32 index);
int vl_client_api_map (const char *region_name);
void vl_client_api_unmap (void);
void vl_set_memory_region_name (const char *name);
void vl_set_memory_root_path (const char *root_path);
void vl_set_memory_uid (int uid);
void vl_set_memory_gid (int gid);
void vl_set_global_memory_baseva (u64 baseva);
void vl_set_global_memory_size (u64 size);
void vl_set_api_memory_size (u64 size);
void vl_set_global_pvt_heap_size (u64 size);
void vl_set_api_pvt_heap_size (u64 size);
void vl_client_disconnect_from_vlib (void);
int vl_client_connect_to_vlib (const char *svm_name, const char *client_name,
int rx_queue_size);
int vl_client_connect_to_vlib_no_rx_pthread (const char *svm_name,
const char *client_name,
int rx_queue_size);
u16 vl_client_get_first_plugin_msg_id (const char *plugin_name);
void vl_api_rpc_call_main_thread (void *fp, u8 * data, u32 data_length);
#endif /* included_vlibmemory_api_common_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/

View File

@ -269,10 +269,15 @@ libvnet_la_SOURCES += \
vnet/lldp/lldp_input.c \
vnet/lldp/lldp_node.c \
vnet/lldp/lldp_output.c \
vnet/lldp/lldp_cli.c
vnet/lldp/lldp_cli.c \
vnet/lldp/lldp_api.c
nobase_include_HEADERS += \
vnet/lldp/lldp_protocol.h
vnet/lldp/lldp_protocol.h \
vnet/lldp/lldp.h \
vnet/lldp/lldp.api.h
API_FILES += vnet/lldp/lldp.api
########################################
# Layer 2/3 "classify"

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