aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRicardo Salveti <ricardo.salveti@linaro.org>2016-07-25 13:22:22 -0300
committerRicardo Salveti <ricardo.salveti@linaro.org>2016-07-25 13:23:50 -0300
commit7b53c036e6bf56623b8273018ff1c8cc62847857 (patch)
tree4af0da8c150bbebd7d1d252d6ac801a7efef0d23 /examples
parent5d4e5dcd8a186778b3d78e27c81550d07a288fd2 (diff)
Imported Upstream version 16.07-rc4
Change-Id: Ic57f6a3726f2dbd1682223648d91310f45705327 Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/ip_pipeline/config_parse.c2
-rw-r--r--examples/ip_pipeline/pipeline/pipeline_flow_actions.c4
-rw-r--r--examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c6
-rw-r--r--examples/ip_pipeline/pipeline/pipeline_passthrough_be.c4
-rw-r--r--examples/ipsec-secgw/ipip.h4
-rw-r--r--examples/ipsec-secgw/ipsec-secgw.c4
-rw-r--r--examples/ipsec-secgw/ipsec.h4
-rw-r--r--examples/ipsec-secgw/sa.c60
-rw-r--r--examples/l2fwd-crypto/main.c7
-rw-r--r--examples/l2fwd-ivshmem/host/host.c3
-rw-r--r--examples/performance-thread/pthread_shim/pthread_shim.c3
-rw-r--r--examples/vhost/main.c2
12 files changed, 60 insertions, 43 deletions
diff --git a/examples/ip_pipeline/config_parse.c b/examples/ip_pipeline/config_parse.c
index 0adca98f..8fe81577 100644
--- a/examples/ip_pipeline/config_parse.c
+++ b/examples/ip_pipeline/config_parse.c
@@ -185,7 +185,7 @@ static const struct app_pktq_swq_params default_swq_params = {
struct app_pktq_tm_params default_tm_params = {
.parsed = 0,
.file_name = "./config/tm_profile.cfg",
- .burst_read = 64,
+ .burst_read = 24,
.burst_write = 32,
};
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
index bf12fd7b..349db6b1 100644
--- a/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
+++ b/examples/ip_pipeline/pipeline/pipeline_flow_actions.c
@@ -290,6 +290,7 @@ app_pipeline_fa_flow_config_bulk(struct app_params *app,
void **req_entry_ptr;
uint32_t *req_flow_id;
uint32_t i;
+ int status;
/* Check input arguments */
if ((app == NULL) ||
@@ -368,6 +369,7 @@ app_pipeline_fa_flow_config_bulk(struct app_params *app,
}
/* Read response */
+ status = (rsp->n_flows == n_flows) ? 0 : -1;
/* Commit flows */
for (i = 0; i < rsp->n_flows; i++) {
@@ -408,7 +410,7 @@ app_pipeline_fa_flow_config_bulk(struct app_params *app,
rte_free(req_flow_id);
rte_free(req_entry_ptr);
- return (rsp->n_flows == n_flows) ? 0 : -1;
+ return status;
}
int
diff --git a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
index 8a762bc7..026f00cd 100644
--- a/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
+++ b/examples/ip_pipeline/pipeline/pipeline_flow_classification_be.c
@@ -221,7 +221,7 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p,
uint32_t flow_id_offset_present = 0;
uint32_t i;
- char key_mask_str[PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2];
+ char key_mask_str[PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2 + 1];
p->hash_offset = 0;
@@ -303,13 +303,13 @@ pipeline_fc_parse_args(struct pipeline_flow_classification *p,
params->name, arg_name);
key_mask_present = 1;
- PIPELINE_ARG_CHECK((mask_str_len <
+ PIPELINE_ARG_CHECK((mask_str_len <=
(PIPELINE_FC_FLOW_KEY_MAX_SIZE * 2)),
"Parse error in section \"%s\": entry "
"\"%s\" is too long", params->name,
arg_name);
- snprintf(key_mask_str, sizeof(key_mask_str), "%s",
+ snprintf(key_mask_str, mask_str_len + 1, "%s",
arg_value);
continue;
diff --git a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
index 6146a28f..356f02d0 100644
--- a/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
+++ b/examples/ip_pipeline/pipeline/pipeline_passthrough_be.c
@@ -366,7 +366,7 @@ pipeline_passthrough_parse_args(struct pipeline_passthrough_params *p,
uint32_t dma_hash_offset_present = 0;
uint32_t lb_present = 0;
uint32_t i;
- char dma_mask_str[PIPELINE_PASSTHROUGH_DMA_SIZE_MAX * 2];
+ char dma_mask_str[PIPELINE_PASSTHROUGH_DMA_SIZE_MAX * 2 + 1];
/* default values */
p->dma_enabled = 0;
@@ -454,7 +454,7 @@ pipeline_passthrough_parse_args(struct pipeline_passthrough_params *p,
params->name, arg_name);
dma_src_mask_present = 1;
- PIPELINE_ARG_CHECK((mask_str_len <
+ PIPELINE_ARG_CHECK((mask_str_len <=
(PIPELINE_PASSTHROUGH_DMA_SIZE_MAX * 2)),
"Parse error in section \"%s\": entry "
"\"%s\" too long", params->name,
diff --git a/examples/ipsec-secgw/ipip.h b/examples/ipsec-secgw/ipip.h
index ce25a2e2..ff1dccdb 100644
--- a/examples/ipsec-secgw/ipip.h
+++ b/examples/ipsec-secgw/ipip.h
@@ -100,8 +100,8 @@ ipip_outbound(struct rte_mbuf *m, uint32_t offset, uint32_t is_ipv6,
outip4->ip_ttl = IPDEFTTL;
outip4->ip_p = IPPROTO_ESP;
- outip4->ip_src.s_addr = src->ip4;
- outip4->ip_dst.s_addr = dst->ip4;
+ outip4->ip_src.s_addr = src->ip.ip4;
+ outip4->ip_dst.s_addr = dst->ip.ip4;
return outip4;
}
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index 1ca144b8..5d04eb3f 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -1273,6 +1273,10 @@ cryptodevs_init(void)
&qp_conf, dev_conf.socket_id))
rte_panic("Failed to setup queue %u for "
"cdev_id %u\n", 0, cdev_id);
+
+ if (rte_cryptodev_start(cdev_id))
+ rte_panic("Failed to start cryptodev %u\n",
+ cdev_id);
}
printf("\n");
diff --git a/examples/ipsec-secgw/ipsec.h b/examples/ipsec-secgw/ipsec.h
index 0d2ee254..a442a74a 100644
--- a/examples/ipsec-secgw/ipsec.h
+++ b/examples/ipsec-secgw/ipsec.h
@@ -86,8 +86,8 @@ struct ip_addr {
union {
uint64_t ip6[2];
uint8_t ip6_b[16];
- };
- };
+ } ip6;
+ } ip;
};
struct ipsec_sa {
diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c
index ab18b811..4439e0f5 100644
--- a/examples/ipsec-secgw/sa.c
+++ b/examples/ipsec-secgw/sa.c
@@ -53,8 +53,8 @@
const struct ipsec_sa sa_out[] = {
{
.spi = 5,
- .src.ip4 = IPv4(172, 16, 1, 5),
- .dst.ip4 = IPv4(172, 16, 2, 5),
+ .src.ip.ip4 = IPv4(172, 16, 1, 5),
+ .dst.ip.ip4 = IPv4(172, 16, 2, 5),
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
.digest_len = 12,
@@ -64,8 +64,8 @@ const struct ipsec_sa sa_out[] = {
},
{
.spi = 6,
- .src.ip4 = IPv4(172, 16, 1, 6),
- .dst.ip4 = IPv4(172, 16, 2, 6),
+ .src.ip.ip4 = IPv4(172, 16, 1, 6),
+ .dst.ip.ip4 = IPv4(172, 16, 2, 6),
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
.digest_len = 12,
@@ -93,8 +93,8 @@ const struct ipsec_sa sa_out[] = {
},
{
.spi = 15,
- .src.ip4 = IPv4(172, 16, 1, 5),
- .dst.ip4 = IPv4(172, 16, 2, 5),
+ .src.ip.ip4 = IPv4(172, 16, 1, 5),
+ .dst.ip.ip4 = IPv4(172, 16, 2, 5),
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
.digest_len = 0,
@@ -104,8 +104,8 @@ const struct ipsec_sa sa_out[] = {
},
{
.spi = 16,
- .src.ip4 = IPv4(172, 16, 1, 6),
- .dst.ip4 = IPv4(172, 16, 2, 6),
+ .src.ip.ip4 = IPv4(172, 16, 1, 6),
+ .dst.ip.ip4 = IPv4(172, 16, 2, 6),
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
.digest_len = 0,
@@ -115,9 +115,9 @@ const struct ipsec_sa sa_out[] = {
},
{
.spi = 25,
- .src.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ .src.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x55, 0x55 },
- .dst.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ .dst.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55 },
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
@@ -128,9 +128,9 @@ const struct ipsec_sa sa_out[] = {
},
{
.spi = 26,
- .src.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ .src.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x66, 0x66 },
- .dst.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ .dst.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x66, 0x66 },
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
@@ -145,8 +145,8 @@ const struct ipsec_sa sa_out[] = {
const struct ipsec_sa sa_in[] = {
{
.spi = 105,
- .src.ip4 = IPv4(172, 16, 2, 5),
- .dst.ip4 = IPv4(172, 16, 1, 5),
+ .src.ip.ip4 = IPv4(172, 16, 2, 5),
+ .dst.ip.ip4 = IPv4(172, 16, 1, 5),
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
.digest_len = 12,
@@ -156,8 +156,8 @@ const struct ipsec_sa sa_in[] = {
},
{
.spi = 106,
- .src.ip4 = IPv4(172, 16, 2, 6),
- .dst.ip4 = IPv4(172, 16, 1, 6),
+ .src.ip.ip4 = IPv4(172, 16, 2, 6),
+ .dst.ip.ip4 = IPv4(172, 16, 1, 6),
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
.digest_len = 12,
@@ -185,8 +185,8 @@ const struct ipsec_sa sa_in[] = {
},
{
.spi = 115,
- .src.ip4 = IPv4(172, 16, 2, 5),
- .dst.ip4 = IPv4(172, 16, 1, 5),
+ .src.ip.ip4 = IPv4(172, 16, 2, 5),
+ .dst.ip.ip4 = IPv4(172, 16, 1, 5),
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
.digest_len = 0,
@@ -196,8 +196,8 @@ const struct ipsec_sa sa_in[] = {
},
{
.spi = 116,
- .src.ip4 = IPv4(172, 16, 2, 6),
- .dst.ip4 = IPv4(172, 16, 1, 6),
+ .src.ip.ip4 = IPv4(172, 16, 2, 6),
+ .dst.ip.ip4 = IPv4(172, 16, 1, 6),
.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
.auth_algo = RTE_CRYPTO_AUTH_NULL,
.digest_len = 0,
@@ -207,9 +207,9 @@ const struct ipsec_sa sa_in[] = {
},
{
.spi = 125,
- .src.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ .src.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x55, 0x55 },
- .dst.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ .dst.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x55, 0x55 },
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
@@ -220,9 +220,9 @@ const struct ipsec_sa sa_in[] = {
},
{
.spi = 126,
- .src.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
+ .src.ip.ip6.ip6_b = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x66, 0x66 },
- .dst.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
+ .dst.ip.ip6.ip6_b = { 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x66, 0x66 },
.cipher_algo = RTE_CRYPTO_CIPHER_AES_CBC,
.auth_algo = RTE_CRYPTO_AUTH_SHA1_HMAC,
@@ -342,8 +342,8 @@ sa_add_rules(struct sa_ctx *sa_ctx, const struct ipsec_sa entries[],
switch (sa->flags) {
case IP4_TUNNEL:
- sa->src.ip4 = rte_cpu_to_be_32(sa->src.ip4);
- sa->dst.ip4 = rte_cpu_to_be_32(sa->dst.ip4);
+ sa->src.ip.ip4 = rte_cpu_to_be_32(sa->src.ip.ip4);
+ sa->dst.ip.ip4 = rte_cpu_to_be_32(sa->dst.ip.ip4);
}
if (inbound) {
@@ -473,15 +473,15 @@ single_inbound_lookup(struct ipsec_sa *sadb, struct rte_mbuf *pkt,
case IP4_TUNNEL:
src4_addr = RTE_PTR_ADD(ip, offsetof(struct ip, ip_src));
if ((ip->ip_v == IPVERSION) &&
- (sa->src.ip4 == *src4_addr) &&
- (sa->dst.ip4 == *(src4_addr + 1)))
+ (sa->src.ip.ip4 == *src4_addr) &&
+ (sa->dst.ip.ip4 == *(src4_addr + 1)))
*sa_ret = sa;
break;
case IP6_TUNNEL:
src6_addr = RTE_PTR_ADD(ip, offsetof(struct ip6_hdr, ip6_src));
if ((ip->ip_v == IP6_VERSION) &&
- !memcmp(&sa->src.ip6, src6_addr, 16) &&
- !memcmp(&sa->dst.ip6, src6_addr + 16, 16))
+ !memcmp(&sa->src.ip.ip6.ip6, src6_addr, 16) &&
+ !memcmp(&sa->dst.ip.ip6.ip6, src6_addr + 16, 16))
*sa_ret = sa;
break;
case TRANSPORT:
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index dd39cc16..66397a08 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -1796,6 +1796,13 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
return -1;
}
+ retval = rte_cryptodev_start(cdev_id);
+ if (retval < 0) {
+ printf("Failed to start device %u: error %d\n",
+ cdev_id, retval);
+ return -1;
+ }
+
l2fwd_enabled_crypto_mask |= (1 << cdev_id);
enabled_cdevs[cdev_id] = 1;
diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c
index cd284b7d..da7b00d9 100644
--- a/examples/l2fwd-ivshmem/host/host.c
+++ b/examples/l2fwd-ivshmem/host/host.c
@@ -110,7 +110,8 @@ static void
print_stats(void)
{
uint64_t total_packets_dropped, total_packets_tx, total_packets_rx;
- uint64_t total_vm_packets_dropped, total_vm_packets_tx, total_vm_packets_rx;
+ uint64_t total_vm_packets_dropped = 0;
+ uint64_t total_vm_packets_tx, total_vm_packets_rx;
unsigned portid;
total_packets_dropped = 0;
diff --git a/examples/performance-thread/pthread_shim/pthread_shim.c b/examples/performance-thread/pthread_shim/pthread_shim.c
index 93c3216d..0d6100c9 100644
--- a/examples/performance-thread/pthread_shim/pthread_shim.c
+++ b/examples/performance-thread/pthread_shim/pthread_shim.c
@@ -417,9 +417,10 @@ int pthread_detach(pthread_t tid)
if (override) {
struct lthread *lt = (struct lthread *)tid;
- if (lt == lthread_current())
+ if (lt == lthread_current()) {
lthread_detach();
return 0;
+ }
NOT_IMPLEMENTED;
}
return _sys_pthread_funcs.f_pthread_detach(tid);
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 3b98f429..92a98233 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -327,6 +327,8 @@ port_init(uint8_t port)
if (enable_tso == 0) {
rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_HOST_TSO4);
rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_HOST_TSO6);
+ rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_GUEST_TSO4);
+ rte_vhost_feature_disable(1ULL << VIRTIO_NET_F_GUEST_TSO6);
}
rx_rings = (uint16_t)dev_info.max_rx_queues;