Compare commits

...

20 Commits

Author SHA1 Message Date
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
35 changed files with 1603 additions and 536 deletions

View File

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

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

@ -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

@ -0,0 +1,41 @@
From af8bfd030fdaa0acb3222296ab7a24bc4ac196f5 Mon Sep 17 00:00:00 2001
From: Georgi Savov <gsavov@cisco.com>
Date: Tue, 10 May 2016 10:59:55 -0400
Subject: [PATCH 30/31] i40e Set PKT_RX_VLAN_PKT flag for VLAN packets
---
drivers/net/i40e/i40e_rxtx.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 39d94ec..07341df 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -99,7 +99,23 @@ i40e_rxd_to_vlan_tci(struct rte_mbuf *mb, volatile union i40e_rx_desc *rxdp)
PMD_RX_LOG(DEBUG, "Descriptor l2tag1: %u",
rte_le_to_cpu_16(rxdp->wb.qword0.lo_dword.l2tag1));
} else {
- mb->vlan_tci = 0;
+ struct ether_hdr *eth_hdr = rte_pktmbuf_mtod(mb, struct ether_hdr *);
+ u16 eth_type = eth_hdr->ether_type;
+
+ // The i40e firmware does not flag VLAN tagged packets if
+ // VLAN stripping is disabled so we need to check the
+ // ethernet header to find out if the received packet
+ // is a VLAN packet
+ if ((eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN)) ||
+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_AD)) ||
+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_9100)) ||
+ (eth_type == rte_be_to_cpu_16(ETHER_TYPE_VLAN_9200))) {
+ struct vlan_hdr *vhdr = (struct vlan_hdr *)(eth_hdr+1);
+ mb->ol_flags |= PKT_RX_VLAN_PKT;
+ mb->vlan_tci = rte_be_to_cpu_16(vhdr->vlan_tci);
+ } else {
+ mb->vlan_tci = 0;
+ }
}
#ifndef RTE_LIBRTE_I40E_16BYTE_RX_DESC
if (rte_le_to_cpu_16(rxdp->wb.qword2.ext_status) &
--
1.9.1

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);
@ -273,25 +287,8 @@ int vl_map_shmem (char *region_name, int is_vlib)
/* Clean up the root region client list */
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;
}
}
}
pthread_mutex_unlock (&vlib_rp->mutex);
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,9 +1414,8 @@ 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)
vm->queue_signal_callback (vm);
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

@ -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

@ -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

@ -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

