aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-12-05 11:42:44 +0100
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2016-12-05 11:46:26 +0100
commit32e04ea00cd159613e04acef75e52bfca6eeff2f (patch)
treef19e4885612e596bb8c8c3c5914157ae5417e180 /examples
parent6cfa4f771efe39dbc944e799cbe465134c8931fa (diff)
Imported Upstream version 16.07.2
Change-Id: I76bc313e0942233ce259612069ded302dd6c87bb Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/ip_pipeline/config/diagram-generator.py2
-rwxr-xr-xexamples/ip_pipeline/config/pipeline-to-core-mapping.py2
-rw-r--r--examples/ip_pipeline/cpu_core_map.c8
-rw-r--r--examples/ip_pipeline/init.c2
-rw-r--r--examples/ipsec-secgw/ipsec-secgw.c4
-rw-r--r--examples/l2fwd-crypto/main.c23
-rw-r--r--examples/qos_sched/app_thread.c22
-rw-r--r--examples/tep_termination/vxlan.c4
8 files changed, 33 insertions, 34 deletions
diff --git a/examples/ip_pipeline/config/diagram-generator.py b/examples/ip_pipeline/config/diagram-generator.py
index f20cbcbb..6b7170b0 100755
--- a/examples/ip_pipeline/config/diagram-generator.py
+++ b/examples/ip_pipeline/config/diagram-generator.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python2
+#!/usr/bin/env python
# BSD LICENSE
#
diff --git a/examples/ip_pipeline/config/pipeline-to-core-mapping.py b/examples/ip_pipeline/config/pipeline-to-core-mapping.py
index 37b131c6..c2050b82 100755
--- a/examples/ip_pipeline/config/pipeline-to-core-mapping.py
+++ b/examples/ip_pipeline/config/pipeline-to-core-mapping.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python2
+#!/usr/bin/env python
# BSD LICENSE
#
diff --git a/examples/ip_pipeline/cpu_core_map.c b/examples/ip_pipeline/cpu_core_map.c
index cb088b1c..dd8f6785 100644
--- a/examples/ip_pipeline/cpu_core_map.c
+++ b/examples/ip_pipeline/cpu_core_map.c
@@ -351,8 +351,10 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
int lcore_socket_id =
cpu_core_map_get_socket_id_linux(lcore_id);
+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;
+#endif
if (((uint32_t) lcore_socket_id) == socket_id)
n_detected++;
@@ -368,6 +370,7 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
cpu_core_map_get_socket_id_linux(
lcore_id);
+#if !defined(RTE_ARCH_PPC_64)
if (lcore_socket_id < 0)
return -1;
@@ -377,9 +380,14 @@ cpu_core_map_compute_linux(struct cpu_core_map *map)
if (lcore_core_id < 0)
return -1;
+#endif
+#if !defined(RTE_ARCH_PPC_64)
if (((uint32_t) lcore_socket_id == socket_id) &&
((uint32_t) lcore_core_id == core_id)) {
+#else
+ if (((uint32_t) lcore_socket_id == socket_id)) {
+#endif
uint32_t pos = cpu_core_map_pos(map,
socket_id,
core_id_contig,
diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c
index cd167f61..891b3274 100644
--- a/examples/ip_pipeline/init.c
+++ b/examples/ip_pipeline/init.c
@@ -236,7 +236,7 @@ app_init_eal(struct app_params *app)
}
if (p->add_driver) {
- snprintf(buffer, sizeof(buffer), "-d=%s", p->add_driver);
+ snprintf(buffer, sizeof(buffer), "-d%s", p->add_driver);
app->eal_argv[n_args++] = strdup(buffer);
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 5d04eb3f..266ae205 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -390,7 +390,7 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip,
struct rte_mbuf *m;
uint32_t i, j, res, sa_idx;
- if (ip->num == 0)
+ if (ip->num == 0 || sp == NULL)
return;
rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res,
@@ -465,7 +465,7 @@ outbound_sp(struct sp_ctx *sp, struct traffic_type *ip,
struct rte_mbuf *m;
uint32_t i, j, sa_idx;
- if (ip->num == 0)
+ if (ip->num == 0 || sp == NULL)
return;
rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res,
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 66397a08..6cfa9168 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -441,6 +441,10 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
/* Zero pad data to be crypto'd so it is block aligned */
data_len = rte_pktmbuf_data_len(m) - ipdata_offset;
+
+ if (cparams->do_hash && cparams->hash_verify)
+ data_len -= cparams->digest_length;
+
pad_len = data_len % cparams->block_size ? cparams->block_size -
(data_len % cparams->block_size) : 0;
@@ -462,8 +466,8 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
op->sym->auth.digest.data = (uint8_t *)rte_pktmbuf_append(m,
cparams->digest_length);
} else {
- op->sym->auth.digest.data = (uint8_t *)rte_pktmbuf_append(m,
- cparams->digest_length);
+ op->sym->auth.digest.data = rte_pktmbuf_mtod(m,
+ uint8_t *) + ipdata_offset + data_len;
}
op->sym->auth.digest.phys_addr = rte_pktmbuf_mtophys_offset(m,
@@ -496,21 +500,10 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m,
if (cparams->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||
cparams->cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8) {
op->sym->cipher.data.offset = ipdata_offset << 3;
- if (cparams->do_hash && cparams->hash_verify)
- /* Do not cipher the hash tag */
- op->sym->cipher.data.length = (data_len -
- cparams->digest_length) << 3;
- else
- op->sym->cipher.data.length = data_len << 3;
-
+ op->sym->cipher.data.length = data_len << 3;
} else {
op->sym->cipher.data.offset = ipdata_offset;
- if (cparams->do_hash && cparams->hash_verify)
- /* Do not cipher the hash tag */
- op->sym->cipher.data.length = data_len -
- cparams->digest_length;
- else
- op->sym->cipher.data.length = data_len;
+ op->sym->cipher.data.length = data_len;
}
}
diff --git a/examples/qos_sched/app_thread.c b/examples/qos_sched/app_thread.c
index 3c678cc4..70fdcdb2 100644
--- a/examples/qos_sched/app_thread.c
+++ b/examples/qos_sched/app_thread.c
@@ -215,17 +215,16 @@ app_worker_thread(struct thread_conf **confs)
while ((conf = confs[conf_idx])) {
uint32_t nb_pkt;
- int retval;
/* Read packet from the ring */
- retval = rte_ring_sc_dequeue_bulk(conf->rx_ring, (void **)mbufs,
+ nb_pkt = rte_ring_sc_dequeue_burst(conf->rx_ring, (void **)mbufs,
burst_conf.ring_burst);
- if (likely(retval == 0)) {
+ if (likely(nb_pkt)) {
int nb_sent = rte_sched_port_enqueue(conf->sched_port, mbufs,
- burst_conf.ring_burst);
+ nb_pkt);
- APP_STATS_ADD(conf->stat.nb_drop, burst_conf.ring_burst - nb_sent);
- APP_STATS_ADD(conf->stat.nb_rx, burst_conf.ring_burst);
+ APP_STATS_ADD(conf->stat.nb_drop, nb_pkt - nb_sent);
+ APP_STATS_ADD(conf->stat.nb_rx, nb_pkt);
}
nb_pkt = rte_sched_port_dequeue(conf->sched_port, mbufs,
@@ -250,17 +249,16 @@ app_mixed_thread(struct thread_conf **confs)
while ((conf = confs[conf_idx])) {
uint32_t nb_pkt;
- int retval;
/* Read packet from the ring */
- retval = rte_ring_sc_dequeue_bulk(conf->rx_ring, (void **)mbufs,
+ nb_pkt = rte_ring_sc_dequeue_burst(conf->rx_ring, (void **)mbufs,
burst_conf.ring_burst);
- if (likely(retval == 0)) {
+ if (likely(nb_pkt)) {
int nb_sent = rte_sched_port_enqueue(conf->sched_port, mbufs,
- burst_conf.ring_burst);
+ nb_pkt);
- APP_STATS_ADD(conf->stat.nb_drop, burst_conf.ring_burst - nb_sent);
- APP_STATS_ADD(conf->stat.nb_rx, burst_conf.ring_burst);
+ APP_STATS_ADD(conf->stat.nb_drop, nb_pkt - nb_sent);
+ APP_STATS_ADD(conf->stat.nb_rx, nb_pkt);
}
diff --git a/examples/tep_termination/vxlan.c b/examples/tep_termination/vxlan.c
index 5ee1f956..9142c8d9 100644
--- a/examples/tep_termination/vxlan.c
+++ b/examples/tep_termination/vxlan.c
@@ -147,7 +147,7 @@ process_inner_cksums(struct ether_hdr *eth_hdr, union tunnel_offload_info *info)
if (tso_segsz != 0) {
ol_flags |= PKT_TX_TCP_SEG;
info->tso_segsz = tso_segsz;
- info->l4_len = sizeof(struct tcp_hdr);
+ info->l4_len = (tcp_hdr->data_off & 0xf0) >> 2;
}
} else if (l4_proto == IPPROTO_SCTP) {
@@ -218,7 +218,7 @@ encapsulation(struct rte_mbuf *m, uint8_t queue_id)
/* copy in IP header */
ip = rte_memcpy(ip, &app_ip_hdr[vport_id],
sizeof(struct ipv4_hdr));
- ip->total_length = rte_cpu_to_be_16(m->data_len
+ ip->total_length = rte_cpu_to_be_16(m->pkt_len
- sizeof(struct ether_hdr));
/* outer IP checksum */