Compare commits

...

27 Commits

Author SHA1 Message Date
Marek Gradzki
92bcecfdcc jvpp: remove redundant libvlib.la dependency
Follows https://gerrit.fd.io/r/#/c/5681/
Should fix VPP-689.

Change-Id: I5514c3d2657f4ee0a932d14c80f55d1471f5d56f
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-04-10 13:15:22 +00:00
Eyal Bari
0f0ff322b1 BRIDGE-DOMAIN:enable arp term,mac/ip learning on local ints
we should not suppress arps on remote interface instead we should  flood them to the local one
used shg != 0 to identify packets from remote interfaces and disable arp term l2 input feature for them

Change-Id: I701537c05df7451a25ccb5bfc9e2b03ea70cff20
Signed-off-by: Eyal Bari <ebari@cisco.com>
(cherry picked from commit a0623f8d26501a230801908cd4bc38d67a35dd23)
2017-04-10 09:44:19 +00:00
John Lo
16c76de9b5 Fix init of ENIC driver to allow receiving of jumbo packets
Set rxmode.enable_scatter field in DPDK port config parameter so ENIC
driver will use multiple mbuf's for receiving jumbo packets.
Also remove ENIC driver check to disable setting ENIC MTU as this
capability is now working with the new ENIC driver, subject to 9002B
limit.

Change-Id: I563976201c4968d4538c0759505cef2de876934a
Signed-off-by: John Lo <loj@cisco.com>
(cherry picked from commit 250b95b71babdfb558554c788a82cf45ccc34ab8)
2017-04-08 17:16:33 +00:00
Florin Coras
b970bb7f01 Fix gpe dp args to allow for 32 bit bridge domain ids, VPP-690
Change-Id: I4e3df197eed33acbceaff495279def8716773303
Signed-off-by: Florin Coras <fcoras@cisco.com>
2017-04-07 00:00:04 +00:00
Marek Gradzki
77ff34d550 jvpp: remove unused print&endian headers (fixes VPP-688)
Change-Id: I97e03d98758a08b1f75a9a1f35f0181385a10ae8
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2017-04-06 08:15:00 +00:00
Sergio Gonzalez Monroy
12cb0c4cdb Fix name typo
Change-Id: Ic7128d4f8a13c021e0fd4731a717193d050431d2
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
2017-04-05 16:41:55 +00:00
Klement Sekera
5d0b86b8ef BFD: add ARP-awareness, fix bugs
Make BFD ARP-aware when sending out packets.
Fix a few one-liner bugs discovered while integrating with cisco
nexus. Enhance CLI view to better observe session state.

Change-Id: I266c29492f351207b84328ab665d9d697969da9c
Signed-off-by: Klement Sekera <ksekera@cisco.com>
2017-04-05 16:18:53 +00:00
Milan Lenco
f7f4535510 Fix two more memif coverity issues
Change-Id: Iff7e1562d395f1f2e000fa8c2e98bb85969479d7
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2017-04-05 15:34:10 +00:00
Filip Tehlar
c6cd26d520 LISP: fix crash when GPE interface is re-added, VPP-685
Change-Id: Ib83baf6ddec4ac192f6b4123d9eb599fb370fd0c
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-04-05 15:19:47 +00:00
Andrew Yourtchenko
7fd3f513c7 acl-plugin: fix pretty-printing in "api trace custom-dump" (VPP-683)
Change-Id: Id15b401223aabe7dacb7566c871ebefc17fbb1fc
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-04-05 10:13:29 +00:00
Filip Tehlar
517f72fe18 LISP: fix crash when adding a negative forwarding entry, VPP-681
Change-Id: I190696da5555c05074ee0eee32eb914bd16e38fb
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-04-05 06:17:37 +00:00
Andrew Yourtchenko
9fc0c26c6b acl-plugin: make the IPv4/IPv6 non-first fragment handling in line with ACL (VPP-682)
This fixes the previously-implicit "drop all non-first fragments" behavior
to be more in line with security rules: a non-first fragment is treated
for the purposes of matching the ACL as a packet with the port
match succeeding. This allows to change the behavior to permit
the fragmented packets for the default "permit specific rules"
ruleset, but also gives the flexibility to block the non-initial
fragments by inserting into the begining a bogus rule
which would deny the L4 traffic.

Also, add a knob which allows to potentially turn this behavior off
in case of a dire need (and revert to dropping all non-initial fragments),
via a debug CLI.

Change-Id: I546b372b65ff2157d9c68b1d32f9e644f1dd71b4
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-04-04 19:45:05 +00:00
Pierre Pfister
ec06222ae1 Fix typo in minimal epoll polling time
epoll was supposed to not sleep when timeout
is less than 1ms, but a typo made it not sleep
any time the requested timeout is lower than
1000 seconds (in practice, never...).

This patch replaces "1e3" with "1e-3", which
represents 1ms.

Change-Id: I731851b27a6bf6ab8e41586e017e94b962b09bf3
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2017-04-04 15:55:21 +01:00
Milan Lenco
de9a7eacd5 Fix memif coverity issues
Change-Id: I1cd649e1d4582792f75d0db60a9524471fc76a9f
Signed-off-by: Milan Lenco <milan.lenco@pantheon.tech>
2017-04-03 10:25:38 +02:00
Dave Barach
f6fc6b674d vpp-678: Rename "show interfaces" -> "show interface"
To line up with "show interface placement," recently added. Otherwise,
"show int" refers only to "show interface placement," which tends to
annoy the cash customers...

Change-Id: Iea9e3681aeb051e2b0e1ecbf06706d98af9a3abf
Signed-off-by: Dave Barach <dave@barachs.net>
(cherry picked from commit 13ad1f02922858177915b1cb1450041d2e4d85de)
2017-03-30 15:03:55 -04:00
Pablo Camarillo
5d2495d550 VPP-673 Fix L2 steering.
Change-Id: I1eab03525f234139ceefbc9b9895a35a03a56910
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
2017-03-30 12:20:24 +00:00
Andrew Yourtchenko
097051a3bd acl-plugin: cleaner node bugfixes (VPP-675)
- use the counters in a private struct rather than node error counters
- ensure the timer for the non-idle connections is restarted
- fix the deletion of conn at the current tail the list

