Compare commits

..

1 Commits

Author SHA1 Message Date
24ba2fc8ce Whitespace probe for CI
Cherrypicked from https://gerrit.fd.io/r/#/c/1046/

Change-Id: I3744ee19a21dcea2885aef2800244c93aa19763a
Signed-off-by: Ed Warnicke <eaw@cisco.com>
(cherry picked from commit a20935192a)
2016-05-13 19:57:10 +00:00
126 changed files with 2028 additions and 3049 deletions

View File

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

View File

@ -30,7 +30,6 @@ OS_VERSION_ID= $(shell grep '^VERSION_ID=' /etc/os-release | cut -f2- -d= | sed
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
DEB_DEPENDS += doxygen graphviz
ifeq ($(OS_VERSION_ID),14.04)
DEB_DEPENDS += openjdk-8-jdk-headless
else
@ -40,8 +39,9 @@ endif
RPM_DEPENDS_GROUPS = 'Development Tools'
RPM_DEPENDS = redhat-lsb glibc-static java-1.8.0-openjdk-devel yum-utils
RPM_DEPENDS += openssl-devel https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm apr-devel
RPM_DEPENDS += doxygen graphviz
#RPM_DEPENDS += doxygen # TODO
EPEL_DEPENDS = libconfuse-devel ganglia-devel
#EPEL_DEPENDS += graphviz # TODO
ifneq ($(wildcard $(STARTUP_DIR)/startup.conf),)
STARTUP_CONF ?= $(STARTUP_DIR)/startup.conf
@ -53,7 +53,7 @@ endif
.PHONY: help bootstrap wipe wipe-release build build-release rebuild rebuild-release
.PHONY: run run-release debug debug-release build-vat run-vat pkg-deb pkg-rpm
.PHONY: ctags cscope doxygen wipe-doxygen
.PHONY: ctags cscope
help:
@echo "Make Targets:"
@ -75,8 +75,6 @@ help:
@echo " pkg-rpm - build RPM packages"
@echo " ctags - (re)generate ctags database"
@echo " cscope - (re)generate cscope database"
@echo " doxygen - (re)generate documentation"
@echo " wipe-doxygen - wipe all generated documentation"
@echo ""
@echo "Make Arguments:"
@echo " V=[0|1] - set build verbosity level"
@ -128,11 +126,11 @@ bootstrap: $(BR)/.bootstrap.ok
install-dep:
ifeq ($(OS_ID),ubuntu)
ifeq ($(OS_VERSION_ID),14.04)
@sudo -E apt-get $(CONFIRM) install software-properties-common
@sudo -E add-apt-repository $(CONFIRM) ppa:openjdk-r/ppa
@sudo -E apt-get update
@sudo apt-get $(CONFIRM) install software-properties-common
@sudo add-apt-repository $(CONFIRM) ppa:openjdk-r/ppa
@sudo apt-get update
endif
@sudo -E apt-get $(CONFIRM) install $(DEB_DEPENDS)
@sudo apt-get $(CONFIRM) install $(DEB_DEPENDS)
else ifneq ("$(wildcard /etc/redhat-release)","")
@sudo yum groupinstall $(CONFIRM) $(RPM_DEPENDS_GROUPS)
@sudo yum install $(CONFIRM) $(RPM_DEPENDS)
@ -214,10 +212,6 @@ cscope: cscope.files
@cscope -b -q -v
#
# Build the documentation
#
DOXY_INPUT = \
README.md \
vppinfra \
@ -228,6 +222,7 @@ DOXY_INPUT = \
vpp \
vpp-api
.PHONY: doxygen
doxygen:
@mkdir -p "$(BR)/docs"
ROOT="$(WS_ROOT)" \

View File

@ -1,4 +0,0 @@
#!/bin/sh -e
# Add the vpp group
groupadd -f -r vpp

View File

@ -3,8 +3,6 @@ Description=Vector Packet Processing Process
After=syslog.target network.target auditd.service
[Service]
ExecStartPre=-/bin/rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api
ExecStartPre=-/sbin/modprobe uio_pci_generic
ExecStart=/usr/bin/vpp -c /etc/vpp/startup.conf
Type=simple
Restart=on-failure

View File

@ -49,10 +49,6 @@ allocator (mheap.c), extendable printf-like interface built on top of vectors
time-based function calls (timer.c).
TODO: reference and describe only the .h files
%pre
# Add the vpp group
groupadd -f -r vpp
%install
#
# binaries
@ -67,7 +63,7 @@ install -p -m 755 %{_vpp_build_dir}/vppapigen/vppapigen %{buildroot}%{_bindir}
mkdir -p -m755 %{buildroot}/etc/vpp
mkdir -p -m755 %{buildroot}/etc/sysctl.d
install -p -m 644 vpp.service %{buildroot}%{_unitdir}
install -p -m 644 ../../vpp/conf/startup.uiopcigeneric.conf %{buildroot}/etc/vpp/startup.conf
install -p -m 644 ../../vpp/conf/startup.conf %{buildroot}/etc/vpp
install -p -m 644 ../../vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d
#
# libraries

View File

@ -1,2 +0,0 @@
#!/bin/sh
echo csit-verified

View File

@ -5,15 +5,6 @@ rm -rf dpdk-includes
mkdir dpdk-includes
(cd $1/dpdk/include; tar cfh - . | (cd ../../../dpdk-includes; tar xf -))
# If CDPATH is set, the "Change Directory" builtin (cd) will output the
# destination directory when a relative path is passed as an argument.
# In this case, this has the negative side effect of polluting the "paths"
# variable with the destination directory, breaking the package generation.
#
# Patient: Doctor! Doctor! It hurts when I do this...
# Doctor: Don't do that!
#
unset CDPATH
paths=`cd dpdk-includes; find . -type f -print`
rm -f $2

View File

@ -30,7 +30,7 @@ if [ -n "${ADDS}" ]; then
print_changelog_item
fi
for TAG in $(git tag -l 'v[0-9][0-9].[0-9][0-9]' | sort -r ); do
for TAG in $(git tag -l 'v[0-9].[0-9].[0-9]' | sort -r ); do
VER=$(echo ${TAG}| sed -e 's/^v//')
DESC=$(git tag -l -n20 ${TAG} | tail -n+2 | sed -e 's/^ */ /')
print_changelog_item

View File

@ -4,10 +4,6 @@ TAG=$(git describe | cut -d- -f1 | sed -e 's/^v//')
ADD=$(git describe | cut -s -d- -f2)
CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4)
if [ -n "${BUILD_NUMBER}" ]; then
BLD="~b${BUILD_NUMBER}"
fi
if [ "$1" = "rpm-version" ]; then
echo ${TAG}
exit
@ -16,12 +12,12 @@ fi
if [ "$1" = "rpm-release" ]; then
[ -z "${ADD}" ] && echo release && exit
CMT=$(git describe --dirty --match 'v*'| cut -s -d- -f3,4 | sed 's/-/_/')
echo ${ADD}${CMT:+~${CMT}}${BLD}
echo ${ADD}~${CMT}
exit
fi
if [ -n "${ADD}" ]; then
echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
echo ${TAG}-${ADD}~${CMT}
else
echo ${TAG}
fi

