Compare commits

...

36 Commits

Author SHA1 Message Date
Ed Warnicke
693f4358de Fix generate-deb-changelog to handle YY.MM release
generate-deb-changelog was only properly handling x.y.z
releases.  This patch fixes it to handle YY.MM.

Change-Id: Iaaee8ff747abd6754d021535c889f67ad2c9998f
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-06-15 23:18:38 -05:00
Damjan Marion
1f25d1a2ec Fix double-enqueued packet in interface-output dual-loop, fixes VPP-116
When speculative enqueue fails and a buffer needs to be moved to a new
node queue the original buffer is not correctly removed from the
original queue so buffer get send for transmit and encryption at the
same time. This issue will only be hit with the double loop so low
throughput traffic like pings will not hit the issue. This code path is
also only hit when the feature flag is enabled so will not be hit by
normal traffic

Patch also reorgnizes code to reduce number of branches in the interface
output node loop.

Change-Id: I3653400e58bdfd833e6c42823bab51586128b54b
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-15 16:38:41 +02:00
Damjan Marion
a55cf2c1e5 Reset new indirect adjacdncy template before using it
Change-Id: Ia69ba39364d4dfa1403c8fbb77b7990226bbcb85
Signed-off-by: Damjan Marion <damarion@cisco.com>
2016-06-15 16:17:44 +02:00
Pierre Pfister
584b99a012 VPP-117: Fix ip4 and ip6 lookup and rewrite traces
Previous patch was printing wrong data since rewrite node traces
an ethernet packet while other ip nodes trace an IP packet.

This patch introduces different tracing functions for:
- lookup node (where the fib index is valid)
- rewrite node (where an ethernet frame is available)
- other ip nodes (only the ip header is traced)

Change-Id: I5971a2e89ae8668f5aed4a410565a5f27e01fc22
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2016-06-13 13:30:47 +01:00
Dave Barach
cf2aa43150 VPP-106: fix performance hit due to unprefetched data read
Change-Id: I1325b60b6deadcb51631e178011a31ee70c06cc7
Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-09 09:50:38 -04:00
Pierre Pfister
363db88095 VPP-117: Add trace to ip4 and ip6 lookup nodes
The absence of trace in ip lookup nodes is misleading to many people.
This patch adds ip lookup tracing and therefore contribute to
worldwide happiness.

In addition, this patch makes sure sw_if_index[VLIB_TX] is
considered when tracing the fib_index value. In ip4/6-rewrite,
the value corresponds to the tx interface index. The formatting
function is therefore modified to take that case into account.

Change-Id: I5915f0446a15c45e391eedfdfcedd9057aa6a237
Signed-off-by: Pierre Pfister <ppfister@cisco.com>
2016-06-09 13:38:05 +00:00
Ed Warnicke
419e65629c VPP-127 Removed spurious use of sudo
Change-Id: I1eb18fc6379db30fb802e3b929931788f54e7dc2
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-06-09 01:38:42 +00:00
John Lo
90da24356f VPP-115: Remove stale ACL CLIs which are not supported
The old ACL CLIs still show up in CLI help which can confuse users.

Change-Id: I9a3722d3d649c4370df6a09b2c07628e7e4aa0f4
Signed-off-by: John Lo <loj@cisco.com>
2016-06-09 00:44:33 +00:00
Ed Warnicke
3c1f5321e5 VPP-127: Make rpm/deb provide vpp group to access vpp-api
Change-Id: I005f971ec5bfbffc5ddd392ff5ae829186b2bf18
Signed-off-by: Ed Warnicke <eaw@cisco.com>
(cherry picked from commit 1f9933d9f0c4615334f4af168dc063a7f1f2d649)
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-06-09 00:43:50 +00:00
Ed Warnicke
cb74b6edd8 VPP-129: Add build-root/scripts/csit-test-branch script
This script returns the csit branch that should be used
for testing and verification.

Related to csit patch:
https://gerrit.fd.io/r/#/c/1344/

Change-Id: I51e44e4ba4dc433056ac8a870f8b7c7f9518189b
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-06-08 23:44:59 +00:00
Ed Warnicke
43f87e2d23 VPP-124: Fix rpms to work out of the box.
Currently, for vpp we are not building any rpms for dpdk or igb_uio.
This is because uio_pci_generic as shipped with centos works with vpp.
However, our vpp rpms do not install kernel module uio_pci_generic at
start up and the /etc/vpp/startup.conf does not configure vpp to use
uio_pci_generic.