Change-Id: I632f63574d2ced95fb75c5e7fb588c78fb3cce1c
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
2017-03-30 09:38:39 +00:00
Filip Tehlar
65d5f03793 LISP: fix IID in decap, VPP-676
Change-Id: I3f67d32d5d76069a27176deef6cba0c1a194b7ec
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2017-03-30 09:26:16 +02:00
Jim Gibson
ee403b722f af_packet driver failure to check VLIB_BUFFER_NEXT_PRESENT flag
af_packet driver must check that VLIB_BUFFER_NEXT_PRESENT flag is set
when walking vlib_buffer_t next_buffer chain on transmit.
On buffer allocation:
- next_buffer is not and may contain a stale invalid value that
  should be ignored if not overwritten by a valid value.
- VLIB_BUFFER_NEXT_PRESENT flag is cleared and only set
  if a valid value is written to next_buffer.

Change-Id: Iebf76ce8eea24a0d63c7bf749e672d6a232c80e7
Signed-off-by: Jim Gibson <gibson+fdio@cisco.com>
2017-03-29 21:50:40 +00:00
Neale Ranns
39cdca35c5 Coverity Error: logically dead code in IP unnumbered CLI
Change-Id: Id3398bd4b7a56c168aaab37942b92715e19d4025
Signed-off-by: Neale Ranns <nranns@cisco.com>
2017-03-29 19:21:40 +00:00
Pablo Camarillo
f60b77c159 Bugfixing and documentation for SRv6
- Fixed three coverity issues
- Linked SRv6 docs
- Moved sample plugin to examples folder
- Fixed bug with hash. Now everything is using mhash. Potentially in the future we want to do bihash.

Change-Id: Ie03a13c8fecb1e315e67d0596cbd23220779aaf2
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
2017-03-29 14:01:49 +00:00
shwethab
ff077a0401 SR replicate mheap corruption fix VPP-672
Change-Id: If1c68fc63fa71fab198f2bf4f79bdd7a9841c2e8
Signed-off-by: shwethab <shwetha.bhandari@gmail.com>
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
2017-03-29 13:57:13 +00:00
Ole Troan
0679760dc5 Python API: Fixup of debian package after cFFI changes.
Change-Id: I4c2a1a818f28d4c6cf52af45f3b7dbfa41d77ccb
Signed-off-by: Ole Troan <ot@cisco.com>
(cherry picked from commit afaa85f873a7bff1cf1e32c22f909af3018ccfee)
2017-03-28 23:37:43 +00:00
John Lo
58f061dca4 Implement MAC Flush for BD or Interface from the L2FIB
Allow non-static MACs in the L2FIB which is associated with an
interface or a bridge domain (BD) be flushed. MAC flush are
initiated automatically when an interface is removed from a BD
or when a BD is deleted. MAC flush can also be invoked manually
via the following CLI:
 l2fib mac-flush interface <if-name>
 l2fib mac-flush bridge-domain <bd-id>

Change-Id: Ie33243622834810a765f48ebcd22bdb8e8fc87a4
Signed-off-by: John Lo <loj@cisco.com>
2017-03-28 22:36:13 +00:00
Ole Troan
45e526f36f Python-API: debian packaging now depends on python-all (for pybuild)
Change-Id: I6b1dd6bdf03fa506c4b114d15800d9fe03e36395
Signed-off-by: Ole Troan <ot@cisco.com>
(cherry picked from commit 9f81d4fe5cfab856e23926bfdb11c03c04838478)
2017-03-28 19:13:55 +00:00
AkshayaNadahalli
f9bb3b45d1 Fix output feature processing (VPP-670)
Double committing to 17.04 as its a bug-fix.

Change-Id: I94539812191ad0eb8abe78e2dad25ab96c780f30
Signed-off-by: AkshayaNadahalli <anadahal@cisco.com>
2017-03-28 12:19:54 +05:30
Ole Troan
cb92fc6edc Change default branch in .gitreview
Change-Id: I204a6125615accaa96b94657e7f76b243c9305d1
Signed-off-by: Ole Troan <ot@cisco.com>
2017-03-22 21:15:07 +01:00
79 changed files with 1594 additions and 1007 deletions

View File

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

View File

@ -57,7 +57,7 @@ M: Damjan Marion <damarion@cisco.com>
F: src/vnet/devices/
VNET Device Drivers - DPDK Crypto
M: Sergio Gonzales Monroy <sergio.gonzalez.monroy@intel.com>
M: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
F: src/devices/dpdk/ipsec/
VNET Feature Arcs
@ -81,7 +81,7 @@ M: Pablo Camarillo <pcamaril@cisco.com>
F: src/vnet/sr/
VNET IPSec
M: Sergio Gonzales Monroy <sergio.gonzalez.monroy@intel.com>
M: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
M: Matus Fabian <matfabia@cisco.com>
F: src/vnet/ipsec/

View File

@ -40,7 +40,7 @@ DEB_DEPENDS = curl build-essential autoconf automake bison libssl-dev ccache
DEB_DEPENDS += debhelper dkms git libtool libganglia1-dev libapr1-dev dh-systemd
DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
DEB_DEPENDS += lcov chrpath autoconf nasm
DEB_DEPENDS += python-dev python-virtualenv python-pip libffi6
DEB_DEPENDS += python-all python-dev python-virtualenv python-pip libffi6
ifeq ($(OS_VERSION_ID),14.04)
DEB_DEPENDS += openjdk-8-jdk-headless
else

View File

@ -59,10 +59,6 @@ install-deb: $(patsubst %,%-find-source,$(ROOT_PACKAGES))
./scripts/find-vpp-api-java-contents $(INSTALL_PREFIX)$(ARCH) \
deb/debian/vpp-api-java.install ; \
\
: vpp-api-python package ; \
./scripts/find-vpp-api-python-contents $(INSTALL_PREFIX)$(ARCH) \
deb/debian/vpp-api-python.install ; \
\
: bin package needs startup config ; \
echo ../../src/vpp/conf/startup.conf /etc/vpp \
>> deb/debian/vpp.install ; \

View File

@ -2,7 +2,7 @@ Source: vpp
Section: net
Priority: extra
Maintainer: Cisco OpenVPP Packaging Team <bogus.address@cisco.com>
Build-Depends: debhelper (>= 9), dh-systemd, dh-python, chrpath
Build-Depends: debhelper (>= 9), dh-systemd, dh-python, chrpath, python-all
Standards-Version: 3.9.4
Package: vpp

View File

@ -16,9 +16,15 @@ include /usr/share/dpkg/default.mk
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
export PYBUILD_NAME = vpp-api-python
export PYBUILD_DIR = ../../src/vpp-api/python
export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
export PYBUILD_DISABLE_python2=test
export PYBUILD_SYSTEM=distutils
# main packaging script based on dh7 syntax
%:
dh $@ --with systemd,python2
dh $@ --with systemd,python2 --buildsystem=pybuild
override_dh_install:
dh_install --exclude .git

