aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/exception_path/main.c3
-rw-r--r--examples/flow_filtering/main.c16
-rw-r--r--examples/ip_pipeline/config_parse_tm.c2
-rw-r--r--examples/ipsec-secgw/ipsec-secgw.c7
-rw-r--r--examples/ipsec-secgw/parser.c2
-rw-r--r--examples/l2fwd-crypto/main.c37
-rw-r--r--examples/l3fwd/l3fwd_em.c1
-rw-r--r--examples/l3fwd/l3fwd_lpm.c1
-rw-r--r--examples/vhost_scsi/scsi.c6
9 files changed, 49 insertions, 26 deletions
diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c
index dc1d9641..ba081e33 100644
--- a/examples/exception_path/main.c
+++ b/examples/exception_path/main.c
@@ -164,6 +164,9 @@ print_stats(void)
" Lcore Port RX TX Dropped on TX\n"
"------- ------ ------------ ------------ ---------------\n");
RTE_LCORE_FOREACH(i) {
+ /* limit ourselves to application supported cores only */
+ if (i >= APP_MAX_LCORE)
+ break;
printf("%6u %7u %13"PRIu64" %13"PRIu64" %16"PRIu64"\n",
i, (unsigned)port_ids[i],
lcore_stats[i].rx, lcore_stats[i].tx,
diff --git a/examples/flow_filtering/main.c b/examples/flow_filtering/main.c
index 7d739b4a..fe512dae 100644
--- a/examples/flow_filtering/main.c
+++ b/examples/flow_filtering/main.c
@@ -149,6 +149,22 @@ init_port(void)
/**< CRC stripped by hardware */
.hw_strip_crc = 1,
},
+ /*
+ * Initialize fdir_conf of rte_eth_conf.
+ * Fdir is used in flow filtering for I40e,
+ * so rte_flow rules involve some fdir
+ * configurations. In long term it's better
+ * that drivers don't require any fdir
+ * configuration for rte_flow, but we need to
+ * get this workaround so that sample app can
+ * run on I40e.
+ */
+ .fdir_conf = {
+ .mode = RTE_FDIR_MODE_PERFECT,
+ .pballoc = RTE_FDIR_PBALLOC_64K,
+ .status = RTE_FDIR_REPORT_STATUS,
+ .drop_queue = 127,
+ },
};
printf(":: initializing port: %d\n", port_id);
diff --git a/examples/ip_pipeline/config_parse_tm.c b/examples/ip_pipeline/config_parse_tm.c
index e75eed71..1c945c9c 100644
--- a/examples/ip_pipeline/config_parse_tm.c
+++ b/examples/ip_pipeline/config_parse_tm.c
@@ -352,7 +352,7 @@ tm_cfgfile_load_sched_subport(
char name[CFG_NAME_LEN + 1];
profile = atoi(entries[j].value);
- strncpy(name,
+ memcpy(name,
entries[j].name,
sizeof(name));
n_tokens = rte_strsplit(
diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c
index b5ec70a1..46af3f05 100644
--- a/examples/ipsec-secgw/ipsec-secgw.c
+++ b/examples/ipsec-secgw/ipsec-secgw.c
@@ -302,6 +302,7 @@ prepare_tx_pkt(struct rte_mbuf *pkt, uint16_t port)
pkt->l3_len = sizeof(struct ip);
pkt->l2_len = ETHER_HDR_LEN;
+ ip->ip_sum = 0;
ethhdr->ether_type = rte_cpu_to_be_16(ETHER_TYPE_IPv4);
} else {
pkt->ol_flags |= PKT_TX_IPV6;
@@ -475,11 +476,13 @@ outbound_sp(struct sp_ctx *sp, struct traffic_type *ip,
sa_idx = ip->res[i] & PROTECT_MASK;
if (ip->res[i] & DISCARD)
rte_pktmbuf_free(m);
+ else if (ip->res[i] & BYPASS)
+ ip->pkts[j++] = m;
else if (sa_idx < IPSEC_SA_MAX_ENTRIES) {
ipsec->res[ipsec->num] = sa_idx;
ipsec->pkts[ipsec->num++] = m;
- } else /* BYPASS */
- ip->pkts[j++] = m;
+ } else /* invalid SA idx */
+ rte_pktmbuf_free(m);
}
ip->num = j;
}
diff --git a/examples/ipsec-secgw/parser.c b/examples/ipsec-secgw/parser.c
index 9d0ea462..e0881b74 100644
--- a/examples/ipsec-secgw/parser.c
+++ b/examples/ipsec-secgw/parser.c
@@ -544,7 +544,7 @@ parse_cfg_file(const char *cfg_filename)
goto error_exit;
}
- strncpy(str + strlen(str), oneline,
+ memcpy(str + strlen(str), oneline,
strlen(oneline));
continue;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index ff575222..77af7e6a 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -439,7 +439,7 @@ 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)
+ if ((cparams->do_hash || cparams->do_aead) && cparams->hash_verify)
data_len -= cparams->digest_length;
if (cparams->do_cipher) {
@@ -2081,10 +2081,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
options->block_size = cap->sym.aead.block_size;
- check_iv_param(&cap->sym.aead.iv_size,
+ if (check_iv_param(&cap->sym.aead.iv_size,
options->aead_iv_param,
options->aead_iv_random_size,
- &options->aead_iv.length);
+ &options->aead_iv.length) < 0)
+ continue;
/*
* Check if length of provided AEAD key is supported
@@ -2098,7 +2099,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.aead.key_size.increment)
!= 0) {
printf("Unsupported aead key length\n");
- return -1;
+ continue;
}
/*
* Check if length of the aead key to be randomly generated
@@ -2111,7 +2112,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.aead.key_size.increment)
!= 0) {
printf("Unsupported aead key length\n");
- return -1;
+ continue;
}
options->aead_xform.aead.key.length =
options->aead_key_random_size;
@@ -2136,7 +2137,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.aead.aad_size.increment)
!= 0) {
printf("Unsupported AAD length\n");
- return -1;
+ continue;
}
/*
* Check if length of AAD to be randomly generated
@@ -2149,7 +2150,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.aead.aad_size.increment)
!= 0) {
printf("Unsupported AAD length\n");
- return -1;
+ continue;
}
options->aad.length = options->aad_random_size;
/* No size provided, use minimum size. */
@@ -2167,7 +2168,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.aead.digest_size.increment)
!= 0) {
printf("Unsupported digest length\n");
- return -1;
+ continue;
}
options->aead_xform.aead.digest_length =
options->digest_size;
@@ -2189,10 +2190,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
options->block_size = cap->sym.cipher.block_size;
- check_iv_param(&cap->sym.cipher.iv_size,
+ if (check_iv_param(&cap->sym.cipher.iv_size,
options->cipher_iv_param,
options->cipher_iv_random_size,
- &options->cipher_iv.length);
+ &options->cipher_iv.length) < 0)
+ continue;
/*
* Check if length of provided cipher key is supported
@@ -2206,7 +2208,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.cipher.key_size.increment)
!= 0) {
printf("Unsupported cipher key length\n");
- return -1;
+ continue;
}
/*
* Check if length of the cipher key to be randomly generated
@@ -2219,7 +2221,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.cipher.key_size.increment)
!= 0) {
printf("Unsupported cipher key length\n");
- return -1;
+ continue;
}
options->cipher_xform.cipher.key.length =
options->ckey_random_size;
@@ -2245,10 +2247,11 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
if (cap == NULL)
continue;
- check_iv_param(&cap->sym.auth.iv_size,
+ if (check_iv_param(&cap->sym.auth.iv_size,
options->auth_iv_param,
options->auth_iv_random_size,
- &options->auth_iv.length);
+ &options->auth_iv.length) < 0)
+ continue;
/*
* Check if length of provided auth key is supported
* by the algorithm chosen.
@@ -2261,7 +2264,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.auth.key_size.increment)
!= 0) {
printf("Unsupported auth key length\n");
- return -1;
+ continue;
}
/*
* Check if length of the auth key to be randomly generated
@@ -2274,7 +2277,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.auth.key_size.increment)
!= 0) {
printf("Unsupported auth key length\n");
- return -1;
+ continue;
}
options->auth_xform.auth.key.length =
options->akey_random_size;
@@ -2296,7 +2299,7 @@ initialize_cryptodevs(struct l2fwd_crypto_options *options, unsigned nb_ports,
cap->sym.auth.digest_size.increment)
!= 0) {
printf("Unsupported digest length\n");
- return -1;
+ continue;
}
options->auth_xform.auth.digest_length =
options->digest_size;
diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c
index 2b7c173b..cc7a8354 100644
--- a/examples/l3fwd/l3fwd_em.c
+++ b/examples/l3fwd/l3fwd_em.c
@@ -47,7 +47,6 @@
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
-#include <rte_mempool.h>
#include <rte_cycles.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index 2d0e1724..c185e5e1 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -46,7 +46,6 @@
#include <rte_debug.h>
#include <rte_ether.h>
#include <rte_ethdev.h>
-#include <rte_mempool.h>
#include <rte_cycles.h>
#include <rte_mbuf.h>
#include <rte_ip.h>
diff --git a/examples/vhost_scsi/scsi.c b/examples/vhost_scsi/scsi.c
index fd430ec2..47c5c83c 100644
--- a/examples/vhost_scsi/scsi.c
+++ b/examples/vhost_scsi/scsi.c
@@ -210,7 +210,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,
break;
case SPC_VPD_UNIT_SERIAL_NUMBER:
hlen = 4;
- strncpy((char *)vpage->params, bdev->name, 32);
+ memcpy((char *)vpage->params, bdev->name, 32);
vpage->alloc_len = rte_cpu_to_be_16(32);
break;
case SPC_VPD_DEVICE_IDENTIFICATION:
@@ -247,7 +247,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,
strncpy((char *)desig->desig, "INTEL", 8);
vhost_strcpy_pad((char *)&desig->desig[8],
bdev->product_name, 16, ' ');
- strncpy((char *)&desig->desig[24], bdev->name, 32);
+ memcpy((char *)&desig->desig[24], bdev->name, 32);
len += sizeof(struct scsi_desig_desc) + 8 + 16 + 32;
buf += sizeof(struct scsi_desig_desc) + desig->len;
@@ -312,7 +312,7 @@ vhost_bdev_scsi_inquiry_command(struct vhost_block_dev *bdev,
bdev->product_name);
/* PRODUCT REVISION LEVEL */
- strncpy((char *)inqdata->product_rev, "0001", 4);
+ memcpy((char *)inqdata->product_rev, "0001", 4);
/* Standard inquiry data ends here. Only populate
* remaining fields if alloc_len indicates enough