vpp rpms should do both, so that when the vpp rpm is installed and
vpp started, it just works out of the box.

This patch fixes the rpms to do so.

Change-Id: Ib934b51f9271cded466d235aa4044bef75c35960
Signed-off-by: Ed Warnicke <eaw@cisco.com>
(cherry picked from commit 40c66394280365ed6b1c5b8f569254f668f80cdb)
2016-06-08 20:46:08 +00:00
Dave Barach
cf6511560e VPP-83: fix collateral damage
Accidentally removed pthread_mutex_unlock (&root_rp->mutex) in the
dead client scan case. Oops. Bad idea.

Change-Id: I488b7e39d01c267052785bd346e8846351db90a9
Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-07 17:36:12 -04:00
Filip Tehlar
3f23e9a3c8 ONE-18: Fix trailing garbage string in LISP status dump API
Change-Id: I5cba5eae5a981e41df3f227834a079e10982537f
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
2016-06-06 13:29:10 +02:00
Dave Wallace
fe82e14267 VPP-112: linux kernel info missing from build log
Change-Id: I343418d409d682b00e74e41236382fdc6b3c780c
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
2016-06-05 13:49:55 +00:00
John Lo
1904214884 VPP-113: BVI shall filter unicast DMAC for L2 to L3 forwading
As BVI receive a packet with unicast DMAC from the BD, including unknown
unicast flood packet, the packet should not be L3 forwarded unless its
DMAC matches the MAC of the BVI.

Change-Id: I46e18629c901062592c8ebe3a238c5cfdc1096b4
Signed-off-by: John Lo <loj@cisco.com>
2016-06-04 00:02:37 -04:00
John Lo
2671f1188d VPP-100: Fix IP4 local handling of TCP/IP fragmented packet
Fix previous change that does not work on little endian machines.
Use inline call ip4_is_fragment() which is endian neutral.

Change-Id: I5a35d89d936650ab6c628dfc388b8c992a74a589
Signed-off-by: John Lo <loj@cisco.com>
2016-06-03 20:48:31 -04:00
Chris Luke
b98a3a87a9 VPP-91 fix sr tunnel add_del collision check
The add_del function was not properly checking if a tunnel already
existed; instead it was checking if the given tunnel name existed.
If no tunnel name was given it flat out refused to add a tunnel
even though that is optional.

Cleanup the add/del parameter validation to "do what I expect" it
to do:

When adding a tunnel:
- If a "name" is given, it must not exist.
- The "key" is always checked, and must not exist.

When deleting a tunnel:
- If the "name" is given, and it exists, then use it.
- If the "name" is not given, use the "key".
- If the "name" and the "key" are given, then both must point to the
  same thing.

Change-Id: I9b48ae0203f9664cf8af0f7dc49bf480ddec10d5
Signed-off-by: Chris Luke <chrisy@flirble.org>
(cherry picked from commit e54436005341800f76a584299ef8bf99e8d66227)
2016-06-03 00:58:17 +00:00
Chris Luke
1f752a3f8f VPP-92 Fixup some srv6 issues
Some small fixes to the srv6 code to bring it toward
conformance with draft-previdi-6man-segment-routing-header-05.

- The first segment needs to remain in the segment list.
- The segment list template needs a space for the ultimate
  destination.
- The ultimate destination needs to be inserted into that
  space when adding the SRH.

Change-Id: I66db6912e0128da084f14ceca20918ef67ccff79
Signed-off-by: Chris Luke <chrisy@flirble.org>
(cherry picked from commit 4b8b718ff9bbba3bea018505ac591bb737f68001)
2016-06-03 00:57:10 +00:00
Ed Warnicke
45eb9713fe VPP-107 Fix for mistake that breaks pkg-rpm in
https://gerrit.fd.io/r/#/c/1338/

Change-Id: I8b7fffe24cbeb435b18faaada9ef1cea9fd93d39
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-06-03 00:28:49 +00:00
John Lo
5faba3aae6 VPP-106: Patch e40i driver to support VLAN sub-interface
Check packet for presence of VLAN tag in the MAC header and set
the PKT_RX_VLAN_PKT flag to trigger sub-interface lookup in VPP
ethernet-input node.