View File

@ -1,5 +0,0 @@
#!/bin/sh -e
# after installing python-api files
python2_sitedir=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
easy_install --install-dir=$python2_sitedir -z $python2_sitedir/vpp_papi/vpp_papi-*.egg

View File

@ -1,8 +0,0 @@
#!/bin/sh -e
# before removing python-api files
python2_sitedir=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
easy_install --install-dir=$python2_sitedir -mxNq vpp_papi
# the egg has been copied during install
rm $python2_sitedir/vpp_papi-*.egg

View File

@ -53,7 +53,8 @@ DOXY_SRC_DIRECTORIES = \
$(DOXY_SRC)/vlibsocket \
$(DOXY_SRC)/vnet \
$(DOXY_SRC)/vpp \
$(DOXY_SRC)/vpp-api
$(DOXY_SRC)/vpp-api \
$(DOXY_SRC)/examples
# Input directories and files
DOXY_INPUT ?= \
@ -72,9 +73,8 @@ DOXY_INPUT := $(subst $(WS_ROOT)/,,$(DOXY_INPUT))
# These must be left-anchored paths for the regexp below to work.
DOXY_EXCLUDE ?= \
$(DOXY_SRC)/vlib/vlib/buffer.c \
$(DOXY_SRC)/vlib/example \
$(DOXY_SRC)/vpp-api/lua \
plugins/sample-plugin
$(DOXY_SRC)/examples/sample-plugin
# Generate a regexp for filenames to exclude
DOXY_EXCLUDE_REGEXP = ($(subst .,\.,$(shell echo '$(strip $(DOXY_EXCLUDE))' | sed -e 's/ /|/g')))

View File