View File

@ -27,15 +27,6 @@ elif [ -f /etc/redhat-release ];then
DISTRIB_CODENAME=`lsb_release -sc`
DISTRIB_DESCRIPTION=`lsb_release -sd`
fi
KERNEL_OS=`uname -o`
KERNEL_MACHINE=`uname -m`
KERNEL_RELEASE=`uname -r`
KERNEL_VERSION=`uname -v`
echo KERNEL_OS: $KERNEL_OS
echo KERNEL_MACHINE: $KERNEL_MACHINE
echo KERNEL_RELEASE: $KERNEL_RELEASE
echo KERNEL_VERSION: $KERNEL_VERSION
echo DISTRIB_ID: $DISTRIB_ID
echo DISTRIB_RELEASE: $DISTRIB_RELEASE
echo DISTRIB_CODENAME: $DISTRIB_CODENAME

View File

@ -1,28 +1,6 @@
/*
* Copyright (c) <YEAR> <YOUR AFFILIATION HERE>
*
* 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.
*/
/* Doxygen directory documentation */
/**
@dir
@brief Someone please fix this description
@todo This directory needs a description.
This is where you would document the contents of a directory.
This looks like a C file but it is not part of the build; it is purely
for documentation.
*/

View File

@ -281,7 +281,7 @@ OPTIMIZE_OUTPUT_VHDL = NO
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING = def=C api=C
EXTENSION_MAPPING = def=C
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
@ -796,7 +796,7 @@ INPUT_ENCODING = UTF-8
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl,
# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js.
FILE_PATTERNS = *.md *.c *.h *.def *.inc *.S *.dox *.api
FILE_PATTERNS = *.md *.c *.h *.def *.inc *.S *.dox
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@ -898,9 +898,7 @@ INPUT_FILTER =
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS = \
*.c=$(ROOT)/doxygen/filter_c.py \
*.api=$(ROOT)/doxygen/filter_api.py
FILTER_PATTERNS = *.c=$(ROOT)/doxygen/filter_c.py
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will also be used to filter the input files that are used for