@ -1773,8 +1773,10 @@ ip4_local (vlib_main_t * vm,
leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 0);
leaf1 = ip4_fib_mtrie_lookup_step (mtrie1, leaf1, &ip1->src_address, 0);
proto0 = ip0->protocol;
proto1 = ip1->protocol;
/* Treat IP frag packets as "experimental" protocol for now
until support of IP frag reassembly is implemented */
proto0 = (ip0->flags_and_fragment_offset << 2) ? 0xfe : ip0->protocol;
proto1 = (ip1->flags_and_fragment_offset << 2) ? 0xfe : ip1->protocol;
is_udp0 = proto0 == IP_PROTOCOL_UDP;
is_udp1 = proto1 == IP_PROTOCOL_UDP;
is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;
@ -1966,7 +1968,9 @@ ip4_local (vlib_main_t * vm,
leaf0 = ip4_fib_mtrie_lookup_step (mtrie0, leaf0, &ip0->src_address, 0);
proto0 = ip0->protocol;
/* Treat IP frag packets as "experimental" protocol for now
until support of IP frag reassembly is implemented */
proto0 = (ip0->flags_and_fragment_offset << 2) ? 0xfe : ip0->protocol;
is_udp0 = proto0 == IP_PROTOCOL_UDP;
is_tcp_udp0 = is_udp0 || proto0 == IP_PROTOCOL_TCP;

File diff suppressed because it is too large Load Diff

View File

@ -132,11 +132,8 @@ int
vnet_lisp_add_del_locator_set (vnet_lisp_add_del_locator_set_args_t * a,
u32 * ls_index);
int
vnet_lisp_add_del_locator_set_name (vnet_lisp_add_del_locator_set_args_t * a,
u32 * ls_index);
int
vnet_lisp_add_del_locator (vnet_lisp_add_del_locator_set_args_t * a,
u32 * ls_index);
locator_set_t * ls, u32 * ls_index);
typedef struct
{

View File

@ -148,7 +148,6 @@ static void replication_recycle_callback (vlib_main_t *vm,
u32 * to_next = 0;
u32 bi0, pi0;
vlib_buffer_t *b0;
vlib_buffer_t *bnext0;
int i;
replication_main_t * rm = &replication_main;
replication_context_t * ctx;
@ -208,8 +207,8 @@ static void replication_recycle_callback (vlib_main_t *vm,
pi0 = from[1];
vlib_prefetch_buffer_with_index(vm,pi0,LOAD);
}
bnext0 = b0 = vlib_get_buffer (vm, bi0);
b0 = vlib_get_buffer (vm, bi0);
// Mark that this buffer was just recycled
b0->flags |= VLIB_BUFFER_IS_RECYCLED;
@ -218,12 +217,6 @@ static void replication_recycle_callback (vlib_main_t *vm,
if (PREDICT_FALSE(b0->flags & VLIB_BUFFER_IS_TRACED))
f->flags |= VLIB_FRAME_TRACE;
while (bnext0->flags & VLIB_BUFFER_NEXT_PRESENT)
{
from += 1;
n_left_from -= 1;
bnext0 = vlib_get_buffer (vm, bnext0->next_buffer);
}
to_next[0] = bi0;
from++;

File diff suppressed because it is too large Load Diff

View File

@ -163,7 +163,11 @@
* Policy List Flags MUST be set to 0x0.
*/
#define ROUTING_HEADER_TYPE_SR 4
#ifndef IPPROTO_IPV6_ROUTE
#define IPPROTO_IPV6_ROUTE 43
#endif
#define ROUTING_HEADER_TYPE_SR 4
typedef struct {
/* Protocol for next header. */

View File

@ -30,12 +30,16 @@ u8 * format_vxlan_gpe_tunnel (u8 * s, va_list * args)
{
case VXLAN_GPE_PROTOCOL_IP4:
s = format (s, "next-protocol ip4");
break;
case VXLAN_GPE_PROTOCOL_IP6:
s = format (s, "next-protocol ip6");
break;
case VXLAN_GPE_PROTOCOL_ETHERNET:
s = format (s, "next-protocol ethernet");
break;
case VXLAN_GPE_PROTOCOL_NSH:
s = format (s, "next-protocol nsh");
break;
default:
s = format (s, "next-protocol unknown %d", t->protocol);
}

View File

@ -186,21 +186,21 @@ vxlan_input (vlib_main_t * vm,
key6_0.vni = vxlan0->vni_reserved;
if (PREDICT_FALSE (memcmp(&key6_0, &last_key6, sizeof(last_key6)) != 0))
{
p0 = hash_get (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&key6_0));
{
p0 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_0);
if (p0 == 0)
{
error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next0 = VXLAN_INPUT_NEXT_DROP;
goto trace0;
}
if (p0 == 0)
{
error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next0 = VXLAN_INPUT_NEXT_DROP;
goto trace0;
}
last_key6 = key6_0;
tunnel_index0 = last_tunnel_index = p0[0];
}
else
tunnel_index0 = last_tunnel_index;
clib_memcpy (&last_key6, &key6_0, sizeof(key6_0));
tunnel_index0 = last_tunnel_index = p0[0];
}
else
tunnel_index0 = last_tunnel_index;
}
t0 = pool_elt_at_index (vxm->tunnels, tunnel_index0);
@ -276,21 +276,21 @@ vxlan_input (vlib_main_t * vm,
key6_1.vni = vxlan1->vni_reserved;
if (PREDICT_FALSE (memcmp(&key6_1, &last_key6, sizeof(last_key6)) != 0))
{
p1 = hash_get (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&key6_1));
{
p1 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_1);
if (p1 == 0)
{
error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next1 = VXLAN_INPUT_NEXT_DROP;
goto trace1;
}
if (p1 == 0)
{
error1 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next1 = VXLAN_INPUT_NEXT_DROP;
goto trace1;
}
last_key6 = key6_1;
tunnel_index1 = last_tunnel_index = p1[0];
}
else
tunnel_index1 = last_tunnel_index;
clib_memcpy (&last_key6, &key6_1, sizeof(key6_1));
tunnel_index1 = last_tunnel_index = p1[0];
}
else
tunnel_index1 = last_tunnel_index;
}
t1 = pool_elt_at_index (vxm->tunnels, tunnel_index1);
@ -420,21 +420,21 @@ vxlan_input (vlib_main_t * vm,
key6_0.vni = vxlan0->vni_reserved;
if (PREDICT_FALSE (memcmp(&key6_0, &last_key6, sizeof(last_key6)) != 0))
{
p0 = hash_get (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&key6_0));
{
p0 = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6_0);
if (p0 == 0)
{
error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next0 = VXLAN_INPUT_NEXT_DROP;
goto trace00;
}
if (p0 == 0)
{
error0 = VXLAN_ERROR_NO_SUCH_TUNNEL;
next0 = VXLAN_INPUT_NEXT_DROP;
goto trace00;
}
last_key6 = key6_0;
tunnel_index0 = last_tunnel_index = p0[0];
}
else
tunnel_index0 = last_tunnel_index;
clib_memcpy (&last_key6, &key6_0, sizeof(key6_0));
tunnel_index0 = last_tunnel_index = p0[0];
}
else
tunnel_index0 = last_tunnel_index;
}
t0 = pool_elt_at_index (vxm->tunnels, tunnel_index0);

