diff options
author | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-11-30 12:44:48 +0300 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2015-11-30 12:44:48 +0300 |
commit | 74785c4e170e035c08476179237d68a36fa23ec3 (patch) | |
tree | 2d614f6491c214b138ed72e5568eb611ef68fe19 /example | |
parent | 56e6043816ecbe954e804004f0b13cdad5915341 (diff) | |
parent | 6f7fad3acc8254a273a0ed80833bf422ad01d9c0 (diff) |
Merge branch 'next'
Diffstat (limited to 'example')
-rw-r--r-- | example/generator/odp_generator.c | 18 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec.c | 2 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec_cache.c | 2 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec_cache.h | 4 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec_misc.h | 12 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec_sa_db.c | 4 | ||||
-rw-r--r-- | example/ipsec/odp_ipsec_stream.c | 3 | ||||
-rw-r--r-- | example/timer/odp_timer_test.c | 10 |
8 files changed, 31 insertions, 24 deletions
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 68f38e62..01807a0b 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -586,7 +586,7 @@ static void *gen_recv_thread(void *arg) */ static void print_global_stats(int num_workers) { - uint64_t start, now, diff; + odp_time_t start, wait, diff; uint64_t pkts, pkts_prev = 0, pps, maximum_pps = 0; int verbose_interval = 20; odp_thrmask_t thrd_mask; @@ -594,7 +594,8 @@ static void print_global_stats(int num_workers) while (odp_thrmask_worker(&thrd_mask) < num_workers) continue; - start = odp_time_cycles(); + wait = odp_time_local_from_ns(verbose_interval * ODP_TIME_SEC_IN_NS); + start = odp_time_local(); while (odp_thrmask_worker(&thrd_mask) == num_workers) { if (args->appl.number != -1 && @@ -603,14 +604,11 @@ static void print_global_stats(int num_workers) break; } - now = odp_time_cycles(); - diff = odp_time_diff_cycles(start, now); - if (odp_time_cycles_to_ns(diff) < - verbose_interval * ODP_TIME_SEC) { + diff = odp_time_diff(odp_time_local(), start); + if (odp_time_cmp(wait, diff) > 0) continue; - } - start = odp_time_cycles(); + start = odp_time_local(); if (args->appl.mode == APPL_MODE_RCV) { pkts = odp_atomic_load_u64(&counters.udp); @@ -732,9 +730,9 @@ int main(int argc, char *argv[]) odp_pool_print(pool); /* Create timer pool */ - tparams.res_ns = 1 * ODP_TIME_MSEC; + tparams.res_ns = 1 * ODP_TIME_MSEC_IN_NS; tparams.min_tmo = 0; - tparams.max_tmo = 10000 * ODP_TIME_SEC; + tparams.max_tmo = 10000 * ODP_TIME_SEC_IN_NS; tparams.num_timers = num_workers; /* One timer per worker */ tparams.priv = 0; /* Shared */ tparams.clk_src = ODP_CLOCK_CPU; diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 9950ccf8..f0ff2c94 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1554,7 +1554,7 @@ static void usage(char *progname) " -r, --route SubNet:Intf:NextHopMAC\n" " -p, --policy SrcSubNet:DstSubNet:(in|out):(ah|esp|both)\n" " -e, --esp SrcIP:DstIP:(3des|null):SPI:Key192\n" - " -a, --ah SrcIP:DstIP:(md5|null):SPI:Key128\n" + " -a, --ah SrcIP:DstIP:(sha256|md5|null):SPI:Key(256|128)\n" "\n" " Where: NextHopMAC is raw hex/dot notation, i.e. 03.BA.44.9A.CE.02\n" " IP is decimal/dot notation, i.e. 192.168.1.1\n" diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 6a8f3c9a..0883d4d4 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -46,7 +46,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa, { odp_crypto_session_params_t params; ipsec_cache_entry_t *entry; - enum odp_crypto_ses_create_err ses_create_rc; + odp_crypto_ses_create_err_t ses_create_rc; odp_crypto_session_t session; sa_mode_t mode = IPSEC_SA_MODE_TRANSPORT; diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h index 57060079..91d9d7e1 100644 --- a/example/ipsec/odp_ipsec_cache.h +++ b/example/ipsec/odp_ipsec_cache.h @@ -38,14 +38,14 @@ typedef struct ipsec_cache_entry_s { uint32_t tun_src_ip; /**< Tunnel src IPv4 addr */ uint32_t tun_dst_ip; /**< Tunnel dst IPv4 addr */ struct { - enum odp_cipher_alg alg; /**< Cipher algorithm */ + odp_cipher_alg_t alg; /**< Cipher algorithm */ uint32_t spi; /**< Cipher SPI */ uint32_t block_len; /**< Cipher block length */ uint32_t iv_len; /**< Cipher IV length */ ipsec_key_t key; /**< Cipher key */ } esp; struct { - enum odp_auth_alg alg; /**< Auth algorithm */ + odp_auth_alg_t alg; /**< Auth algorithm */ uint32_t spi; /**< Auth SPI */ uint32_t icv_len; /**< Auth ICV length */ ipsec_key_t key; /**< Auth key */ diff --git a/example/ipsec/odp_ipsec_misc.h b/example/ipsec/odp_ipsec_misc.h index f6a12b5c..e583c01a 100644 --- a/example/ipsec/odp_ipsec_misc.h +++ b/example/ipsec/odp_ipsec_misc.h @@ -28,8 +28,9 @@ extern "C" { #define MAX_STRING 32 /**< maximum string length */ #define MAX_IV_LEN 32 /**< Maximum IV length in bytes */ -#define KEY_BITS_3DES 192 /**< 3DES cipher key length in bits */ -#define KEY_BITS_MD5_96 128 /**< MD5_96 auth key length in bits */ +#define KEY_BITS_3DES 192 /**< 3DES cipher key length in bits */ +#define KEY_BITS_MD5_96 128 /**< MD5_96 auth key length in bits */ +#define KEY_BITS_SHA256_128 256 /**< SHA256_128 auth key length in bits */ /**< Number of bits represnted by a string of hexadecimal characters */ #define KEY_STR_BITS(str) (4 * strlen(str)) @@ -59,8 +60,8 @@ typedef struct { typedef struct { odp_bool_t cipher; union { - enum odp_cipher_alg cipher; - enum odp_auth_alg auth; + odp_cipher_alg_t cipher; + odp_auth_alg_t auth; } u; } ipsec_alg_t; @@ -102,6 +103,9 @@ int parse_key_string(char *keystring, if ((alg->u.auth == ODP_AUTH_ALG_MD5_96) && (KEY_BITS_MD5_96 == key_bits_in)) key->length = key_bits_in / 8; + else if ((alg->u.auth == ODP_AUTH_ALG_SHA256_128) && + (KEY_BITS_SHA256_128 == key_bits_in)) + key->length = key_bits_in / 8; } for (idx = 0; idx < key->length; idx++) { diff --git a/example/ipsec/odp_ipsec_sa_db.c b/example/ipsec/odp_ipsec_sa_db.c index 79676145..928c4cb4 100644 --- a/example/ipsec/odp_ipsec_sa_db.c +++ b/example/ipsec/odp_ipsec_sa_db.c @@ -111,6 +111,10 @@ int create_sa_db_entry(char *input, odp_bool_t cipher) entry->alg.u.auth = ODP_AUTH_ALG_MD5_96; entry->icv_len = 12; + } else if (!strcmp(token, "sha256")) { + entry->alg.u.auth = + ODP_AUTH_ALG_SHA256_128; + entry->icv_len = 16; } else { entry->alg.u.auth = ODP_AUTH_ALG_NULL; } diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index 8a1cc56a..f750e180 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -227,7 +227,8 @@ odp_packet_t create_ipv4_packet(stream_db_entry_t *stream, /* AH (if specified) */ if (entry && (entry == stream->input.entry) && (ODP_AUTH_ALG_NULL != entry->ah.alg)) { - if (ODP_AUTH_ALG_MD5_96 != entry->ah.alg) + if (entry->ah.alg != ODP_AUTH_ALG_MD5_96 && + entry->ah.alg != ODP_AUTH_ALG_SHA256_128) abort(); ah = (odph_ahhdr_t *)data; diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index aee01c83..8796b663 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -95,7 +95,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) queue = odp_queue_lookup("timer_queue"); - period_ns = gbls->args.period_us*ODP_TIME_USEC; + period_ns = gbls->args.period_us * ODP_TIME_USEC_IN_NS; period = odp_timer_ns_to_tick(gbls->tp, period_ns); EXAMPLE_DBG(" [%i] period %"PRIu64" ticks, %"PRIu64" ns\n", thr, @@ -411,9 +411,9 @@ int main(int argc, char *argv[]) return -1; } - tparams.res_ns = gbls->args.resolution_us*ODP_TIME_USEC; - tparams.min_tmo = gbls->args.min_us*ODP_TIME_USEC; - tparams.max_tmo = gbls->args.max_us*ODP_TIME_USEC; + tparams.res_ns = gbls->args.resolution_us * ODP_TIME_USEC_IN_NS; + tparams.min_tmo = gbls->args.min_us * ODP_TIME_USEC_IN_NS; + tparams.max_tmo = gbls->args.max_us * ODP_TIME_USEC_IN_NS; tparams.num_timers = num_workers; /* One timer per worker */ tparams.priv = 0; /* Shared */ tparams.clk_src = ODP_CLOCK_CPU; @@ -458,7 +458,7 @@ int main(int argc, char *argv[]) printf(" %12" PRIu64 " ticks -> %12" PRIu64 " ns\n", tick, odp_timer_tick_to_ns(gbls->tp, tick)); - for (ns = 1; ns <= 100*ODP_TIME_SEC; ns *= 10) { + for (ns = 1; ns <= 100 * ODP_TIME_SEC_IN_NS; ns *= 10) { tick = odp_timer_ns_to_tick(gbls->tp, ns); printf(" %12" PRIu64 " ns -> %12" PRIu64 " ticks\n", ns, |