View File

@ -1,45 +0,0 @@
#!/usr/bin/env python
# Copyright (c) 2016 Comcast Cable Communications Management, LLC.
#
# 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.
# Filter for vpe.api to make it Doxygenish.
import sys, re
if len(sys.argv) < 2:
sys.stderr.write("Usage: %s <filename>\n" % (sys.argv[0]))
sys.exit(1)
patterns = [
# Search for "define" blocks and treat them as structs
( re.compile(r"^.*(manual_.[^\s]+\s+)?define\s+(?P<name>[^\s]+)"), r"typedef struct vl_api_\g<name>_t"),
# For every "brief" statement at the start of a comment block, add an
# xref with whatever is on the same line. This gives us an index page
# with all the API methods in one place.
# XXX Commented out for now; works but duplicates the brief text in the
# struct documentation
#( re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)(\*/)$"), r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'), # capture inline comment close
#( re.compile(r"/\*\*\s*(?P<b>[\\@]brief)\s+(?P<c>.+)$"), r'/** @xrefitem api "" "VPP API" \g<c> \g<b> \g<c>'),
# Since structs don't have params, replace @param with @tparam
( re.compile("[\\@]param\\b"), "@tparam"),
]
with open(sys.argv[1]) as fd:
for line in fd:
str = line[:-1] # strip \n
for p in patterns:
str = p[0].sub(p[1], str)
sys.stdout.write(str+"\n")

View File