View File

@ -218,7 +218,7 @@ int vnet_vxlan_add_del_tunnel
key6.src.as_u64[1] = a->dst.ip6.as_u64[1];
key6.vni = clib_host_to_net_u32 (a->vni << 8);
p = hash_get (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&key6));
p = hash_get_mem (vxm->vxlan6_tunnel_by_key, &key6);
}
if (a->is_add)
@ -243,10 +243,16 @@ int vnet_vxlan_add_del_tunnel
else foreach_copy_ipv6
#undef _
if (a->is_ip6) {
/* copy the key */
t->key6 = key6;
}
/* copy the key */
if (a->is_ip6)
{
t->key6 = clib_mem_alloc (sizeof(vxlan6_tunnel_key_t));
clib_memcpy (t->key6, &key6, sizeof(key6));
}
else
{
t->key4 = 0; /* not yet used */
}
if (!a->is_ip6) t->flags |= VXLAN_TUNNEL_IS_IPV4;
@ -265,7 +271,7 @@ int vnet_vxlan_add_del_tunnel
if (!a->is_ip6)
hash_set (vxm->vxlan4_tunnel_by_key, key4.as_u64, t - vxm->tunnels);
else
hash_set (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&t->key6), t - vxm->tunnels);
hash_set_mem (vxm->vxlan6_tunnel_by_key, t->key6, t - vxm->tunnels);
if (vec_len (vxm->free_vxlan_tunnel_hw_if_indices) > 0)
{
@ -340,14 +346,21 @@ int vnet_vxlan_add_del_tunnel
if (!a->is_ip6)
hash_unset (vxm->vxlan4_tunnel_by_key, key4.as_u64);
else
hash_unset (vxm->vxlan6_tunnel_by_key, pointer_to_uword(&key6));
hash_unset_mem (vxm->vxlan6_tunnel_by_key, t->key6);
vec_free (t->rewrite);
if (!a->is_ip6) {
t->rewrite = vxlan4_dummy_rewrite;
} else {
t->rewrite = vxlan6_dummy_rewrite;
}
if (!a->is_ip6)
{
t->rewrite = vxlan4_dummy_rewrite;
t->key4 = 0;
}
else
{
t->rewrite = vxlan6_dummy_rewrite;
clib_mem_free (t->key6);
t->key6 = 0;
}
pool_put (vxm->tunnels, t);
}

View File