Change-Id: Iadbfc59d08ef85efb936c88323a90194f3cd656f
Signed-off-by: John Lo <loj@cisco.com>
2016-06-02 15:52:21 -04:00
John Lo
142db43bb6 VPP-100: Fix IPv4 local handling of IP fragmented packets
Before VPP is enhenced to do IP reassembly of local packets, just set
the protocol path to "experimental" for now so they will be error-punted
as unknow IP protocol.

Change-Id: I2ffefb0b4205357653ba24d80c722cafd5972fba
Signed-off-by: John Lo <loj@cisco.com>
2016-06-02 14:16:29 +00:00
Chris Luke
a0e1f31b3d VPP-105 Map API SHM uid/gid name to number
When providing uid or gid for the API SHM, if non-numeric values
are given look them up in the local system user database and if
found use the values discovered.

Change-Id: I95152f58646643bc44d2af4cbad6338901935c69
Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-06-01 19:50:09 -04:00
Chris Luke
966bef4ad1 VPP-98 Dedicated storage for VXLAN over IPv6 hash keys
When creating VXLAN over IPv6 the code was using storage for the
hash key that could later be moved. Since the key is larger than
the word size this was being referenced as a pointer; when the
storage moves that breaks the hash.

Instead allocate dedicated storage for the key.

This patch also includes other minor cleanups, including using
clib_memcpy in places it should be used and some whitespace
fixes.

Change-Id: I579f2cb515853ef56dedcca350fcad08aa6111a9
Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-06-01 19:53:54 +00:00
Dave Barach
db0cf7963b VPP-83 Allow non-privileged clients to use the vpp binary API.
Use the command line argument "api-segment { uid <nnn> gid <nnn> }" to
configure shared memory segment file ownership. Defaults to uid = gid
= 0.  Shared-memory segments are explicitly set to 0770 mode, aka
"rwxrwx---".

Change-Id: Ic5d596b68139add61e7de6ace035c57dfd030111
Signed-off-by: Dave Barach <dave@barachs.net>
2016-06-01 19:21:58 +00:00
John Lo
8d9e80583f VPP-102: vHost reconnect to previously used sockets on VPP restart
Change-Id: Ida11bddb52268e0e8513b7b379eeed6103bd48f1
Signed-off-by: John Lo <loj@cisco.com>
2016-05-31 23:32:09 +00:00
Ed Warnicke
6795fb9f70 Fix build-root/scripts/version to not have spurious ~
Change-Id: Id28f134e3a4aa19c5756014d53004501db0d0c88
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-05-31 21:35:22 +00:00
John Lo
245576a438 VPP97: Flooding of pkts with multiple buffers in BD with BVI crashes VPP
The loopback interface should use vnet_interface_output_no_flatten so
follow-on buffers of a jumbo packet do not get put on the output frame
and be sent back to ethernet-input or l2-input node.

The replication_recycle_callback() function should not assume follow-on
buffers of a jumbo packet are on the buffer free list.

Change-Id: Ide646a6d9b43e82782c0581ea3022a9e70f82582
Signed-off-by: John Lo <loj@cisco.com>
2016-05-31 16:25:13 -04:00
Andrej Kozemcak
68660906e6 ONE-15: Fix duplicate locator, refactoring locator
Check duplication locator and clean after locator when remove it.
Refactoring locator_set code.

Change-Id: Ib83cbcddc7a363a60fa5b6a366203d0dc0ea7ca6
Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
2016-05-30 09:17:17 +02:00
John Lo
3d4110fe0c VPP-96 ENID driver update for rx of jumbo pkts using muliple mbuf's
Change-Id: I0e985b079da3224f4886e3ee2cece4d046e291eb
Signed-off-by: John Lo <loj@cisco.com>
2016-05-28 11:44:45 -04:00
Chris Luke
f090a30eef VPP-95 VXLAN add_del API intermittent failure
The VXLAN add_del API sometimes rejects calls with
VNET_API_ERROR_SAME_SRC_DST when the two parameters are obviously
different. This is because the API code is checking the "is_ip6" flag in
a not-yet initialized area of memory leading to random results.

Also fix help text for vxlan_add_del_tunnel in vat.

This does not change the API; it repairs intermittent failure.