@ -1,19 +1,4 @@
#!/usr/bin/env python
# Copyright (c) 2016 Comcast Cable Communications Management, LLC.
#
# 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.
# Filter for .c files to make various preprocessor tricks Doxygenish
import sys, re
@ -46,7 +31,7 @@ patterns = [
with open(sys.argv[1]) as fd:
for line in fd:
str = line[:-1] # filter \n
str = line
for p in patterns:
str = p[0].sub(p[1], str)
sys.stdout.write(str+"\n")
sys.stdout.write(str)

View File

@ -1,148 +0,0 @@
diff -ur dpdk-16.04.orig/drivers/net/enic/enic.h dpdk-16.04/drivers/net/enic/enic.h
--- dpdk-16.04.orig/drivers/net/enic/enic.h 2016-05-26 16:59:16.531326660 -0700
+++ dpdk-16.04/drivers/net/enic/enic.h 2016-05-26 16:59:52.689262489 -0700
@@ -91,6 +91,11 @@
struct enic_fdir_node *nodes[ENICPMD_FDIR_MAX];
};
+struct enic_soft_stats {
+ rte_atomic64_t rx_nombuf;
+ rte_atomic64_t rx_packet_errors;
+};
+
/* Per-instance private data structure */
struct enic {
struct enic *next;
@@ -133,6 +138,8 @@
/* interrupt resource */
struct vnic_intr intr;
unsigned int intr_count;
+
+ struct enic_soft_stats soft_stats;
};
static inline unsigned int enic_cq_rq(__rte_unused struct enic *enic, unsigned int rq)
diff -ur dpdk-16.04.orig/drivers/net/enic/enic_main.c dpdk-16.04/drivers/net/enic/enic_main.c
--- dpdk-16.04.orig/drivers/net/enic/enic_main.c 2016-05-26 16:59:16.533326822 -0700
+++ dpdk-16.04/drivers/net/enic/enic_main.c 2016-05-26 17:08:11.768801926 -0700
@@ -142,22 +142,51 @@
}
+static void enic_clear_soft_stats(struct enic *enic)
+{
+ struct enic_soft_stats *soft_stats = &enic->soft_stats;
+ rte_atomic64_clear(&soft_stats->rx_nombuf);
+ rte_atomic64_clear(&soft_stats->rx_packet_errors);
+}
+
+static void enic_init_soft_stats(struct enic *enic)
+{
+ struct enic_soft_stats *soft_stats = &enic->soft_stats;
+ rte_atomic64_init(&soft_stats->rx_nombuf);
+ rte_atomic64_init(&soft_stats->rx_packet_errors);
+ enic_clear_soft_stats(enic);
+}
+
void enic_dev_stats_clear(struct enic *enic)
{
if (vnic_dev_stats_clear(enic->vdev))
dev_err(enic, "Error in clearing stats\n");
+ enic_clear_soft_stats(enic);
}
void enic_dev_stats_get(struct enic *enic, struct rte_eth_stats *r_stats)
{
struct vnic_stats *stats;
+ struct enic_soft_stats *soft_stats = &enic->soft_stats;
+ int64_t rx_truncated;
+ uint64_t rx_packet_errors;
if (vnic_dev_stats_dump(enic->vdev, &stats)) {
dev_err(enic, "Error in getting stats\n");
return;
}
- r_stats->ipackets = stats->rx.rx_frames_ok;
+ /* The number of truncated packets can only be calculated by
+ * subtracting a hardware counter from error packets received by
+ * the driver. Note: this causes transient inaccuracies in the
+ * ipackets count. Also, the length of truncated packets are
+ * counted in ibytes even though truncated packets are dropped
+ * which can make ibytes be slightly higher than it should be.
+ */
+ rx_packet_errors = rte_atomic64_read(&soft_stats->rx_packet_errors);
+ rx_truncated = rx_packet_errors - stats->rx.rx_errors;
+
+ r_stats->ipackets = stats->rx.rx_frames_ok - rx_truncated;
r_stats->opackets = stats->tx.tx_frames_ok;
r_stats->ibytes = stats->rx.rx_bytes_ok;
@@ -166,10 +195,9 @@
r_stats->ierrors = stats->rx.rx_errors + stats->rx.rx_drop;
r_stats->oerrors = stats->tx.tx_errors;
- r_stats->imissed = stats->rx.rx_no_bufs;
+ r_stats->imissed = stats->rx.rx_no_bufs + rx_truncated;
- r_stats->imcasts = stats->rx.rx_multicast_frames_ok;
- r_stats->rx_nombuf = stats->rx.rx_no_bufs;
+ r_stats->rx_nombuf = rte_atomic64_read(&soft_stats->rx_nombuf);
}
void enic_del_mac_address(struct enic *enic)
@@ -755,6 +783,8 @@
{
int ret;
+ enic_init_soft_stats(enic);
+
ret = enic_set_rss_nic_cfg(enic);
if (ret) {
dev_err(enic, "Failed to config nic, aborting.\n");
diff -ur dpdk-16.04.orig/drivers/net/enic/enic_rxtx.c dpdk-16.04/drivers/net/enic/enic_rxtx.c
--- dpdk-16.04.orig/drivers/net/enic/enic_rxtx.c 2016-05-26 16:59:16.522325929 -0700
+++ dpdk-16.04/drivers/net/enic/enic_rxtx.c 2016-05-26 16:59:52.694262896 -0700
@@ -251,6 +251,7 @@
struct vnic_cq *cq;
volatile struct cq_desc *cqd_ptr;
uint8_t color;
+ uint16_t nb_err = 0;
cq = &enic->cq[enic_cq_rq(enic, rq->index)];
rx_id = cq->to_clean; /* index of cqd, rqd, mbuf_table */
@@ -278,10 +279,7 @@
/* allocate a new mbuf */
nmb = rte_rxmbuf_alloc(rq->mp);
if (nmb == NULL) {
- dev_err(enic, "RX mbuf alloc failed port=%u qid=%u",
- enic->port_id, (unsigned)rq->index);
- rte_eth_devices[enic->port_id].
- data->rx_mbuf_alloc_failed++;
+ rte_atomic64_inc(&enic->soft_stats.rx_nombuf);
break;
}
@@ -323,9 +321,10 @@
rxmb->packet_type = enic_cq_rx_flags_to_pkt_type(&cqd);
enic_cq_rx_to_pkt_flags(&cqd, rxmb);
} else {
- rxmb->pkt_len = 0;
- rxmb->packet_type = 0;
- rxmb->ol_flags = 0;
+ rte_pktmbuf_free(rxmb);
+ rte_atomic64_inc(&enic->soft_stats.rx_packet_errors);
+ nb_err++;
+ continue;
}
rxmb->data_len = rxmb->pkt_len;
@@ -337,7 +336,7 @@
rx_pkts[nb_rx++] = rxmb;
}
- nb_hold += nb_rx;
+ nb_hold += nb_rx + nb_err;
cq->to_clean = rx_id;
if (nb_hold > rq->rx_free_thresh) {

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,3 @@
/*
* Copyright (c) 2016 Cisco and/or its affiliates.
* Copyright (c) 2016 Comcast Cable Communications Management, LLC.
*
* 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.
*/
/* Doxygen directory documentation */
/**
@dir

View File

@ -391,11 +391,6 @@ void *svm_map_region (svm_map_region_args_t *a)
svm_fd = shm_open((char *) shm_name, O_RDWR | O_CREAT | O_EXCL, 0777);
if (svm_fd >= 0) {
if (fchmod (svm_fd, 0770) < 0)
clib_unix_warning ("segment chmod");
/* This turns out to fail harmlessly if the client starts first */
if (fchown (svm_fd, a->uid, a->gid) < 0)
clib_unix_warning ("segment chown [ok if client starts first]");
vec_free(shm_name);
@ -620,19 +615,18 @@ static void svm_mutex_cleanup (void)
}
}
static void svm_region_init_internal (char *root_path, int uid, int gid)
static void svm_region_init_internal (char *root_path)
{
svm_region_t *rp;
svm_map_region_args_t _a, *a=&_a;
svm_map_region_args_t *a=0;
u64 ticks = clib_cpu_time_now();
uword randomize_baseva;
/* guard against klutz calls */
root_rp_refcount++;
if (root_rp)
return;
root_rp_refcount++;
atexit(svm_mutex_cleanup);
/* Randomize the shared-VM base at init time */
@ -641,14 +635,12 @@ static void svm_region_init_internal (char *root_path, int uid, int gid)
else
randomize_baseva = (ticks & 3) * MMAP_PAGESIZE;
memset (a, 0, sizeof (*a));
vec_validate(a,0);
a->root_path = root_path;
a->name = SVM_GLOBAL_REGION_NAME;
a->baseva = SVM_GLOBAL_REGION_BASEVA + randomize_baseva;
a->size = SVM_GLOBAL_REGION_SIZE;
a->flags = SVM_FLAGS_NODATA;
a->uid = uid;
a->gid = gid;
rp = svm_map_region (a);
ASSERT(rp);
@ -671,22 +663,18 @@ static void svm_region_init_internal (char *root_path, int uid, int gid)
svm_pop_heap (oldheap);
}
region_unlock(rp);
vec_free (a);
root_rp = rp;
}
void svm_region_init (void)
{
svm_region_init_internal (0, 0 /* uid */, 0 /* gid */);
svm_region_init_internal (0);
}
void svm_region_init_chroot (char *root_path)
{
svm_region_init_internal (root_path, 0 /* uid */, 0 /* gid */);
}
void svm_region_init_chroot_uid_gid (char *root_path, int uid, int gid)
{
svm_region_init_internal (root_path, uid, gid);
svm_region_init_internal (root_path);
}
void *svm_region_find_or_create (svm_map_region_args_t *a)