@ -4,13 +4,14 @@ User Documentation {#user_doc}
Several modules provide operational, dataplane-user focused documentation.
- [GUI guided user demo](https://wiki.fd.io/view/VPP_Sandbox/vpp-userdemo)
- @subpage qos_doc
- @subpage ipsec_gre_doc
- @subpage dpdk_crypto_ipsec_doc
- @subpage map_doc
- @subpage lldp_doc
- @subpage ioam_plugin_doc
- @subpage lb_plugin_doc
- @subpage flowperpkt_plugin_doc
- @subpage span_doc
- @subpage bfd_doc
- @subpage ioam_plugin_doc
- @subpage ipsec_gre_doc
- @subpage lb_plugin_doc
- @subpage lldp_doc
- @subpage map_doc
- @subpage dpdk_crypto_ipsec_doc
- @subpage flowperpkt_plugin_doc
- @subpage qos_doc
- @subpage span_doc
- @subpage srv6_doc

View File

@ -154,7 +154,6 @@ PLUGIN_ENABLED(lb)
PLUGIN_ENABLED(memif)
PLUGIN_ENABLED(sixrd)
PLUGIN_ENABLED(snat)
PLUGIN_DISABLED(srv6sample)
###############################################################################
# Dependency checks

View File

@ -1,12 +1,4 @@
# SRv6 Sample LocalSID documentation {#srv6_plugin_doc}
## Disclaimer
This is a memo intended to contain documentation for the sample SRv6 LocalSID behavior plugin
Everything that is not directly obvious should come here.
For any feedback on content that should be explained please mailto:pcamaril@cisco.com
This plugin refers to Segment Routing. Please read the SR documentation first.
# Sample SRv6 LocalSID documentation {#srv6_plugin_doc}
## Introduction

View File

@ -69,10 +69,6 @@ if ENABLE_SNAT_PLUGIN
include snat.am
endif
if ENABLE_SRV6SAMPLE_PLUGIN
include sample_srv6_localsid.am
endif
include ../suffix-rules.mk
# Remove *.la files

View File

@ -22,6 +22,7 @@ acl_plugin_la_SOURCES = \
acl/l2sess.c \
acl/l2sess_node.c \
acl/l2sess.h \
acl/manual_fns.h \
acl/acl_plugin.api.h
API_FILES += acl/acl.api
@ -29,8 +30,9 @@ API_FILES += acl/acl.api
nobase_apiinclude_HEADERS += \
acl/acl_all_api_h.h \
acl/acl_msg_enum.h \
acl/manual_fns.h \
acl/acl.api.h
acl_test_plugin_la_SOURCES = acl/acl_test.c acl/acl_plugin.api.h
acl_test_plugin_la_SOURCES = acl/acl_test.c acl/acl_plugin.api.h acl/acl_all_api.h
# vi:syntax=automake

View File

@ -60,7 +60,7 @@ define acl_plugin_get_version_reply
@param tcp_flags_value - if proto==6, mask to AND the TCP flags in the packet with
*/
typeonly manual_print manual_endian define acl_rule
typeonly manual_print define acl_rule
{
u8 is_permit;
u8 is_ipv6;
@ -104,7 +104,7 @@ typeonly manual_print manual_endian define acl_rule
@param src_ip_prefix_len - Source prefix length
*/
typeonly manual_print manual_endian define macip_acl_rule
typeonly manual_print define macip_acl_rule
{
u8 is_permit;
u8 is_ipv6;
@ -161,7 +161,7 @@ define acl_add_replace_reply
@param acl_index - ACL index to delete
*/
define acl_del
manual_print define acl_del
{
u32 client_index;
u32 context;
@ -190,7 +190,7 @@ define acl_del_reply
@param acl_index - index of ACL for the operation
*/
define acl_interface_add_del
manual_print define acl_interface_add_del
{
u32 client_index;
u32 context;
@ -224,7 +224,7 @@ define acl_interface_add_del_reply
@param acls - vector of ACL indices
*/
manual_endian define acl_interface_set_acl_list
manual_print define acl_interface_set_acl_list
{
u32 client_index;
u32 context;
@ -266,7 +266,7 @@ define acl_dump
@param r - Array of rules within this ACL
*/
manual_print manual_endian define acl_details
manual_endian manual_print define acl_details
{
u32 context;
u32 acl_index;
@ -296,7 +296,7 @@ define acl_interface_list_dump
@param acls - the vector of ACL indices
*/
manual_endian define acl_interface_list_details
define acl_interface_list_details
{
u32 context;
u32 sw_if_index;
@ -313,7 +313,7 @@ manual_endian define acl_interface_list_details
@param r - vector of MACIP ACL rules
*/
manual_print manual_endian define macip_acl_add
manual_endian manual_print define macip_acl_add
{
u32 client_index;
u32 context;
@ -341,7 +341,7 @@ define macip_acl_add_reply
@param acl_index - MACIP ACL index to delete
*/
define macip_acl_del
manual_print define macip_acl_del
{
u32 client_index;
u32 context;
@ -367,7 +367,7 @@ define macip_acl_del_reply
@param acl_index - MACIP ACL index
*/
define macip_acl_interface_add_del
manual_print define macip_acl_interface_add_del
{
u32 client_index;
u32 context;
@ -409,7 +409,7 @@ define macip_acl_dump
@param r - rules comprising this ACL
*/
manual_print manual_endian define macip_acl_details
manual_endian manual_print define macip_acl_details
{
u32 context;
u32 acl_index;

View File

@ -1767,8 +1767,6 @@ vl_api_macip_acl_interface_get_t_handler (vl_api_macip_acl_interface_get_t *
vl_msg_api_send_shmem (q, (u8 *) & rmp);
}
/* Set up the API message handling tables */
static clib_error_t *
acl_plugin_api_hookup (vlib_main_t * vm)
@ -2010,6 +2008,11 @@ acl_set_aclplugin_fn (vlib_main_t * vm,
}
goto done;
}
if (unformat (input, "l4-match-nonfirst-fragment %u", &val))
{
am->l4_match_nonfirst_fragment = (val != 0);
goto done;
}
if (unformat (input, "session")) {
if (unformat (input, "clear")) {
acl_main_t *am = &acl_main;
@ -2120,10 +2123,15 @@ acl_show_aclplugin_fn (vlib_main_t * vm,
u64 n_dels = sw_if_index < vec_len(am->fa_session_dels_by_sw_if_index) ? am->fa_session_dels_by_sw_if_index[sw_if_index] : 0;
out0 = format(out0, "sw_if_index %d: add %lu - del %lu = %lu\n", sw_if_index, n_adds, n_dels, n_adds - n_dels);
}));
out0 = format(out0, "\n\nConn cleaner thread counters:\n");
#define _(cnt, desc) out0 = format(out0, " %20lu: %s\n", am->cnt, desc);
foreach_fa_cleaner_counter;
#undef _
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,
am->fa_cleaner_wait_time_increment * 1000.0, ((f64)am->fa_current_cleaner_timer_wait_interval) * 1000.0/(f64)vm->clib_time.clocks_per_second);
vec_free(out0);
}
return error;
@ -2190,10 +2198,20 @@ acl_init (vlib_main_t * vm)
am->fa_max_deleted_sessions_per_interval = ACL_FA_DEFAULT_MAX_DELETED_SESSIONS_PER_INTERVAL;
am->fa_cleaner_wait_time_increment = ACL_FA_DEFAULT_CLEANER_WAIT_TIME_INCREMENT;
am->fa_cleaner_cnt_delete_by_sw_index = 0;
am->fa_cleaner_cnt_delete_by_sw_index_ok = 0;
am->fa_cleaner_cnt_unknown_event = 0;
am->fa_cleaner_cnt_deleted_sessions = 0;
am->fa_cleaner_cnt_timer_restarted = 0;
am->fa_cleaner_cnt_wait_with_timeout = 0;
#define _(N, v, s) am->fa_ipv6_known_eh_bitmap = clib_bitmap_set(am->fa_ipv6_known_eh_bitmap, v, 1);
foreach_acl_eh
#undef _
am->l4_match_nonfirst_fragment = 1;
return error;
}

View File

@ -181,6 +181,9 @@ typedef struct {
/* EH values that we can skip over */
uword *fa_ipv6_known_eh_bitmap;
/* whether to match L4 ACEs with ports on the non-initial fragment */
int l4_match_nonfirst_fragment;
/* conn table per-interface conn table parameters */
u32 fa_conn_table_hash_num_buckets;
uword fa_conn_table_hash_memory_size;
@ -209,6 +212,22 @@ typedef struct {
u32 fa_conn_list_head[ACL_N_TIMEOUTS];
u32 fa_conn_list_tail[ACL_N_TIMEOUTS];
/* Counters for the cleaner thread */
#define foreach_fa_cleaner_counter \
_(fa_cleaner_cnt_delete_by_sw_index, "delete_by_sw_index events") \
_(fa_cleaner_cnt_delete_by_sw_index_ok, "delete_by_sw_index handled ok") \
_(fa_cleaner_cnt_unknown_event, "unknown events received") \
_(fa_cleaner_cnt_deleted_sessions, "sessions deleted") \
_(fa_cleaner_cnt_timer_restarted, "session idle timers restarted") \
_(fa_cleaner_cnt_wait_with_timeout, "event wait with timeout called") \
_(fa_cleaner_cnt_wait_without_timeout, "event wait w/o timeout called") \
_(fa_cleaner_cnt_event_cycles, "total event cycles") \
_(fa_cleaner_cnt_already_deleted, "try to delete already deleted conn") \
/* end of counters */
#define _(id, desc) u32 id;
foreach_fa_cleaner_counter
#undef _
/* convenience */
vlib_main_t * vlib_main;
@ -219,6 +238,7 @@ typedef struct {
_(HOPBYHOP , 0 , "IPv6ExtHdrHopByHop") \
_(ROUTING , 43 , "IPv6ExtHdrRouting") \
_(DESTOPT , 60 , "IPv6ExtHdrDestOpt") \
_(FRAGMENT , 44 , "IPv6ExtHdrFragment") \
_(MOBILITY , 135, "Mobility Header") \
_(HIP , 139, "Experimental use Host Identity Protocol") \
_(SHIM6 , 140, "Shim6 Protocol") \
@ -231,7 +251,6 @@ typedef struct {
Also, Fragment header needs special processing.
_(NONEXT , 59 , "NoNextHdr") \
_(FRAGMENT , 44 , "IPv6ExtHdrFragment") \
ESP is hiding its internal format, so no point in trying to go past it.

File diff suppressed because it is too large Load Diff

View File

@ -164,14 +164,14 @@ vl_api_acl_rule_t_pretty_format (u8 *out, vl_api_acl_rule_t * a)
inet_ntop(af, a->src_ip_addr, (void *)src, sizeof(src));
inet_ntop(af, a->dst_ip_addr, (void *)dst, sizeof(dst));
out = format(out, "%s action %d src %s/%d dst %s/%d proto %d sport %d-%d dport %d-%d tcpflags %d %d",
out = format(out, "%s action %d src %s/%d dst %s/%d proto %d sport %d-%d dport %d-%d tcpflags %d mask %d",
a->is_ipv6 ? "ipv6" : "ipv4", a->is_permit,
src, a->src_ip_prefix_len,
dst, a->dst_ip_prefix_len,
a->proto,
a->srcport_or_icmptype_first, a->srcport_or_icmptype_last,
a->dstport_or_icmpcode_first, a->dstport_or_icmpcode_last,
a->tcp_flags_mask, a->tcp_flags_value);
a->tcp_flags_value, a->tcp_flags_mask);
return(out);
}
@ -326,6 +326,7 @@ static int api_acl_add_replace (vat_main_t * vam)
vl_api_acl_rule_t *rules = 0;
int rule_idx = 0;
int n_rules = 0;
int n_rules_override = -1;
u32 proto = 0;
u32 port1 = 0;
u32 port2 = 0;
@ -363,6 +364,10 @@ static int api_acl_add_replace (vat_main_t * vam)
vec_validate_acl_rules(rules, rule_idx);
rules[rule_idx].is_permit = 1;
}
else if (unformat (i, "count %d", &n_rules_override))
{
/* we will use this later */
}
else if (unformat (i, "action %d", &action))
{
vec_validate_acl_rules(rules, rule_idx);
@ -430,6 +435,12 @@ static int api_acl_add_replace (vat_main_t * vam)
rules[rule_idx].tcp_flags_value = tcpflags;
rules[rule_idx].tcp_flags_mask = tcpmask;
}
else if (unformat (i, "tcpflags %d mask %d", &tcpflags, &tcpmask))
{
vec_validate_acl_rules(rules, rule_idx);
rules[rule_idx].tcp_flags_value = tcpflags;
rules[rule_idx].tcp_flags_mask = tcpmask;
}
else if (unformat (i, "proto %d", &proto))
{
vec_validate_acl_rules(rules, rule_idx);
@ -455,6 +466,9 @@ static int api_acl_add_replace (vat_main_t * vam)
else
n_rules = 0;
if (n_rules_override >= 0)
n_rules = n_rules_override;
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);
@ -812,6 +826,7 @@ static int api_macip_acl_add (vat_main_t * vam)
vl_api_macip_acl_rule_t *rules = 0;
int rule_idx = 0;
int n_rules = 0;
int n_rules_override = -1;
u32 src_prefix_length = 0;
u32 action = 0;
ip4_address_t src_v4address;
@ -843,6 +858,10 @@ static int api_macip_acl_add (vat_main_t * vam)
vec_validate_macip_acl_rules(rules, rule_idx);
rules[rule_idx].is_permit = 0;
}
else if (unformat (i, "count %d", &n_rules_override))
{
/* we will use this later */
}
else if (unformat (i, "action %d", &action))
{
vec_validate_macip_acl_rules(rules, rule_idx);
@ -856,6 +875,10 @@ static int api_macip_acl_add (vat_main_t * vam)
rules[rule_idx].src_ip_prefix_len = src_prefix_length;
rules[rule_idx].is_ipv6 = 0;
}
else if (unformat (i, "src"))
{
/* Everything in MACIP is "source" but allow this verbosity */
}
else if (unformat (i, "ip %U/%d",
unformat_ip6_address, &src_v6address, &src_prefix_length))
{
@ -897,6 +920,9 @@ static int api_macip_acl_add (vat_main_t * vam)
else
n_rules = 0;
if (n_rules_override >= 0)
n_rules = n_rules_override;
msg_size += n_rules*sizeof(rules[0]);
mp = vl_msg_api_alloc_as_if_client(msg_size);

View File

@ -191,7 +191,21 @@ acl_match_5tuple (acl_main_t * am, u32 acl_index, fa_5tuple_t * pkt_5tuple,
{
if (pkt_5tuple->l4.proto != r->proto)
continue;
/* A sanity check just to ensure what we jave just matched was a valid L4 extracted from the packet */
if (PREDICT_FALSE (pkt_5tuple->pkt.is_nonfirst_fragment &&
am->l4_match_nonfirst_fragment))
{
/* non-initial fragment with frag match configured - match this rule */
*trace_bitmap |= 0x80000000;
*r_action = r->is_permit;
if (r_acl_match_p)
*r_acl_match_p = acl_index;
if (r_rule_match_p)
*r_rule_match_p = i;
return 1;
}
/* A sanity check just to ensure we are about to match the ports extracted from the packet */
if (PREDICT_FALSE (!pkt_5tuple->pkt.l4_valid))
continue;
@ -312,6 +326,10 @@ acl_fill_5tuple (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
l3_offset = 0;
}
/* key[0..3] contains src/dst address and is cleared/set below */
/* Remainder of the key and per-packet non-key data */
p5tuple_pkt->kv.key[4] = 0;
p5tuple_pkt->kv.value = 0;
if (is_ip6)
{
@ -333,12 +351,33 @@ acl_fill_5tuple (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
int need_skip_eh = clib_bitmap_get (am->fa_ipv6_known_eh_bitmap, proto);
if (PREDICT_FALSE (need_skip_eh))
{
/* FIXME: add fragment header special handling. Currently causes treated as unknown header. */
while (need_skip_eh && offset_within_packet (b0, l4_offset))
{
u8 nwords = *(u8 *) get_ptr_to_offset (b0, 1 + l4_offset);
proto = *(u8 *) get_ptr_to_offset (b0, l4_offset);
l4_offset += 8 * (1 + (u16) nwords);
/* Fragment header needs special handling */
if (PREDICT_FALSE(ACL_EH_FRAGMENT == proto))
{
proto = *(u8 *) get_ptr_to_offset (b0, l4_offset);
u16 frag_offset;
clib_memcpy (&frag_offset, get_ptr_to_offset (b0, 2 + l4_offset), sizeof(frag_offset));
frag_offset = ntohs(frag_offset) >> 3;
if (frag_offset)
{
p5tuple_pkt->pkt.is_nonfirst_fragment = 1;
/* invalidate L4 offset so we don't try to find L4 info */
l4_offset += b0->current_length;
}
else
{
/* First fragment: skip the frag header and move on. */
l4_offset += 8;
}
}
else
{
u8 nwords = *(u8 *) get_ptr_to_offset (b0, 1 + l4_offset);
proto = *(u8 *) get_ptr_to_offset (b0, l4_offset);
l4_offset += 8 * (1 + (u16) nwords);
}
#ifdef FA_NODE_VERBOSE_DEBUG
clib_warning ("ACL_FA_NODE_DBG: new proto: %d, new offset: %d",
proto, l4_offset);
@ -369,13 +408,26 @@ acl_fill_5tuple (acl_main_t * am, vlib_buffer_t * b0, int is_ip6,
offsetof (ip4_header_t,
protocol) + l3_offset);
l4_offset = l3_offset + sizeof (ip4_header_t);
u16 flags_and_fragment_offset;
clib_memcpy (&flags_and_fragment_offset,
get_ptr_to_offset (b0,
offsetof (ip4_header_t,
flags_and_fragment_offset)) + l3_offset,
sizeof(flags_and_fragment_offset));
flags_and_fragment_offset = ntohs (flags_and_fragment_offset);
/* non-initial fragments have non-zero offset */
if ((PREDICT_FALSE(0xfff & flags_and_fragment_offset)))
{
p5tuple_pkt->pkt.is_nonfirst_fragment = 1;
/* invalidate L4 offset so we don't try to find L4 info */
l4_offset += b0->current_length;
}
}
/* Remainder of the key and per-packet non-key data */
p5tuple_pkt->kv.key[4] = 0;
p5tuple_pkt->kv.value = 0;
p5tuple_pkt->l4.proto = proto;
if (PREDICT_TRUE (offset_within_packet (b0, l4_offset)))
{
p5tuple_pkt->l4.proto = proto;
p5tuple_pkt->pkt.l4_valid = 1;
if (icmp_protos[is_ip6] == proto)
{
@ -533,6 +585,10 @@ acl_fa_conn_list_add_session (acl_main_t * am, u32 sess_id)
if (~0 == am->fa_conn_list_head[list_id]) {
am->fa_conn_list_head[list_id] = sess_id;
/* If it is a first conn in any list, kick off the cleaner */
vlib_process_signal_event (am->vlib_main, am->fa_cleaner_node_index,
ACL_FA_CLEANER_RESCHEDULE, 0);
}
}
@ -556,7 +612,7 @@ acl_fa_conn_list_delete_session (acl_main_t *am, u32 sess_id)
am->fa_conn_list_head[sess->link_list_id] = sess->link_next_idx;
}
if (am->fa_conn_list_tail[sess->link_list_id] == sess_id) {
am->fa_conn_list_tail[sess->link_list_id] = sess->link_next_idx;
am->fa_conn_list_tail[sess->link_list_id] = sess->link_prev_idx;
}
}
@ -982,14 +1038,6 @@ acl_out_ip4_fa_node_fn (vlib_main_t * vm,
/* *INDENT-OFF* */
#define foreach_acl_fa_cleaner_error \
_(EVENT_CYCLE, "event processing cycle") \
_(TIMER_RESTARTED, "restarted session timers") \
_(DELETED_SESSIONS, "deleted sessions") \
_(ALREADY_DELETED, "timer event for already deleted session") \
_(DELETE_BY_SW_IF_INDEX, "delete by sw_if_index event") \
_(DELETE_BY_SW_IF_INDEX_OK, "delete by sw_if_index completed ok") \
_(WAIT_WITHOUT_TIMEOUT, "process waits without timeout") \
_(WAIT_WITH_TIMEOUT, "process waits with timeout") \
_(UNKNOWN_EVENT, "unknown event received") \
/* end of errors */
@ -1067,7 +1115,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
f64 cpu_cps = vm->clib_time.clocks_per_second;
u64 next_expire;
/* We should call timer wheel at least twice a second */
u64 max_timer_wait_interval = cpu_cps / 2;
u64 max_timer_wait_interval = cpu_cps / 2;
am->fa_current_cleaner_timer_wait_interval = max_timer_wait_interval;
u32 *expired = NULL;
@ -1079,10 +1127,24 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
{
u32 count_deleted_sessions = 0;
u32 count_already_deleted = 0;
u32 count_timer_restarted = 0;
now = clib_cpu_time_now ();
next_expire = now + am->fa_current_cleaner_timer_wait_interval;
int has_pending_conns = 0;
u8 tt;
for(tt = 0; tt < ACL_N_TIMEOUTS; tt++)
{
if (~0 != am->fa_conn_list_head[tt])
has_pending_conns = 1;
}
/* If no pending connections then no point in timing out */
if (!has_pending_conns)
{
am->fa_cleaner_cnt_wait_without_timeout++;
(void) vlib_process_wait_for_event (vm);
event_type = vlib_process_get_events (vm, &event_data);
}
else
{
f64 timeout = ((i64) next_expire - (i64) now) / cpu_cps;
if (timeout <= 0)
@ -1095,11 +1157,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
/* Timing wheel code is happier if it is called regularly */
if (timeout > 0.5)
timeout = 0.5;
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.
index,
ACL_FA_CLEANER_ERROR_WAIT_WITH_TIMEOUT,
1);
am->fa_cleaner_cnt_wait_with_timeout++;
(void) vlib_process_wait_for_event_or_clock (vm, timeout);
event_type = vlib_process_get_events (vm, &event_data);
}
@ -1119,11 +1177,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
uword *sw_if_index0;
vec_foreach (sw_if_index0, event_data)
{
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.
index,
ACL_FA_CLEANER_ERROR_DELETE_BY_SW_IF_INDEX,
1);
am->fa_cleaner_cnt_delete_by_sw_index++;
#ifdef FA_NODE_VERBOSE_DEBUG
clib_warning
("ACL_FA_NODE_CLEAN: ACL_FA_CLEANER_DELETE_BY_SW_IF_INDEX: %d",
@ -1134,11 +1188,7 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
acl_fa_clean_sessions_by_sw_if_index (am, *sw_if_index0,
&count);
count_deleted_sessions += count;
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.
index,
ACL_FA_CLEANER_ERROR_DELETE_BY_SW_IF_INDEX_OK,
result);
am->fa_cleaner_cnt_delete_by_sw_index_ok += result;
}
}
break;
@ -1147,17 +1197,21 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
clib_warning ("ACL plugin connection cleaner: unknown event %u",
event_type);
#endif
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.
index,
ACL_FA_CLEANER_ERROR_UNKNOWN_EVENT, 1);
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.
index,
ACL_FA_CLEANER_ERROR_UNKNOWN_EVENT, 1);
am->fa_cleaner_cnt_unknown_event++;
break;
}
{
u8 tt = 0;
for(tt = 0; tt < ACL_N_TIMEOUTS; tt++) {
while((vec_len(expired) < 2*am->fa_max_deleted_sessions_per_interval) && (~0 != am->fa_conn_list_head[tt]) && (acl_fa_conn_has_timed_out(am, now, am->fa_conn_list_head[tt]))) {
while((vec_len(expired) < 2*am->fa_max_deleted_sessions_per_interval)
&& (~0 != am->fa_conn_list_head[tt])
&& (acl_fa_conn_has_timed_out(am, now,
am->fa_conn_list_head[tt]))) {
u32 sess_id = am->fa_conn_list_head[tt];
vec_add1(expired, sess_id);
acl_fa_conn_list_delete_session(am, sess_id);
@ -1165,7 +1219,6 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
}
}
u32 *psid = NULL;
vec_foreach (psid, expired)
{
@ -1181,15 +1234,22 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
/* clib_warning ("ACL_FA_NODE_CLEAN: Restarting timer for session %d",
(int) session_index); */
/* Pretend we did this in the past, at last_active moment */
count_timer_restarted++;
/* There was activity on the session, so the idle timeout
has not passed. Enqueue for another time period. */
acl_fa_conn_list_add_session(am, session_index);
/* FIXME: When/if moving to timer wheel,
pretend we did this in the past,
at last_active moment, so the timer is accurate */
am->fa_cleaner_cnt_timer_restarted++;
}
else
{
/* clib_warning ("ACL_FA_NODE_CLEAN: Deleting session %d",
(int) session_index); */
acl_fa_delete_session (am, sw_if_index, session_index);
count_deleted_sessions++;
count_deleted_sessions++;
}
}
else
@ -1210,22 +1270,9 @@ acl_fa_session_cleaner_process (vlib_main_t * vm, vlib_node_runtime_t * rt,
if (am->fa_current_cleaner_timer_wait_interval < max_timer_wait_interval)
am->fa_current_cleaner_timer_wait_interval += cpu_cps * am->fa_cleaner_wait_time_increment;
}
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.index,
ACL_FA_CLEANER_ERROR_EVENT_CYCLE, 1);
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.index,
ACL_FA_CLEANER_ERROR_TIMER_RESTARTED,
count_timer_restarted);
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.index,
ACL_FA_CLEANER_ERROR_DELETED_SESSIONS,
count_deleted_sessions);
vlib_node_increment_counter (vm,
acl_fa_session_cleaner_process_node.index,
ACL_FA_CLEANER_ERROR_ALREADY_DELETED,
count_already_deleted);
am->fa_cleaner_cnt_event_cycles++;
am->fa_cleaner_cnt_deleted_sessions += count_deleted_sessions;
am->fa_cleaner_cnt_already_deleted += count_already_deleted;
}
/* NOT REACHED */
return 0;

View File

@ -22,10 +22,12 @@
typedef union {
u64 as_u64;
struct {
u8 tcp_flags_valid;
u8 tcp_flags;
u8 is_input;
u8 l4_valid;
u8 tcp_flags_valid:1;
u8 is_input:1;
u8 l4_valid:1;
u8 is_nonfirst_fragment:1;
u8 flags_reserved:4;
};
} fa_packet_info_t;

File diff suppressed because it is too large Load Diff

View File

@ -419,56 +419,35 @@ dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
}
else if (ETHERNET_INTERFACE_FLAG_CONFIG_MTU (flags))
{
/*
* DAW-FIXME: The Cisco VIC firmware does not provide an api for a
* driver to dynamically change the mtu. If/when the
* VIC firmware gets fixed, then this should be removed.
*/
if (xd->pmd == VNET_DPDK_PMD_ENIC)
int rv;
xd->port_conf.rxmode.max_rx_pkt_len = hi->max_packet_bytes;
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
rte_eth_dev_stop (xd->device_index);
rv = rte_eth_dev_configure
(xd->device_index, xd->rx_q_used, xd->tx_q_used, &xd->port_conf);
if (rv < 0)
vlib_cli_output (vlib_get_main (),
"rte_eth_dev_configure[%d]: err %d",
xd->device_index, rv);
rte_eth_dev_set_mtu (xd->device_index, hi->max_packet_bytes);
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
struct rte_eth_dev_info dev_info;
/*
* Restore mtu to what has been set by CIMC in the firmware cfg.
*/
rte_eth_dev_info_get (xd->device_index, &dev_info);
hi->max_packet_bytes = dev_info.max_rx_pktlen;
vlib_cli_output (vlib_get_main (),
"Cisco VIC mtu can only be changed "
"using CIMC then rebooting the server!");
}
else
{
int rv;
xd->port_conf.rxmode.max_rx_pkt_len = hi->max_packet_bytes;
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
rte_eth_dev_stop (xd->device_index);
rv = rte_eth_dev_configure
(xd->device_index, xd->rx_q_used, xd->tx_q_used, &xd->port_conf);
int rv = rte_eth_dev_start (xd->device_index);
if (!rv && xd->default_mac_address)
rv = rte_eth_dev_default_mac_addr_set (xd->device_index,
(struct ether_addr *)
xd->default_mac_address);
if (rv < 0)
vlib_cli_output (vlib_get_main (),
"rte_eth_dev_configure[%d]: err %d",
xd->device_index, rv);
rte_eth_dev_set_mtu (xd->device_index, hi->max_packet_bytes);
if (xd->flags & DPDK_DEVICE_FLAG_ADMIN_UP)
{
int rv = rte_eth_dev_start (xd->device_index);
if (!rv && xd->default_mac_address)
rv = rte_eth_dev_default_mac_addr_set (xd->device_index,
(struct ether_addr *)
xd->default_mac_address);
if (rv < 0)
clib_warning ("rte_eth_dev_start %d returned %d",
xd->device_index, rv);
}
clib_warning ("rte_eth_dev_start %d returned %d",
xd->device_index, rv);
}
}
return old;
}
@ -655,11 +634,13 @@ dpdk_lib_init (dpdk_main_t * dm)
{
xd->tx_conf.txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS;
port_conf_template.rxmode.jumbo_frame = 0;
port_conf_template.rxmode.enable_scatter = 0;
}
else
{
xd->tx_conf.txq_flags &= ~ETH_TXQ_FLAGS_NOMULTSEGS;
port_conf_template.rxmode.jumbo_frame = 1;
port_conf_template.rxmode.enable_scatter = 1;
xd->flags |= DPDK_DEVICE_FLAG_MAYBE_MULTISEG;
}
@ -1065,16 +1046,13 @@ dpdk_lib_init (dpdk_main_t * dm)
hi = vnet_get_hw_interface (dm->vnet_main, xd->vlib_hw_if_index);
/*
* DAW-FIXME: The Cisco VIC firmware does not provide an api for a
* driver to dynamically change the mtu. If/when the
* VIC firmware gets fixed, then this should be removed.
* For cisco VIC vNIC, set default to VLAN strip enabled, unless
* specified otherwise in the startup config.
* For other NICs default to VLAN strip disabled, unless specified
* otherwis in the startup config.
*/
if (xd->pmd == VNET_DPDK_PMD_ENIC)
{
/*
* Initialize mtu to what has been set by CIMC in the firmware cfg.
*/
hi->max_packet_bytes = dev_info.max_rx_pktlen;
if (devconf->vlan_strip_offload != DPDK_DEVICE_VLAN_STRIP_OFF)
vlan_strip = 1; /* remove vlan tag from VIC port by default */
else

View File

@ -272,9 +272,11 @@ static clib_error_t *
memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
memif_main_t *apm = &memif_main;
memif_msg_t msg;
vlib_main_t *vm = vlib_get_main ();
memif_msg_t msg = { 0 };
vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
memif_if_t *mif = pool_elt_at_index (apm->interfaces, hw->dev_instance);
static clib_error_t *error = 0;
if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
mif->flags |= MEMIF_IF_FLAG_ADMIN_UP;
@ -286,11 +288,17 @@ memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
{
msg.version = MEMIF_VERSION;
msg.type = MEMIF_MSG_TYPE_DISCONNECT;
send (mif->connection.fd, &msg, sizeof (msg), 0);
if (send (mif->connection.fd, &msg, sizeof (msg), 0) < 0)
{
clib_unix_warning ("Failed to send disconnect request");
error = clib_error_return_unix (0, "send fd %d",
mif->connection.fd);
memif_disconnect (vm, mif);
}
}
}
return 0;
return error;
}
static clib_error_t *

View File

@ -85,7 +85,7 @@ memif_connect (vlib_main_t * vm, memif_if_t * mif)
VNET_HW_INTERFACE_FLAG_LINK_UP);
}
static void
void
memif_disconnect (vlib_main_t * vm, memif_if_t * mif)
{
vnet_main_t *vnm = vnet_get_main ();
@ -241,6 +241,7 @@ memif_process_connect_req (memif_pending_conn_t * pending_conn,
uf->private_data = mif->if_index << 1;
mif->connection = pending_conn->connection;
pool_put (mm->pending_conns, pending_conn);
pending_conn = 0;
memif_connect (vm, mif);
@ -248,7 +249,22 @@ response:
resp.version = MEMIF_VERSION;
resp.type = MEMIF_MSG_TYPE_CONNECT_RESP;
resp.retval = retval;
send (fd, &resp, sizeof (resp), 0);
if (send (fd, &resp, sizeof (resp), 0) < 0)
{
DEBUG_UNIX_LOG ("Failed to send connection response");
error = clib_error_return_unix (0, "send fd %d", fd);
if (pending_conn)
memif_remove_pending_conn (pending_conn);
else
memif_disconnect (vm, mif);
}
if (retval > 0)
{
if (shm_fd >= 0)
close (shm_fd);
if (int_fd >= 0)
close (int_fd);
}
return error;
}
@ -511,7 +527,8 @@ memif_connect_master (vlib_main_t * vm, memif_if_t * mif)
{
u16 slot = i * (1 << mif->log2_ring_size) + j;
ring->desc[j].region = 0;
ring->desc[j].offset = buffer_offset + (slot * mif->buffer_size);
ring->desc[j].offset =
buffer_offset + (u32) (slot * mif->buffer_size);
ring->desc[j].buffer_length = mif->buffer_size;
}
}
@ -524,7 +541,8 @@ memif_connect_master (vlib_main_t * vm, memif_if_t * mif)
u16 slot =
(i + mif->num_s2m_rings) * (1 << mif->log2_ring_size) + j;
ring->desc[j].region = 0;
ring->desc[j].offset = buffer_offset + (slot * mif->buffer_size);
ring->desc[j].offset =
buffer_offset + (u32) (slot * mif->buffer_size);
ring->desc[j].buffer_length = mif->buffer_size;
}
}
@ -595,6 +613,11 @@ memif_process (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
f64 start_time, last_run_duration = 0, now;
sockfd = socket (AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0)
{
DEBUG_UNIX_LOG ("socket AF_UNIX");
return 0;
}
sun.sun_family = AF_UNIX;
template.read_function = memif_conn_fd_read_ready;
@ -734,26 +757,28 @@ int
memif_worker_thread_enable ()
{
/* if worker threads are enabled, switch to polling mode */
/* *INDENT-OFF* */
foreach_vlib_main ((
{
vlib_node_set_state (this_vlib_main,
memif_input_node.index,
VLIB_NODE_STATE_POLLING);
}));
/* *INDENT-ON* */
return 0;
}
int
memif_worker_thread_disable ()
{
/* *INDENT-OFF* */
foreach_vlib_main ((
{
vlib_node_set_state (this_vlib_main,
memif_input_node.index,
VLIB_NODE_STATE_INTERRUPT);
}));
/* *INDENT-ON* */
return 0;
}

View File

@ -194,6 +194,7 @@ typedef struct
int memif_create_if (vlib_main_t * vm, memif_create_if_args_t * args);
int memif_delete_if (vlib_main_t * vm, u64 key);
void memif_disconnect (vlib_main_t * vm, memif_if_t * mif);
clib_error_t *memif_plugin_api_hookup (vlib_main_t * vm);
#ifndef __NR_memfd_create

View File

@ -214,20 +214,19 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (n_trace > 0))
{
if (b0)
{
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next0, b0,
/* follow_chain */ 0);
vlib_set_trace_count (vm, node, --n_trace);
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->next_index = next0;
tr->hw_if_index = mif->hw_if_index;
tr->ring = rid;
}
/* b0 */
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next0, b0,
/* follow_chain */ 0);
vlib_set_trace_count (vm, node, --n_trace);
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->next_index = next0;
tr->hw_if_index = mif->hw_if_index;
tr->ring = rid;
if (n_trace && b1)
if (n_trace)
{
/* b1 */
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next1, b1,
/* follow_chain */ 0);
@ -286,17 +285,14 @@ memif_device_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (n_trace > 0))
{
if (b0)
{
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next0, b0,
/* follow_chain */ 0);
vlib_set_trace_count (vm, node, --n_trace);
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->next_index = next0;
tr->hw_if_index = mif->hw_if_index;
tr->ring = rid;
}
memif_input_trace_t *tr;
vlib_trace_buffer (vm, node, next0, b0,
/* follow_chain */ 0);
vlib_set_trace_count (vm, node, --n_trace);
tr = vlib_add_trace (vm, node, b0, sizeof (*tr));
tr->next_index = next0;
tr->hw_if_index = mif->hw_if_index;
tr->ring = rid;
}

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