Change-Id: I41863694f478c1f669078f82f69d8cca4841c989
Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-27 12:11:24 -04:00
Andrej Kozemcak
edc40dbda0 ONE-14: Fix crash when re-enable Lisp
Change-Id: Ib95338d7055dea9036eddb7dff5ca7ccbcb35639
Signed-off-by: Andrej Kozemcak <akozemca@cisco.com>
(cherry picked from commit 94e34764b46a2babcaea6b309158524a7c1bb632)
2016-05-25 12:20:03 +00:00
Hongjun Ni
aafe40deae VPP-89: Fix an issue in format_vxlan_gpe_tunnel
Change-Id: Ie81e2eb918e441ddaa9e7ab57e8bb0129f0f4f8f
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
2016-05-25 17:35:51 +08:00
Marek Gradzki
205c75c8db VPP-86: fix array copy in generated JNI code
Change-Id: Ic67b3c0623d98c5ee3f1ffa1e1bd9cfb96b233bd
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
2016-05-24 17:33:16 +02:00
Chris Luke
1728f85066 VPP-77 Creating VXLAN over IPv6 via API fails
Tunnel dst is incorrectly being set to the requested src address.

Change-Id: I44e2ee475f0572e78d148951c5d4684e85e08ce7
Signed-off-by: Chris Luke <chrisy@flirble.org>
2016-05-20 12:14:32 -04:00
Ed Warnicke
2c386b26c6 Add newline to the end of .gitreview
Change-Id: I9a5a97c4a42b8aebbb6ba132879b7843ca7cfacd
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-05-16 20:37:19 -05:00
Ed Warnicke
826d4f7b1f Initial changes for stable/1606 branch
This patch adds an entry for the defaultbranch
in .gitreview and also changes the generated
jar file version to 16.06.

Change-Id: I9acd35745eee7daa90d9abcc33e75b76c11af76e
Signed-off-by: Ed Warnicke <eaw@cisco.com>
2016-05-16 15:03:17 -05:00
57 changed files with 1846 additions and 669 deletions

View File

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

View File

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

View File

@ -3,6 +3,8 @@ 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,6 +49,10 @@ 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
@ -63,7 +67,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.conf %{buildroot}/etc/vpp
install -p -m 644 ../../vpp/conf/startup.uiopcigeneric.conf %{buildroot}/etc/vpp/startup.conf
install -p -m 644 ../../vpp/conf/80-vpp.conf %{buildroot}/etc/sysctl.d
#
# libraries

View File

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

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]' | sort -r ); do
for TAG in $(git tag -l 'v[0-9][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

@ -16,12 +16,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}${BLD}
echo ${ADD}${CMT:+~${CMT}}${BLD}
exit
fi
if [ -n "${ADD}" ]; then
echo ${TAG}-${ADD}~${CMT}${BLD}
echo ${TAG}-${ADD}${CMT:+~${CMT}}${BLD}
else
echo ${TAG}
fi

View File

@ -27,6 +27,15 @@ 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

@ -0,0 +1,148 @@
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

@ -391,6 +391,11 @@ 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);
@ -615,18 +620,19 @@ static void svm_mutex_cleanup (void)
}
}
static void svm_region_init_internal (char *root_path)
static void svm_region_init_internal (char *root_path, int uid, int gid)
{
svm_region_t *rp;
svm_map_region_args_t *a=0;
svm_map_region_args_t _a, *a=&_a;
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 */
@ -635,12 +641,14 @@ static void svm_region_init_internal (char *root_path)
else
randomize_baseva = (ticks & 3) * MMAP_PAGESIZE;
vec_validate(a,0);
memset (a, 0, sizeof (*a));
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);
@ -663,18 +671,22 @@ static void svm_region_init_internal (char *root_path)
svm_pop_heap (oldheap);
}
region_unlock(rp);
vec_free (a);
root_rp = rp;
}
void svm_region_init (void)
{
svm_region_init_internal (0);
svm_region_init_internal (0, 0 /* uid */, 0 /* gid */);
}
void svm_region_init_chroot (char *root_path)
{
svm_region_init_internal (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);
}
void *svm_region_find_or_create (svm_map_region_args_t *a)

View File

