Compare commits
20 Commits
v20.05
...
v16.06-rc2
Author | SHA1 | Date | |
---|---|---|---|
|
b98a3a87a9 | ||
|
1f752a3f8f | ||
|
45eb9713fe | ||
|
5faba3aae6 | ||
|
142db43bb6 | ||
|
a0e1f31b3d | ||
|
966bef4ad1 | ||
|
db0cf7963b | ||
|
8d9e80583f | ||
|
6795fb9f70 | ||
|
245576a438 | ||
|
68660906e6 | ||
|
3d4110fe0c | ||
|
f090a30eef | ||
|
edc40dbda0 | ||
|
aafe40deae | ||
|
205c75c8db | ||
|
1728f85066 | ||
|
2c386b26c6 | ||
|
826d4f7b1f |
@ -2,3 +2,4 @@
|
||||
host=gerrit.fd.io
|
||||
port=29418
|
||||
project=vpp
|
||||
defaultbranch=stable/1606
|
||||
|
@ -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
|
||||
|
148
dpdk/dpdk-16.04_patches/0015-enic-counter_improvement.patch
Executable file
148
dpdk/dpdk-16.04_patches/0015-enic-counter_improvement.patch
Executable 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) {
|
650
dpdk/dpdk-16.04_patches/0016-enic-scatter-rx.patch
Executable file
650
dpdk/dpdk-16.04_patches/0016-enic-scatter-rx.patch
Executable file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
26
svm/svm.c
26
svm/svm.c
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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 \
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
@ -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
|
||||
{
|
||||
|
@ -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
@ -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. */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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, \
|
||||
|
@ -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
|
||||
|
@ -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
Reference in New Issue
Block a user