View File

@ -74,9 +74,6 @@ typedef struct svm_map_region_args_ {
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;
@ -111,7 +108,6 @@ typedef struct {
void *svm_region_find_or_create (svm_map_region_args_t *a);
void svm_region_init(void);
void svm_region_init_chroot(char *root_path);
void svm_region_init_chroot_uid_gid(char *root_path, int uid, int gid);
void svm_region_exit (void);
void svm_region_unmap(void *rp_arg);
void svm_client_scan (char *root_path);

View File

@ -134,10 +134,6 @@ typedef struct {
/* vector of message ranges */
vl_api_msg_range_t *msg_ranges;
/* gid for the api shared memory region */
int api_gid;
int api_uid;
/* Client-only data structures */
unix_shared_memory_queue_t *vl_input_queue;

View File

@ -647,14 +647,6 @@ vl_api_init (vlib_main_t *vm)
once = 1;
am->region_name = "/unset";
/*
* Eventually passed to fchown, -1 => "current user"
* instead of 0 => "root". A very fine disctinction at best.
*/
if (am->api_uid == 0)
am->api_uid = -1;
if (am->api_gid == 0)
am->api_gid = -1;
return (0);
}

View File

@ -133,8 +133,6 @@ int vl_client_api_map (char *region_name);
void vl_client_api_unmap (void);
void vl_set_memory_region_name (char *name);
void vl_set_memory_root_path (char *root_path);
void vl_set_memory_uid (int uid);
void vl_set_memory_gid (int gid);
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(char *svm_name, char *client_name,

View File

@ -197,23 +197,9 @@ void vl_set_memory_root_path (char *name)
am->root_path = name;
}
void vl_set_memory_uid (int uid)
{
api_main_t *am = &api_main;
am->api_uid = uid;
}
void vl_set_memory_gid (int gid)
{
api_main_t *am = &api_main;
am->api_gid = gid;
}
int vl_map_shmem (char *region_name, int is_vlib)
{
svm_map_region_args_t _a, *a = &_a;
svm_map_region_args_t *a = 0;
svm_region_t *vlib_rp, *root_rp;
void *oldheap;
vl_shmem_hdr_t *shmem_hdr=0;
@ -224,16 +210,16 @@ int vl_map_shmem (char *region_name, int is_vlib)
if (is_vlib == 0)
svm_region_init_chroot(am->root_path);
memset (a, 0, sizeof (*a));
vec_validate (a, 0);
a->name = region_name;
a->size = 16<<20;
a->flags = SVM_FLAGS_MHEAP;
a->uid = am->api_uid;
a->gid = am->api_gid;
vlib_rp = svm_region_find_or_create (a);
vec_free (a);
if (vlib_rp == 0)
return (-2);
@ -288,8 +274,24 @@ int vl_map_shmem (char *region_name, int is_vlib)
pthread_mutex_lock (&root_rp->mutex);
svm_client_scan_this_region_nolock (root_rp);
pthread_mutex_unlock (&root_rp->mutex);
}
pthread_mutex_unlock (&vlib_rp->mutex);
} else {
pthread_mutex_unlock (&vlib_rp->mutex);
/*
* Make sure the vlib app is really there...
* Wait up to 100 seconds...
*/
for (i = 0; i < 10000; i++) {
/* Yup, it's there, off we go... */
if (kill (am->shmem_hdr->vl_pid, 0) >= 0)
break;
ts.tv_sec = 0;
ts.tv_nsec = 10000*1000; /* 10 ms */
while (nanosleep(&ts, &tsrem) < 0)
ts = tsrem;
}
}
am->vlib_rp = vlib_rp;
vec_add1(am->mapped_shmem_regions, vlib_rp);
return 0;

View File

@ -343,6 +343,7 @@ typedef enum {
static u64 vector_rate_histogram[SLEEP_N_BUCKETS];
static void memclnt_queue_signal (int signum);
static void memclnt_queue_callback (vlib_main_t *vm);
static uword
@ -361,6 +362,8 @@ memclnt_process (vlib_main_t * vm,
f64 vector_rate;
vlib_set_queue_signal_callback (vm, memclnt_queue_callback);
am->vlib_signal = SIGUSR1;
signal (am->vlib_signal, memclnt_queue_signal);
if ((rv = memory_api_init(am->region_name)) < 0) {
clib_warning("memory_api_init returned %d, wait for godot...", rv);
@ -455,7 +458,6 @@ memclnt_process (vlib_main_t * vm,
}
event_type = vlib_process_wait_for_event_or_clock (vm, sleep_time);
vm->queue_signal_pending = 0;
vlib_process_get_events (vm, 0 /* event_data */);
if (vlib_time_now (vm) > dead_client_scan_time) {
@ -619,33 +621,27 @@ VLIB_REGISTER_NODE (memclnt_node,static) = {
.state = VLIB_NODE_STATE_DISABLED,
};
static void
memclnt_queue_signal (int signum)
{
vlib_main_t * vm = vlib_get_main();
vm->queue_signal_pending = 1;
vm->api_queue_nonempty = 1;
}
static void
memclnt_queue_callback (vlib_main_t *vm)
{
static volatile int * cursizep;
#if 0
/* If we need to manually suspend / resume the memclnt process */
vlib_node_t * n = vlib_get_node (vm, memclnt_node.index);
vlib_process_t * p = vlib_get_process_from_node (vm, n);
#endif
if (PREDICT_FALSE (cursizep == 0))
{
api_main_t *am = &api_main;
vl_shmem_hdr_t *shmem_hdr = am->shmem_hdr;
unix_shared_memory_queue_t * q;
if (shmem_hdr == 0)
return;
q = shmem_hdr->vl_input_queue;
if (q == 0)
return;
cursizep = &q->cursize;
}
if (*cursizep >= 1)
{
vm->queue_signal_pending = 1;
vm->api_queue_nonempty = 1;
vlib_process_signal_event (vm, memclnt_node.index,
/* event_type */ 0, /* event_data */ 0);
}
vm->queue_signal_pending = 0;
vlib_process_signal_event
(vm, memclnt_node.index, /* event_type */ 0, /* event_data */ 0);
}
void vl_enable_disable_memory_api (vlib_main_t *vm, int enable)
@ -1053,8 +1049,8 @@ clib_error_t *
vlibmemory_init (vlib_main_t * vm)
{
api_main_t *am = &api_main;
/* Normally NULL / 0, set by cmd line "api-segment" */
svm_region_init_chroot_uid_gid (am->root_path, am->api_uid, am->api_gid);
/* Normally NULL, can be set by cmd line "chroot {prefix foo}" */
svm_region_init_chroot (am->root_path);
return 0;
}

View File

@ -1,19 +1,3 @@
/*
* Copyright (c) 2016 Cisco and/or its affiliates.
* Copyright (c) 2016 Comcast Cable Communications Management, LLC.
*
* 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.
*/
/* Doxygen directory documentation */
/**
@dir

View File

@ -1,19 +1,3 @@
/*
* Copyright (c) 2016 Cisco and/or its affiliates.
* Copyright (c) 2016 Comcast Cable Communications Management, LLC.
*
* 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.
*/
/* Doxygen directory documentation */
/**
@dir

View File

@ -1,19 +1,3 @@
/*
* Copyright (c) 2016 Cisco and/or its affiliates.
* Copyright (c) 2016 Comcast Cable Communications Management, LLC.
*
* 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.
*/
/* Doxygen directory documentation */
/**
@dir

View File

@ -1414,8 +1414,9 @@ static void vlib_main_loop (vlib_main_t * vm)
/* frame */ 0,
cpu_time_now);
if (PREDICT_TRUE (vm->queue_signal_pending == 0))
vm->queue_signal_callback (vm);
if (PREDICT_FALSE(vm->queue_signal_pending))
if (vm->queue_signal_callback)
vm->queue_signal_callback (vm);
/* Next handle interrupts. */
{
@ -1532,15 +1533,11 @@ vlib_main_configure (vlib_main_t * vm, unformat_input_t * input)
VLIB_EARLY_CONFIG_FUNCTION (vlib_main_configure, "vlib");
static void dummy_queue_signal_callback (vlib_main_t * vm) { }
/* Main function. */
int vlib_main (vlib_main_t * vm, unformat_input_t * input)
{
clib_error_t * error;
vm->queue_signal_callback = dummy_queue_signal_callback;
clib_time_init (&vm->clib_time);
/* Turn on event log. */

View File

@ -58,8 +58,6 @@ libvnet_la_SOURCES += \
nobase_include_HEADERS += \
vnet/policer/police.h \
vnet/policer/policer.h \
vnet/policer/fix_types.h \
vnet/policer/xlate.h
########################################
@ -398,6 +396,30 @@ nobase_include_HEADERS += \
vnet/mpls-gre/error.def
########################################
# NSH Map: nsh
########################################
libvnet_la_SOURCES += \
vnet/nsh/nsh.c
nobase_include_HEADERS += \
vnet/nsh/nsh_packet.h \
vnet/nsh/nsh.h \
vnet/nsh/nsh_error.def
########################################
# Tunnel protocol: nsh-gre
########################################
# libvnet_la_SOURCES += \
# vnet/nsh-gre/nsh_gre.c \
# vnet/nsh-gre/encap.c \
# vnet/nsh-gre/decap.c
# nobase_include_HEADERS += \
# vnet/nsh-gre/nsh_gre.h
########################################
# Tunnel protocol: vxlan-gpe
########################################

View File

@ -1,4 +0,0 @@
#!/bin/bash
# to obtain dhcp address from leftpeer
dhclient -d -v eth1

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