@ -74,6 +74,9 @@ 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;
@ -108,6 +111,7 @@ 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,6 +134,10 @@ 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,6 +647,14 @@ 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,6 +133,8 @@ 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,9 +197,23 @@ 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 = 0;
svm_map_region_args_t _a, *a = &_a;
svm_region_t *vlib_rp, *root_rp;
void *oldheap;
vl_shmem_hdr_t *shmem_hdr=0;
@ -210,16 +224,16 @@ int vl_map_shmem (char *region_name, int is_vlib)
if (is_vlib == 0)
svm_region_init_chroot(am->root_path);
vec_validate (a, 0);
memset (a, 0, sizeof (*a));
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);
@ -274,24 +288,8 @@ 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);
} 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,7 +343,6 @@ 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
@ -362,8 +361,6 @@ 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);
@ -458,6 +455,7 @@ 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) {
@ -621,27 +619,33 @@ 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)
{
#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
static volatile int * cursizep;
vm->queue_signal_pending = 0;
vlib_process_signal_event
(vm, memclnt_node.index, /* event_type */ 0, /* event_data */ 0);
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);
}
}
void vl_enable_disable_memory_api (vlib_main_t *vm, int enable)
@ -1049,8 +1053,8 @@ clib_error_t *
vlibmemory_init (vlib_main_t * vm)
{
api_main_t *am = &api_main;
/* Normally NULL, can be set by cmd line "chroot {prefix foo}" */
svm_region_init_chroot (am->root_path);
/* Normally NULL / 0, set by cmd line "api-segment" */
svm_region_init_chroot_uid_gid (am->root_path, am->api_uid, am->api_gid);
return 0;
}

View File

@ -1414,8 +1414,7 @@ static void vlib_main_loop (vlib_main_t * vm)
/* frame */ 0,
cpu_time_now);
if (PREDICT_FALSE(vm->queue_signal_pending))
if (vm->queue_signal_callback)
if (PREDICT_TRUE (vm->queue_signal_pending == 0))
vm->queue_signal_callback (vm);
/* Next handle interrupts. */
@ -1533,11 +1532,15 @@ 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

@ -61,6 +61,8 @@
#define ETH_BUFFER_VLAN_BITS (ETH_BUFFER_VLAN_1_DEEP | \
ETH_BUFFER_VLAN_2_DEEP)
#define LOG2_BUFFER_OUTPUT_FEAT_DONE LOG2_VLIB_BUFFER_FLAG_USER(5)
#define BUFFER_OUTPUT_FEAT_DONE (1 << LOG2_BUFFER_OUTPUT_FEAT_DONE)
#define foreach_buffer_opaque_union_subtype \
_(ethernet) \

View File

@ -1136,7 +1136,10 @@ dpdk_subif_add_del_function (vnet_main_t * vnm,
dpdk_device_t * xd = vec_elt_at_index (xm->devices, hw->dev_instance);
vnet_sw_interface_t * t = (vnet_sw_interface_t *) st;
int r, vlan_offload;
u32 prev_subifs = xd->vlan_subifs;
if (is_add) xd->vlan_subifs++;
else if (xd->vlan_subifs) xd->vlan_subifs--;
if (xd->dev_type != VNET_DPDK_DEV_ETH)
return 0;
@ -1149,21 +1152,26 @@ dpdk_subif_add_del_function (vnet_main_t * vnm,
if (t->sub.eth.flags.no_tags == 1)
return 0;
if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 ))
if ((t->sub.eth.flags.one_tag != 1) || (t->sub.eth.flags.exact_match != 1 )) {
xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "unsupported VLAN setup");
}
vlan_offload = rte_eth_dev_get_vlan_offload(xd->device_index);
vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload)))
if ((r = rte_eth_dev_set_vlan_offload(xd->device_index, vlan_offload))) {
xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "rte_eth_dev_set_vlan_offload[%d]: err %d",
xd->device_index, r);
}
if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add)))
if ((r = rte_eth_dev_vlan_filter(xd->device_index, t->sub.eth.outer_vlan_id, is_add))) {
xd->vlan_subifs = prev_subifs;
return clib_error_return (0, "rte_eth_dev_vlan_filter[%d]: err %d",
xd->device_index, r);
}
return 0;
}

View File