@ -84,8 +84,8 @@ typedef struct {
u32 sw_if_index;
union { /* storage for the hash key */
vxlan4_tunnel_key_t key4;
vxlan6_tunnel_key_t key6;
vxlan4_tunnel_key_t *key4;
vxlan6_tunnel_key_t *key6;
};
/* flags */

View File

@ -7364,8 +7364,8 @@ static int api_vxlan_add_del_tunnel (vat_main_t * vam)
M (VXLAN_ADD_DEL_TUNNEL, vxlan_add_del_tunnel);
if (ipv6_set) {
clib_memcpy(&mp->dst_address, &src6, sizeof(src6));
clib_memcpy(&mp->dst_address, &src6, sizeof(dst6));
clib_memcpy(&mp->src_address, &src6, sizeof(src6));
clib_memcpy(&mp->dst_address, &dst6, sizeof(dst6));
} else {
clib_memcpy(&mp->src_address, &src4, sizeof(src4));
clib_memcpy(&mp->dst_address, &dst4, sizeof(dst4));
@ -10713,7 +10713,7 @@ _(l2tpv3_set_lookup_key, \
"lookup_v6_src | lookup_v6_dst | lookup_session_id") \
_(sw_if_l2tpv3_tunnel_dump, "") \
_(vxlan_add_del_tunnel, \
"src <ip4-addr> dst <ip4-addr> vni <vni> [encap-vrf-id <nn>]\n" \
"src <ip-addr> dst <ip-addr> vni <vni> [encap-vrf-id <nn>]\n" \
" [decap-next l2|ip4|ip6] [del]") \
_(vxlan_tunnel_dump, "[<intfc> | sw_if_index <nn>]") \
_(gre_add_del_tunnel, \

View File

@ -1,4 +1,4 @@
AC_INIT(vpp-japi, 1.0.0)
AC_INIT(vpp-japi, 16.06)
LT_INIT
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE

View File

@ -89,7 +89,8 @@ u64_struct_setter_template = Template("""
u8_array_struct_setter_template = Template("""
{
jsize cnt = (*env)->GetArrayLength (env, ${java_name});
if (cnt > sizeof(mp->${c_name})) cnt = sizeof(mp->${c_name});
size_t max_size = ${field_length};
if (max_size != 0 && cnt > max_size) cnt = max_size;
(*env)->GetByteArrayRegion(env, ${java_name}, 0, cnt, (jbyte *)mp->${c_name});
}
""")
@ -97,8 +98,11 @@ u8_array_struct_setter_template = Template("""
u32_array_struct_setter_template = Template("""
jint * ${java_name}ArrayElements = (*env)->GetIntArrayElements(env, ${java_name}, NULL);
{
int _i;
for (_i = 0; _i < 0; _i++) {
size_t _i;
jsize cnt = (*env)->GetArrayLength (env, ${java_name});
size_t max_size = ${field_length};
if (max_size != 0 && cnt > max_size) cnt = max_size;
for (_i = 0; _i < cnt; _i++) {
mp->${c_name}[_i] = clib_host_to_net_u32(${java_name}ArrayElements[_i]);
}
}
@ -180,16 +184,18 @@ def generate_jni_impl(func_list, inputfile):
jni_getter=jni_getter)
# field setters
for t in zip(f['c_types'], f['args']):
for t in zip(f['c_types'], f['args'], f['lengths']):
c_type = t[0]
c_name = t[1]
field_length = t[2]
java_field_name = util.underscore_to_camelcase(c_name)
struct_setter_template = struct_setter_templates[c_type]
struct_setters += struct_setter_template.substitute(
c_name=c_name,
java_name=java_field_name)
java_name=java_field_name,
field_length=field_length)
jni_impl.append(jni_impl_template.substitute(
inputfile=inputfile,
@ -221,23 +227,23 @@ u64_dto_field_setter_template = Template("""
""")
u8_array_dto_field_setter_template = Template("""
jbyteArray ${java_name} = (*env)->NewByteArray(env, sizeof(mp->${c_name}));
(*env)->SetByteArrayRegion(env, ${java_name}, 0, sizeof(mp->${c_name}), (const jbyte*)mp->${c_name});
jbyteArray ${java_name} = (*env)->NewByteArray(env, ${field_length});
(*env)->SetByteArrayRegion(env, ${java_name}, 0, ${field_length}, (const jbyte*)mp->${c_name});
(*env)->SetObjectField(env, dto, ${java_name}FieldId, ${java_name});
""")
# For each u64 array we get its elements. Then we convert values to host byte order.
# All changes to jint* buffer are written to jlongArray (isCopy is set to NULL)
u64_array_dto_field_setter_template = Template("""
jlongArray ${java_name} = (*env)->NewLongArray(env, sizeof(mp->${c_name}));
{
jlongArray ${java_name} = (*env)->NewLongArray(env, ${field_length});
jlong * ${java_name}ArrayElements = (*env)->GetLongArrayElements(env, ${java_name}, NULL);
int _i;
for (_i = 0; _i < 0; _i++) {
unsigned int _i;
for (_i = 0; _i < ${field_length}; _i++) {
${java_name}ArrayElements[_i] = clib_net_to_host_u64(mp->${c_name}[_i]);
}
(*env)->SetObjectField(env, dto, ${java_name}FieldId, ${java_name});
}
(*env)->SetObjectField(env, dto, ${java_name}FieldId, ${java_name});
""")
dto_field_setter_templates = {'u8': default_dto_field_setter_template,
@ -282,10 +288,11 @@ def generate_msg_handlers(func_list, inputfile):
dto_setters = ''
# dto setters
for t in zip(f['c_types'], f['types'], f['args']):
for t in zip(f['c_types'], f['types'], f['args'], f['lengths']):
c_type = t[0]
jni_type = t[1]
c_name = t[2]
field_length = t[3]
java_field_name = util.underscore_to_camelcase(c_name)
jni_signature = util.jni_2_signature_mapping[jni_type]
@ -302,7 +309,8 @@ def generate_msg_handlers(func_list, inputfile):
java_name=java_field_name,
jni_signature=jni_signature,
c_name=c_name,
jni_setter=jni_setter)
jni_setter=jni_setter,
field_length=field_length)
handlers.append(msg_handler_template.substitute(
inputfile=inputfile,

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