@ -208,6 +208,9 @@ typedef struct {
/* per-worker destination frame queue */
dpdk_frame_t * frames;
/* number of sub-interfaces */
u16 vlan_subifs;
dpdk_device_type_t dev_type:8;
dpdk_pmd_t pmd:8;
i8 cpu_socket;

View File

@ -21,6 +21,7 @@
#define DPDK_NB_TX_DESC_10GE 2048
#define DPDK_NB_RX_DESC_40GE (4096-128)
#define DPDK_NB_TX_DESC_40GE 2048
#define DPDK_NB_RX_DESC_ENIC (4096+1024)
/* These args appear by themselves */
#define foreach_eal_double_hyphen_predicate_arg \

View File

@ -382,16 +382,15 @@ dpdk_lib_init (dpdk_main_t * dm)
case VNET_DPDK_PMD_VICE:
case VNET_DPDK_PMD_ENIC:
rte_eth_link_get_nowait(i, &l);
xd->nb_rx_desc = DPDK_NB_RX_DESC_ENIC;
if (l.link_speed == 40000)
{
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_40G;
xd->nb_rx_desc = DPDK_NB_RX_DESC_40GE;
xd->nb_tx_desc = DPDK_NB_TX_DESC_40GE;
}
else
{
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_10G;
xd->nb_rx_desc = DPDK_NB_RX_DESC_10GE;
xd->nb_tx_desc = DPDK_NB_TX_DESC_10GE;
}
break;

View File

@ -303,9 +303,9 @@ dpdk_rx_next_and_error_from_mb_flags_x1 (dpdk_device_t *xd, struct rte_mbuf *mb,
else
{
*error0 = DPDK_ERROR_NONE;
if (xd->per_interface_next_index != ~0)
if (PREDICT_FALSE(xd->per_interface_next_index != ~0))
n0 = xd->per_interface_next_index;
else if (mb_flags & PKT_RX_VLAN_PKT)
else if (PREDICT_FALSE(xd->vlan_subifs || (mb_flags & PKT_RX_VLAN_PKT)))
n0 = DPDK_RX_NEXT_ETHERNET_INPUT;
else
{

View File

@ -589,6 +589,14 @@ dpdk_vhost_user_set_vring_addr(u32 hw_if_index, u8 idx, u64 desc, \
clib_warning("falied to set vring addr");
}
if (vq->last_used_idx != vq->used->idx) {
clib_warning("last_used_idx (%u) and vq->used->idx (%u) mismatches; "
"some packets maybe resent for Tx and dropped for Rx",
vq->last_used_idx, vq->used->idx);
vq->last_used_idx = vq->used->idx;
vq->last_used_idx_res = vq->used->idx;
}
/*
* Inform the guest that there is no need to inform (kick) the
* host when it adds buffers. kick results in vmexit and will

View File

@ -472,6 +472,14 @@ eth_identify_subint (vnet_hw_interface_t * hi,
return 1;
}
// Compare two ethernet macs. Return 1 if they are the same, 0 if different
always_inline u32
eth_mac_equal (u8 * mac1, u8 * mac2) {
return (*((u32 *)(mac1+0)) == *((u32 *)(mac2+0)) &&
*((u32 *)(mac1+2)) == *((u32 *)(mac2+2)));
}
always_inline ethernet_main_t *
vnet_get_ethernet_main (void)
{

View File

@ -343,6 +343,7 @@ VNET_DEVICE_CLASS (ethernet_simulated_device_class) = {
.format_device_name = format_simulated_ethernet_name,
.tx_function = simulated_ethernet_interface_tx,
.admin_up_down_function = simulated_ethernet_admin_up_down,
.no_flatten_output_chains = 1,
};
int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 *mac_address)

View File

@ -81,14 +81,6 @@ typedef enum {
} ethernet_input_variant_t;
// Compare two ethernet macs. Return 1 if they are the same, 0 if different
static_always_inline u32
eth_mac_equal (u8 * mac1, u8 * mac2) {
return (*((u32 *)(mac1+0)) == *((u32 *)(mac2+0)) &&
*((u32 *)(mac1+2)) == *((u32 *)(mac2+2)));
}
// Parse the ethernet header to extract vlan tags and innermost ethertype
static_always_inline void
parse_header (ethernet_input_variant_t variant,

View File

@ -393,11 +393,11 @@ vnet_interface_output_node (vlib_main_t * vm,
return n_buffers;
}
uword
vnet_interface_output_node_no_flatten (vlib_main_t * vm,
always_inline uword
vnet_interface_output_node_no_flatten_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
vlib_frame_t * frame,
int with_features)
{
vnet_main_t * vnm = vnet_get_main();
vnet_interface_output_runtime_t * rt = (void *) node->runtime_data;
@ -465,6 +465,7 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
u32 bi0, bi1;
vlib_buffer_t * b0, * b1;
u32 tx_swif0, tx_swif1;
u32 next0, next1;
/* Prefetch next iteration. */
vlib_prefetch_buffer_with_index (vm, from[2], LOAD);
@ -493,19 +494,16 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
n_bytes += n_bytes_b0 + n_bytes_b1;
n_packets += 2;
if (PREDICT_FALSE(si->output_feature_bitmap &&
vnet_buffer(b0)->output_features.bitmap != (1 << INTF_OUTPUT_FEAT_DONE)))
if (with_features)
{
u32 next0;
b0->flags |= BUFFER_OUTPUT_FEAT_DONE;
vnet_buffer(b0)->output_features.bitmap = si->output_feature_bitmap;
count_trailing_zeros(next0, vnet_buffer(b0)->output_features.bitmap);
vnet_buffer(b0)->output_features.bitmap &= ~(1 << next0);
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_tx,
n_left_to_tx, bi0, next0);
}
else
{
next0 = VNET_INTERFACE_OUTPUT_NEXT_TX;
vnet_buffer(b0)->output_features.bitmap = 0;
if (PREDICT_FALSE(tx_swif0 != rt->sw_if_index))
@ -520,18 +518,16 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
}
}
if (PREDICT_FALSE(si->output_feature_bitmap &&
vnet_buffer(b1)->output_features.bitmap != (1 << INTF_OUTPUT_FEAT_DONE)))
if (with_features)
{
u32 next1;
b1->flags |= BUFFER_OUTPUT_FEAT_DONE;
vnet_buffer(b1)->output_features.bitmap = si->output_feature_bitmap;
count_trailing_zeros(next1, vnet_buffer(b1)->output_features.bitmap);
vnet_buffer(b1)->output_features.bitmap &= ~(1 << next1);
vlib_validate_buffer_enqueue_x1 (vm, node, next_index, to_tx,
n_left_to_tx, bi1, next1);
}
else
{
next1 = VNET_INTERFACE_OUTPUT_NEXT_TX;
vnet_buffer(b1)->output_features.bitmap = 0;
/* update vlan subif tx counts, if required */
@ -546,7 +542,9 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
n_bytes_b1);
}
}
if (with_features)
vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_tx,
n_left_to_tx, bi0, bi1, next0, next1);
}
while (from + 1 <= from_end && n_left_to_tx >= 1)
@ -572,10 +570,10 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
n_bytes += n_bytes_b0;
n_packets += 1;
if (PREDICT_FALSE(si->output_feature_bitmap &&
vnet_buffer(b0)->output_features.bitmap != (1 << INTF_OUTPUT_FEAT_DONE)))
if (with_features)
{
u32 next0;
b0->flags |= BUFFER_OUTPUT_FEAT_DONE;
vnet_buffer(b0)->output_features.bitmap = si->output_feature_bitmap;
count_trailing_zeros(next0, vnet_buffer(b0)->output_features.bitmap);
vnet_buffer(b0)->output_features.bitmap &= ~(1 << next0);
@ -613,6 +611,29 @@ vnet_interface_output_node_no_flatten (vlib_main_t * vm,
return n_buffers;
}
uword
vnet_interface_output_node_no_flatten (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
vnet_main_t * vnm = vnet_get_main ();
vnet_interface_output_runtime_t * rt = (void *) node->runtime_data;
vnet_sw_interface_t * si;
si = vnet_get_sw_interface (vnm, rt->sw_if_index);
if (PREDICT_FALSE(si->output_feature_bitmap))
{
/* if first pakcet in the frame have BUFFER_OUTPUT_FEAT_DONE flag set
then whole frame is arriving from feature node */
u32 * from = vlib_frame_args (frame);
vlib_buffer_t * b = vlib_get_buffer (vm, from[0]);
if ((b->flags & BUFFER_OUTPUT_FEAT_DONE) == 0)
return vnet_interface_output_node_no_flatten_inline (vm, node, frame, 1);
}
return vnet_interface_output_node_no_flatten_inline (vm, node, frame, 0);
}
/* Use buffer's sw_if_index[VNET_TX] to choose output interface. */
static uword

View File

@ -173,6 +173,7 @@ extern ip4_main_t ip4_main;
extern vlib_node_registration_t ip4_input_node;
extern vlib_node_registration_t ip4_lookup_node;
extern vlib_node_registration_t ip4_rewrite_node;
extern vlib_node_registration_t ip4_rewrite_local_node;
extern vlib_node_registration_t ip4_arp_node;
u32 ip4_fib_lookup_with_table (ip4_main_t * im, u32 fib_index, ip4_address_t * dst,

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