[dpdk-dev] [PATCH v1 1/2] test/compress: add out of space test

2018-12-14 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

This patch adds new out of space testcase to check
that the destination mbuf is smaller than required for
the output of compression to ensure the driver doesn't crash
and returns the valid error case.

Signed-off-by: Marko Kovacevic 
---
 test/test/test_compressdev.c | 112 +--
 1 file changed, 108 insertions(+), 4 deletions(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index 4ea13f4..63b1ba9 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -41,6 +41,9 @@
 #define ZLIB_TRAILER_SIZE 4
 #define GZIP_HEADER_SIZE 10
 #define GZIP_TRAILER_SIZE 8
+#define OUT_OF_SPACE_BUF 1
+
+int out_of_space;
 
 const char *
 huffman_type_strings[] = {
@@ -727,8 +730,9 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 
if (sgl) {
for (i = 0; i < num_bufs; i++) {
-   data_size = strlen(test_bufs[i]) *
-   COMPRESS_BUF_SIZE_RATIO;
+   out_of_space ? data_size = OUT_OF_SPACE_BUF :
+   (data_size = strlen(test_bufs[i]) *
+   COMPRESS_BUF_SIZE_RATIO);
if (prepare_sgl_bufs(NULL, comp_bufs[i],
data_size,
ts_params->small_mbuf_pool,
@@ -739,8 +743,9 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 
} else {
for (i = 0; i < num_bufs; i++) {
-   data_size = strlen(test_bufs[i]) *
-   COMPRESS_BUF_SIZE_RATIO;
+   out_of_space ? data_size = OUT_OF_SPACE_BUF :
+   (data_size = strlen(test_bufs[i]) *
+   COMPRESS_BUF_SIZE_RATIO);
rte_pktmbuf_append(comp_bufs[i], data_size);
}
}
@@ -1663,6 +1668,103 @@ test_compressdev_deflate_stateless_checksum(void)
return ret;
 }
 
+static int
+test_compressdev_out_of_space_buffer(void)
+{
+   struct comp_testsuite_params *ts_params = &testsuite_params;
+   const char *test_buffer;
+   int ret;
+   uint16_t i = 0;
+   const struct rte_compressdev_capabilities *capab;
+   out_of_space = 1;
+
+   capab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);
+   TEST_ASSERT(capab != NULL, "Failed to retrieve device capabilities");
+
+   if ((capab->comp_feature_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0)
+   return -ENOTSUP;
+
+   struct rte_comp_xform *compress_xform =
+   rte_malloc(NULL, sizeof(struct rte_comp_xform), 0);
+
+   if (compress_xform == NULL) {
+   RTE_LOG(ERR, USER1,
+   "Compress xform could not be created\n");
+   ret = TEST_FAILED;
+   goto exit;
+   }
+
+   test_buffer = compress_test_bufs[i];
+
+   if (capab->comp_feature_flags & RTE_COMP_FF_OOP_SGL_IN_SGL_OUT) {
+
+   /* Compress with compressdev, decompress with Zlib */
+   if (test_deflate_comp_decomp(&test_buffer, 1,
+   &i,
+   &ts_params->def_comp_xform,
+   &ts_params->def_decomp_xform,
+   1,
+   RTE_COMP_OP_STATELESS,
+   1,
+   ZLIB_DECOMPRESS,
+   0) == 0) {
+   ret = TEST_FAILED;
+   goto exit;
+
+   }
+
+   /* Compress with Zlib, decompress with compressdev */
+   if (test_deflate_comp_decomp(&test_buffer, 1,
+   &i,
+   &ts_params->def_comp_xform,
+   &ts_params->def_decomp_xform,
+   1,
+   RTE_COMP_OP_STATELESS,
+   0,
+   ZLIB_COMPRESS,
+   0) == 0) {
+   ret = TEST_FAILED;
+   goto exit;
+   }
+   }
+
+   /* Compress with compressdev, decompress with Zlib */
+   if (test_deflate_comp_decomp(&test_buffer, 1,
+   &i,
+   &ts_params->def_comp_xform,
+   &ts_params->def_decomp_xform,
+   1,
+   RTE_COMP_OP_STATELESS,
+   0,
+   ZLIB_DECOMPRESS,
+   0) == 0) {
+   ret = TEST_FAILED;
+   goto exit;
+
+   }
+
+   /* Com

[dpdk-dev] [PATCH v1 2/2] test/compress: add varied buffer input/outputs

2018-12-14 Thread Marko Kovacevic
Added unit test to check if a SGL buffer
was added as an input and a Linear Buffer
as output and vice versa so we can test if the
application would process the different buffers
properly.

Signed-off-by: Marko Kovacevic 
---
 test/test/test_compressdev.c | 185 +++
 1 file changed, 134 insertions(+), 51 deletions(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index 63b1ba9..1fa9824 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -71,6 +71,13 @@ struct comp_testsuite_params {
struct rte_comp_xform *def_decomp_xform;
 };
 
+enum varied_buff {
+LB_BOTH = 0,   /* both input and output are linear*/
+SGL_BOTH,  /* both input and output are chained */
+SGL_TO_LB, /* input buffer is chained */
+LB_TO_SGL  /* output buffer is chained */
+};
+
 static struct comp_testsuite_params testsuite_params = { 0 };
 
 static void
@@ -346,7 +353,7 @@ compress_zlib(struct rte_comp_op *op,
}
 
/* Assuming stateless operation */
-   /* SGL */
+   /* SGL Input */
if (op->m_src->nb_segs > 1) {
single_src_buf = rte_malloc(NULL,
rte_pktmbuf_pkt_len(op->m_src), 0);
@@ -354,14 +361,10 @@ compress_zlib(struct rte_comp_op *op,
RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
goto exit;
}
-   single_dst_buf = rte_malloc(NULL,
-   rte_pktmbuf_pkt_len(op->m_dst), 0);
-   if (single_dst_buf == NULL) {
-   RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
-   goto exit;
-   }
-   if (rte_pktmbuf_read(op->m_src, 0,
-   rte_pktmbuf_pkt_len(op->m_src),
+
+   if (rte_pktmbuf_read(op->m_src, op->src.offset,
+   rte_pktmbuf_pkt_len(op->m_src) -
+   op->src.offset,
single_src_buf) == NULL) {
RTE_LOG(ERR, USER1,
"Buffer could not be read entirely\n");
@@ -370,15 +373,31 @@ compress_zlib(struct rte_comp_op *op,
 
stream.avail_in = op->src.length;
stream.next_in = single_src_buf;
-   stream.avail_out = rte_pktmbuf_pkt_len(op->m_dst);
-   stream.next_out = single_dst_buf;
 
} else {
stream.avail_in = op->src.length;
-   stream.next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
+   stream.next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+   op->src.offset);
+   }
+   /* SGL output */
+   if (op->m_dst->nb_segs > 1) {
+
+   single_dst_buf = rte_malloc(NULL,
+   rte_pktmbuf_pkt_len(op->m_dst), 0);
+   if (single_dst_buf == NULL) {
+   RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
+   goto exit;
+   }
+
+   stream.avail_out = op->m_dst->pkt_len;
+   stream.next_out = single_dst_buf;
+
+   } else {/* linear output */
stream.avail_out = op->m_dst->data_len;
-   stream.next_out = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
+   stream.next_out = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+   op->dst.offset);
}
+
/* Stateless operation, all buffer will be compressed in one go */
zlib_flush = map_zlib_flush_flag(op->flush_flag);
ret = deflate(&stream, zlib_flush);
@@ -392,14 +411,14 @@ compress_zlib(struct rte_comp_op *op,
goto exit;
 
/* Copy data to destination SGL */
-   if (op->m_src->nb_segs > 1) {
+   if (op->m_dst->nb_segs > 1) {
uint32_t remaining_data = stream.total_out;
uint8_t *src_data = single_dst_buf;
struct rte_mbuf *dst_buf = op->m_dst;
 
while (remaining_data > 0) {
-   uint8_t *dst_data = rte_pktmbuf_mtod(dst_buf,
-   uint8_t *);
+   uint8_t *dst_data = rte_pktmbuf_mtod_offset(dst_buf,
+   uint8_t *, op->dst.offset);
/* Last segment */
if (remaining_data < dst_buf->data_len) {
memcpy(dst_data, src_data, remaining_data);
@@ -655,7 +674,7 @@ test_deflate_comp_decomp(const char * const test_bufs[],
struct rte_comp_xform *decompress_xforms[]

[dpdk-dev] [PATCH v2 1/2] test/compress: add out of space test

2018-12-20 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

This patch adds new out of space testcase to check
that the destination mbuf is smaller than required for
the output of compression to ensure the driver doesn't crash
and returns the valid error case.

Signed-off-by: Marko Kovacevic 
Acked-by: Lee Daly 

---
V2:
  Added check flag to return proper status to user
---
 test/test/test_compressdev.c | 130 +--
 1 file changed, 126 insertions(+), 4 deletions(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index 42327dc..b2999fa 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -41,6 +41,9 @@
 #define ZLIB_TRAILER_SIZE 4
 #define GZIP_HEADER_SIZE 10
 #define GZIP_TRAILER_SIZE 8
+#define OUT_OF_SPACE_BUF 1
+
+int out_of_space;
 
 const char *
 huffman_type_strings[] = {
@@ -734,8 +737,9 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 
if (sgl) {
for (i = 0; i < num_bufs; i++) {
-   data_size = strlen(test_bufs[i]) *
-   COMPRESS_BUF_SIZE_RATIO;
+   out_of_space ? data_size = OUT_OF_SPACE_BUF :
+   (data_size = strlen(test_bufs[i]) *
+   COMPRESS_BUF_SIZE_RATIO);
if (prepare_sgl_bufs(NULL, comp_bufs[i],
data_size,
ts_params->small_mbuf_pool,
@@ -746,8 +750,9 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 
} else {
for (i = 0; i < num_bufs; i++) {
-   data_size = strlen(test_bufs[i]) *
-   COMPRESS_BUF_SIZE_RATIO;
+   out_of_space ? data_size = OUT_OF_SPACE_BUF :
+   (data_size = strlen(test_bufs[i]) *
+   COMPRESS_BUF_SIZE_RATIO);
rte_pktmbuf_append(comp_bufs[i], data_size);
}
}
@@ -913,6 +918,16 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 * compress operation information is needed for the decompression stage)
 */
for (i = 0; i < num_bufs; i++) {
+   if(out_of_space) {
+   if (ops_processed[i]->status ==
+   RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED) {
+   RTE_LOG(ERR, USER1,
+   "Some operations were not successful\n");
+   out_of_space = 0;
+   goto exit;
+   }
+   }
+
if (ops_processed[i]->status != RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
"Some operations were not successful\n");
@@ -1110,6 +1125,16 @@ test_deflate_comp_decomp(const char * const test_bufs[],
 * compress operation information is still needed)
 */
for (i = 0; i < num_bufs; i++) {
+   if(out_of_space) {
+   if (ops_processed[i]->status ==
+   RTE_COMP_OP_STATUS_OUT_OF_SPACE_TERMINATED) {
+   RTE_LOG(ERR, USER1,
+   "Some operations were not successful\n");
+   out_of_space = 0;
+   goto exit;
+   }
+   }
+
if (ops_processed[i]->status != RTE_COMP_OP_STATUS_SUCCESS) {
RTE_LOG(ERR, USER1,
"Some operations were not successful\n");
@@ -1664,6 +1689,101 @@ test_compressdev_deflate_stateless_checksum(void)
return ret;
 }
 
+static int
+test_compressdev_out_of_space_buffer(void)
+{
+   struct comp_testsuite_params *ts_params = &testsuite_params;
+   const char *test_buffer;
+   int ret;
+   uint16_t i = 0;
+   const struct rte_compressdev_capabilities *capab;
+   out_of_space = 1;
+
+   capab = rte_compressdev_capability_get(0, RTE_COMP_ALGO_DEFLATE);
+   TEST_ASSERT(capab != NULL, "Failed to retrieve device capabilities");
+
+   if ((capab->comp_feature_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0)
+   return -ENOTSUP;
+
+   struct rte_comp_xform *compress_xform =
+   rte_malloc(NULL, sizeof(struct rte_comp_xform), 0);
+
+   if (compress_xform == NULL) {
+   RTE_LOG(ERR, USER1,
+   "Compress xform could not be created\n");
+   ret = TEST_FAILED;
+   goto exit;
+   }
+
+   test_buffer = compress_test_bufs[i];
+
+   /* Compress with compressdev, decompress with Zlib */
+   if (test_de

[dpdk-dev] [PATCH v2 2/2] test/compress: add varied buffer input/outputs

2018-12-20 Thread Marko Kovacevic
Added unit test to check if a SGL buffer
was added as an input and a Linear Buffer
as output and vice versa so we can test if the
application would process the different buffers
properly.

Signed-off-by: Marko Kovacevic 
Acked-by: Lee Daly 
---
 test/test/test_compressdev.c | 173 ---
 1 file changed, 130 insertions(+), 43 deletions(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index b2999fa..5d62206 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -71,6 +71,13 @@ struct comp_testsuite_params {
struct rte_comp_xform *def_decomp_xform;
 };
 
+enum varied_buff {
+LB_BOTH = 0,   /* both input and output are linear*/
+SGL_BOTH,  /* both input and output are chained */
+SGL_TO_LB, /* input buffer is chained */
+LB_TO_SGL  /* output buffer is chained */
+};
+
 static struct comp_testsuite_params testsuite_params = { 0 };
 
 static void
@@ -353,7 +360,7 @@ compress_zlib(struct rte_comp_op *op,
}
 
/* Assuming stateless operation */
-   /* SGL */
+   /* SGL Input */
if (op->m_src->nb_segs > 1) {
single_src_buf = rte_malloc(NULL,
rte_pktmbuf_pkt_len(op->m_src), 0);
@@ -361,14 +368,10 @@ compress_zlib(struct rte_comp_op *op,
RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
goto exit;
}
-   single_dst_buf = rte_malloc(NULL,
-   rte_pktmbuf_pkt_len(op->m_dst), 0);
-   if (single_dst_buf == NULL) {
-   RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
-   goto exit;
-   }
-   if (rte_pktmbuf_read(op->m_src, 0,
-   rte_pktmbuf_pkt_len(op->m_src),
+
+   if (rte_pktmbuf_read(op->m_src, op->src.offset,
+   rte_pktmbuf_pkt_len(op->m_src) -
+   op->src.offset,
single_src_buf) == NULL) {
RTE_LOG(ERR, USER1,
"Buffer could not be read entirely\n");
@@ -377,15 +380,31 @@ compress_zlib(struct rte_comp_op *op,
 
stream.avail_in = op->src.length;
stream.next_in = single_src_buf;
-   stream.avail_out = rte_pktmbuf_pkt_len(op->m_dst);
-   stream.next_out = single_dst_buf;
 
} else {
stream.avail_in = op->src.length;
-   stream.next_in = rte_pktmbuf_mtod(op->m_src, uint8_t *);
+   stream.next_in = rte_pktmbuf_mtod_offset(op->m_src, uint8_t *,
+   op->src.offset);
+   }
+   /* SGL output */
+   if (op->m_dst->nb_segs > 1) {
+
+   single_dst_buf = rte_malloc(NULL,
+   rte_pktmbuf_pkt_len(op->m_dst), 0);
+   if (single_dst_buf == NULL) {
+   RTE_LOG(ERR, USER1, "Buffer could not be allocated\n");
+   goto exit;
+   }
+
+   stream.avail_out = op->m_dst->pkt_len;
+   stream.next_out = single_dst_buf;
+
+   } else {/* linear output */
stream.avail_out = op->m_dst->data_len;
-   stream.next_out = rte_pktmbuf_mtod(op->m_dst, uint8_t *);
+   stream.next_out = rte_pktmbuf_mtod_offset(op->m_dst, uint8_t *,
+   op->dst.offset);
}
+
/* Stateless operation, all buffer will be compressed in one go */
zlib_flush = map_zlib_flush_flag(op->flush_flag);
ret = deflate(&stream, zlib_flush);
@@ -399,14 +418,14 @@ compress_zlib(struct rte_comp_op *op,
goto exit;
 
/* Copy data to destination SGL */
-   if (op->m_src->nb_segs > 1) {
+   if (op->m_dst->nb_segs > 1) {
uint32_t remaining_data = stream.total_out;
uint8_t *src_data = single_dst_buf;
struct rte_mbuf *dst_buf = op->m_dst;
 
while (remaining_data > 0) {
-   uint8_t *dst_data = rte_pktmbuf_mtod(dst_buf,
-   uint8_t *);
+   uint8_t *dst_data = rte_pktmbuf_mtod_offset(dst_buf,
+   uint8_t *, op->dst.offset);
/* Last segment */
if (remaining_data < dst_buf->data_len) {
memcpy(dst_data, src_data, remaining_data);
@@ -662,7 +681,7 @@ test_deflate_comp_decomp(const char * const test_bufs[],
struct rte_comp_xform *decompress_xforms[]

[dpdk-dev] [PATCH v4 0/8] FIPS validation capability

2018-10-12 Thread Marko Kovacevic
This sample application is made for the purpose so that users of DPDK
who wish to get FIPS certification for their platforms, this sample app enables
users to parse test vectors that is gotten from NIST and be able to get
a generated response file which they can then verify and be sure their
system will pass FIPS certification.

Marko Kovacevic (8):
v4:
- Added Limitation
- Changed TDES BLOCK SIZE from 16 -> 8
  as DES block size is 64bits (main.c)
v3:
- Fixed a no-testing bug
- Fixed some code style issue

v2:
- Refactor the code.
- Move the code from test to sample applcation

  examples: add fips validation into examples
  examples: add aes parser and enablement for test types
  examples: add hmac parser
  examples: add TDES parser and enablement for test types
  examples: add gcm parser
  examples: add cmac parser and enablement for test types
  examples: add ccm parser and enablement for test types
  doc: add guides for fips validation

 doc/guides/rel_notes/release_18_11.rst |6 +
 doc/guides/sample_app_ug/fips_validation.rst   |  105 ++
 doc/guides/sample_app_ug/index.rst |1 +
 examples/cryptodev_fips_validate/Makefile  |   75 ++
 .../cryptodev_fips_parse_3des.c|  259 +
 .../cryptodev_fips_parse_aes.c |  188 +++
 .../cryptodev_fips_parse_ccm.c |  272 +
 .../cryptodev_fips_parse_cmac.c|  116 ++
 .../cryptodev_fips_parse_gcm.c |  125 ++
 .../cryptodev_fips_parse_hmac.c|  105 ++
 .../cryptodev_fips_parse_validate.c|  593 ++
 .../cryptodev_fips_validate.h  |  234 
 examples/cryptodev_fips_validate/main.c| 1221 
 examples/cryptodev_fips_validate/meson.build   |   20 +
 14 files changed, 3320 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst
 create mode 100644 examples/cryptodev_fips_validate/Makefile
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
 create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_validate.h
 create mode 100644 examples/cryptodev_fips_validate/main.c
 create mode 100644 examples/cryptodev_fips_validate/meson.build

-- 
2.9.5



[dpdk-dev] [PATCH v4 1/8] examples: add fips validation into examples

2018-10-12 Thread Marko Kovacevic
Added FIPS application into the examples to allow
users to use a simple sample app to validate
their systems and be able to get FIPS certification.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |  69 +++
 .../cryptodev_fips_parse_validate.c| 562 +
 .../cryptodev_fips_validate.h  | 150 ++
 examples/cryptodev_fips_validate/main.c| 388 ++
 examples/cryptodev_fips_validate/meson.build   |  14 +
 5 files changed, 1183 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/Makefile
 create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_validate.h
 create mode 100644 examples/cryptodev_fips_validate/main.c
 create mode 100644 examples/cryptodev_fips_validate/meson.build

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
new file mode 100644
index 000..5515aa6
--- /dev/null
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+
+# binary name
+APP = cryptodev_fips_validate_app
+
+# all source are stored in SRCS-y
+SRCS-y += cryptodev_fips_parse_validate.c
+SRCS-y += main.c
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+   ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+   ln -sf $(APP)-static build/$(APP)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+   @mkdir -p $@
+
+.PHONY: clean
+clean:
+   rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+   rmdir --ignore-fail-on-non-empty build
+
+else
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overridden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+INC += $(sort $(wildcard *.h))
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
new file mode 100644
index 000..aec5bb9
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
@@ -0,0 +1,562 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define skip_white_spaces(pos) \
+({ \
+   __typeof__(pos) _p = (pos); \
+   for ( ; isspace(*_p); _p++) \
+   ;   \
+   _p; \
+})
+
+static int
+get_file_line(void)
+{
+   FILE *fp = info.fp_rd;
+   char *line = info.one_line_text;
+   char c;
+   uint32_t loc = 0;
+
+   memset(line, 0, MAX_LINE_CHAR);
+   while ((c = fgetc(fp)) != EOF) {
+   if (loc >= MAX_LINE_CHAR - 1)
+   return -ENOMEM;
+   if (c == '\n')
+   return 0;
+   line[loc++] = c;
+   }
+
+   if (c == EOF)
+   return -EOF;
+
+   return 0;
+}
+
+int
+fips_test_fetch_one_block(void)
+{
+   size_t size;
+   int ret = 0;
+   uint32_t i;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   free(info.vec[i]);
+   info.vec[i] = NULL;
+   }
+
+   i = 0;
+   do {
+   if (i >= MAX_LINE_PER_VECTOR) {
+   ret = -ENOMEM;
+   goto error_exit;
+   }
+
+   ret = get_file_line();
+   size = strlen(info.one_line_text);
+   if (size == 0)
+   break;
+
+   info.vec[i] = calloc(1, size + 5);
+   if (info.vec[i] == NULL)

[dpdk-dev] [PATCH v4 2/8] examples: add aes parser and enablement for test types

2018-10-12 Thread Marko Kovacevic
Added enablement for AES-CBC parser, to allow the
application to parser the aes request file and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_aes.c | 186 +++
 .../cryptodev_fips_parse_validate.c|   6 +
 .../cryptodev_fips_validate.h  |  24 ++
 examples/cryptodev_fips_validate/main.c| 346 -
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 563 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 5515aa6..f058081 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -5,6 +5,7 @@
 APP = cryptodev_fips_validate_app
 
 # all source are stored in SRCS-y
+SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
new file mode 100644
index 000..39dbd6f
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
@@ -0,0 +1,186 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define MODE_STR   "AESVS"
+#define ALGO_STR   "test data for "
+#define OP_STR "State"
+#define KEY_SIZE_STR   "Key Length : "
+
+
+#define COUNT_STR  "COUNT = "
+#define KEY_STR"KEY = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+
+#define OP_ENC_STR "ENCRYPT"
+#define OP_DEC_STR "DECRYPT"
+
+struct {
+   uint32_t type;
+   const char *desc;
+} aes_test_types[] = {
+   {AESAVS_TYPE_GFXBOX, "GFSbox"},
+   {AESAVS_TYPE_KEYSBOX, "KeySbox"},
+   {AESAVS_TYPE_VARKEY, "VarKey"},
+   {AESAVS_TYPE_VARTXT, "VarTxt"},
+   {AESAVS_TYPE_MMT, "MMT"},
+   {AESAVS_TYPE_MCT, "MCT"},
+};
+
+struct aes_test_algo {
+   const char *name;
+   enum rte_crypto_cipher_algorithm algo;
+} const algo_con[] = {
+   {"CBC", RTE_CRYPTO_CIPHER_AES_CBC},
+};
+
+static int
+parse_interim_enc_dec(const char *key,
+   __attribute__((__unused__)) char *text,
+   __attribute__((__unused__)) struct fips_val *val)
+{
+   if (strcmp(key, OP_ENC_STR) == 0)
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   else if (strcmp(key, OP_DEC_STR) == 0)
+   info.op = FIPS_TEST_DEC_AUTH_VERIF;
+   else
+   return -1;
+
+   return 0;
+}
+
+struct fips_test_callback aes_tests_interim[] = {
+   {OP_ENC_STR, parse_interim_enc_dec, NULL},
+   {OP_DEC_STR, parse_interim_enc_dec, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_tests_vectors[] = {
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {CT_STR, parse_uint8_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_tests_interim_vectors[] = {
+   {OP_ENC_STR, parse_interim_enc_dec, NULL},
+   {OP_DEC_STR, parse_interim_enc_dec, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_writeback_callbacks[] = {
+   /** First element is used to pass COUNT string */
+   {COUNT_STR, NULL, NULL},
+   {IV_STR, writeback_hex_str, &vec.iv},
+   {KEY_STR, writeback_hex_str, &vec.cipher_auth.key},
+   {PT_STR, writeback_hex_str, &vec.pt},
+   {CT_STR, writeback_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_aes_writeback(struct fips_val *val)
+{
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN)
+   fprintf(info.fp_wr, "%s", CT_STR);
+   else
+   fprintf(info.fp_wr, "%s", PT_STR);
+
+   parse_write_hex_str(val);
+
+   return 0;
+}
+
+static int
+rsp_test_aes_check(struct fips_val *val)
+{
+   struct fips_val *data;
+
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN)
+   data = &vec.ct;
+   else
+   data 

[dpdk-dev] [PATCH v4 4/8] examples: add TDES parser and enablement for test types

2018-10-12 Thread Marko Kovacevic
Added enablement for TDES parser, to allow the
application to parser the TDES request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_3des.c| 259 +
 .../cryptodev_fips_parse_aes.c |   2 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |  21 ++
 examples/cryptodev_fips_validate/main.c| 175 ++
 examples/cryptodev_fips_validate/meson.build   |   1 +
 7 files changed, 464 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 50be23c..54ea43f 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -7,6 +7,7 @@ APP = cryptodev_fips_validate_app
 # all source are stored in SRCS-y
 SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
+SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
new file mode 100644
index 000..82e9132
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
@@ -0,0 +1,259 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define TEST_TYPE_KEY  " for CBC"
+#define TEST_CBCI_KEY  " for CBCI"
+
+#define ENC_STR"[ENCRYPT]"
+#define DEC_STR"[DECRYPT]"
+
+#define COUNT_STR  "COUNT = "
+#define KEY1_STR   "KEY1 = "
+#define KEY2_STR   "KEY2 = "
+#define KEY3_STR   "KEY3 = "
+
+#define KEYS_STR   "KEYs = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+#define NK_STR "NumKeys = "
+
+#define SET_STR" = "
+
+#define PLAIN_TEXT 0
+#define CIPHER_TEXT1
+#define KEY_TEXT   2
+#define IV_TEXT3
+
+#define DEVICE_STR "# Config Info for : "
+
+struct {
+   uint32_t type;
+   const char *desc;
+} test_types[] = {
+   {TDES_INVERSE_PERMUTATION, "INVERSE PERMUTATION"},
+   {TDES_PERMUTATION, "PERMUTATION OPERATION"},
+   {TDES_SUBSTITUTION_TABLE, "SUBSTITUTION TABLE"},
+   {TDES_VARIABLE_KEY, "VARIABLE KEY"},
+   {TDES_VARIABLE_TEXT, "VARIABLE PLAINTEXT/CIPHERTEXT"},
+   {TDES_VARIABLE_TEXT, "KAT"},
+   {TDES_MCT, "Monte Carlo (Modes) Test"},
+   {TDES_MMT, "Multi block Message Test"},
+};
+
+static int
+writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val);
+
+static int
+parse_3des_uint8_hex_str(const char *key, char *src, struct fips_val *val);
+
+static int
+parse_tdes_interim(const char *key,
+   __attribute__((__unused__)) char *text,
+   struct fips_val *val);
+
+struct fips_test_callback tdes_tests_vectors[] = {
+   {KEYS_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY1_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY3_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {CT_STR, parse_uint8_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_tests_interim_vectors[] = {
+   {ENC_STR, parse_tdes_interim, NULL},
+   {DEC_STR, parse_tdes_interim, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_writeback_callbacks[] = {
+   /** First element is used to pass COUNT string */
+   {COUNT_STR, NULL, NULL},
+   {IV_STR, writeback_hex_str, &vec.iv},
+   {KEY1_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEY3_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEYS_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {PT_STR, writeback

[dpdk-dev] [PATCH v4 5/8] examples: add gcm parser

2018-10-12 Thread Marko Kovacevic
Added enablement for GCM parser, to allow the
application to parser the GCM request file and to validate all
tests supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_gcm.c | 125 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   4 +
 examples/cryptodev_fips_validate/main.c| 116 ++-
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 251 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 54ea43f..1eb0108 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -8,6 +8,7 @@ APP = cryptodev_fips_validate_app
 SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
+SRCS-y += cryptodev_fips_parse_gcm.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
new file mode 100644
index 000..6999dad
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "GCM "
+
+#define PARAM_PREFIX   "["
+#define KEYLEN_STR "Keylen = "
+#define IVLEN_STR  "IVlen = "
+#define PTLEN_STR  "PTlen = "
+#define AADLEN_STR "AADlen = "
+#define TAGLEN_STR "Taglen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "IV = "
+#define PT_STR "PT = "
+#define CT_STR "CT = "
+#define TAG_STR"Tag = "
+#define AAD_STR"AAD = "
+
+#define OP_ENC_STR "Encrypt"
+#define OP_DEC_STR "Decrypt"
+
+#define NEG_TEST_STR   "FAIL"
+
+struct fips_test_callback gcm_dec_vectors[] = {
+   {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {CT_STR, parse_uint8_known_len_hex_str, &vec.ct},
+   {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad},
+   {TAG_STR, parse_uint8_known_len_hex_str,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+struct fips_test_callback gcm_interim_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.key},
+   {IVLEN_STR, parser_read_uint32_bit_val, &vec.iv},
+   {PTLEN_STR, parser_read_uint32_bit_val, &vec.pt},
+   {AADLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.aad},
+   {TAGLEN_STR, parser_read_uint32_bit_val,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback gcm_enc_vectors[] = {
+   {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_gcm_writeback(struct fips_val *val)
+{
+   struct fips_val tmp_val;
+
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN) {
+   fprintf(info.fp_wr, "%s", CT_STR);
+
+   tmp_val.val = val->val;
+   tmp_val.len = vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+
+   tmp_val.val = val->val + vec.pt.len;
+   tmp_val.len = val->len - vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+   } else {
+   if (vec.status == RTE_CRYPTO_OP_STATUS_SUCCESS) {
+   fprintf(info.fp_wr, "%s", PT_STR);
+
+   tmp_val.val = val->val;
+   tmp_val.len = vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+   } else
+   fprintf(info.fp_wr, "%s\n", NEG_TEST_STR);
+   }
+

[dpdk-dev] [PATCH v4 3/8] examples: add hmac parser

2018-10-12 Thread Marko Kovacevic
Added enablement for HMAC parser, to allow the
application to parser the hmac request files and to validate all
tests supported

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_hmac.c| 105 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   9 ++
 examples/cryptodev_fips_validate/main.c| 103 
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 224 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index f058081..50be23c 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -6,6 +6,7 @@ APP = cryptodev_fips_validate_app
 
 # all source are stored in SRCS-y
 SRCS-y := cryptodev_fips_parse_aes.c
+SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
new file mode 100644
index 000..2fbc246
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define ALGO_PREFIX"[L="
+#define KEYLEN_STR "Klen = "
+#define TAGLEN_STR "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+struct hash_size_conversion {
+   const char *str;
+   enum rte_crypto_auth_algorithm algo;
+} hsc[] = {
+   {"20", RTE_CRYPTO_AUTH_SHA1_HMAC},
+   {"28", RTE_CRYPTO_AUTH_SHA224_HMAC},
+   {"32", RTE_CRYPTO_AUTH_SHA256_HMAC},
+   {"48", RTE_CRYPTO_AUTH_SHA384_HMAC},
+   {"64", RTE_CRYPTO_AUTH_SHA512_HMAC},
+};
+
+static int
+parse_interim_algo(__attribute__((__unused__)) const char *key,
+   char *text,
+   __attribute__((__unused__)) struct fips_val *val)
+{
+
+   uint32_t i;
+
+   for (i = 0; i < RTE_DIM(hsc); i++) {
+   if (strstr(text, hsc[i].str)) {
+   info.interim_info.hmac_data.algo = hsc[i].algo;
+   break;
+   }
+   }
+
+   if (i == RTE_DIM(hsc))
+   return -1;
+
+   return 0;
+}
+
+struct fips_test_callback hmac_tests_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_val, &vec.cipher_auth.key},
+   {TAGLEN_STR, parser_read_uint32_val, &vec.cipher_auth.digest},
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {TAG_STR, parse_uint8_hex_str, &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback hmac_tests_interim_vectors[] = {
+   {ALGO_PREFIX, parse_interim_algo, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_hmac_writeback(struct fips_val *val)
+{
+   struct fips_val val_local;
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+
+   val_local.val = val->val + vec.pt.len;
+   val_local.len = vec.cipher_auth.digest.len;
+
+   parse_write_hex_str(&val_local);
+   return 0;
+}
+
+static int
+rsp_test_hmac_check(struct fips_val *val)
+{
+   if (memcmp(val->val + vec.pt.len, vec.cipher_auth.digest.val,
+   vec.cipher_auth.digest.len) == 0)
+   fprintf(info.fp_wr, "Success\n");
+   else
+   fprintf(info.fp_wr, "Failed\n");
+
+   return 0;
+}
+
+int
+parse_test_hmac_init(void)
+{
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   info.parse_writeback = parse_test_hmac_writeback;
+   info.callbacks = hmac_tests_vectors;
+   info.interim_callbacks = hmac_tests_interim_vectors;
+   info.writeback_callbacks = NULL;
+   info.kat_check = rsp_test_hmac_check;
+
+   return 0;
+}
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
index 32af47b..f1cd802 100644
--- a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
@@ -109,6 +109,11 @@ fips_test_parse_header(void)
re

[dpdk-dev] [PATCH v4 6/8] examples: add cmac parser and enablement for test types

2018-10-12 Thread Marko Kovacevic
Added enablement for CMAC parser, to allow the
application to parser the cmac request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_cmac.c| 116 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   4 +
 examples/cryptodev_fips_validate/main.c|  43 
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 170 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 1eb0108..f5c2705 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -9,6 +9,7 @@ SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_gcm.c
+SRCS-y += cryptodev_fips_parse_cmac.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
new file mode 100644
index 000..37c6317
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "CMAC"
+
+#define ALGO_STR   "Alg = "
+#define MODE_STR   "Mode = "
+
+#define COUNT_STR  "Count = "
+#define KLEN_STR   "Klen = "
+#define PTLEN_STR  "Mlen = "
+#define TAGLEN_STR "Tlen = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+#define GEN_STR"Generate"
+#define VERIF_STR  "Verify"
+
+#define POS_NEG_STR"Result = "
+#define PASS_STR   "P"
+#define FAIL_STR   "F"
+
+struct hash_algo_conversion {
+   const char *str;
+   enum fips_test_algorithms algo;
+} cmac_algo[] = {
+   {"AES", FIPS_TEST_ALGO_AES_CMAC},
+};
+
+static int
+parse_test_cmac_writeback(struct fips_val *val)
+{
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN) {
+   struct fips_val tmp_val = {val->val + vec.pt.len,
+   vec.cipher_auth.digest.len};
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+   parse_write_hex_str(&tmp_val);
+   } else {
+   fprintf(info.fp_wr, "%s", POS_NEG_STR);
+
+   if (vec.status == RTE_CRYPTO_OP_STATUS_SUCCESS)
+   fprintf(info.fp_wr, "%s\n", PASS_STR);
+   else if (vec.status == RTE_CRYPTO_OP_STATUS_AUTH_FAILED)
+   fprintf(info.fp_wr, "%s\n", FAIL_STR);
+   else
+   fprintf(info.fp_wr, "Error\n");
+   }
+
+   return 0;
+}
+
+struct fips_test_callback cmac_tests_vectors[] = {
+   {KLEN_STR, parser_read_uint32_val, &vec.cipher_auth.key},
+   {PTLEN_STR, parser_read_uint32_val, &vec.pt},
+   {TAGLEN_STR, parser_read_uint32_val, &vec.cipher_auth.digest},
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {TAG_STR, parse_uint8_known_len_hex_str,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+int
+parse_test_cmac_init(void)
+{
+   char *tmp;
+   uint32_t i, j;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   char *line = info.vec[i];
+
+   tmp = strstr(line, ALGO_STR);
+   if (!tmp)
+   continue;
+
+   for (j = 0; j < RTE_DIM(cmac_algo); j++) {
+   if (!strstr(line, cmac_algo[j].str))
+   continue;
+
+   info.algo = cmac_algo[j].algo;
+   break;
+   }
+
+   if (j == RTE_DIM(cmac_algo))
+   return -EINVAL;
+
+   tmp = strstr(line, MODE_STR);
+   if (!tmp)
+   return -1;
+
+   if (strstr(tmp, GEN_STR))
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   else if (strstr(tmp, VERIF_STR))
+   info.op = FIPS_TEST_DEC_AUTH_VERIF;
+ 

[dpdk-dev] [PATCH v4 7/8] examples: add ccm parser and enablement for test types

2018-10-12 Thread Marko Kovacevic
Added enablement for CCM parser, to allow the
application to parser the ccm request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_ccm.c | 272 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |  22 ++
 examples/cryptodev_fips_validate/main.c|  56 -
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 356 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index f5c2705..4f1dc6b 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -10,6 +10,7 @@ SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_gcm.c
 SRCS-y += cryptodev_fips_parse_cmac.c
+SRCS-y += cryptodev_fips_parse_ccm.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
new file mode 100644
index 000..0fdb75a
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
@@ -0,0 +1,272 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define DVPT_STR   "CCM-DVPT"
+#define VADT_STR   "CCM-VADT"
+#define VPT_STR"CCM-VPT"
+#define VNT_STR"CCM-VNT"
+#define VTT_STR"CCM-VTT"
+
+#define PARAM_PREFIX   "["
+#define ALEN_PREFIX"Alen = "
+#define PLEN_PREFIX"Plen = "
+#define IVLEN_PREFIX   "Nlen = "
+#define DIGESTL_PREFIX "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "Nonce = "
+#define PT_STR "Payload = "
+#define CT_STR "CT = "
+#define AAD_STR"Adata = "
+#define POS_NEG_STR"Result = "
+
+#define POS_KEYWORD"Pass"
+#define NEG_KEYWORD"Fail"
+
+static int
+parser_dvpt_interim(const char *key, char *src, struct fips_val *val)
+{
+   char *tmp, c, value[10];
+   char num_pattern[] = "0123456789";
+   int i = 0;
+
+   memset(value, 0, 10);
+
+   tmp = strstr(src, key);
+   if (!tmp)
+   return -1;
+
+   tmp += strlen(key);
+
+   c = tmp[0];
+
+   while (strchr(num_pattern, c) && i < 10) {
+   value[i++] = c;
+   c = tmp[i];
+   }
+
+   return parser_read_uint32_val("", value, val);
+}
+
+static int
+parse_dvpt_ct_hex_str(const char *key, char *src, struct fips_val *val)
+{
+   int ret;
+
+   val->len = vec.pt.len;
+
+   ret = parse_uint8_known_len_hex_str(key, src, val);
+   if (ret < 0)
+   return ret;
+
+   src += strlen(key) + val->len * 2;
+
+   ret = parse_uint8_known_len_hex_str("", src, &vec.aead.digest);
+   if (ret < 0) {
+   rte_free(val->val);
+   memset(val, 0, sizeof(*val));
+   return ret;
+   }
+
+   return 0;
+}
+
+static int
+parse_uint8_ccm_aad_str(const char *key, char *src, struct fips_val *val)
+{
+   uint32_t len = val->len, j;
+
+   src += strlen(key);
+
+   /* CCM aad requires 18 bytes padding before the real content */
+   val->val = rte_zmalloc(NULL, len + 18, 0);
+   if (!val->val)
+   return -1;
+
+   for (j = 0; j < len; j++) {
+   char byte[3] = {src[j * 2], src[j * 2 + 1], '\0'};
+
+   if (parser_read_uint8_hex(&val->val[j + 18], byte) < 0) {
+   rte_free(val->val);
+   memset(val, 0, sizeof(*val));
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
+struct fips_test_callback ccm_vnt_vec[] = {
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {AAD_STR, parse_uint8_ccm_aad_str, &vec.aead.aad},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback ccm_vnt_interim_vec[] = {
+   {ALEN_PREFIX, parser_read_uint32_val, &vec.aead.aad},
+   {PLEN_PREFIX, parser_read_uint32_val, &vec.pt},
+   {DIGESTL_PREFIX, parser_r

[dpdk-dev] [PATCH v4 8/8] doc: add guides for fips validation

2018-10-12 Thread Marko Kovacevic
Document explains how to run the fips sample app
and instructions users need to parser all the request
files and generate the response files.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
---
 doc/guides/rel_notes/release_18_11.rst   |   6 ++
 doc/guides/sample_app_ug/fips_validation.rst | 105 +++
 doc/guides/sample_app_ug/index.rst   |   1 +
 3 files changed, 112 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst

diff --git a/doc/guides/rel_notes/release_18_11.rst 
b/doc/guides/rel_notes/release_18_11.rst
index 436b20e..83ad92e 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -54,6 +54,12 @@ New Features
  Also, make sure to start the actual text at the margin.
  =
 
+* **Added Cryptodev Fips Validation Example Application.**
+
+  Added an example application to parse and perform symmetric cryptography
+  computation to the NIST Cryptographic Algorithm Validation Program (CAVP)
+  test vectors.
+
 * **Added support for using externally allocated memory in DPDK.**
 
   DPDK has gained support for creating new ``rte_malloc`` heaps referencing
diff --git a/doc/guides/sample_app_ug/fips_validation.rst 
b/doc/guides/sample_app_ug/fips_validation.rst
new file mode 100644
index 000..e67b513
--- /dev/null
+++ b/doc/guides/sample_app_ug/fips_validation.rst
@@ -0,0 +1,105 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2018 Intel Corporation.
+
+Federal Information Processing Standards (FIPS) CryptoDev Validation
+
+
+Overview
+
+
+Federal Information Processing Standards (FIPS) are publicly announced 
standards
+developed by the United States federal government for use in computer systems 
by
+non-military government agencies and government contractors.
+
+This application is used to parse and perform symmetric cryptography
+computation to the NIST Cryptographic Algorithm Validation Program (CAVP) test
+vectors.
+
+Limitations
+---
+
+* Only NIST CAVP request files are parsed by this application.
+* The version of request file supported is ``CAVS 21.0``
+* If the header comment in a ``.req`` file does not contain a Algo tag
+  i.e ``AES,TDES,GCM`` you need to manually add it into the head comment for
+  example::
+
+  # VARIABLE KEY - KAT for CBC / # TDES VARIABLE KEY - KAT for CBC
+
+* The application does not supply the test vectors. The user is expected to
+  obtain the test vector files from `NIST
+  <https://csrc.nist.gov/projects/cryptographic-algorithm-validation-
+  program/block-ciphers>`_
+* Supported test vectors
+* AES-CBC (128,192,256) - GFSbox, KeySbox, MCT, MMT
+* AES-GCM (128,192,256) - EncryptExtIV, Decrypt
+* AES-CCM (128) - VADT, VNT, VPT, VTT, DVPT
+* AES-CMAC (128) - Generate, Verify
+* HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
+* TDES-CBC (1 Key, 2 Keys, 3 Keys) - MMT, Monte, Permop, Subkey, Varkey,
+  VarText
+
+Compiling the Application
+-
+
+* Compile Application
+
+.. code-block:: console
+
+ make -C examples/cryptodev_fips_validate
+
+*  Run ``dos2unix`` on the request files
+
+.. code-block:: console
+
+ dos2unix AES/req/*
+ dos2unix AES_GCM/req/*
+ dos2unix CCM/req/*
+ dos2unix CMAC/req/*
+ dos2unix HMAC/req/*
+ dos2unix TDES/req/*
+
+Running the Application
+---
+
+The application requires a number of command line options:
+
+.. code-block:: console
+
+ ./cryptodev_fips_validate_app [EAL options]
+ -- --req-file FILE_PATH/FOLDER_PATH
+ --rsp-file FILE_PATH/FOLDER_PATH
+ [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
+
+where,
+  * req-file: The path of the request file or folder, separated by
+``path-is-folder`` option.
+
+  * rsp-file: The path that the response file or folder is stored. separated by
+``path-is-folder`` option.
+
+  * cryptodev: The name of the target DPDK Crypto device to be validated.
+
+  * cryptodev-id: The id of the target DPDK Crypto device to be validated.
+
+  * path-is-folder: If presented the application expects req-file and rsp-file
+are folder paths.
+
+To run the application in linuxapp environment to test one AES FIPS test data
+file for crypto_aesni_mb PMD, issue the command:
+
+.. code-block:: console
+
+$ ./cryptodev_fips_validate_app --vdev crypto_aesni_mb --
+--req-file /PATH/TO/REQUEST/FILE.req --rsp-file ./PATH/TO/RESPONSE/FILE.rsp
+--cryptodev crypto_aesni_mb
+
+To run the application in linuxapp environment to test all AES-GCM FIPS test
+data files in one folder for crypto_aesni_gcm PMD, issue the command:
+
+.. code-block:: console
+
+$ ./cryptodev_fips_validate_app --vdev crypto_aesni_gcm0 --
+--req-file /PATH/TO/REQUES

[dpdk-dev] [PATCH v5 1/8] examples/cryptodev_fips_validate: add fips validation into examples

2018-10-17 Thread Marko Kovacevic
Added FIPS application into the examples to allow
users to use a simple sample app to validate
their systems and be able to get FIPS certification.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |  69 +++
 .../cryptodev_fips_parse_validate.c| 562 +
 .../cryptodev_fips_validate.h  | 150 ++
 examples/cryptodev_fips_validate/main.c| 388 ++
 examples/cryptodev_fips_validate/meson.build   |  14 +
 5 files changed, 1183 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/Makefile
 create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_validate.h
 create mode 100644 examples/cryptodev_fips_validate/main.c
 create mode 100644 examples/cryptodev_fips_validate/meson.build

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
new file mode 100644
index 000..7f0e603
--- /dev/null
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation
+
+# binary name
+APP = fips_validation
+
+# all source are stored in SRCS-y
+SRCS-y += cryptodev_fips_parse_validate.c
+SRCS-y += main.c
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+   ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+   ln -sf $(APP)-static build/$(APP)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+   @mkdir -p $@
+
+.PHONY: clean
+clean:
+   rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+   rmdir --ignore-fail-on-non-empty build
+
+else
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overridden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+INC += $(sort $(wildcard *.h))
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
new file mode 100644
index 000..aec5bb9
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
@@ -0,0 +1,562 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define skip_white_spaces(pos) \
+({ \
+   __typeof__(pos) _p = (pos); \
+   for ( ; isspace(*_p); _p++) \
+   ;   \
+   _p; \
+})
+
+static int
+get_file_line(void)
+{
+   FILE *fp = info.fp_rd;
+   char *line = info.one_line_text;
+   char c;
+   uint32_t loc = 0;
+
+   memset(line, 0, MAX_LINE_CHAR);
+   while ((c = fgetc(fp)) != EOF) {
+   if (loc >= MAX_LINE_CHAR - 1)
+   return -ENOMEM;
+   if (c == '\n')
+   return 0;
+   line[loc++] = c;
+   }
+
+   if (c == EOF)
+   return -EOF;
+
+   return 0;
+}
+
+int
+fips_test_fetch_one_block(void)
+{
+   size_t size;
+   int ret = 0;
+   uint32_t i;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   free(info.vec[i]);
+   info.vec[i] = NULL;
+   }
+
+   i = 0;
+   do {
+   if (i >= MAX_LINE_PER_VECTOR) {
+   ret = -ENOMEM;
+   goto error_exit;
+   }
+
+   ret = get_file_line();
+   size = strlen(info.one_line_text);
+   if (size == 0)
+   break;
+
+   info.vec[i] = calloc(1, size + 5);
+   if (info.vec[i

[dpdk-dev] [PATCH v5 0/8] FIPS validation capability

2018-10-17 Thread Marko Kovacevic
This sample application is made for the purpose so that users of DPDK
who wish to get FIPS certification for their platforms, this sample app enables
users to parse test vectors that is gotten from NIST and be able to get
a generated response file which they can then verify and be sure their
system will pass FIPS certification.


Marko Kovacevic (8):
v5:
  - Changed patch titles
  - Added MAINTAINERS File
  - Removed bus_pci Dependency
  - Updated documentation
  - Changed app name
v4:
- Added Limitation
- Changed TDES BLOCK SIZE from 16 -> 8
  as DES block size is 64bits (main.c)
v3:
- Fixed a no-testing bug
- Fixed some code style issue

v2:
- Refactor the code.
- Move the code from test to sample applcation

  examples/cryptodev_fips_validate: add fips validation into examples
  examples/cryptodev_fips_validate: add aes parser and enablement for
test types
  examples/cryptodev_fips_validate: add hmac parser
  examples/cryptodev_fips_validate: add TDES parser and enablement for
test types
  examples/cryptodev_fips_validate: add gcm parser
  examples/cryptodev_fips_validate: add cmac parser and enablement for
test types
  examples/cryptodev_fips_validate: add ccm parser and enablement for
test types
  doc/guides/sample_app_ug: add guides for fips validation

 MAINTAINERS|4 +
 doc/guides/rel_notes/release_18_11.rst |6 +
 doc/guides/sample_app_ug/fips_validation.rst   |  119 ++
 doc/guides/sample_app_ug/index.rst |1 +
 examples/cryptodev_fips_validate/Makefile  |   75 ++
 .../cryptodev_fips_parse_3des.c|  259 +
 .../cryptodev_fips_parse_aes.c |  188 +++
 .../cryptodev_fips_parse_ccm.c |  272 +
 .../cryptodev_fips_parse_cmac.c|  116 ++
 .../cryptodev_fips_parse_gcm.c |  125 ++
 .../cryptodev_fips_parse_hmac.c|  105 ++
 .../cryptodev_fips_parse_validate.c|  593 ++
 .../cryptodev_fips_validate.h  |  234 
 examples/cryptodev_fips_validate/main.c| 1221 
 examples/cryptodev_fips_validate/meson.build   |   20 +
 15 files changed, 3338 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst
 create mode 100644 examples/cryptodev_fips_validate/Makefile
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
 create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_validate.h
 create mode 100644 examples/cryptodev_fips_validate/main.c
 create mode 100644 examples/cryptodev_fips_validate/meson.build

-- 
2.9.5



[dpdk-dev] [PATCH v5 2/8] examples/cryptodev_fips_validate: add aes parser and enablement for test types

2018-10-17 Thread Marko Kovacevic
Added enablement for AES-CBC parser, to allow the
application to parser the aes request file and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_aes.c | 186 +++
 .../cryptodev_fips_parse_validate.c|   6 +
 .../cryptodev_fips_validate.h  |  24 ++
 examples/cryptodev_fips_validate/main.c| 346 -
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 563 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 7f0e603..2fc5689 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -5,6 +5,7 @@
 APP = fips_validation
 
 # all source are stored in SRCS-y
+SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
new file mode 100644
index 000..39dbd6f
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_aes.c
@@ -0,0 +1,186 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define MODE_STR   "AESVS"
+#define ALGO_STR   "test data for "
+#define OP_STR "State"
+#define KEY_SIZE_STR   "Key Length : "
+
+
+#define COUNT_STR  "COUNT = "
+#define KEY_STR"KEY = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+
+#define OP_ENC_STR "ENCRYPT"
+#define OP_DEC_STR "DECRYPT"
+
+struct {
+   uint32_t type;
+   const char *desc;
+} aes_test_types[] = {
+   {AESAVS_TYPE_GFXBOX, "GFSbox"},
+   {AESAVS_TYPE_KEYSBOX, "KeySbox"},
+   {AESAVS_TYPE_VARKEY, "VarKey"},
+   {AESAVS_TYPE_VARTXT, "VarTxt"},
+   {AESAVS_TYPE_MMT, "MMT"},
+   {AESAVS_TYPE_MCT, "MCT"},
+};
+
+struct aes_test_algo {
+   const char *name;
+   enum rte_crypto_cipher_algorithm algo;
+} const algo_con[] = {
+   {"CBC", RTE_CRYPTO_CIPHER_AES_CBC},
+};
+
+static int
+parse_interim_enc_dec(const char *key,
+   __attribute__((__unused__)) char *text,
+   __attribute__((__unused__)) struct fips_val *val)
+{
+   if (strcmp(key, OP_ENC_STR) == 0)
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   else if (strcmp(key, OP_DEC_STR) == 0)
+   info.op = FIPS_TEST_DEC_AUTH_VERIF;
+   else
+   return -1;
+
+   return 0;
+}
+
+struct fips_test_callback aes_tests_interim[] = {
+   {OP_ENC_STR, parse_interim_enc_dec, NULL},
+   {OP_DEC_STR, parse_interim_enc_dec, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_tests_vectors[] = {
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {CT_STR, parse_uint8_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_tests_interim_vectors[] = {
+   {OP_ENC_STR, parse_interim_enc_dec, NULL},
+   {OP_DEC_STR, parse_interim_enc_dec, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback aes_writeback_callbacks[] = {
+   /** First element is used to pass COUNT string */
+   {COUNT_STR, NULL, NULL},
+   {IV_STR, writeback_hex_str, &vec.iv},
+   {KEY_STR, writeback_hex_str, &vec.cipher_auth.key},
+   {PT_STR, writeback_hex_str, &vec.pt},
+   {CT_STR, writeback_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_aes_writeback(struct fips_val *val)
+{
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN)
+   fprintf(info.fp_wr, "%s", CT_STR);
+   else
+   fprintf(info.fp_wr, "%s", PT_STR);
+
+   parse_write_hex_str(val);
+
+   return 0;
+}
+
+static int
+rsp_test_aes_check(struct fips_val *val)
+{
+   struct fips_val *data;
+
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN)
+   data = &vec.ct;
+   else

[dpdk-dev] [PATCH v5 5/8] examples/cryptodev_fips_validate: add gcm parser

2018-10-17 Thread Marko Kovacevic
Added enablement for GCM parser, to allow the
application to parser the GCM request file and to validate all
tests supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_gcm.c | 125 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   4 +
 examples/cryptodev_fips_validate/main.c| 116 ++-
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 251 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 2ddf326..f8cfda7 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -8,6 +8,7 @@ APP = fips_validation
 SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
+SRCS-y += cryptodev_fips_parse_gcm.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
new file mode 100644
index 000..6999dad
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_gcm.c
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "GCM "
+
+#define PARAM_PREFIX   "["
+#define KEYLEN_STR "Keylen = "
+#define IVLEN_STR  "IVlen = "
+#define PTLEN_STR  "PTlen = "
+#define AADLEN_STR "AADlen = "
+#define TAGLEN_STR "Taglen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "IV = "
+#define PT_STR "PT = "
+#define CT_STR "CT = "
+#define TAG_STR"Tag = "
+#define AAD_STR"AAD = "
+
+#define OP_ENC_STR "Encrypt"
+#define OP_DEC_STR "Decrypt"
+
+#define NEG_TEST_STR   "FAIL"
+
+struct fips_test_callback gcm_dec_vectors[] = {
+   {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {CT_STR, parse_uint8_known_len_hex_str, &vec.ct},
+   {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad},
+   {TAG_STR, parse_uint8_known_len_hex_str,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+struct fips_test_callback gcm_interim_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.key},
+   {IVLEN_STR, parser_read_uint32_bit_val, &vec.iv},
+   {PTLEN_STR, parser_read_uint32_bit_val, &vec.pt},
+   {AADLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.aad},
+   {TAGLEN_STR, parser_read_uint32_bit_val,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback gcm_enc_vectors[] = {
+   {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_gcm_writeback(struct fips_val *val)
+{
+   struct fips_val tmp_val;
+
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN) {
+   fprintf(info.fp_wr, "%s", CT_STR);
+
+   tmp_val.val = val->val;
+   tmp_val.len = vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+
+   tmp_val.val = val->val + vec.pt.len;
+   tmp_val.len = val->len - vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+   } else {
+   if (vec.status == RTE_CRYPTO_OP_STATUS_SUCCESS) {
+   fprintf(info.fp_wr, "%s", PT_STR);
+
+   tmp_val.val = val->val;
+   tmp_val.len = vec.pt.len;
+
+   parse_write_hex_str(&tmp_val);
+   } else
+   fprintf(info.fp_wr, "%s\n", NEG_TEST_STR);

[dpdk-dev] [PATCH v5 4/8] examples/cryptodev_fips_validate: add TDES parser and enablement for test types

2018-10-17 Thread Marko Kovacevic
Added enablement for TDES parser, to allow the
application to parser the TDES request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_3des.c| 259 +
 .../cryptodev_fips_parse_aes.c |   2 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |  21 ++
 examples/cryptodev_fips_validate/main.c| 175 ++
 examples/cryptodev_fips_validate/meson.build   |   1 +
 7 files changed, 464 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index c85c76c..2ddf326 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -7,6 +7,7 @@ APP = fips_validation
 # all source are stored in SRCS-y
 SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
+SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
new file mode 100644
index 000..82e9132
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
@@ -0,0 +1,259 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define TEST_TYPE_KEY  " for CBC"
+#define TEST_CBCI_KEY  " for CBCI"
+
+#define ENC_STR"[ENCRYPT]"
+#define DEC_STR"[DECRYPT]"
+
+#define COUNT_STR  "COUNT = "
+#define KEY1_STR   "KEY1 = "
+#define KEY2_STR   "KEY2 = "
+#define KEY3_STR   "KEY3 = "
+
+#define KEYS_STR   "KEYs = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+#define NK_STR "NumKeys = "
+
+#define SET_STR" = "
+
+#define PLAIN_TEXT 0
+#define CIPHER_TEXT1
+#define KEY_TEXT   2
+#define IV_TEXT3
+
+#define DEVICE_STR "# Config Info for : "
+
+struct {
+   uint32_t type;
+   const char *desc;
+} test_types[] = {
+   {TDES_INVERSE_PERMUTATION, "INVERSE PERMUTATION"},
+   {TDES_PERMUTATION, "PERMUTATION OPERATION"},
+   {TDES_SUBSTITUTION_TABLE, "SUBSTITUTION TABLE"},
+   {TDES_VARIABLE_KEY, "VARIABLE KEY"},
+   {TDES_VARIABLE_TEXT, "VARIABLE PLAINTEXT/CIPHERTEXT"},
+   {TDES_VARIABLE_TEXT, "KAT"},
+   {TDES_MCT, "Monte Carlo (Modes) Test"},
+   {TDES_MMT, "Multi block Message Test"},
+};
+
+static int
+writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val);
+
+static int
+parse_3des_uint8_hex_str(const char *key, char *src, struct fips_val *val);
+
+static int
+parse_tdes_interim(const char *key,
+   __attribute__((__unused__)) char *text,
+   struct fips_val *val);
+
+struct fips_test_callback tdes_tests_vectors[] = {
+   {KEYS_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY1_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY3_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {CT_STR, parse_uint8_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_tests_interim_vectors[] = {
+   {ENC_STR, parse_tdes_interim, NULL},
+   {DEC_STR, parse_tdes_interim, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_writeback_callbacks[] = {
+   /** First element is used to pass COUNT string */
+   {COUNT_STR, NULL, NULL},
+   {IV_STR, writeback_hex_str, &vec.iv},
+   {KEY1_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEY3_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEYS_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {PT_STR, writeback

[dpdk-dev] [PATCH v5 6/8] examples/cryptodev_fips_validate: add cmac parser and enablement for test types

2018-10-17 Thread Marko Kovacevic
Added enablement for CMAC parser, to allow the
application to parser the cmac request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_cmac.c| 116 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   4 +
 examples/cryptodev_fips_validate/main.c|  43 
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 170 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index f8cfda7..09acfd3 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -9,6 +9,7 @@ SRCS-y := cryptodev_fips_parse_aes.c
 SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_gcm.c
+SRCS-y += cryptodev_fips_parse_cmac.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
new file mode 100644
index 000..37c6317
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_cmac.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "CMAC"
+
+#define ALGO_STR   "Alg = "
+#define MODE_STR   "Mode = "
+
+#define COUNT_STR  "Count = "
+#define KLEN_STR   "Klen = "
+#define PTLEN_STR  "Mlen = "
+#define TAGLEN_STR "Tlen = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+#define GEN_STR"Generate"
+#define VERIF_STR  "Verify"
+
+#define POS_NEG_STR"Result = "
+#define PASS_STR   "P"
+#define FAIL_STR   "F"
+
+struct hash_algo_conversion {
+   const char *str;
+   enum fips_test_algorithms algo;
+} cmac_algo[] = {
+   {"AES", FIPS_TEST_ALGO_AES_CMAC},
+};
+
+static int
+parse_test_cmac_writeback(struct fips_val *val)
+{
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN) {
+   struct fips_val tmp_val = {val->val + vec.pt.len,
+   vec.cipher_auth.digest.len};
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+   parse_write_hex_str(&tmp_val);
+   } else {
+   fprintf(info.fp_wr, "%s", POS_NEG_STR);
+
+   if (vec.status == RTE_CRYPTO_OP_STATUS_SUCCESS)
+   fprintf(info.fp_wr, "%s\n", PASS_STR);
+   else if (vec.status == RTE_CRYPTO_OP_STATUS_AUTH_FAILED)
+   fprintf(info.fp_wr, "%s\n", FAIL_STR);
+   else
+   fprintf(info.fp_wr, "Error\n");
+   }
+
+   return 0;
+}
+
+struct fips_test_callback cmac_tests_vectors[] = {
+   {KLEN_STR, parser_read_uint32_val, &vec.cipher_auth.key},
+   {PTLEN_STR, parser_read_uint32_val, &vec.pt},
+   {TAGLEN_STR, parser_read_uint32_val, &vec.cipher_auth.digest},
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {TAG_STR, parse_uint8_known_len_hex_str,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+int
+parse_test_cmac_init(void)
+{
+   char *tmp;
+   uint32_t i, j;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   char *line = info.vec[i];
+
+   tmp = strstr(line, ALGO_STR);
+   if (!tmp)
+   continue;
+
+   for (j = 0; j < RTE_DIM(cmac_algo); j++) {
+   if (!strstr(line, cmac_algo[j].str))
+   continue;
+
+   info.algo = cmac_algo[j].algo;
+   break;
+   }
+
+   if (j == RTE_DIM(cmac_algo))
+   return -EINVAL;
+
+   tmp = strstr(line, MODE_STR);
+   if (!tmp)
+   return -1;
+
+   if (strstr(tmp, GEN_STR))
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   else if (strstr(tmp, VERIF_STR))
+   info.op = 

[dpdk-dev] [PATCH v5 7/8] examples/cryptodev_fips_validate: add ccm parser and enablement for test types

2018-10-17 Thread Marko Kovacevic
Added enablement for CCM parser, to allow the
application to parser the ccm request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_ccm.c | 272 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |  22 ++
 examples/cryptodev_fips_validate/main.c|  56 -
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 356 insertions(+), 1 deletion(-)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 09acfd3..c07d35a 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -10,6 +10,7 @@ SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_3des.c
 SRCS-y += cryptodev_fips_parse_gcm.c
 SRCS-y += cryptodev_fips_parse_cmac.c
+SRCS-y += cryptodev_fips_parse_ccm.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
new file mode 100644
index 000..0fdb75a
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_ccm.c
@@ -0,0 +1,272 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define DVPT_STR   "CCM-DVPT"
+#define VADT_STR   "CCM-VADT"
+#define VPT_STR"CCM-VPT"
+#define VNT_STR"CCM-VNT"
+#define VTT_STR"CCM-VTT"
+
+#define PARAM_PREFIX   "["
+#define ALEN_PREFIX"Alen = "
+#define PLEN_PREFIX"Plen = "
+#define IVLEN_PREFIX   "Nlen = "
+#define DIGESTL_PREFIX "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "Nonce = "
+#define PT_STR "Payload = "
+#define CT_STR "CT = "
+#define AAD_STR"Adata = "
+#define POS_NEG_STR"Result = "
+
+#define POS_KEYWORD"Pass"
+#define NEG_KEYWORD"Fail"
+
+static int
+parser_dvpt_interim(const char *key, char *src, struct fips_val *val)
+{
+   char *tmp, c, value[10];
+   char num_pattern[] = "0123456789";
+   int i = 0;
+
+   memset(value, 0, 10);
+
+   tmp = strstr(src, key);
+   if (!tmp)
+   return -1;
+
+   tmp += strlen(key);
+
+   c = tmp[0];
+
+   while (strchr(num_pattern, c) && i < 10) {
+   value[i++] = c;
+   c = tmp[i];
+   }
+
+   return parser_read_uint32_val("", value, val);
+}
+
+static int
+parse_dvpt_ct_hex_str(const char *key, char *src, struct fips_val *val)
+{
+   int ret;
+
+   val->len = vec.pt.len;
+
+   ret = parse_uint8_known_len_hex_str(key, src, val);
+   if (ret < 0)
+   return ret;
+
+   src += strlen(key) + val->len * 2;
+
+   ret = parse_uint8_known_len_hex_str("", src, &vec.aead.digest);
+   if (ret < 0) {
+   rte_free(val->val);
+   memset(val, 0, sizeof(*val));
+   return ret;
+   }
+
+   return 0;
+}
+
+static int
+parse_uint8_ccm_aad_str(const char *key, char *src, struct fips_val *val)
+{
+   uint32_t len = val->len, j;
+
+   src += strlen(key);
+
+   /* CCM aad requires 18 bytes padding before the real content */
+   val->val = rte_zmalloc(NULL, len + 18, 0);
+   if (!val->val)
+   return -1;
+
+   for (j = 0; j < len; j++) {
+   char byte[3] = {src[j * 2], src[j * 2 + 1], '\0'};
+
+   if (parser_read_uint8_hex(&val->val[j + 18], byte) < 0) {
+   rte_free(val->val);
+   memset(val, 0, sizeof(*val));
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
+struct fips_test_callback ccm_vnt_vec[] = {
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {AAD_STR, parse_uint8_ccm_aad_str, &vec.aead.aad},
+   {PT_STR, parse_uint8_known_len_hex_str, &vec.pt},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback ccm_vnt_interim_vec[] = {
+   {ALEN_PREFIX, parser_read_uint32_val, &vec.aead.aad},
+   {PLEN_PREFIX, parser_read_uint32_val, &vec.pt},
+   

[dpdk-dev] [PATCH v5 3/8] examples/cryptodev_fips_validate: add hmac parser

2018-10-17 Thread Marko Kovacevic
Added enablement for HMAC parser, to allow the
application to parser the hmac request files and to validate all
tests supported

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/cryptodev_fips_validate/Makefile  |   1 +
 .../cryptodev_fips_parse_hmac.c| 105 +
 .../cryptodev_fips_parse_validate.c|   5 +
 .../cryptodev_fips_validate.h  |   9 ++
 examples/cryptodev_fips_validate/main.c| 103 
 examples/cryptodev_fips_validate/meson.build   |   1 +
 6 files changed, 224 insertions(+)
 create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index 2fc5689..c85c76c 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -6,6 +6,7 @@ APP = fips_validation
 
 # all source are stored in SRCS-y
 SRCS-y := cryptodev_fips_parse_aes.c
+SRCS-y += cryptodev_fips_parse_hmac.c
 SRCS-y += cryptodev_fips_parse_validate.c
 SRCS-y += main.c
 
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
new file mode 100644
index 000..2fbc246
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_hmac.c
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define ALGO_PREFIX"[L="
+#define KEYLEN_STR "Klen = "
+#define TAGLEN_STR "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+struct hash_size_conversion {
+   const char *str;
+   enum rte_crypto_auth_algorithm algo;
+} hsc[] = {
+   {"20", RTE_CRYPTO_AUTH_SHA1_HMAC},
+   {"28", RTE_CRYPTO_AUTH_SHA224_HMAC},
+   {"32", RTE_CRYPTO_AUTH_SHA256_HMAC},
+   {"48", RTE_CRYPTO_AUTH_SHA384_HMAC},
+   {"64", RTE_CRYPTO_AUTH_SHA512_HMAC},
+};
+
+static int
+parse_interim_algo(__attribute__((__unused__)) const char *key,
+   char *text,
+   __attribute__((__unused__)) struct fips_val *val)
+{
+
+   uint32_t i;
+
+   for (i = 0; i < RTE_DIM(hsc); i++) {
+   if (strstr(text, hsc[i].str)) {
+   info.interim_info.hmac_data.algo = hsc[i].algo;
+   break;
+   }
+   }
+
+   if (i == RTE_DIM(hsc))
+   return -1;
+
+   return 0;
+}
+
+struct fips_test_callback hmac_tests_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_val, &vec.cipher_auth.key},
+   {TAGLEN_STR, parser_read_uint32_val, &vec.cipher_auth.digest},
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {TAG_STR, parse_uint8_hex_str, &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback hmac_tests_interim_vectors[] = {
+   {ALGO_PREFIX, parse_interim_algo, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+static int
+parse_test_hmac_writeback(struct fips_val *val)
+{
+   struct fips_val val_local;
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+
+   val_local.val = val->val + vec.pt.len;
+   val_local.len = vec.cipher_auth.digest.len;
+
+   parse_write_hex_str(&val_local);
+   return 0;
+}
+
+static int
+rsp_test_hmac_check(struct fips_val *val)
+{
+   if (memcmp(val->val + vec.pt.len, vec.cipher_auth.digest.val,
+   vec.cipher_auth.digest.len) == 0)
+   fprintf(info.fp_wr, "Success\n");
+   else
+   fprintf(info.fp_wr, "Failed\n");
+
+   return 0;
+}
+
+int
+parse_test_hmac_init(void)
+{
+   info.op = FIPS_TEST_ENC_AUTH_GEN;
+   info.parse_writeback = parse_test_hmac_writeback;
+   info.callbacks = hmac_tests_vectors;
+   info.interim_callbacks = hmac_tests_interim_vectors;
+   info.writeback_callbacks = NULL;
+   info.kat_check = rsp_test_hmac_check;
+
+   return 0;
+}
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
index 32af47b..f1cd802 100644
--- a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
@@ -109,6 +109,11 @@ fips_test_parse_

[dpdk-dev] [PATCH v5 8/8] doc/guides/sample_app_ug: add guides for fips validation

2018-10-17 Thread Marko Kovacevic
Document explains how to run the fips sample app
and instructions users need to parser all the request
files and generate the response files.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 MAINTAINERS  |   4 +
 doc/guides/rel_notes/release_18_11.rst   |   6 ++
 doc/guides/sample_app_ug/fips_validation.rst | 119 +++
 doc/guides/sample_app_ug/index.rst   |   1 +
 4 files changed, 130 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst

diff --git a/MAINTAINERS b/MAINTAINERS
index 5d73756..31c9c65 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1314,3 +1314,7 @@ F: examples/tep_termination/
 F: examples/vmdq/
 F: examples/vmdq_dcb/
 F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst
+
+M: Marko Kovacevic 
+F: examples/cryptodev_fips_validate
+F: doc/guides/sample_app_ug/fips_validation.rst
diff --git a/doc/guides/rel_notes/release_18_11.rst 
b/doc/guides/rel_notes/release_18_11.rst
index 436b20e..83ad92e 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -54,6 +54,12 @@ New Features
  Also, make sure to start the actual text at the margin.
  =
 
+* **Added Cryptodev Fips Validation Example Application.**
+
+  Added an example application to parse and perform symmetric cryptography
+  computation to the NIST Cryptographic Algorithm Validation Program (CAVP)
+  test vectors.
+
 * **Added support for using externally allocated memory in DPDK.**
 
   DPDK has gained support for creating new ``rte_malloc`` heaps referencing
diff --git a/doc/guides/sample_app_ug/fips_validation.rst 
b/doc/guides/sample_app_ug/fips_validation.rst
new file mode 100644
index 000..9e0db23
--- /dev/null
+++ b/doc/guides/sample_app_ug/fips_validation.rst
@@ -0,0 +1,119 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2018 Intel Corporation.
+
+Federal Information Processing Standards (FIPS) CryptoDev Validation
+
+
+Overview
+
+
+Federal Information Processing Standards (FIPS) are publicly announced 
standards
+developed by the United States federal government for use in computer systems 
by
+non-military government agencies and government contractors.
+
+This application is used to parse and perform symmetric cryptography
+computation to the NIST Cryptographic Algorithm Validation Program (CAVP) test
+vectors.
+
+For an algorithm implementation to be listed on a cryptographic module
+validation certificate as an Approved security function, the algorithm
+implementation must meet all the requirements of FIPS 140-2 and must
+successfully complete the cryptographic algorithm validation process.
+
+Limitations
+---
+
+* Only NIST CAVP request files are parsed by this application.
+* The version of request file supported is ``CAVS 21.0``
+* If the header comment in a ``.req`` file does not contain a Algo tag
+  i.e ``AES,TDES,GCM`` you need to manually add it into the head comment for
+  example::
+
+  # VARIABLE KEY - KAT for CBC / # TDES VARIABLE KEY - KAT for CBC
+
+* The application does not supply the test vectors. The user is expected to
+  obtain the test vector files from `NIST
+  <https://csrc.nist.gov/projects/cryptographic-algorithm-validation-
+  program/block-ciphers>`_ website. To obtain the ``.req`` files you need to
+  email a person from the NIST webiste and pay for the ``.req`` files.
+  The ``.rsp`` files from the site can be used to validate and compare with
+  the ``.rsp`` files created by the FIPS application.
+
+* Supported test vectors
+* AES-CBC (128,192,256) - GFSbox, KeySbox, MCT, MMT
+* AES-GCM (128,192,256) - EncryptExtIV, Decrypt
+* AES-CCM (128) - VADT, VNT, VPT, VTT, DVPT
+* AES-CMAC (128) - Generate, Verify
+* HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
+* TDES-CBC (1 Key, 2 Keys, 3 Keys) - MMT, Monte, Permop, Subkey, Varkey,
+  VarText
+
+Compiling the Application
+-
+
+* Compile Application
+
+.. code-block:: console
+
+ make -C examples/cryptodev_fips_validate
+
+*  Run ``dos2unix`` on the request files
+
+.. code-block:: console
+
+ dos2unix AES/req/*
+ dos2unix AES_GCM/req/*
+ dos2unix CCM/req/*
+ dos2unix CMAC/req/*
+ dos2unix HMAC/req/*
+ dos2unix TDES/req/*
+
+Running the Application
+---
+
+The application requires a number of command line options:
+
+.. code-block:: console
+
+ ./cryptodev_fips_validate_app [EAL options]
+ -- --req-file FILE_PATH/FOLDER_PATH
+ --rsp-file FILE_PATH/FOLDER_PATH
+ [--cryptodev DEVICE_NAME] [--cryptodev-id ID] [--path-is-folder]
+
+where,
+  * req-file: The path of the request file or folder, separated by
+``path-is-folder`` option.
+
+ 

Re: [dpdk-dev] [PATCH v5 4/8] examples/cryptodev_fips_validate: add TDES parser and enablement for test types

2018-10-24 Thread Marko Kovacevic



On 24/10/2018 13:31, Akhil Goyal wrote:

better to be uniform with the name
TDES or 3DES

sure will make it uniform


On 10/17/2018 6:19 PM, Marko Kovacevic wrote:

Added enablement for TDES parser, to allow the
application to parser the TDES request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
   examples/cryptodev_fips_validate/Makefile  |   1 +
   .../cryptodev_fips_parse_3des.c| 259 
+
   .../cryptodev_fips_parse_aes.c |   2 +
   .../cryptodev_fips_parse_validate.c|   5 +
   .../cryptodev_fips_validate.h  |  21 ++
   examples/cryptodev_fips_validate/main.c| 175 ++
   examples/cryptodev_fips_validate/meson.build   |   1 +
   7 files changed, 464 insertions(+)
   create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
index c85c76c..2ddf326 100644
--- a/examples/cryptodev_fips_validate/Makefile
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -7,6 +7,7 @@ APP = fips_validation
   # all source are stored in SRCS-y
   SRCS-y := cryptodev_fips_parse_aes.c
   SRCS-y += cryptodev_fips_parse_hmac.c
+SRCS-y += cryptodev_fips_parse_3des.c
   SRCS-y += cryptodev_fips_parse_validate.c
   SRCS-y += main.c
   
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c

new file mode 100644
index 000..82e9132
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_3des.c
@@ -0,0 +1,259 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define NEW_LINE_STR   "#"
+#define TEST_TYPE_KEY  " for CBC"
+#define TEST_CBCI_KEY  " for CBCI"
+
+#define ENC_STR"[ENCRYPT]"
+#define DEC_STR"[DECRYPT]"
+
+#define COUNT_STR  "COUNT = "
+#define KEY1_STR   "KEY1 = "
+#define KEY2_STR   "KEY2 = "
+#define KEY3_STR   "KEY3 = "
+
+#define KEYS_STR   "KEYs = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+#define NK_STR "NumKeys = "
+
+#define SET_STR" = "
+
+#define PLAIN_TEXT 0
+#define CIPHER_TEXT1
+#define KEY_TEXT   2
+#define IV_TEXT3
+
+#define DEVICE_STR "# Config Info for : "
+
+struct {
+   uint32_t type;
+   const char *desc;
+} test_types[] = {
+   {TDES_INVERSE_PERMUTATION, "INVERSE PERMUTATION"},
+   {TDES_PERMUTATION, "PERMUTATION OPERATION"},
+   {TDES_SUBSTITUTION_TABLE, "SUBSTITUTION TABLE"},
+   {TDES_VARIABLE_KEY, "VARIABLE KEY"},
+   {TDES_VARIABLE_TEXT, "VARIABLE PLAINTEXT/CIPHERTEXT"},
+   {TDES_VARIABLE_TEXT, "KAT"},
+   {TDES_MCT, "Monte Carlo (Modes) Test"},
+   {TDES_MMT, "Multi block Message Test"},
+};
+
+static int
+writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val);
+
+static int
+parse_3des_uint8_hex_str(const char *key, char *src, struct fips_val *val);
+
+static int
+parse_tdes_interim(const char *key,
+   __attribute__((__unused__)) char *text,
+   struct fips_val *val);
+
+struct fips_test_callback tdes_tests_vectors[] = {
+   {KEYS_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY1_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {KEY3_STR, parse_3des_uint8_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_hex_str, &vec.iv},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+   {CT_STR, parse_uint8_hex_str, &vec.ct},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_tests_interim_vectors[] = {
+   {ENC_STR, parse_tdes_interim, NULL},
+   {DEC_STR, parse_tdes_interim, NULL},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_test_callback tdes_writeback_callbacks[] = {
+   /** First element is used to pass COUNT string */
+   {COUNT_STR, NULL, NULL},
+   {IV_STR, writeback_hex_str, &vec.iv},
+   {KEY1_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},
+   {KEY2_STR, writeback_tdes_hex_str, &vec.ciphe

Re: [dpdk-dev] [PATCH v5 1/8] examples/cryptodev_fips_validate: add fips validation into examples

2018-10-24 Thread Marko Kovacevic



On 24/10/2018 13:13, Akhil Goyal wrote:


On 10/17/2018 6:19 PM, Marko Kovacevic wrote:

Added FIPS application into the examples to allow
users to use a simple sample app to validate
their systems and be able to get FIPS certification.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
   examples/cryptodev_fips_validate/Makefile  |  69 +++
   .../cryptodev_fips_parse_validate.c| 562 
+
   .../cryptodev_fips_validate.h  | 150 ++
   examples/cryptodev_fips_validate/main.c| 388 ++
   examples/cryptodev_fips_validate/meson.build   |  14 +
   5 files changed, 1183 insertions(+)
   create mode 100644 examples/cryptodev_fips_validate/Makefile
   create mode 100644 
examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
   create mode 100644 examples/cryptodev_fips_validate/cryptodev_fips_validate.h
   create mode 100644 examples/cryptodev_fips_validate/main.c
   create mode 100644 examples/cryptodev_fips_validate/meson.build

diff --git a/examples/cryptodev_fips_validate/Makefile 
b/examples/cryptodev_fips_validate/Makefile
new file mode 100644
index 000..7f0e603
--- /dev/null
+++ b/examples/cryptodev_fips_validate/Makefile
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2010-2014 Intel Corporation

I believe this is a copy paste error, it should be 2018

Yeah your right will make the change.

+
+# binary name
+APP = fips_validation
+
+# all source are stored in SRCS-y
+SRCS-y += cryptodev_fips_parse_validate.c
+SRCS-y += main.c
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+   ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+   ln -sf $(APP)-static build/$(APP)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+   @mkdir -p $@
+
+.PHONY: clean
+clean:
+   rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+   rmdir --ignore-fail-on-non-empty build
+
+else
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overridden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+INC += $(sort $(wildcard *.h))
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c 
b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
new file mode 100644
index 000..aec5bb9
--- /dev/null
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_parse_validate.c
@@ -0,0 +1,562 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "cryptodev_fips_validate.h"
+
+#define skip_white_spaces(pos) \
+({ \
+   __typeof__(pos) _p = (pos); \
+   for ( ; isspace(*_p); _p++) \
+   ;   \
+   _p; \
+})
+
+static int
+get_file_line(void)
+{
+   FILE *fp = info.fp_rd;
+   char *line = info.one_line_text;
+   char c;
+   uint32_t loc = 0;
+
+   memset(line, 0, MAX_LINE_CHAR);
+   while ((c = fgetc(fp)) != EOF) {
+   if (loc >= MAX_LINE_CHAR - 1)
+   return -ENOMEM;
+   if (c == '\n')
+   return 0;
+   line[loc++] = c;
+   }
+
+   if (c == EOF)
+   return -EOF;
+
+   return 0;
+}
+
+int
+fips_test_fetch_one_block(void)
+{
+   size_t size;
+   int ret = 0;
+   uint32_t i;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   free(info.vec[i]);
+   info.vec[i] = NULL;
+   }
+
+   i = 0;
+   do {
+   if (i >= MAX_LINE_PER_VECTOR) {
+   ret = -ENOMEM;
+   goto error_exit;
+   }
+
+   ret = get_fil

Re: [dpdk-dev] [PATCH v5 2/8] examples/cryptodev_fips_validate: add aes parser and enablement for test types

2018-10-24 Thread Marko Kovacevic



On 24/10/2018 13:37, Akhil Goyal wrote:


On 10/17/2018 6:19 PM, Marko Kovacevic wrote:

diff --git a/examples/cryptodev_fips_validate/cryptodev_fips_validate.h 
b/examples/cryptodev_fips_validate/cryptodev_fips_validate.h
index beb6bed..5ac858d 100644
--- a/examples/cryptodev_fips_validate/cryptodev_fips_validate.h
+++ b/examples/cryptodev_fips_validate/cryptodev_fips_validate.h
@@ -23,6 +23,7 @@
   #define FAX_FILE_PERFIX  "fax"
   
   enum fips_test_algorithms {

+   FIPS_TEST_ALGO_AES = 0,
FIPS_TEST_ALGO_MAX
   };
   
@@ -77,6 +78,21 @@ struct fips_test_callback {

struct fips_val *val;
   };
   
+enum fips_aesavs_test_types {

+   AESAVS_TYPE_GFXBOX = 0,
+   AESAVS_TYPE_KEYSBOX,
+   AESAVS_TYPE_VARKEY,
+   AESAVS_TYPE_VARTXT,
+   AESAVS_TYPE_MMT,
+   AESAVS_TYPE_MCT,
+};

It would be better to start the enums from 1. Consider a case when an
uninitialized/unsupported type is accidentally used and it would be
treated as AES and would be processed accordingly.

sure ill change that


Re: [dpdk-dev] [PATCH v5 1/8] examples/cryptodev_fips_validate: add fips validation into examples

2018-10-24 Thread Marko Kovacevic



On 24/10/2018 15:36, Akhil Goyal wrote:


On 10/24/2018 7:47 PM, Marko Kovacevic wrote:

On 24/10/2018 13:13, Akhil Goyal wrote:

On 10/17/2018 6:19 PM, Marko Kovacevic wrote:

snip [..]

+int
+fips_test_parse_one_case(void)
+{
+    uint32_t i, j = 0;
+    uint32_t is_interim = 0;
+    int ret;
+
+    if (info.interim_callbacks) {
+    for (i = 0; i < info.nb_vec_lines; i++) {
+    for (j = 0; info.interim_callbacks[j].key != NULL; j++)
+    if (strstr(info.vec[i],
+    info.interim_callbacks[j].key)) {

it looks interim_callback is a single structure and there is no need for
treating as an array.

For some tests interim data could be multiple lines.

here you are not incrementing j, which means you are not using the other
ones. Also I cannot see it getting incremented in this function in rest
of the patches.


  for (j = 0; info.interim_callbacks[j].key != NULL; j++)
j is incremented as shown in the above line



[dpdk-dev] [PATCH v6 0/8] FIPS validation capability

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

This sample application is made for the purpose so that users of DPDK
who wish to get FIPS certification for their platforms, this sample app enables
users to parse test vectors that is gotten from NIST and be able to get
a generated response file which they can then verify and be sure their
system will pass FIPS certification.


Marko Kovacevic (8):
v6:
  - Added MAINTAINER file into different patch
  - Udpated documentation
  - Changed app name and file location
  - Fixed memory leak in TDES
  - Changed patch titles
  - Made other changes from comments
v5:
  - Changed patch titles
  - Added MAINTAINERS File
  - Removed bus_pci Dependency
  - Updated documentation
  - Changed app name
v4:
- Added Limitation
- Changed TDES BLOCK SIZE from 16 -> 8
  as DES block size is 64bits (main.c)
v3:
- Fixed a no-testing bug
- Fixed some code style issue

v2:
- Refactor the code.
- Move the code from test to sample applcation

Kovacevic, Marko (8):
  examples/fips_validation: add cryptodev fips compliant application
  examples/fips_validation: support AES parsing
  examples/fips_validation: support HMAC parsing
  examples/fips_validation: support TDES parsing
  examples/fips_validation: support GCM parsing
  examples/fips_validation: support CMAC parsing
  examples/fips_validation: support CCM parsing
  doc: add fips validation application guide

 MAINTAINERS |4 +
 doc/guides/rel_notes/release_18_11.rst  |5 +
 doc/guides/sample_app_ug/fips_validation.rst|  132 +++
 doc/guides/sample_app_ug/index.rst  |1 +
 examples/fips_validation/Makefile   |   75 ++
 examples/fips_validation/fips_validation.c  |  593 +++
 examples/fips_validation/fips_validation.h  |  233 +
 examples/fips_validation/fips_validation_aes.c  |  188 
 examples/fips_validation/fips_validation_ccm.c  |  272 +
 examples/fips_validation/fips_validation_cmac.c |  116 +++
 examples/fips_validation/fips_validation_gcm.c  |  125 +++
 examples/fips_validation/fips_validation_hmac.c |  105 ++
 examples/fips_validation/fips_validation_tdes.c |  264 +
 examples/fips_validation/main.c | 1221 +++
 examples/fips_validation/meson.build|   20 +
 15 files changed, 3354 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst
 create mode 100644 examples/fips_validation/Makefile
 create mode 100644 examples/fips_validation/fips_validation.c
 create mode 100644 examples/fips_validation/fips_validation.h
 create mode 100644 examples/fips_validation/fips_validation_aes.c
 create mode 100644 examples/fips_validation/fips_validation_ccm.c
 create mode 100644 examples/fips_validation/fips_validation_cmac.c
 create mode 100644 examples/fips_validation/fips_validation_gcm.c
 create mode 100644 examples/fips_validation/fips_validation_hmac.c
 create mode 100644 examples/fips_validation/fips_validation_tdes.c
 create mode 100644 examples/fips_validation/main.c
 create mode 100644 examples/fips_validation/meson.build

-- 
2.9.5



[dpdk-dev] [PATCH v6 3/8] examples/fips_validation: support HMAC parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for HMAC parser, to allow the
application to parser the hmac request files and to validate all
tests supported

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile   |   1 +
 examples/fips_validation/fips_validation.c  |   5 ++
 examples/fips_validation/fips_validation.h  |   9 ++
 examples/fips_validation/fips_validation_hmac.c | 105 
 examples/fips_validation/main.c | 103 +++
 examples/fips_validation/meson.build|   1 +
 6 files changed, 224 insertions(+)
 create mode 100644 examples/fips_validation/fips_validation_hmac.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 1eb1bc5..0d76101 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -7,6 +7,7 @@ APP = fips_validation
 # all source are stored in SRCS-y
 SRCS-y := fips_validation.c
 SRCS-y += fips_validation_aes.c
+SRCS-y += fips_validation_hmac.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 9e70a47..994bd0c 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -109,6 +109,11 @@ fips_test_parse_header(void)
ret = parse_test_aes_init();
if (ret < 0)
return ret;
+   } else if (strstr(info.vec[i], "HMAC")) {
+   info.algo = FIPS_TEST_ALGO_HMAC;
+   ret = parse_test_hmac_init();
+   if (ret < 0)
+   return ret;
}
 
tmp = strstr(info.vec[i], "# Config info for ");
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index e947de1..f9e3a3b 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -24,6 +24,7 @@
 
 enum fips_test_algorithms {
FIPS_TEST_ALGO_AES = 0,
+   FIPS_TEST_ALGO_HMAC,
FIPS_TEST_ALGO_MAX
 };
 
@@ -93,6 +94,10 @@ struct aesavs_interim_data {
uint32_t key_len;
 };
 
+struct hmac_interim_data {
+   enum rte_crypto_auth_algorithm algo;
+};
+
 struct fips_test_interim_info {
FILE *fp_rd;
FILE *fp_wr;
@@ -105,6 +110,7 @@ struct fips_test_interim_info {
 
union {
struct aesavs_interim_data aes_data;
+   struct hmac_interim_data hmac_data;
 
} interim_info;
 
@@ -141,6 +147,9 @@ int
 parse_test_aes_init(void);
 
 int
+parse_test_hmac_init(void);
+
+int
 parser_read_uint8_hex(uint8_t *value, const char *p);
 
 int
diff --git a/examples/fips_validation/fips_validation_hmac.c 
b/examples/fips_validation/fips_validation_hmac.c
new file mode 100644
index 000..97ac718
--- /dev/null
+++ b/examples/fips_validation/fips_validation_hmac.c
@@ -0,0 +1,105 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "fips_validation.h"
+
+#define ALGO_PREFIX"[L="
+#define KEYLEN_STR "Klen = "
+#define TAGLEN_STR "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+struct hash_size_conversion {
+   const char *str;
+   enum rte_crypto_auth_algorithm algo;
+} hsc[] = {
+   {"20", RTE_CRYPTO_AUTH_SHA1_HMAC},
+   {"28", RTE_CRYPTO_AUTH_SHA224_HMAC},
+   {"32", RTE_CRYPTO_AUTH_SHA256_HMAC},
+   {"48", RTE_CRYPTO_AUTH_SHA384_HMAC},
+   {"64", RTE_CRYPTO_AUTH_SHA512_HMAC},
+};
+
+static int
+parse_interim_algo(__attribute__((__unused__)) const char *key,
+   char *text,
+   __attribute__((__unused__)) struct fips_val *val)
+{
+
+   uint32_t i;
+
+   for (i = 0; i < RTE_DIM(hsc); i++) {
+   if (strstr(text, hsc[i].str)) {
+   info.interim_info.hmac_data.algo = hsc[i].algo;
+   break;
+   }
+   }
+
+   if (i == RTE_DIM(hsc))
+   return -1;
+
+   return 0;
+}
+
+struct fips_test_callback hmac_tests_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_val, &vec.cipher_auth.key},
+   {TAGLEN_STR, parser_read_uint32_val, &vec.cipher_auth.digest},
+   {KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},
+   {PT_STR, parse_uint8_hex_str, &vec.pt},
+ 

[dpdk-dev] [PATCH v6 2/8] examples/fips_validation: support AES parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for AES-CBC parser, to allow the
application to parser the aes request file and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile  |   1 +
 examples/fips_validation/fips_validation.c |   6 +
 examples/fips_validation/fips_validation.h |  24 ++
 examples/fips_validation/fips_validation_aes.c | 186 +
 examples/fips_validation/main.c| 346 -
 examples/fips_validation/meson.build   |   1 +
 6 files changed, 563 insertions(+), 1 deletion(-)
 create mode 100644 examples/fips_validation/fips_validation_aes.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 59d56c7..1eb1bc5 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -6,6 +6,7 @@ APP = fips_validation
 
 # all source are stored in SRCS-y
 SRCS-y := fips_validation.c
+SRCS-y += fips_validation_aes.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 8ed15f4..9e70a47 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -104,6 +104,12 @@ fips_test_parse_header(void)
return ret;
 
for (i = 0; i < info.nb_vec_lines; i++) {
+   if (strstr(info.vec[i], "AESVS")) {
+   info.algo = FIPS_TEST_ALGO_AES;
+   ret = parse_test_aes_init();
+   if (ret < 0)
+   return ret;
+   }
 
tmp = strstr(info.vec[i], "# Config info for ");
if (tmp != NULL) {
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index dd3bc09..e947de1 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -23,6 +23,7 @@
 #define FAX_FILE_PERFIX"fax"
 
 enum fips_test_algorithms {
+   FIPS_TEST_ALGO_AES = 0,
FIPS_TEST_ALGO_MAX
 };
 
@@ -77,6 +78,21 @@ struct fips_test_callback {
struct fips_val *val;
 };
 
+enum fips_aesavs_test_types {
+   AESAVS_TYPE_GFXBOX = 1,
+   AESAVS_TYPE_KEYSBOX,
+   AESAVS_TYPE_VARKEY,
+   AESAVS_TYPE_VARTXT,
+   AESAVS_TYPE_MMT,
+   AESAVS_TYPE_MCT,
+};
+
+struct aesavs_interim_data {
+   enum fips_aesavs_test_types test_type;
+   uint32_t cipher_algo;
+   uint32_t key_len;
+};
+
 struct fips_test_interim_info {
FILE *fp_rd;
FILE *fp_wr;
@@ -87,6 +103,11 @@ struct fips_test_interim_info {
uint32_t nb_vec_lines;
char device_name[MAX_STRING_SIZE];
 
+   union {
+   struct aesavs_interim_data aes_data;
+
+   } interim_info;
+
enum fips_test_op op;
 
const struct fips_test_callback *callbacks;
@@ -117,6 +138,9 @@ void
 fips_test_write_one_case(void);
 
 int
+parse_test_aes_init(void);
+
+int
 parser_read_uint8_hex(uint8_t *value, const char *p);
 
 int
diff --git a/examples/fips_validation/fips_validation_aes.c 
b/examples/fips_validation/fips_validation_aes.c
new file mode 100644
index 000..f60b864
--- /dev/null
+++ b/examples/fips_validation/fips_validation_aes.c
@@ -0,0 +1,186 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "fips_validation.h"
+
+#define MODE_STR   "AESVS"
+#define ALGO_STR   "test data for "
+#define OP_STR "State"
+#define KEY_SIZE_STR   "Key Length : "
+
+
+#define COUNT_STR  "COUNT = "
+#define KEY_STR"KEY = "
+#define IV_STR "IV = "
+#define PT_STR "PLAINTEXT = "
+#define CT_STR "CIPHERTEXT = "
+
+#define OP_ENC_STR "ENCRYPT"
+#define OP_DEC_STR "DECRYPT"
+
+struct {
+   uint32_t type;
+   const char *desc;
+} aes_test_types[] = {
+   {AESAVS_TYPE_GFXBOX, "GFSbox"},
+   {AESAVS_TYPE_KEYSBOX, "KeySbox"},
+   {AESAVS_TYPE_VARKEY, "VarKey"},
+   {AESAVS_TYPE_VARTXT, "VarTxt"},
+   {AESAVS_TYPE_MMT, "MMT"},
+   {AESAVS_TYPE_MCT, "MCT"},
+};
+
+struct aes_test_algo {
+   const char *name;
+   enum rte_crypto_cipher_algorithm algo;
+} const algo_con[] = {
+   {"CBC", RTE_CRYPTO_CIPHER_AES_CBC},
+};
+
+static int
+parse_interim_enc_dec(const char *key,
+   __attribute__((__unused__)) char *text,
+   __attribute__((__unu

[dpdk-dev] [PATCH v6 5/8] examples/fips_validation: support GCM parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for GCM parser, to allow the
application to parser the GCM request file and to validate all
tests supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile  |   1 +
 examples/fips_validation/fips_validation.c |   5 +
 examples/fips_validation/fips_validation.h |   4 +
 examples/fips_validation/fips_validation_gcm.c | 125 +
 examples/fips_validation/main.c| 116 ++-
 examples/fips_validation/meson.build   |   1 +
 6 files changed, 251 insertions(+), 1 deletion(-)
 create mode 100644 examples/fips_validation/fips_validation_gcm.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 57cc778..6373ac3 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -9,6 +9,7 @@ SRCS-y := fips_validation.c
 SRCS-y += fips_validation_aes.c
 SRCS-y += fips_validation_hmac.c
 SRCS-y += fips_validation_tdes.c
+SRCS-y += fips_validation_gcm.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index ce66b9b..9a6005a 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -109,6 +109,11 @@ fips_test_parse_header(void)
ret = parse_test_aes_init();
if (ret < 0)
return ret;
+   } else if (strstr(info.vec[i], "GCM")) {
+   info.algo = FIPS_TEST_ALGO_AES_GCM;
+   ret = parse_test_gcm_init();
+   if (ret < 0)
+   return ret;
} else if (strstr(info.vec[i], "HMAC")) {
info.algo = FIPS_TEST_ALGO_HMAC;
ret = parse_test_hmac_init();
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index 69a2116..4cceff5 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -24,6 +24,7 @@
 
 enum fips_test_algorithms {
FIPS_TEST_ALGO_AES = 0,
+   FIPS_TEST_ALGO_AES_GCM,
FIPS_TEST_ALGO_HMAC,
FIPS_TEST_ALGO_TDES,
FIPS_TEST_ALGO_MAX
@@ -171,6 +172,9 @@ int
 parse_test_hmac_init(void);
 
 int
+parse_test_gcm_init(void);
+
+int
 parser_read_uint8_hex(uint8_t *value, const char *p);
 
 int
diff --git a/examples/fips_validation/fips_validation_gcm.c 
b/examples/fips_validation/fips_validation_gcm.c
new file mode 100644
index 000..0509b10
--- /dev/null
+++ b/examples/fips_validation/fips_validation_gcm.c
@@ -0,0 +1,125 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include "fips_validation.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "GCM "
+
+#define PARAM_PREFIX   "["
+#define KEYLEN_STR "Keylen = "
+#define IVLEN_STR  "IVlen = "
+#define PTLEN_STR  "PTlen = "
+#define AADLEN_STR "AADlen = "
+#define TAGLEN_STR "Taglen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "IV = "
+#define PT_STR "PT = "
+#define CT_STR "CT = "
+#define TAG_STR"Tag = "
+#define AAD_STR"AAD = "
+
+#define OP_ENC_STR "Encrypt"
+#define OP_DEC_STR "Decrypt"
+
+#define NEG_TEST_STR   "FAIL"
+
+struct fips_test_callback gcm_dec_vectors[] = {
+   {KEY_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.key},
+   {IV_STR, parse_uint8_known_len_hex_str, &vec.iv},
+   {CT_STR, parse_uint8_known_len_hex_str, &vec.ct},
+   {AAD_STR, parse_uint8_known_len_hex_str, &vec.cipher_auth.aad},
+   {TAG_STR, parse_uint8_known_len_hex_str,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+struct fips_test_callback gcm_interim_vectors[] = {
+   {KEYLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.key},
+   {IVLEN_STR, parser_read_uint32_bit_val, &vec.iv},
+   {PTLEN_STR, parser_read_uint32_bit_val, &vec.pt},
+   {AADLEN_STR, parser_read_uint32_bit_val, &vec.cipher_auth.aad},
+   {TAGLEN_STR, parser_read_uint32_bit_val,
+   &vec.cipher_auth.digest},
+   {NULL, NULL, NULL} /**< end pointer */
+};
+
+struct fips_

[dpdk-dev] [PATCH v6 4/8] examples/fips_validation: support TDES parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for TDES parser, to allow the
application to parser the TDES request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile   |   1 +
 examples/fips_validation/fips_validation.c  |   5 +
 examples/fips_validation/fips_validation.h  |  21 ++
 examples/fips_validation/fips_validation_aes.c  |   2 +
 examples/fips_validation/fips_validation_tdes.c | 264 
 examples/fips_validation/main.c | 175 
 examples/fips_validation/meson.build|   1 +
 7 files changed, 469 insertions(+)
 create mode 100644 examples/fips_validation/fips_validation_tdes.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 0d76101..57cc778 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -8,6 +8,7 @@ APP = fips_validation
 SRCS-y := fips_validation.c
 SRCS-y += fips_validation_aes.c
 SRCS-y += fips_validation_hmac.c
+SRCS-y += fips_validation_tdes.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 994bd0c..ce66b9b 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -114,6 +114,11 @@ fips_test_parse_header(void)
ret = parse_test_hmac_init();
if (ret < 0)
return ret;
+   } else if (strstr(info.vec[i], "TDES")) {
+   info.algo = FIPS_TEST_ALGO_TDES;
+   ret = parse_test_tdes_init();
+   if (ret < 0)
+   return 0;
}
 
tmp = strstr(info.vec[i], "# Config info for ");
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index f9e3a3b..69a2116 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -25,6 +25,7 @@
 enum fips_test_algorithms {
FIPS_TEST_ALGO_AES = 0,
FIPS_TEST_ALGO_HMAC,
+   FIPS_TEST_ALGO_TDES,
FIPS_TEST_ALGO_MAX
 };
 
@@ -88,6 +89,17 @@ enum fips_aesavs_test_types {
AESAVS_TYPE_MCT,
 };
 
+enum fips_tdes_test_types {
+   TDES_INVERSE_PERMUTATION = 0,
+   TDES_PERMUTATION,
+   TDES_SUBSTITUTION_TABLE,
+   TDES_VARIABLE_KEY,
+   TDES_VARIABLE_TEXT,
+   TDES_KAT,
+   TDES_MCT, /* Monte Carlo (Modes) Test */
+   TDES_MMT /* Multi block Message Test */
+};
+
 struct aesavs_interim_data {
enum fips_aesavs_test_types test_type;
uint32_t cipher_algo;
@@ -98,6 +110,11 @@ struct hmac_interim_data {
enum rte_crypto_auth_algorithm algo;
 };
 
+struct tdes_interim_data {
+   enum fips_tdes_test_types test_type;
+   uint32_t nb_keys;
+};
+
 struct fips_test_interim_info {
FILE *fp_rd;
FILE *fp_wr;
@@ -111,6 +128,7 @@ struct fips_test_interim_info {
union {
struct aesavs_interim_data aes_data;
struct hmac_interim_data hmac_data;
+   struct tdes_interim_data tdes_data;
 
} interim_info;
 
@@ -147,6 +165,9 @@ int
 parse_test_aes_init(void);
 
 int
+parse_test_tdes_init(void);
+
+int
 parse_test_hmac_init(void);
 
 int
diff --git a/examples/fips_validation/fips_validation_aes.c 
b/examples/fips_validation/fips_validation_aes.c
index f60b864..8cbc158 100644
--- a/examples/fips_validation/fips_validation_aes.c
+++ b/examples/fips_validation/fips_validation_aes.c
@@ -33,6 +33,8 @@ struct {
{AESAVS_TYPE_KEYSBOX, "KeySbox"},
{AESAVS_TYPE_VARKEY, "VarKey"},
{AESAVS_TYPE_VARTXT, "VarTxt"},
+   {TDES_VARIABLE_TEXT, "VARIABLE PLAINTEXT/CIPHERTEXT"},
+   {TDES_VARIABLE_TEXT, "KAT"},
{AESAVS_TYPE_MMT, "MMT"},
{AESAVS_TYPE_MCT, "MCT"},
 };
diff --git a/examples/fips_validation/fips_validation_tdes.c 
b/examples/fips_validation/fips_validation_tdes.c
new file mode 100644
index 000..5064ff3
--- /dev/null
+++ b/examples/fips_validation/fips_validation_tdes.c
@@ -0,0 +1,264 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+
+#include "fips_validation.h"
+
+#define NEW_LINE_STR   "#"
+#define TEST_TYPE_KEY  " for CBC"
+#define TEST_CBCI_KEY  " for CBCI"
+
+#define ENC_STR"[ENCRYPT]"
+#define DEC_STR"[DECRYPT]"
+
+#define COUNT_STR  "COUNT = "
+#define 

[dpdk-dev] [PATCH v6 1/8] examples/fips_validation: add cryptodev fips compliant application

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added FIPS application into the examples to allow
users to use a simple sample app to validate
their systems and be able to get FIPS certification.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 MAINTAINERS|   4 +
 examples/fips_validation/Makefile  |  69 
 examples/fips_validation/fips_validation.c | 562 +
 examples/fips_validation/fips_validation.h | 149 
 examples/fips_validation/main.c| 388 
 examples/fips_validation/meson.build   |  14 +
 6 files changed, 1186 insertions(+)
 create mode 100644 examples/fips_validation/Makefile
 create mode 100644 examples/fips_validation/fips_validation.c
 create mode 100644 examples/fips_validation/fips_validation.h
 create mode 100644 examples/fips_validation/main.c
 create mode 100644 examples/fips_validation/meson.build

diff --git a/MAINTAINERS b/MAINTAINERS
index b220479..8e0d3a5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1336,3 +1336,7 @@ F: examples/tep_termination/
 F: examples/vmdq/
 F: examples/vmdq_dcb/
 F: doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst
+
+M: Marko Kovacevic 
+F: examples/fips_validation
+F: doc/guides/sample_app_ug/fips_validation.rst
diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
new file mode 100644
index 000..59d56c7
--- /dev/null
+++ b/examples/fips_validation/Makefile
@@ -0,0 +1,69 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Intel Corporation
+
+# binary name
+APP = fips_validation
+
+# all source are stored in SRCS-y
+SRCS-y := fips_validation.c
+SRCS-y += main.c
+
+# Build using pkg-config variables if possible
+$(shell pkg-config --exists libdpdk)
+ifeq ($(.SHELLSTATUS),0)
+
+all: shared
+.PHONY: shared static
+shared: build/$(APP)-shared
+   ln -sf $(APP)-shared build/$(APP)
+static: build/$(APP)-static
+   ln -sf $(APP)-static build/$(APP)
+
+PC_FILE := $(shell pkg-config --path libdpdk)
+CFLAGS += -O3 $(shell pkg-config --cflags libdpdk)
+LDFLAGS_SHARED = $(shell pkg-config --libs libdpdk)
+LDFLAGS_STATIC = -Wl,-Bstatic $(shell pkg-config --static --libs libdpdk)
+
+build/$(APP)-shared: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
+
+build/$(APP)-static: $(SRCS-y) Makefile $(PC_FILE) | build
+   $(CC) $(CFLAGS) $(SRCS-y) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
+
+build:
+   @mkdir -p $@
+
+.PHONY: clean
+clean:
+   rm -f build/$(APP) build/$(APP)-static build/$(APP)-shared
+   rmdir --ignore-fail-on-non-empty build
+
+else
+
+ifeq ($(RTE_SDK),)
+$(error "Please define RTE_SDK environment variable")
+endif
+
+# Default target, can be overridden by command line or environment
+RTE_TARGET ?= x86_64-native-linuxapp-gcc
+
+INC += $(sort $(wildcard *.h))
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+CFLAGS += $(WERROR_FLAGS)
+
+# workaround for a gcc bug with noreturn attribute
+# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
+ifeq ($(CONFIG_RTE_TOOLCHAIN_GCC),y)
+CFLAGS_main.o += -Wno-return-type
+endif
+
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3
+CFLAGS += $(WERROR_FLAGS)
+
+include $(RTE_SDK)/mk/rte.extapp.mk
+
+endif
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
new file mode 100644
index 000..8ed15f4
--- /dev/null
+++ b/examples/fips_validation/fips_validation.c
@@ -0,0 +1,562 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "fips_validation.h"
+
+#define skip_white_spaces(pos) \
+({ \
+   __typeof__(pos) _p = (pos); \
+   for ( ; isspace(*_p); _p++) \
+   ;   \
+   _p; \
+})
+
+static int
+get_file_line(void)
+{
+   FILE *fp = info.fp_rd;
+   char *line = info.one_line_text;
+   char c;
+   uint32_t loc = 0;
+
+   memset(line, 0, MAX_LINE_CHAR);
+   while ((c = fgetc(fp)) != EOF) {
+   if (loc >= MAX_LINE_CHAR - 1)
+   return -ENOMEM;
+   if (c == '\n')
+   return 0;
+   line[loc++] = c;
+   }
+
+   if (c == EOF)
+   return -EOF;
+
+   return 0;
+}
+
+int
+fips_test_fetch_one_block(void)
+{
+   size_t size;
+   int ret = 0;
+   uint32_t i;
+
+   for (i = 0; i < info.nb_vec_lines; i++) {
+   free(info.vec[i]);
+   info.vec[i] = NULL;
+   }
+
+   i = 0;
+   do {
+   if (i >= MAX_LINE_PER_VECTOR) {
+   ret = -ENOMEM;
+   goto error_exit;
+ 

[dpdk-dev] [PATCH v6 7/8] examples/fips_validation: support CCM parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for CCM parser, to allow the
application to parser the ccm request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile  |   1 +
 examples/fips_validation/fips_validation.c |   5 +
 examples/fips_validation/fips_validation.h |  22 ++
 examples/fips_validation/fips_validation_ccm.c | 272 +
 examples/fips_validation/main.c|  56 -
 examples/fips_validation/meson.build   |   1 +
 6 files changed, 356 insertions(+), 1 deletion(-)
 create mode 100644 examples/fips_validation/fips_validation_ccm.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 77b15ae..7b1fe34 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -11,6 +11,7 @@ SRCS-y += fips_validation_hmac.c
 SRCS-y += fips_validation_tdes.c
 SRCS-y += fips_validation_gcm.c
 SRCS-y += fips_validation_cmac.c
+SRCS-y += fips_validation_ccm.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 3b8f1ae..d5a16b3 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -119,6 +119,11 @@ fips_test_parse_header(void)
ret = parse_test_cmac_init();
if (ret < 0)
return 0;
+   } else if (strstr(info.vec[i], "CCM")) {
+   info.algo = FIPS_TEST_ALGO_AES_CCM;
+   ret = parse_test_ccm_init();
+   if (ret < 0)
+   return 0;
} else if (strstr(info.vec[i], "HMAC")) {
info.algo = FIPS_TEST_ALGO_HMAC;
ret = parse_test_hmac_init();
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index 8dffe8e..3e291bc 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -26,6 +26,7 @@ enum fips_test_algorithms {
FIPS_TEST_ALGO_AES = 0,
FIPS_TEST_ALGO_AES_GCM,
FIPS_TEST_ALGO_AES_CMAC,
+   FIPS_TEST_ALGO_AES_CCM,
FIPS_TEST_ALGO_HMAC,
FIPS_TEST_ALGO_TDES,
FIPS_TEST_ALGO_MAX
@@ -102,6 +103,14 @@ enum fips_tdes_test_types {
TDES_MMT /* Multi block Message Test */
 };
 
+enum fips_ccm_test_types {
+   CCM_VADT= 1, /* Variable Associated Data Test */
+   CCM_VPT, /* Variable Payload Test */
+   CCM_VNT, /* Variable Nonce Test */
+   CCM_VTT, /* Variable Tag Test */
+   CCM_DVPT,/*  Decryption-Verification Process Test */
+};
+
 struct aesavs_interim_data {
enum fips_aesavs_test_types test_type;
uint32_t cipher_algo;
@@ -117,6 +126,15 @@ struct tdes_interim_data {
uint32_t nb_keys;
 };
 
+struct ccm_interim_data {
+   enum fips_ccm_test_types test_type;
+   uint32_t aad_len;
+   uint32_t pt_len;
+   uint32_t digest_len;
+   uint32_t key_len;
+   uint32_t iv_len;
+};
+
 struct fips_test_interim_info {
FILE *fp_rd;
FILE *fp_wr;
@@ -131,6 +149,7 @@ struct fips_test_interim_info {
struct aesavs_interim_data aes_data;
struct hmac_interim_data hmac_data;
struct tdes_interim_data tdes_data;
+   struct ccm_interim_data ccm_data;
 
} interim_info;
 
@@ -179,6 +198,9 @@ int
 parse_test_cmac_init(void);
 
 int
+parse_test_ccm_init(void);
+
+int
 parser_read_uint8_hex(uint8_t *value, const char *p);
 
 int
diff --git a/examples/fips_validation/fips_validation_ccm.c 
b/examples/fips_validation/fips_validation_ccm.c
new file mode 100644
index 000..632999c
--- /dev/null
+++ b/examples/fips_validation/fips_validation_ccm.c
@@ -0,0 +1,272 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "fips_validation.h"
+
+#define DVPT_STR   "CCM-DVPT"
+#define VADT_STR   "CCM-VADT"
+#define VPT_STR"CCM-VPT"
+#define VNT_STR"CCM-VNT"
+#define VTT_STR"CCM-VTT"
+
+#define PARAM_PREFIX   "["
+#define ALEN_PREFIX"Alen = "
+#define PLEN_PREFIX"Plen = "
+#define IVLEN_PREFIX   "Nlen = "
+#define DIGESTL_PREFIX "Tlen = "
+
+#define COUNT_STR  "Count = "
+#define KEY_STR"Key = "
+#define IV_STR "Nonce = "
+#d

[dpdk-dev] [PATCH v6 6/8] examples/fips_validation: support CMAC parsing

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Added enablement for CMAC parser, to allow the
application to parser the cmac request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 examples/fips_validation/Makefile   |   1 +
 examples/fips_validation/fips_validation.c  |   5 +
 examples/fips_validation/fips_validation.h  |   4 +
 examples/fips_validation/fips_validation_cmac.c | 116 
 examples/fips_validation/main.c |  43 +
 examples/fips_validation/meson.build|   1 +
 6 files changed, 170 insertions(+)
 create mode 100644 examples/fips_validation/fips_validation_cmac.c

diff --git a/examples/fips_validation/Makefile 
b/examples/fips_validation/Makefile
index 6373ac3..77b15ae 100644
--- a/examples/fips_validation/Makefile
+++ b/examples/fips_validation/Makefile
@@ -10,6 +10,7 @@ SRCS-y += fips_validation_aes.c
 SRCS-y += fips_validation_hmac.c
 SRCS-y += fips_validation_tdes.c
 SRCS-y += fips_validation_gcm.c
+SRCS-y += fips_validation_cmac.c
 SRCS-y += main.c
 
 # Build using pkg-config variables if possible
diff --git a/examples/fips_validation/fips_validation.c 
b/examples/fips_validation/fips_validation.c
index 9a6005a..3b8f1ae 100644
--- a/examples/fips_validation/fips_validation.c
+++ b/examples/fips_validation/fips_validation.c
@@ -114,6 +114,11 @@ fips_test_parse_header(void)
ret = parse_test_gcm_init();
if (ret < 0)
return ret;
+   } else if (strstr(info.vec[i], "CMAC")) {
+   info.algo = FIPS_TEST_ALGO_AES_CMAC;
+   ret = parse_test_cmac_init();
+   if (ret < 0)
+   return 0;
} else if (strstr(info.vec[i], "HMAC")) {
info.algo = FIPS_TEST_ALGO_HMAC;
ret = parse_test_hmac_init();
diff --git a/examples/fips_validation/fips_validation.h 
b/examples/fips_validation/fips_validation.h
index 4cceff5..8dffe8e 100644
--- a/examples/fips_validation/fips_validation.h
+++ b/examples/fips_validation/fips_validation.h
@@ -25,6 +25,7 @@
 enum fips_test_algorithms {
FIPS_TEST_ALGO_AES = 0,
FIPS_TEST_ALGO_AES_GCM,
+   FIPS_TEST_ALGO_AES_CMAC,
FIPS_TEST_ALGO_HMAC,
FIPS_TEST_ALGO_TDES,
FIPS_TEST_ALGO_MAX
@@ -175,6 +176,9 @@ int
 parse_test_gcm_init(void);
 
 int
+parse_test_cmac_init(void);
+
+int
 parser_read_uint8_hex(uint8_t *value, const char *p);
 
 int
diff --git a/examples/fips_validation/fips_validation_cmac.c 
b/examples/fips_validation/fips_validation_cmac.c
new file mode 100644
index 000..54c951e
--- /dev/null
+++ b/examples/fips_validation/fips_validation_cmac.c
@@ -0,0 +1,116 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include "fips_validation.h"
+
+#define NEW_LINE_STR   "#"
+#define OP_STR "CMAC"
+
+#define ALGO_STR   "Alg = "
+#define MODE_STR   "Mode = "
+
+#define COUNT_STR  "Count = "
+#define KLEN_STR   "Klen = "
+#define PTLEN_STR  "Mlen = "
+#define TAGLEN_STR "Tlen = "
+#define KEY_STR"Key = "
+#define PT_STR "Msg = "
+#define TAG_STR"Mac = "
+
+#define GEN_STR"Generate"
+#define VERIF_STR  "Verify"
+
+#define POS_NEG_STR"Result = "
+#define PASS_STR   "P"
+#define FAIL_STR   "F"
+
+struct hash_algo_conversion {
+   const char *str;
+   enum fips_test_algorithms algo;
+} cmac_algo[] = {
+   {"AES", FIPS_TEST_ALGO_AES_CMAC},
+};
+
+static int
+parse_test_cmac_writeback(struct fips_val *val)
+{
+   if (info.op == FIPS_TEST_ENC_AUTH_GEN) {
+   struct fips_val tmp_val = {val->val + vec.pt.len,
+   vec.cipher_auth.digest.len};
+
+   fprintf(info.fp_wr, "%s", TAG_STR);
+   parse_write_hex_str(&tmp_val);
+   } else {
+   fprintf(info.fp_wr, "%s", POS_NEG_STR);
+
+   if (vec.status == RTE_CRYPTO_OP_STATUS_SUCCESS)
+   fprintf(info.fp_wr, "%s\n", PASS_STR);
+   else if (vec.status == RTE_CRYPTO_OP_STATUS_AUTH_FAILED)
+   fprintf(info.fp_wr, "%s\n", FAIL_STR);
+   else
+   fprintf(info.fp_wr, "Error\n");
+   }
+
+   return 0;
+}
+
+struct fips_test_callback cmac_tests_vectors[] = {
+   {KLEN_STR, parser_r

[dpdk-dev] [PATCH v6 8/8] doc: add fips validation application guide

2018-10-26 Thread Marko Kovacevic
From: "Kovacevic, Marko" 

Document explains how to run the fips sample app
and instructions users need to parser all the request
files and generate the response files.

Signed-off-by: Marko Kovacevic 
Signed-off-by: Fan Zhang 
Acked-by: Arek Kusztal 
---
 doc/guides/rel_notes/release_18_11.rst   |   5 +
 doc/guides/sample_app_ug/fips_validation.rst | 132 +++
 doc/guides/sample_app_ug/index.rst   |   1 +
 3 files changed, 138 insertions(+)
 create mode 100644 doc/guides/sample_app_ug/fips_validation.rst

diff --git a/doc/guides/rel_notes/release_18_11.rst 
b/doc/guides/rel_notes/release_18_11.rst
index 04f3745..c085d4b 100644
--- a/doc/guides/rel_notes/release_18_11.rst
+++ b/doc/guides/rel_notes/release_18_11.rst
@@ -198,6 +198,11 @@ New Features
   this application doesn't need to launch dedicated worker threads for vhost
   enqueue/dequeue operations.
 
+* **Added Cryptodev Fips Validation Example Application.**
+
+  Added an example application to parse and perform symmetric cryptography
+  computation to the NIST Cryptographic Algorithm Validation Program (CAVP)
+  test vectors.
 
 API Changes
 ---
diff --git a/doc/guides/sample_app_ug/fips_validation.rst 
b/doc/guides/sample_app_ug/fips_validation.rst
new file mode 100644
index 000..aeacfac
--- /dev/null
+++ b/doc/guides/sample_app_ug/fips_validation.rst
@@ -0,0 +1,132 @@
+..  SPDX-License-Identifier: BSD-3-Clause
+Copyright(c) 2018 Intel Corporation.
+
+Federal Information Processing Standards (FIPS) CryptoDev Validation
+
+
+Overview
+
+
+Federal Information Processing Standards (FIPS) are publicly announced 
standards
+developed by the United States federal government for use in computer systems 
by
+non-military government agencies and government contractors.
+
+This application is used to parse and perform symmetric cryptography
+computation to the NIST Cryptographic Algorithm Validation Program (CAVP) test
+vectors.
+
+For an algorithm implementation to be listed on a cryptographic module
+validation certificate as an Approved security function, the algorithm
+implementation must meet all the requirements of FIPS 140-2 and must
+successfully complete the cryptographic algorithm validation process.
+
+Limitations
+---
+
+* Only NIST CAVP request files are parsed by this application.
+* The version of request file supported is ``CAVS 21.0``
+* If the header comment in a ``.req`` file does not contain a Algo tag
+  i.e ``AES,TDES,GCM`` you need to manually add it into the header comment for
+  example::
+
+  # VARIABLE KEY - KAT for CBC / # TDES VARIABLE KEY - KAT for CBC
+
+* The application does not supply the test vectors. The user is expected to
+  obtain the test vector files from `NIST
+  <https://csrc.nist.gov/projects/cryptographic-algorithm-validation-
+  program/block-ciphers>`_ website. To obtain the ``.req`` files you need to
+  email a person from the NIST website and pay for the ``.req`` files.
+  The ``.rsp`` files from the site can be used to validate and compare with
+  the ``.rsp`` files created by the FIPS application.
+
+* Supported test vectors
+* AES-CBC (128,192,256) - GFSbox, KeySbox, MCT, MMT
+* AES-GCM (128,192,256) - EncryptExtIV, Decrypt
+* AES-CCM (128) - VADT, VNT, VPT, VTT, DVPT
+* AES-CMAC (128) - Generate, Verify
+* HMAC (SHA1, SHA224, SHA256, SHA384, SHA512)
+* TDES-CBC (1 Key, 2 Keys, 3 Keys) - MMT, Monte, Permop, Subkey, Varkey,
+  VarText
+
+Application Information
+---
+
+If a ``.req`` is used as the input file after the application is finished
+running it will generate a response file or ``.rsp``. Differences between the
+two files are, the ``.req`` file has missing information for instance if doing
+encryption you will not have the cipher text and that will be generated in the
+response file. Also if doing decryption it will not have the plain text until 
it
+finished the work and in the response file it will be added onto the end of 
each
+operation.
+
+The application can be run with a ``.rsp`` file and what the outcome of that
+will be is it will add a extra line in the generated ``.rsp`` which should be
+the same as the ``.rsp`` used to run the application, this is useful for
+validating if the application has done the operation correctly.
+
+
+Compiling the Application
+-
+
+* Compile Application
+
+.. code-block:: console
+
+ make -C examples/fips_validation
+
+*  Run ``dos2unix`` on the request files
+
+.. code-block:: console
+
+ dos2unix AES/req/*
+ dos2unix AES_GCM/req/*
+ dos2unix CCM/req/*
+ dos2unix CMAC/req/*
+ dos2unix HMAC/req/*
+ dos2unix TDES/req/*
+
+Running the Application
+---
+
+The application requires a number of command line options:
+
+..

[dpdk-dev] [PATCH] doc: fix pdf build

2018-11-02 Thread Marko Kovacevic
PDF build was failing in the howto guides
found the weird character causing the issue

Fixes: 6e9270eab112 ("doc: add telemetry how-to")
Cc: ciara.po...@intel.com

Signed-off-by: Marko Kovacevic 
---
 doc/guides/howto/telemetry.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/howto/telemetry.rst b/doc/guides/howto/telemetry.rst
index 3fcb061..00f8f7a 100644
--- a/doc/guides/howto/telemetry.rst
+++ b/doc/guides/howto/telemetry.rst
@@ -29,7 +29,7 @@ formatted in JSON and sent back to the requesting client.
 Pre-requisites
 ~~
 
-* Python ≥ 2.5
+* Python >= 2.5
 
 * Jansson library for JSON serialization
 
-- 
2.9.5



[dpdk-dev] [PATCH] examples/fips_validation: fix compilation issue

2018-11-06 Thread Marko Kovacevic
Fixed compilation issue with variable which may
be used uninitialized

Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
Cc: marko.kovace...@intel.com

Signed-off-by: Marko Kovacevic 
---
 examples/fips_validation/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c
index 85f54cb..e7559c6 100644
--- a/examples/fips_validation/main.c
+++ b/examples/fips_validation/main.c
@@ -887,9 +887,9 @@ fips_mct_tdes_test(void)
 #define TDES_EXTERN_ITER   400
 #define TDES_INTERN_ITER   1
struct fips_val val, val_key;
-   uint8_t prev_out[TDES_BLOCK_SIZE];
-   uint8_t prev_prev_out[TDES_BLOCK_SIZE];
-   uint8_t prev_in[TDES_BLOCK_SIZE];
+   uint8_t prev_out[TDES_BLOCK_SIZE] = {0};
+   uint8_t prev_prev_out[TDES_BLOCK_SIZE] = {0};
+   uint8_t prev_in[TDES_BLOCK_SIZE] = {0};
uint32_t i, j, k;
int ret;
 
-- 
2.9.5



[dpdk-dev] [PATCH] examples/fips_validation: fix coverity bug

2018-11-07 Thread Marko Kovacevic
Fixing a bug raised in coverity using
uninitialized value.

Coverity issue: 325881
Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
Cc: marko.kovace...@intel.com

Signed-off-by: Marko Kovacevic 
---
 examples/fips_validation/fips_validation_tdes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/fips_validation/fips_validation_tdes.c 
b/examples/fips_validation/fips_validation_tdes.c
index 5064ff3..15ee434 100644
--- a/examples/fips_validation/fips_validation_tdes.c
+++ b/examples/fips_validation/fips_validation_tdes.c
@@ -202,7 +202,7 @@ parse_test_tdes_writeback(struct fips_val *val)
 static int
 writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val)
 {
-   struct fips_val tmp_val;
+   struct fips_val tmp_val = {0};
 
tmp_val.len = 8;
 
-- 
2.9.5



[dpdk-dev] [PATCH] examples/fips_validation: fix uninitialized pointer read

2018-11-07 Thread Marko Kovacevic
Fixing a bug raised in coverity using
uninitialized value.

Coverity issue: 325881
Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
Cc: marko.kovace...@intel.com

Signed-off-by: Marko Kovacevic 
---
 examples/fips_validation/fips_validation_tdes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/fips_validation/fips_validation_tdes.c 
b/examples/fips_validation/fips_validation_tdes.c
index 5064ff3..15ee434 100644
--- a/examples/fips_validation/fips_validation_tdes.c
+++ b/examples/fips_validation/fips_validation_tdes.c
@@ -202,7 +202,7 @@ parse_test_tdes_writeback(struct fips_val *val)
 static int
 writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val)
 {
-   struct fips_val tmp_val;
+   struct fips_val tmp_val = {0};
 
tmp_val.len = 8;
 
-- 
2.9.5



[dpdk-dev] [PATCH] app/pdump: fix port id storage size

2018-11-13 Thread Marko Kovacevic
port_id size should be uint16_t,
fix where it is defined as uint8_t

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: zhiyong.y...@intel.com

Signed-off-by: Marko Kovacevic 
---
 app/pdump/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index d96556e..baabd04 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -266,7 +266,7 @@ parse_pdump(const char *optarg)
&parse_uint_value, &v);
if (ret < 0)
goto free_kvlist;
-   pt->port = (uint8_t) v.val;
+   pt->port = (uint16_t) v.val;
pt->dump_by_type = PORT_ID;
} else if (cnt2 == 1) {
ret = rte_kvargs_process(kvlist, PDUMP_PCI_ARG,
@@ -435,7 +435,7 @@ disable_pdump(struct pdump_tuples *pt)
 }
 
 static inline void
-pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct pdump_stats *stats)
+pdump_rxtx(struct rte_ring *ring, uint16_t vdev_id, struct pdump_stats *stats)
 {
/* write input packets of port to vdev for pdump */
struct rte_mbuf *rxtx_bufs[BURST_SIZE];
@@ -462,7 +462,7 @@ pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct 
pdump_stats *stats)
 }
 
 static void
-free_ring_data(struct rte_ring *ring, uint8_t vdev_id,
+free_ring_data(struct rte_ring *ring, uint16_t vdev_id,
struct pdump_stats *stats)
 {
while (rte_ring_count(ring))
-- 
2.9.5



[dpdk-dev] [PATCH] app/pdump: fix port id storage size

2018-11-13 Thread Marko Kovacevic
port_id size should be uint16_t,
fix where it is defined as uint8_t

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: zhiyong.y...@intel.com

Signed-off-by: Marko Kovacevic 
---
 app/pdump/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index d96556e..baabd04 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -266,7 +266,7 @@ parse_pdump(const char *optarg)
&parse_uint_value, &v);
if (ret < 0)
goto free_kvlist;
-   pt->port = (uint8_t) v.val;
+   pt->port = (uint16_t) v.val;
pt->dump_by_type = PORT_ID;
} else if (cnt2 == 1) {
ret = rte_kvargs_process(kvlist, PDUMP_PCI_ARG,
@@ -435,7 +435,7 @@ disable_pdump(struct pdump_tuples *pt)
 }
 
 static inline void
-pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct pdump_stats *stats)
+pdump_rxtx(struct rte_ring *ring, uint16_t vdev_id, struct pdump_stats *stats)
 {
/* write input packets of port to vdev for pdump */
struct rte_mbuf *rxtx_bufs[BURST_SIZE];
@@ -462,7 +462,7 @@ pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct 
pdump_stats *stats)
 }
 
 static void
-free_ring_data(struct rte_ring *ring, uint8_t vdev_id,
+free_ring_data(struct rte_ring *ring, uint16_t vdev_id,
struct pdump_stats *stats)
 {
while (rte_ring_count(ring))
-- 
2.9.5



[dpdk-dev] [PATCH v2] app/pdump: fix port id storage size

2018-11-13 Thread Marko Kovacevic
port_id size should be uint16_t,
fix where it is defined as uint8_t

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: zhiyong.y...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Marko Kovacevic 

--
v2:
  Added cc to stable
---
 app/pdump/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index d96556e..baabd04 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -266,7 +266,7 @@ parse_pdump(const char *optarg)
&parse_uint_value, &v);
if (ret < 0)
goto free_kvlist;
-   pt->port = (uint8_t) v.val;
+   pt->port = (uint16_t) v.val;
pt->dump_by_type = PORT_ID;
} else if (cnt2 == 1) {
ret = rte_kvargs_process(kvlist, PDUMP_PCI_ARG,
@@ -435,7 +435,7 @@ disable_pdump(struct pdump_tuples *pt)
 }
 
 static inline void
-pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct pdump_stats *stats)
+pdump_rxtx(struct rte_ring *ring, uint16_t vdev_id, struct pdump_stats *stats)
 {
/* write input packets of port to vdev for pdump */
struct rte_mbuf *rxtx_bufs[BURST_SIZE];
@@ -462,7 +462,7 @@ pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct 
pdump_stats *stats)
 }
 
 static void
-free_ring_data(struct rte_ring *ring, uint8_t vdev_id,
+free_ring_data(struct rte_ring *ring, uint16_t vdev_id,
struct pdump_stats *stats)
 {
while (rte_ring_count(ring))
-- 
2.9.5



[dpdk-dev] [PATCH v3] app/pdump: fix port id storage size

2018-11-14 Thread Marko Kovacevic
port_id size should be uint16_t,
fix where it is defined as uint8_t

Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: zhiyong.y...@intel.com
Cc: sta...@dpdk.org

Signed-off-by: Marko Kovacevic 

--
v2:
  Added cc to stable
v3:
  Changed two more values to uint16_t (Reshma)
---
 app/pdump/main.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/app/pdump/main.c b/app/pdump/main.c
index d96556e..9e86bf6 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -119,8 +119,8 @@ struct pdump_tuples {
 
/* params for packet dumping */
enum pdump_by dump_by_type;
-   int rx_vdev_id;
-   int tx_vdev_id;
+   uint16_t rx_vdev_id;
+   uint16_t tx_vdev_id;
enum pcap_stream rx_vdev_stream_type;
enum pcap_stream tx_vdev_stream_type;
bool single_pdump_dev;
@@ -266,7 +266,7 @@ parse_pdump(const char *optarg)
&parse_uint_value, &v);
if (ret < 0)
goto free_kvlist;
-   pt->port = (uint8_t) v.val;
+   pt->port = (uint16_t) v.val;
pt->dump_by_type = PORT_ID;
} else if (cnt2 == 1) {
ret = rte_kvargs_process(kvlist, PDUMP_PCI_ARG,
@@ -435,7 +435,7 @@ disable_pdump(struct pdump_tuples *pt)
 }
 
 static inline void
-pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct pdump_stats *stats)
+pdump_rxtx(struct rte_ring *ring, uint16_t vdev_id, struct pdump_stats *stats)
 {
/* write input packets of port to vdev for pdump */
struct rte_mbuf *rxtx_bufs[BURST_SIZE];
@@ -462,7 +462,7 @@ pdump_rxtx(struct rte_ring *ring, uint8_t vdev_id, struct 
pdump_stats *stats)
 }
 
 static void
-free_ring_data(struct rte_ring *ring, uint8_t vdev_id,
+free_ring_data(struct rte_ring *ring, uint16_t vdev_id,
struct pdump_stats *stats)
 {
while (rte_ring_count(ring))
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: fix sample application formatting

2018-08-16 Thread Marko Kovacevic
Fixed formatting an extra header was added making it an extra
section when it was not intended.

Fixes: d0dff9ba445e ("doc: sample application user guide")
Cc: bernard.iremon...@intel.com

Signed-off-by: Marko Kovacevic 
---
 doc/guides/sample_app_ug/ip_reassembly.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst 
b/doc/guides/sample_app_ug/ip_reassembly.rst
index 18912cd..e1b56d7 100644
--- a/doc/guides/sample_app_ug/ip_reassembly.rst
+++ b/doc/guides/sample_app_ug/ip_reassembly.rst
@@ -23,8 +23,8 @@ There are two key differences from the L2 Forwarding sample 
application:
 
 *   The second difference is that the application differentiates between IP 
and non-IP traffic by means of offload flags.
 
-The Longest Prefix Match (LPM for IPv4, LPM6 for IPv6) table is used to 
store/lookup an outgoing port number, associated with that IPv4 address. Any 
unmatched packets are forwarded to the originating port.Compiling the 
Application
---
+The Longest Prefix Match (LPM for IPv4, LPM6 for IPv6) table is used to 
store/lookup an outgoing port number,
+associated with that IPv4 address. Any unmatched packets are forwarded to the 
originating port.
 
 
 Compiling the Application
-- 
2.9.5



[dpdk-dev] [PATCH] doc: fix build issue with pdf doc

2018-04-25 Thread Marko Kovacevic
A .svg extension was added instead of .* which caused
the pdf docs to not build this change fixes that.

Fixes: a5e1231f099b ("net/szedata2: do not affect Ethernet interfaces")
Cc: v...@cesnet.cz

Signed-off-by: Marko Kovacevic 
---
 doc/guides/nics/szedata2.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/guides/nics/szedata2.rst b/doc/guides/nics/szedata2.rst
index 1b4b3eb..96fed30 100644
--- a/doc/guides/nics/szedata2.rst
+++ b/doc/guides/nics/szedata2.rst
@@ -91,7 +91,7 @@ NUMA node, the card is represented as two ports in DPDK (each 
with half of the
 queues), which allows DPDK to work with data from the individual queues on the
 right NUMA node.
 
-.. figure:: img/szedata2_nfb200g_architecture.svg
+.. figure:: img/szedata2_nfb200g_architecture.*
 :align: center
 
 NFB-200G2QL high-level diagram
-- 
2.9.5



[dpdk-dev] [PATCH v1 0/2] FIPS validation capability

2018-09-07 Thread Marko Kovacevic
Adding capability into DPDK to allow certification for FIPS
validation, I have just added one test for one algo will be adding other
algos into other versions of the patch and i will be refactoring the code and
cleaning the parser once i start adding the different algos.

Marko Kovacevic (2):
  test/test: cryptodev application for FIPS certification
  test/test: cryptodev application parser for FIPS certification

 test/test/Makefile   |   4 +
 test/test/test_cryptodev_fips.c  | 771 +++
 test/test/test_cryptodev_fips_parse.h| 156 ++
 test/test/test_cryptodev_fips_parse_aes.c| 399 ++
 test/test/test_cryptodev_fips_parse_common.c | 330 
 5 files changed, 1660 insertions(+)
 create mode 100644 test/test/test_cryptodev_fips.c
 create mode 100644 test/test/test_cryptodev_fips_parse.h
 create mode 100644 test/test/test_cryptodev_fips_parse_aes.c
 create mode 100644 test/test/test_cryptodev_fips_parse_common.c

-- 
2.9.5



[dpdk-dev] [PATCH v1 2/2] test/test: cryptodev application parser for FIPS certification

2018-09-07 Thread Marko Kovacevic
Added parser to parser required request file which has
different algos required by the fips certification
and to generate the response file needed.

Signed-off-by: Marko Kovacevic 
---
 test/test/Makefile   |   3 +
 test/test/test_cryptodev_fips_parse.h| 156 +++
 test/test/test_cryptodev_fips_parse_aes.c| 399 +++
 test/test/test_cryptodev_fips_parse_common.c | 330 ++
 4 files changed, 888 insertions(+)
 create mode 100644 test/test/test_cryptodev_fips_parse.h
 create mode 100644 test/test/test_cryptodev_fips_parse_aes.c
 create mode 100644 test/test/test_cryptodev_fips_parse_common.c

diff --git a/test/test/Makefile b/test/test/Makefile
index ee74450..9d6abb5 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -183,6 +183,9 @@ SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += 
test_cryptodev_blockcipher.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_fips.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_fips_parse_common.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_fips_parse_aes.c
+
 
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
diff --git a/test/test/test_cryptodev_fips_parse.h 
b/test/test/test_cryptodev_fips_parse.h
new file mode 100644
index 000..edb1d41
--- /dev/null
+++ b/test/test/test_cryptodev_fips_parse.h
@@ -0,0 +1,156 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+#ifndef _TEST_CRYPTODEV_FIPS_PARSE_
+#define _TEST_CRYPTODEV_FIPS_PARSE_
+
+#include 
+
+#define FIPS_PARSE_ERR(line, fmt, args...) \
+   RTE_LOG(ERR, USER1, "[%s] %s() line %u: Error in file line %u " \
+   fmt "\n", "FIPS", __func__, __LINE__, line, ## args)
+
+#define ERR_MSG_SIZE   128
+#define MAX_CASE_LINE  15
+#define MAX_NB_CHAR1024 /*< maximum number of characters per line */
+#define MAX_NB_TESTS   10240
+#define MAX_BUF_SIZE   2048 /*< maximum plain/cipher text size */
+#define MAX_KEY_LEN64
+#define MAX_IV_LEN 256
+
+#define POSITIVE_TEST  0
+#define NEGATIVE_TEST  -1
+
+#define REQ_FILE_PERFIX"req"
+#define RSP_FILE_PERFIX"rsp"
+#define FAX_FILE_PERFIX"fax"
+
+#define HEADER_IND "#"
+#define GEN_TIME_STR   "# Generated on "
+
+enum file_types {
+   FIPS_FILE_TYPE_REQ = 1,
+   FIPS_FILE_TYPE_FAX,
+   FIPS_FILE_TYPE_RSP
+};
+
+struct fips_aes_test_case {
+   char case_desc[MAX_CASE_LINE][MAX_NB_CHAR];
+#define AESAVS_OP_ENC  1
+#define AESAVS_OP_DEC  2
+   enum rte_crypto_cipher_operation test_op;
+   uint8_t key[MAX_KEY_LEN];
+   uint8_t iv[MAX_IV_LEN];
+   uint32_t iv_len;
+   uint8_t plaintext[MAX_BUF_SIZE];
+   uint32_t plaintext_len;
+   uint8_t ciphertext[MAX_BUF_SIZE];
+   uint32_t ciphertext_len;
+   uint32_t count;
+   uint32_t skip_flag;
+};
+
+/* AES TEST DATA */
+struct fips_aes_test_data {
+   enum file_types f_type;
+   char file_header[MAX_CASE_LINE][MAX_NB_CHAR];
+
+/* follow the sequence as test_type_strings declared above */
+#define AESAVS_TYPE_GFXBOX 0
+#define AESAVS_TYPE_KEYSBOX1
+#define AESAVS_TYPE_VARKEY 2
+#define AESAVS_TYPE_VARTXT 3
+#define AESAVS_TYPE_MMT4
+#define AESAVS_TYPE_MCT5
+   uint32_t test_type;
+
+   /* *_algo == 0 means no algo */
+   enum rte_crypto_cipher_algorithm cipher_algo;
+   enum rte_crypto_auth_algorithm auth_algo;
+
+   uint32_t key_len;
+
+   uint32_t nb_test_cases;
+
+   struct fips_aes_test_case test_cases[MAX_NB_TESTS];
+};
+
+/**
+ * INTERNAL APIS, used for other parsers
+ */
+int
+fips_get_file_line(FILE **fp, char *line,  uint32_t max_line_char);
+
+int
+parser_read_uint64(uint64_t *value, const char *p);
+
+int
+parser_read_uint64_hex(uint64_t *value, const char *p);
+
+int
+parser_read_uint32(uint32_t *value, const char *p);
+
+int
+parser_read_uint32_hex(uint32_t *value, const char *p);
+
+int
+parser_read_uint16(uint16_t *value, const char *p);
+
+int
+parser_read_uint16_hex(uint16_t *value, const char *p);
+
+int
+parser_read_uint8(uint8_t *value, const char *p);
+
+int
+parser_read_uint8_hex(uint8_t *value, const char *p);
+
+int
+parse_uint8_hex_str(uint8_t *dst, char *src, uint32_t max_len);
+
+enum file_types
+parse_file_type(const char *path);
+
+int
+fetch_block(FILE **fp, char *line[MAX_CASE_LINE], uint32_t from_line,
+   const char *trigger, uint32_t max_nb_line_char);
+
+void
+copy_block(char dst[][MAX_NB_CHAR], char *src[MAX_CASE_LINE],
+   uint32_t nb_lines, uint32_t max_nb_line_char);
+
+void
+write_block_to_file(FILE *fp, char from[][MAX_NB_CHAR]);
+
+void
+write_uint8_s

[dpdk-dev] [PATCH v1 1/2] test/test: cryptodev application for FIPS certification

2018-09-07 Thread Marko Kovacevic
Adding initial set up for the FIPS ceritifcation into DPDK,
more algos will be added in other versions of the code.
Also documentation will be added with steps on how to run.

Signed-off-by: Marko Kovacevic 
---
 test/test/Makefile  |   1 +
 test/test/test_cryptodev_fips.c | 771 
 2 files changed, 772 insertions(+)
 create mode 100644 test/test/test_cryptodev_fips.c

diff --git a/test/test/Makefile b/test/test/Makefile
index e6967ba..ee74450 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -182,6 +182,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_RING) += test_pmd_ring_perf.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_blockcipher.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev.c
 SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_asym.c
+SRCS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) += test_cryptodev_fips.c
 
 ifeq ($(CONFIG_RTE_COMPRESSDEV_TEST),y)
 SRCS-$(CONFIG_RTE_LIBRTE_COMPRESSDEV) += test_compressdev.c
diff --git a/test/test/test_cryptodev_fips.c b/test/test/test_cryptodev_fips.c
new file mode 100644
index 000..4bfc24e
--- /dev/null
+++ b/test/test/test_cryptodev_fips.c
@@ -0,0 +1,771 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "test.h"
+#include "test_cryptodev.h"
+#include "test_cryptodev_fips_parse.h"
+
+#define AES_IV_LENGTH16
+#define AES_BLOCK_LENGTH 16
+#define AES_MCT_NUM_INTERNAL_ITER 1000
+#define AES_MCT_NUM_EXTERNAL_ITER 100
+
+
+
+struct crypto_testsuite_params {
+   struct rte_mempool *mbuf_pool;
+   struct rte_mempool *op_mpool;
+   struct rte_mempool *session_mpool;
+   struct rte_cryptodev_config conf;
+   struct rte_cryptodev_qp_conf qp_conf;
+   uint8_t enabled_devs[RTE_CRYPTO_MAX_DEVS];
+   uint8_t nb_enabled_devs;
+};
+
+static struct crypto_testsuite_params testsuite_params = { NULL };
+
+static int
+fips_testsuite_setup(void)
+{
+   struct crypto_testsuite_params *ts_params = &testsuite_params;
+   uint8_t nb_devs;
+   uint8_t dev_id, i;
+   uint32_t max_session_size = 0;
+
+   memset(ts_params, 0, sizeof(*ts_params));
+
+   ts_params->mbuf_pool = rte_mempool_lookup("mbuf pool");
+   if (ts_params->mbuf_pool == NULL) {
+   /* Not already created so create */
+   ts_params->mbuf_pool = rte_pktmbuf_pool_create(
+   "Mbuf pool",
+   1, 0, 0, UINT16_MAX,
+   rte_socket_id());
+   if (ts_params->mbuf_pool == NULL) {
+   RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n");
+   return TEST_FAILED;
+   }
+   }
+
+   ts_params->op_mpool = rte_crypto_op_pool_create(
+   "Op pool",
+   RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+   1, 0,
+   MAXIMUM_IV_LENGTH,
+   rte_socket_id());
+   if (ts_params->op_mpool == NULL) {
+   RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
+   return TEST_FAILED;
+   }
+
+   nb_devs = rte_cryptodev_count();
+   if (nb_devs < 1) {
+   RTE_LOG(ERR, USER1, "No crypto devices found?\n");
+   return TEST_FAILED;
+   }
+
+   ts_params->conf.nb_queue_pairs = 1;
+   ts_params->conf.socket_id = SOCKET_ID_ANY;
+
+   struct rte_cryptodev_sym_capability_idx cap_idx;
+
+   /* Configure device capable of encrypting with AES-CBC */
+   for (dev_id = 0; dev_id < nb_devs; dev_id++) {
+   cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+   cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;
+   if (rte_cryptodev_sym_capability_get(dev_id, &cap_idx) != NULL) 
{
+   ts_params->enabled_devs[ts_params->nb_enabled_devs] = 
dev_id;
+   (ts_params->nb_enabled_devs)++;
+   break;
+   }
+   }
+
+   if (dev_id == nb_devs)
+   RTE_LOG(WARNING, USER1, "There is no device that supports 
AES-CBC\n");
+
+   /* Configure device capable of encrypting with AES-GCM */
+   for (dev_id = 0; dev_id < nb_devs; dev_id++) {
+   cap_idx.type = RTE_CRYPTO_SYM_XFORM_AEAD;
+   cap_idx.algo.aead = RTE_CRYPTO_AEAD_AES_GCM;
+   if (rte_cryptodev_sym_capability_get(dev_id, &cap_idx) != NULL) 
{
+   for (i = 0; i < ts_params->nb_enabled_devs; i++)
+   if (ts_params->enabled_devs[i] == dev_id)
+ 

[dpdk-dev] [PATCH] doc: add note into coding style

2018-09-17 Thread Marko Kovacevic
Added a note into the coding style to
highlight the use of a bool within a struct

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/coding_style.rst | 9 +
 1 file changed, 9 insertions(+)

diff --git a/doc/guides/contributing/coding_style.rst 
b/doc/guides/contributing/coding_style.rst
index b1bf0d1..8b1febe 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -247,6 +247,15 @@ Structure Declarations
 * Use of the structures should be by separate variable declarations and those 
declarations must be extern if they are declared in a header file.
 * Externally visible structure definitions should have the structure name 
prefixed by ``rte_`` to avoid namespace collisions.
 
+.. note::
+
+Uses of ``bool`` in structures are not preferred as is wastes space and
+it's also not clear as to what type size the bool is. A preferred use of
+``bool`` is mainly as a return type from functions that return true/false,
+and maybe local variable functions.
+
+Ref: `LKML <https://lkml.org/lkml/2017/11/21/384>`_
+
 Queues
 ~~
 
-- 
2.9.5



[dpdk-dev] [PATCH v6] app/testpmd: add new command for show port info

2018-09-25 Thread Marko Kovacevic
From: Emma Finn 

existing testpmd command "show port info" is too verbose.
Added a new summary command to print brief information on ports.

console output:
testpmd> show port summary all
Number of available ports: 2
Port MAC Address   Name  Driver   Status Link
011:22:33:44:55:66 :07:00.0  net_i40e  up4Mbps
166:55:44:33:22:11 :07:00.1  net_i40e  up4Mbps

Signed-off-by: Emma Finn 
Reviewed-by: Stephen Hemminger 
Reviewed-by: Ferruh Yigit 

---

v2: droped off redundant information added
a single header line. (Stephen Hemminger)

v3: removed deprecated function and refactored code.

v4: fixed unsigned checkpatch warning and removed commas.

v5: fixed commit message console output.

V6: changed the fields to me a bit wider to allow for longer
driver names
---
 app/test-pmd/cmdline.c  | 19 +++
 app/test-pmd/config.c   | 37 +
 app/test-pmd/testpmd.h  |  2 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  4 +++-
 4 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index 0cbd340..cb0d9ef 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -167,7 +167,7 @@ static void cmd_help_long_parsed(void *parsed_result,
"Display:\n"
"\n\n"
 
-   "show port 
(info|stats|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n"
+   "show port 
(info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n"
"Display information for port_id, or all.\n\n"
 
"show port X rss reta (size) (mask0,mask1,...)\n"
@@ -7071,6 +7071,11 @@ static void cmd_showportall_parsed(void *parsed_result,
} else if (!strcmp(res->what, "info"))
RTE_ETH_FOREACH_DEV(i)
port_infos_display(i);
+   else if (!strcmp(res->what, "summary")) {
+   port_summary_header_display();
+   RTE_ETH_FOREACH_DEV(i)
+   port_summary_display(i);
+   }
else if (!strcmp(res->what, "stats"))
RTE_ETH_FOREACH_DEV(i)
nic_stats_display(i);
@@ -7098,14 +7103,14 @@ cmdline_parse_token_string_t cmd_showportall_port =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port");
 cmdline_parse_token_string_t cmd_showportall_what =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what,
-"info#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
+
"info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
 cmdline_parse_token_string_t cmd_showportall_all =
TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all");
 cmdline_parse_inst_t cmd_showportall = {
.f = cmd_showportall_parsed,
.data = NULL,
.help_str = "show|clear port "
-   "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap all",
+   "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap all",
.tokens = {
(void *)&cmd_showportall_show,
(void *)&cmd_showportall_port,
@@ -7135,6 +7140,10 @@ static void cmd_showport_parsed(void *parsed_result,
nic_xstats_clear(res->portnum);
} else if (!strcmp(res->what, "info"))
port_infos_display(res->portnum);
+   else if (!strcmp(res->what, "summary")) {
+   port_summary_header_display();
+   port_summary_display(res->portnum);
+   }
else if (!strcmp(res->what, "stats"))
nic_stats_display(res->portnum);
else if (!strcmp(res->what, "xstats"))
@@ -7156,7 +7165,7 @@ cmdline_parse_token_string_t cmd_showport_port =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port");
 cmdline_parse_token_string_t cmd_showport_what =
TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what,
-"info#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
+
"info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap");
 cmdline_parse_token_num_t cmd_showport_portnum =
TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, UINT16);
 
@@ -7164,7 +7173,7 @@ cmdline_parse_inst_t cmd_showport = {
.f = cmd_showport_parsed,
.data = NULL,
.help_str = "show|clear port "
-   "info|stats|xstats|fdir|stat_qmap|dcb_tc|cap "
+   "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap "
"",
.tokens = {
(void *)&cmd_showport_show,
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index a0f9349..d53723c 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -518,6 +518,43 @@ port_infos_display(portid_t po

[dpdk-dev] [PATCH v1] doc: add guides for patch fix issues

2018-05-28 Thread Marko Kovacevic
Added contribution guideline for adding tags
when sending patches that have been raised on
Bugzilla

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/patches.rst | 48 ++---
 1 file changed, 34 insertions(+), 14 deletions(-)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 7bb5710..0033fd4 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -256,26 +256,46 @@ In addition to the ``Signed-off-by:`` name the commit 
messages can also have
 tags for who reported, suggested, tested and reviewed the patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
-Coverity Related Patch Fixes
-
+Patch Fix Related Issues
+
 
-`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_
-is a tool for static code analysis.
-It is used as a cloud-based service used to scan the DPDK source code,
-and alert developers of any potential defects in the source code.
-When fixing an issue found by Coverity, the patch must contain a Coverity 
issue ID
-in the body of the commit message. For example::
+  `Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_
+   is a tool for static code analysis.
+   It is used as a cloud-based service used to scan the DPDK source code,
+   and alert developers of any potential defects in the source code.
+   When fixing an issue found by Coverity, the patch must contain a Coverity 
issue ID
+   in the body of the commit message. For example::
 
 
- doc: fix some parameter description
+   doc: fix some parameter description
+
+   Update the docs, fixing description of some parameter.
+
+   Coverity issue: 12345
+   Fixes: abcdefgh1234 ("doc: add some parameter")
+   Cc: aut...@example.com
+
+   Signed-off-by: Alex Smith 
+
+
+  `Bugzilla <https://dpdk.org/tracker>`_
+   is a bug- or issue-tracking system. Bug-tracking
+   systems allow individual or groups of developers effectively to keep track 
of outstanding
+   problems with their product. When fixing an issue raised in Bugzilla, the 
patch must contain
+   a Bugzilla issue ID in the body of the commit message. For example::
+
+   doc: fix some parameter description
+
+   Update the docs, fixing description of some parameter.
+
+   Bugzilla ID: 12345
+   Fixes: abcdefgh1234 ("doc: add some parameter")
+   Cc: aut...@example.com
+
+   Signed-off-by: Alex Smith 
 
- Update the docs, fixing description of some parameter.
 
- Coverity issue: 12345
- Fixes: abcdefgh1234 ("doc: add some parameter")
- Cc: aut...@example.com
 
- Signed-off-by: Alex Smith 
 
 Patch for Stable Releases
 ~
-- 
2.9.5



[dpdk-dev] [PATCH v2] doc: add guides for patch fix issues

2018-05-29 Thread Marko Kovacevic
Added contribution guideline for adding tags
when sending patches that have been raised on
Bugzilla

Signed-off-by: Marko Kovacevic 
Acked-by: Ferruh Yigit 

---

V2: removed accidental indents  (Thomas)
---
 doc/guides/contributing/patches.rst | 21 +++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 7bb5710..3707711 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -256,8 +256,8 @@ In addition to the ``Signed-off-by:`` name the commit 
messages can also have
 tags for who reported, suggested, tested and reviewed the patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
-Coverity Related Patch Fixes
-
+Patch Fix Related Issues
+
 
 `Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_
 is a tool for static code analysis.
@@ -277,6 +277,23 @@ in the body of the commit message. For example::
 
  Signed-off-by: Alex Smith 
 
+
+`Bugzilla <https://dpdk.org/tracker>`_
+is a bug- or issue-tracking system. Bug-tracking
+systems allow individual or groups of developers effectively to keep track of 
outstanding
+problems with their product. When fixing an issue raised in Bugzilla, the 
patch must contain
+a Bugzilla issue ID in the body of the commit message. For example::
+
+doc: fix some parameter description
+
+Update the docs, fixing description of some parameter.
+
+Bugzilla ID: 12345
+Fixes: abcdefgh1234 ("doc: add some parameter")
+Cc: aut...@example.com
+
+Signed-off-by: Alex Smith 
+
 Patch for Stable Releases
 ~
 
-- 
2.9.5



[dpdk-dev] [PATCH] test/compress: fix size of test buffer

2019-01-22 Thread Marko Kovacevic
Changed size of test buffer to 100 to allow
qat to run compress unit-test,
qat_comp_process_response():
QAT intermediate buffer may be too small for output,
try configuring a larger size

Fixes: c1bbb613ce96 ("test/compress: add out of space test")
Cc: marko.kovace...@intel.com

Signed-off-by: Marko Kovacevic 
---
 test/test/test_compressdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index e8476ed..99cc390 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -42,7 +42,7 @@
 #define GZIP_HEADER_SIZE 10
 #define GZIP_TRAILER_SIZE 8
 
-#define OUT_OF_SPACE_BUF 1
+#define OUT_OF_SPACE_BUF 100
 
 const char *
 huffman_type_strings[] = {
-- 
2.9.5



[dpdk-dev] [PATCH] test/compress: fix size of test buffer

2019-01-24 Thread Marko Kovacevic
Changed size of test buffer to 100 to allow
qat to run compress unit-test,
qat_comp_process_response():
QAT intermediate buffer may be too small for output,
try configuring a larger size

Fixes: c1bbb613ce96 ("test/compress: add out of space test")
Cc: marko.kovace...@intel.com

Signed-off-by: Marko Kovacevic 
---
 test/test/test_compressdev.c | 25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/test/test/test_compressdev.c b/test/test/test_compressdev.c
index e8476ed..4db65c4 100644
--- a/test/test/test_compressdev.c
+++ b/test/test/test_compressdev.c
@@ -42,7 +42,7 @@
 #define GZIP_HEADER_SIZE 10
 #define GZIP_TRAILER_SIZE 8
 
-#define OUT_OF_SPACE_BUF 1
+#define OUT_OF_SPACE_BUF 100
 
 const char *
 huffman_type_strings[] = {
@@ -597,13 +597,15 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf 
*head_buf,
uint32_t total_data_size,
struct rte_mempool *small_mbuf_pool,
struct rte_mempool *large_mbuf_pool,
-   uint8_t limit_segs_in_sgl)
+   uint8_t limit_segs_in_sgl,
+   const struct test_data_params *test_params)
 {
uint32_t remaining_data = total_data_size;
uint16_t num_remaining_segs = DIV_CEIL(remaining_data, SMALL_SEG_SIZE);
struct rte_mempool *pool;
struct rte_mbuf *next_seg;
uint32_t data_size;
+   unsigned int out_of_space = test_params->out_of_space;
char *buf_ptr;
const char *data_ptr = test_buf;
uint16_t i;
@@ -639,6 +641,10 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf 
*head_buf,
 * Allocate the rest of the segments,
 * copy the rest of the data and chain the segments.
 */
+   if (out_of_space)
+   num_remaining_segs = 1;
+
+
for (i = 0; i < num_remaining_segs; i++) {
 
if (i == (num_remaining_segs - 1)) {
@@ -647,9 +653,11 @@ prepare_sgl_bufs(const char *test_buf, struct rte_mbuf 
*head_buf,
pool = large_mbuf_pool;
else
pool = small_mbuf_pool;
-   data_size = remaining_data;
+   out_of_space ? data_size = out_of_space :
+   (data_size = remaining_data);
} else {
-   data_size = SMALL_SEG_SIZE;
+
+   (data_size = SMALL_SEG_SIZE);
pool = small_mbuf_pool;
}
 
@@ -759,7 +767,8 @@ test_deflate_comp_decomp(const struct interim_data_params 
*int_data,
data_size,
ts_params->small_mbuf_pool,
ts_params->large_mbuf_pool,
-   MAX_SEGS) < 0)
+   MAX_SEGS,
+   test_data) < 0)
goto exit;
}
} else {
@@ -791,7 +800,8 @@ test_deflate_comp_decomp(const struct interim_data_params 
*int_data,
data_size,
ts_params->small_mbuf_pool,
ts_params->large_mbuf_pool,
-   MAX_SEGS) < 0)
+   MAX_SEGS,
+   test_data) < 0)
goto exit;
}
 
@@ -1019,7 +1029,8 @@ test_deflate_comp_decomp(const struct interim_data_params 
*int_data,
data_size,
ts_params->small_mbuf_pool,
ts_params->large_mbuf_pool,
-   MAX_SEGS) < 0)
+   MAX_SEGS,
+   test_data) < 0)
goto exit;
}
 
-- 
2.9.5



[dpdk-dev] [PATCH] qat/compress: fix qat comp setup inter_buffers

2019-01-24 Thread Marko Kovacevic
This patch fixes qat comp setup inter_buffers
memory allocation size to a broader size
then just 2MB

Fixes: a124830a6f00 ("compress/qat: enable dynamic huffman encoding")
Cc: fiona.tr...@intel.com

Signed-off-by: Marko Kovacevic 
---
 drivers/compress/qat/qat_comp_pmd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/compress/qat/qat_comp_pmd.c 
b/drivers/compress/qat/qat_comp_pmd.c
index 27c8856..d45cd67 100644
--- a/drivers/compress/qat/qat_comp_pmd.c
+++ b/drivers/compress/qat/qat_comp_pmd.c
@@ -185,7 +185,7 @@ qat_comp_setup_inter_buffers(struct qat_comp_dev_private 
*comp_dev,
 
memzone = rte_memzone_reserve_aligned(inter_buff_mz_name, full_size,
comp_dev->compressdev->data->socket_id,
-   RTE_MEMZONE_2MB, QAT_64_BYTE_ALIGN);
+   RTE_MEMZONE_IOVA_CONTIG, QAT_64_BYTE_ALIGN);
if (memzone == NULL) {
QAT_LOG(ERR, "Can't allocate intermediate buffers"
" for device %s", comp_dev->qat_dev->name);
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: add SPDX Licence to doc files

2018-04-09 Thread Marko Kovacevic
Added SPDX headers to doc files to have them aligned with
the other doc files.

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/cheatsheet.rst   | 3 +++
 doc/guides/contributing/coding_style.rst | 3 +++
 doc/guides/contributing/design.rst   | 3 +++
 doc/guides/contributing/documentation.rst| 3 +++
 doc/guides/contributing/img/patch_cheatsheet.svg | 3 ++-
 doc/guides/contributing/index.rst| 3 +++
 doc/guides/contributing/patches.rst  | 3 +++
 doc/guides/contributing/stable.rst   | 3 +++
 doc/guides/contributing/versioning.rst   | 3 +++
 doc/guides/linux_gsg/nic_perf_intel_platform.rst | 3 +++
 doc/guides/rel_notes/deprecation.rst | 3 +++
 doc/guides/rel_notes/release_16_04.rst   | 3 +++
 doc/guides/rel_notes/release_16_07.rst   | 3 +++
 doc/guides/rel_notes/release_16_11.rst   | 3 +++
 doc/guides/rel_notes/release_17_02.rst   | 3 +++
 doc/guides/rel_notes/release_17_05.rst   | 3 +++
 doc/guides/rel_notes/release_17_08.rst   | 3 +++
 doc/guides/rel_notes/release_17_11.rst   | 3 +++
 doc/guides/rel_notes/release_18_02.rst   | 3 +++
 doc/guides/rel_notes/release_2_2.rst | 3 +++
 20 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/doc/guides/contributing/cheatsheet.rst 
b/doc/guides/contributing/cheatsheet.rst
index 7bc0771..97512d7 100644
--- a/doc/guides/contributing/cheatsheet.rst
+++ b/doc/guides/contributing/cheatsheet.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 Patch Cheatsheet
 
 
diff --git a/doc/guides/contributing/coding_style.rst 
b/doc/guides/contributing/coding_style.rst
index b0f0adb..e285fc8 100644
--- a/doc/guides/contributing/coding_style.rst
+++ b/doc/guides/contributing/coding_style.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 .. _coding_style:
 
 DPDK Coding Style
diff --git a/doc/guides/contributing/design.rst 
b/doc/guides/contributing/design.rst
index 88d3a43..bbe219e 100644
--- a/doc/guides/contributing/design.rst
+++ b/doc/guides/contributing/design.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 Design
 ==
 
diff --git a/doc/guides/contributing/documentation.rst 
b/doc/guides/contributing/documentation.rst
index 82f2e1b..7ac1b41 100644
--- a/doc/guides/contributing/documentation.rst
+++ b/doc/guides/contributing/documentation.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 .. _doc_guidelines:
 
 DPDK Documentation Guidelines
diff --git a/doc/guides/contributing/img/patch_cheatsheet.svg 
b/doc/guides/contributing/img/patch_cheatsheet.svg
index 8522592..af2473d 100644
--- a/doc/guides/contributing/img/patch_cheatsheet.svg
+++ b/doc/guides/contributing/img/patch_cheatsheet.svg
@@ -1,5 +1,6 @@
 
-
+
+
 
 http://purl.org/dc/elements/1.1/";
diff --git a/doc/guides/contributing/index.rst 
b/doc/guides/contributing/index.rst
index 329b678..9fa0076 100644
--- a/doc/guides/contributing/index.rst
+++ b/doc/guides/contributing/index.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 Contributor's Guidelines
 
 
diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 2287835..494cdf4 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 .. submitting_patches:
 
 Contributing Code to DPDK
diff --git a/doc/guides/contributing/stable.rst 
b/doc/guides/contributing/stable.rst
index 0f2f1f3..16518b0 100644
--- a/doc/guides/contributing/stable.rst
+++ b/doc/guides/contributing/stable.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 .. stable_lts_releases:
 
 DPDK Stable Releases and Long Term Support
diff --git a/doc/guides/contributing/versioning.rst 
b/doc/guides/contributing/versioning.rst
index c495294d..6e2f073 100644
--- a/doc/guides/contributing/versioning.rst
+++ b/doc/guides/contributing/versioning.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 Managing ABI updates
 
 
diff --git a/doc/guides/linux_gsg/nic_perf_intel_platform.rst 
b/doc/guides/linux_gsg/nic_perf_intel_platform.rst
index 987cd0a..7bd05b6 100644
--- a/doc/guides/linux_gsg/nic_perf_intel_platform.rst
+++ b/doc/guides/linux_gsg/nic_perf_intel_platform.rst
@@ -1,3 +1,6 @@
+.. SPDX-License-Identifier: BSD-3-Clause
+   Copyright(c) 2018 Intel Corporation
+
 How to get best performance with NICs on Intel platforms
 
 
diff --git a/doc/guides

[dpdk-dev] [PATCH v1 1/2] doc: add guidelines for coverity tags

2018-01-09 Thread Marko Kovacevic
 Added contribution guideline for adding tags
 when sending patches that have been raised by
 coverity

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/patches.rst | 20 
 1 file changed, 20 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 64408e7..e6b6e80 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -257,6 +257,26 @@ tags for who reported, suggested, tested and reviewed the 
patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
 
+Coverity Related Patch Fixes:
+~
+
+`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_ is a 
gratis
+static-analysis cloud-based service for the open source community. It is a 
tool for
+C,C++,C# and Java it is used for finding bugs through static analysis. If a 
patch
+fix is being sent to the mailing list due to a Coverity related issue,a
+Coverity issue tag should be inserted into the commit message body as so::
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Coverity issue: 12345
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: aut...@example.com
+
+ Signed-off-by: Alex Smith 
+
+
 Creating Patches
 
 
-- 
2.9.5



[dpdk-dev] [PATCH v1 2/2] doc: add guidelines for stable tags

2018-01-09 Thread Marko Kovacevic
   Added contribution guideline for adding stable
   tags when sending patches all fix patches to the
   master branch that are candidates for backporting

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/patches.rst | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index e6b6e80..f98e601 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -276,6 +276,21 @@ Coverity issue tag should be inserted into the commit 
message body as so::
 
  Signed-off-by: Alex Smith 
 
+Patch for Stable Releases:
+~~
+
+All fix patches to the master branch that are candidates for backporting
+should also be CCed to the `sta...@dpdk.org 
<http://dpdk.org/ml/listinfo/stable>`_
+mailing list. In the commit message body the Cc: sta...@dpdk.org should be 
inserted as so::
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: sta...@dpdk.org
+
+ Signed-off-by: Alex Smith 
 
 Creating Patches
 
-- 
2.9.5



[dpdk-dev] [PATCH v2 1/2] doc: add guidelines for coverity tags

2018-01-10 Thread Marko Kovacevic
 Added contribution guideline for adding tags
 when sending patches that have been raised by
 coverity

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/patches.rst | 20 
 1 file changed, 20 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 64408e7..e6b6e80 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -257,6 +257,26 @@ tags for who reported, suggested, tested and reviewed the 
patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
 
+Coverity Related Patch Fixes:
+~
+
+`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_ is a 
gratis
+static-analysis cloud-based service for the open source community. It is a 
tool for
+C,C++,C# and Java it is used for finding bugs through static analysis. If a 
patch
+fix is being sent to the mailing list due to a Coverity related issue,a
+Coverity issue tag should be inserted into the commit message body as so::
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Coverity issue: 12345
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: aut...@example.com
+
+ Signed-off-by: Alex Smith 
+
+
 Creating Patches
 
 
-- 
2.9.5



[dpdk-dev] [PATCH v2 2/2] doc: add guidelines for stable tags

2018-01-10 Thread Marko Kovacevic
   Added contribution guideline for adding stable
   tags when sending patches all fix patches to the
   master branch that are candidates for backporting

Signed-off-by: Marko Kovacevic 
---
 doc/guides/contributing/patches.rst | 17 +
 1 file changed, 17 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index e6b6e80..124dade 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -276,6 +276,23 @@ Coverity issue tag should be inserted into the commit 
message body as so::
 
  Signed-off-by: Alex Smith 
 
+Patch for Stable Releases:
+~~
+
+All fix patches to the master branch that are candidates for backporting
+should also be CCed to the `sta...@dpdk.org 
<http://dpdk.org/ml/listinfo/stable>`_
+mailing list. In the commit message body the Cc: sta...@dpdk.org should be 
inserted as so::
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: sta...@dpdk.org
+
+ Signed-off-by: Alex Smith 
+
+For further information on stable contribution you can go here :doc:`Stable 
Contribution`
 
 Creating Patches
 
-- 
2.9.5



[dpdk-dev] [PATCH v3 1/2] doc: add guidelines for coverity tags

2018-01-16 Thread Marko Kovacevic
 Added contribution guideline for adding tags
 when sending patches that have been raised by
 coverity

Signed-off-by: Marko Kovacevic 
Acked-by: Hemant Agrawal 
---
 doc/guides/contributing/patches.rst | 21 +
 1 file changed, 21 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 64408e7..59d2aaf 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -257,6 +257,27 @@ tags for who reported, suggested, tested and reviewed the 
patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
 
+Coverity Related Patch Fixes:
+~
+
+`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_ is a 
tool for
+static code analysis. It is used as a cloud-based service used to scan the
+DPDK source code, and alert developers of any potential defects in the source 
code.
+When fixing an issue found by Coverity, the patch must contain a Coverity 
issue ID in the
+body of the commit message. For example::
+
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Coverity issue: 12345
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: aut...@example.com
+
+ Signed-off-by: Alex Smith 
+
+
 Creating Patches
 
 
-- 
2.9.5



[dpdk-dev] [PATCH v3 1/2] doc: add guidelines for coverity tags

2018-01-16 Thread Marko Kovacevic
 Added contribution guideline for adding tags
 when sending patches that have been raised by
 coverity

Signed-off-by: Marko Kovacevic 
Acked-by: Hemant Agrawal 
---
 doc/guides/contributing/patches.rst | 21 +
 1 file changed, 21 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 64408e7..59d2aaf 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -257,6 +257,27 @@ tags for who reported, suggested, tested and reviewed the 
patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
 
+Coverity Related Patch Fixes:
+~
+
+`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_ is a 
tool for
+static code analysis. It is used as a cloud-based service used to scan the
+DPDK source code, and alert developers of any potential defects in the source 
code.
+When fixing an issue found by Coverity, the patch must contain a Coverity 
issue ID in the
+body of the commit message. For example::
+
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Coverity issue: 12345
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: aut...@example.com
+
+ Signed-off-by: Alex Smith 
+
+
 Creating Patches
 
 
-- 
2.9.5



[dpdk-dev] [PATCH v3 1/2] doc: add guidelines for coverity tags

2018-01-16 Thread Marko Kovacevic
 Added contribution guideline for adding tags
 when sending patches that have been raised by
 coverity

Signed-off-by: Marko Kovacevic 
Acked-by: Hemant Agrawal 
---
 doc/guides/contributing/patches.rst | 21 +
 1 file changed, 21 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 64408e7..59d2aaf 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -257,6 +257,27 @@ tags for who reported, suggested, tested and reviewed the 
patch being
 posted. Please refer to the `Tested, Acked and Reviewed by`_ section.
 
 
+Coverity Related Patch Fixes:
+~
+
+`Coverity 
<https://scan.coverity.com/projects/dpdk-data-plane-development-kit>`_ is a 
tool for
+static code analysis. It is used as a cloud-based service used to scan the
+DPDK source code, and alert developers of any potential defects in the source 
code.
+When fixing an issue found by Coverity, the patch must contain a Coverity 
issue ID in the
+body of the commit message. For example::
+
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Coverity issue: 12345
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: aut...@example.com
+
+ Signed-off-by: Alex Smith 
+
+
 Creating Patches
 
 
-- 
2.9.5



[dpdk-dev] [PATCH v3 2/2] doc: add guidelines for stable tags

2018-01-16 Thread Marko Kovacevic
   Added contribution guideline for adding stable
   tags when sending patches all fix patches to the
   master branch that are candidates for backporting

Signed-off-by: Marko Kovacevic 
Acked-by: Hemant Agrawal 
---
 doc/guides/contributing/patches.rst | 17 +
 1 file changed, 17 insertions(+)

diff --git a/doc/guides/contributing/patches.rst 
b/doc/guides/contributing/patches.rst
index 59d2aaf..cef9776 100644
--- a/doc/guides/contributing/patches.rst
+++ b/doc/guides/contributing/patches.rst
@@ -277,6 +277,23 @@ body of the commit message. For example::
 
  Signed-off-by: Alex Smith 
 
+Patch for Stable Releases:
+~~
+
+All fix patches to the master branch that are candidates for backporting
+should also be CCed to the `sta...@dpdk.org 
<http://dpdk.org/ml/listinfo/stable>`_
+mailing list. In the commit message body the Cc: sta...@dpdk.org should be 
inserted as follows::
+
+ doc: fix some parameter description
+
+ Update the docs, fixing description of some parameter.
+
+ Fixes: abcdefgh1234 ("doc: add some parameter")
+ Cc: sta...@dpdk.org
+
+ Signed-off-by: Alex Smith 
+
+For further information on stable contribution you can go here :doc:`Stable 
Contribution`
 
 Creating Patches
 
-- 
2.9.5



[dpdk-dev] [PATCH v1] mk: support building with renamed makefile

2018-01-22 Thread Marko Kovacevic
The build system made a recursive call to "make" after
creating the build directory. This recursive call used
the hard-coded filename "Makefile", which prevented
builds from working if the file was renamed and make
called using "make -f". Taking the filename from
MAKEFILES_LIST make variable fixes this.

Fixes: af75078fece3 ("first public release")
Cc: sta...@dpdk.org

Signed-off-by: Marko Kovacevic 
---
 mk/internal/rte.extvars.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mk/internal/rte.extvars.mk b/mk/internal/rte.extvars.mk
index 94f27e9..19594da 100644
--- a/mk/internal/rte.extvars.mk
+++ b/mk/internal/rte.extvars.mk
@@ -20,7 +20,7 @@ ifeq ("$(origin M)", "command line")
 RTE_EXTMK := $(abspath $(M))
 endif
 endif
-RTE_EXTMK ?= $(RTE_SRCDIR)/Makefile
+RTE_EXTMK ?= $(RTE_SRCDIR)/$(firstword $(MAKEFILE_LIST))
 export RTE_EXTMK
 
 # RTE_SDK_BIN must point to .config, include/ and lib/.
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: remove TUN from TAP PMD guide

2018-01-23 Thread Marko Kovacevic
From: Vipin Varghese 

TUN PMD is not supported, removing the refrences
from Network Interface Controller Driver Tun/Tap
Poll Mode Driver section

Signed-off-by: Vipin Varghese 
---
 doc/guides/nics/tap.rst | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/guides/nics/tap.rst b/doc/guides/nics/tap.rst
index dc6f834..b23e7f5 100644
--- a/doc/guides/nics/tap.rst
+++ b/doc/guides/nics/tap.rst
@@ -28,10 +28,10 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Tun/Tap Poll Mode Driver
-
+Tap Poll Mode Driver
+
 
-The ``rte_eth_tap.c`` PMD creates a device using TUN/TAP interfaces on the
+The ``rte_eth_tap.c`` PMD creates a device using TAP interfaces on the
 local host. The PMD allows for DPDK and the host to communicate using a raw
 device interface on the host and in the DPDK application.
 
@@ -170,7 +170,7 @@ Distribute IPv4 TCP packets using RSS to a given MAC 
address over queues 0-3::
 Example
 ---
 
-The following is a simple example of using the TUN/TAP PMD with the Pktgen
+The following is a simple example of using the TAP PMD with the Pktgen
 packet generator. It requires that the ``socat`` utility is installed on the
 test system.
 
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: fix bbdev test guide build

2018-01-24 Thread Marko Kovacevic
Some indentations in the bbdev test application
were causing build failures. Which are solved by this
commit.

Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")
Cc: amr.mokh...@intel.com

Signed-off-by: Marko Kovacevic 
---
 doc/guides/tools/testbbdev.rst | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/doc/guides/tools/testbbdev.rst b/doc/guides/tools/testbbdev.rst
index c7aac49..5c7112d 100644
--- a/doc/guides/tools/testbbdev.rst
+++ b/doc/guides/tools/testbbdev.rst
@@ -71,24 +71,26 @@ The following are the command-line options:
  Defines test cases to run. If not specified all available tests are run.
 
  The following tests can be run:
-  * unittest
+
+ * unittest
  Small unit tests witch check basic functionality of bbdev library.
-  * latency
+ * latency
  Test calculates three latency metrics:
-  * offload_latency_tc
+
+ * offload_latency_tc
  measures the cost of offloading enqueue and dequeue operations.
-  * offload_latency_empty_q_tc
+ * offload_latency_empty_q_tc
  measures the cost of offloading a dequeue operation from an empty 
queue.
  checks how long last dequeueing if there is no operations to dequeue
-  * operation_latency_tc
+ * operation_latency_tc
  measures the time difference from the first attempt to enqueue till 
the
  first successful dequeue.
-  * validation
+ * validation
  Test do enqueue on given vector and compare output after dequeueing.
-  * throughput
+ * throughput
  Test measures the achieved throughput on the available lcores.
  Results are printed in million operations per second and million bits per 
second.
-  * interrupt
+ * interrupt
  The same test as 'throughput' but uses interrupts instead of PMD to 
perform
  the dequeue.
 
-- 
2.9.5



[dpdk-dev] [PATCH v2] doc: fix bbdev test guide build

2018-01-24 Thread Marko Kovacevic
Fix build issue with pdf guides. Some indentations in the bbdev test
application doc were causing build failures. Latex Log message:
 
    doc.log:! LaTeX Error: Too deeply nested.
   
Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")
Cc: amr.mokh...@intel.com
 

Signed-off-by: Marko Kovacevic 
---

V2: Added more information into commit message
about the issue

 doc/guides/tools/testbbdev.rst | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/doc/guides/tools/testbbdev.rst b/doc/guides/tools/testbbdev.rst
index c7aac49..5c7112d 100644
--- a/doc/guides/tools/testbbdev.rst
+++ b/doc/guides/tools/testbbdev.rst
@@ -71,24 +71,26 @@ The following are the command-line options:
  Defines test cases to run. If not specified all available tests are run.
 
  The following tests can be run:
-  * unittest
+
+ * unittest
  Small unit tests witch check basic functionality of bbdev library.
-  * latency
+ * latency
  Test calculates three latency metrics:
-  * offload_latency_tc
+
+ * offload_latency_tc
  measures the cost of offloading enqueue and dequeue operations.
-  * offload_latency_empty_q_tc
+ * offload_latency_empty_q_tc
  measures the cost of offloading a dequeue operation from an empty 
queue.
  checks how long last dequeueing if there is no operations to dequeue
-  * operation_latency_tc
+ * operation_latency_tc
  measures the time difference from the first attempt to enqueue till 
the
  first successful dequeue.
-  * validation
+ * validation
  Test do enqueue on given vector and compare output after dequeueing.
-  * throughput
+ * throughput
  Test measures the achieved throughput on the available lcores.
  Results are printed in million operations per second and million bits per 
second.
-  * interrupt
+ * interrupt
  The same test as 'throughput' but uses interrupts instead of PMD to 
perform
  the dequeue.
 
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: add note in proc info for stats retrieval

2018-01-24 Thread Marko Kovacevic
Note added to outline that using
proc_info for virtual devices is not supported

Signed-off-by: Marko Kovacevic 
---
 doc/guides/tools/proc_info.rst | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst
index fd17e27..191ab20 100644
--- a/doc/guides/tools/proc_info.rst
+++ b/doc/guides/tools/proc_info.rst
@@ -68,3 +68,6 @@ The xstats-reset parameter controls the resetting of extended 
port statistics.
 If no port mask is specified xstats are reset for all DPDK ports.
 
 **-m**: Print DPDK memory information.
+
+.. NOTE::
+   NOTE: Stats retrieval using ``proc_info`` is not supported for virtual 
devices like PCAP and TAP
-- 
2.9.5



[dpdk-dev] [PATCH v4 1/2] doc: add generic compilation doc for all sample apps

2017-10-05 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Fixes: d0dff9ba445e ("doc: sample application user guide")
Fixes: 60643134c1c1 ("doc: add distributor application")
Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample 
application")
Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")
Fixes: e64833f2273a ("examples/l2fwd-keepalive: add sample application")
Fixes: d0dff9ba445e ("doc: sample application user guide")
Fixes: f6baccbc2b3b ("examples/l2fwd-cat: add sample application for PQoS CAT 
and CDP")
Fixes: ba7b86b1419b ("doc: add l2fwd-crypto sample app guide")
Fixes: ccefe752cab0 ("doc: add jobstats sample guide")
Fixes: 1b2038b06fae ("doc: new packet ordering app description")
Fixes: 4d1a771bd88d ("doc: add guide for performance-thread example")
Fixes: 2d1232571112 ("doc: add PTP client sample guide")
Fixes: 0d8d3df6b81b ("doc: add Rx and Tx callbacks sample app user guide")
Fixes: eb21185d6f21 ("doc: add flow distributor example guide")
Fixes: 1443da3bbd71 ("doc: add basic forwarding skeleton user guide")
Fixes: 181654b7162e ("doc: add a VXLAN sample guide")
Fixes: c75f4e6a7a2b ("doc: add vm power mgmt app")

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 

---
v3:
   -removed unnecessary addition of export RTE_TARGET (Thomas)
   -changed make install to make config   (Thomas)
   -Inserted new method to export and make examples   (Thomas)
---
 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 135 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +--
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +--
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +---
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++---
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +---
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +---
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +--
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +--
 39 files changed, 241 insertions(+), 741 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is u

[dpdk-dev] [PATCH v4 2/2] doc: add new introduction to sample app guides

2017-10-05 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
---
 doc/guides/faq/faq.rst |   2 +-
 doc/guides/sample_app_ug/dist_app.rst  |   2 +
 doc/guides/sample_app_ug/exception_path.rst|   2 +-
 doc/guides/sample_app_ug/hello_world.rst   |   2 +
 doc/guides/sample_app_ug/index.rst |   2 +
 doc/guides/sample_app_ug/intro.rst | 152 +++--
 doc/guides/sample_app_ug/ipsec_secgw.rst   |   2 +
 .../sample_app_ug/l2_forward_real_virtual.rst  |   2 +-
 doc/guides/sample_app_ug/l3_forward.rst|   2 +
 doc/guides/sample_app_ug/multi_process.rst |   2 +-
 doc/guides/sample_app_ug/ptpclient.rst |   1 +
 doc/guides/sample_app_ug/qos_scheduler.rst |   2 +
 doc/guides/sample_app_ug/rxtx_callbacks.rst|   1 +
 doc/guides/sample_app_ug/server_node_efd.rst   |   2 +-
 doc/guides/sample_app_ug/skeleton.rst  |   1 +
 15 files changed, 132 insertions(+), 45 deletions(-)

diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index dac8050..da9b484 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -221,7 +221,7 @@ I350 has RSS support and 8 queue pairs can be used in RSS 
mode. It should work w
 How can hugepage-backed memory be shared among multiple processes?
 --
 
-See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
+See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
 
 
 Why can't my application receive packets on my system with UEFI Secure Boot 
enabled?
diff --git a/doc/guides/sample_app_ug/dist_app.rst 
b/doc/guides/sample_app_ug/dist_app.rst
index 466115d..0431b97 100644
--- a/doc/guides/sample_app_ug/dist_app.rst
+++ b/doc/guides/sample_app_ug/dist_app.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_dist_app:
+
 Distributor Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/exception_path.rst 
b/doc/guides/sample_app_ug/exception_path.rst
index 2dee8bf..40e5b5c 100644
--- a/doc/guides/sample_app_ug/exception_path.rst
+++ b/doc/guides/sample_app_ug/exception_path.rst
@@ -115,7 +115,7 @@ The following sections provide some explanation of the code.
 Initialization
 ~~
 
-Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`l2_fwd_app_real_and_virtual`.
+Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`sample_app_l2_fwd`.
 In addition, the TAP interfaces must also be created.
 A TAP interface is created for each lcore that is being used.
 The code for creating the TAP interface is as follows:
diff --git a/doc/guides/sample_app_ug/hello_world.rst 
b/doc/guides/sample_app_ug/hello_world.rst
index 8196702..8cf23a3 100644
--- a/doc/guides/sample_app_ug/hello_world.rst
+++ b/doc/guides/sample_app_ug/hello_world.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_hello_world:
+
 Hello World Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 4f8340a..163b468 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -1,4 +1,5 @@
 ..  BSD LICENSE
+
 Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 All rights reserved.
 
@@ -28,6 +29,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Sample Applications User Guides
 ===
 
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..b276714 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,114 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Documentation Ro

[dpdk-dev] [PATCH v5 1/2] doc: add generic compilation doc for all sample apps

2017-10-09 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 

---

v5:
   All relevant code and comment changes made (John)


 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 123 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 39 files changed, 229 insertions(+), 741 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..23e5f13
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,123 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived

[dpdk-dev] [PATCH v5 2/2] doc: add new introduction to sample app guides

2017-10-09 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---

v5:
   All changes to your comments have been dealt with (John)


 doc/guides/faq/faq.rst |   2 +-
 doc/guides/sample_app_ug/dist_app.rst  |   2 +
 doc/guides/sample_app_ug/exception_path.rst|   2 +-
 doc/guides/sample_app_ug/hello_world.rst   |   2 +
 doc/guides/sample_app_ug/index.rst |   2 +
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 doc/guides/sample_app_ug/ipsec_secgw.rst   |   2 +
 .../sample_app_ug/l2_forward_real_virtual.rst  |   2 +-
 doc/guides/sample_app_ug/l3_forward.rst|   2 +
 doc/guides/sample_app_ug/multi_process.rst |   2 +-
 doc/guides/sample_app_ug/ptpclient.rst |   1 +
 doc/guides/sample_app_ug/qos_scheduler.rst |   2 +
 doc/guides/sample_app_ug/rxtx_callbacks.rst|   1 +
 doc/guides/sample_app_ug/server_node_efd.rst   |   2 +-
 doc/guides/sample_app_ug/skeleton.rst  |   1 +
 15 files changed, 133 insertions(+), 45 deletions(-)

diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index dac8050..da9b484 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -221,7 +221,7 @@ I350 has RSS support and 8 queue pairs can be used in RSS 
mode. It should work w
 How can hugepage-backed memory be shared among multiple processes?
 --
 
-See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
+See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
 
 
 Why can't my application receive packets on my system with UEFI Secure Boot 
enabled?
diff --git a/doc/guides/sample_app_ug/dist_app.rst 
b/doc/guides/sample_app_ug/dist_app.rst
index 466115d..0431b97 100644
--- a/doc/guides/sample_app_ug/dist_app.rst
+++ b/doc/guides/sample_app_ug/dist_app.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_dist_app:
+
 Distributor Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/exception_path.rst 
b/doc/guides/sample_app_ug/exception_path.rst
index 2dee8bf..40e5b5c 100644
--- a/doc/guides/sample_app_ug/exception_path.rst
+++ b/doc/guides/sample_app_ug/exception_path.rst
@@ -115,7 +115,7 @@ The following sections provide some explanation of the code.
 Initialization
 ~~
 
-Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`l2_fwd_app_real_and_virtual`.
+Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`sample_app_l2_fwd`.
 In addition, the TAP interfaces must also be created.
 A TAP interface is created for each lcore that is being used.
 The code for creating the TAP interface is as follows:
diff --git a/doc/guides/sample_app_ug/hello_world.rst 
b/doc/guides/sample_app_ug/hello_world.rst
index 8196702..8cf23a3 100644
--- a/doc/guides/sample_app_ug/hello_world.rst
+++ b/doc/guides/sample_app_ug/hello_world.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_hello_world:
+
 Hello World Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 4f8340a..163b468 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -1,4 +1,5 @@
 ..  BSD LICENSE
+
 Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 All rights reserved.
 
@@ -28,6 +29,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Sample Applications User Guides
 ===
 
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..9498d3d 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructio

[dpdk-dev] [PATCH v6 2/2] doc: add new introduction to sample app guides

2017-10-11 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---
 doc/guides/faq/faq.rst |   2 +-
 doc/guides/sample_app_ug/dist_app.rst  |   2 +
 doc/guides/sample_app_ug/exception_path.rst|   2 +-
 doc/guides/sample_app_ug/hello_world.rst   |   2 +
 doc/guides/sample_app_ug/index.rst |   2 +
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 doc/guides/sample_app_ug/ipsec_secgw.rst   |   2 +
 .../sample_app_ug/l2_forward_real_virtual.rst  |   2 +-
 doc/guides/sample_app_ug/l3_forward.rst|   2 +
 doc/guides/sample_app_ug/multi_process.rst |   2 +-
 doc/guides/sample_app_ug/ptpclient.rst |   1 +
 doc/guides/sample_app_ug/qos_scheduler.rst |   2 +
 doc/guides/sample_app_ug/rxtx_callbacks.rst|   1 +
 doc/guides/sample_app_ug/server_node_efd.rst   |   2 +-
 doc/guides/sample_app_ug/skeleton.rst  |   1 +
 15 files changed, 133 insertions(+), 45 deletions(-)

diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index dac8050..da9b484 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -221,7 +221,7 @@ I350 has RSS support and 8 queue pairs can be used in RSS 
mode. It should work w
 How can hugepage-backed memory be shared among multiple processes?
 --
 
-See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
+See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
 
 
 Why can't my application receive packets on my system with UEFI Secure Boot 
enabled?
diff --git a/doc/guides/sample_app_ug/dist_app.rst 
b/doc/guides/sample_app_ug/dist_app.rst
index 466115d..0431b97 100644
--- a/doc/guides/sample_app_ug/dist_app.rst
+++ b/doc/guides/sample_app_ug/dist_app.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_dist_app:
+
 Distributor Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/exception_path.rst 
b/doc/guides/sample_app_ug/exception_path.rst
index 2dee8bf..40e5b5c 100644
--- a/doc/guides/sample_app_ug/exception_path.rst
+++ b/doc/guides/sample_app_ug/exception_path.rst
@@ -115,7 +115,7 @@ The following sections provide some explanation of the code.
 Initialization
 ~~
 
-Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`l2_fwd_app_real_and_virtual`.
+Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`sample_app_l2_fwd`.
 In addition, the TAP interfaces must also be created.
 A TAP interface is created for each lcore that is being used.
 The code for creating the TAP interface is as follows:
diff --git a/doc/guides/sample_app_ug/hello_world.rst 
b/doc/guides/sample_app_ug/hello_world.rst
index 8196702..8cf23a3 100644
--- a/doc/guides/sample_app_ug/hello_world.rst
+++ b/doc/guides/sample_app_ug/hello_world.rst
@@ -28,6 +28,8 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+.. _sample_app_hello_world:
+
 Hello World Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 4f8340a..163b468 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -1,4 +1,5 @@
 ..  BSD LICENSE
+
 Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 All rights reserved.
 
@@ -28,6 +29,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Sample Applications User Guides
 ===
 
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..9498d3d 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Document

[dpdk-dev] [PATCH v6 1/2] doc: add generic compilation doc for all sample apps

2017-10-11 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---

v6:
   All revelant files updated, changed and fixed (John)


 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 124 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 .../sample_app_ug/eventdev_pipeline_sw_pmd.rst |  21 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/tep_termination.rst   |  31 +-
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vhost_scsi.rst|  19 +---
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 42 files changed, 241 insertions(+), 801 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..882432f
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,124 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or

[dpdk-dev] [PATCH v7 1/2] doc: add generic compilation doc for all sample apps

2017-10-16 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---
 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 124 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 .../sample_app_ug/eventdev_pipeline_sw_pmd.rst |  21 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/tep_termination.rst   |  31 +-
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vhost_scsi.rst|  19 +---
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 42 files changed, 241 insertions(+), 801 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..882432f
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,124 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution

[dpdk-dev] [PATCH v7 2/2] doc: add new introduction to sample app guides

2017-10-16 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 

---

V7:
removed :ref: targets. (Thomas)

 doc/guides/faq/faq.rst |   2 +-
 doc/guides/sample_app_ug/dist_app.rst  |   1 +
 doc/guides/sample_app_ug/exception_path.rst|   2 +-
 doc/guides/sample_app_ug/hello_world.rst   |   1 +
 doc/guides/sample_app_ug/index.rst |   2 +
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 doc/guides/sample_app_ug/ipsec_secgw.rst   |   1 +
 .../sample_app_ug/l2_forward_real_virtual.rst  |   1 -
 doc/guides/sample_app_ug/l3_forward.rst|   1 +
 doc/guides/sample_app_ug/multi_process.rst |   1 -
 doc/guides/sample_app_ug/qos_scheduler.rst |   1 +
 doc/guides/sample_app_ug/server_node_efd.rst   |   2 +-
 12 files changed, 123 insertions(+), 45 deletions(-)

diff --git a/doc/guides/faq/faq.rst b/doc/guides/faq/faq.rst
index dac8050..da9b484 100644
--- a/doc/guides/faq/faq.rst
+++ b/doc/guides/faq/faq.rst
@@ -221,7 +221,7 @@ I350 has RSS support and 8 queue pairs can be used in RSS 
mode. It should work w
 How can hugepage-backed memory be shared among multiple processes?
 --
 
-See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
+See the Primary and Secondary examples in the :ref:`multi-process sample 
application `.
 
 
 Why can't my application receive packets on my system with UEFI Secure Boot 
enabled?
diff --git a/doc/guides/sample_app_ug/dist_app.rst 
b/doc/guides/sample_app_ug/dist_app.rst
index 466115d..f705d9e 100644
--- a/doc/guides/sample_app_ug/dist_app.rst
+++ b/doc/guides/sample_app_ug/dist_app.rst
@@ -28,6 +28,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Distributor Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/exception_path.rst 
b/doc/guides/sample_app_ug/exception_path.rst
index 2dee8bf..40e5b5c 100644
--- a/doc/guides/sample_app_ug/exception_path.rst
+++ b/doc/guides/sample_app_ug/exception_path.rst
@@ -115,7 +115,7 @@ The following sections provide some explanation of the code.
 Initialization
 ~~
 
-Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`l2_fwd_app_real_and_virtual`.
+Setup of the mbuf pool, driver and queues is similar to the setup done in the 
:ref:`sample_app_l2_fwd`.
 In addition, the TAP interfaces must also be created.
 A TAP interface is created for each lcore that is being used.
 The code for creating the TAP interface is as follows:
diff --git a/doc/guides/sample_app_ug/hello_world.rst 
b/doc/guides/sample_app_ug/hello_world.rst
index 8196702..9ef7e25 100644
--- a/doc/guides/sample_app_ug/hello_world.rst
+++ b/doc/guides/sample_app_ug/hello_world.rst
@@ -28,6 +28,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Hello World Sample Application
 ==
 
diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 4f8340a..163b468 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -1,4 +1,5 @@
 ..  BSD LICENSE
+
 Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 All rights reserved.
 
@@ -28,6 +29,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Sample Applications User Guides
 ===
 
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..ae12503 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Documentation Roadmap
--
-
-The following is a list of DPDK documents in suggested reading order:
-
-*   **Release Notes** : Provides release-specific information, including 
supported features,
-limita

[dpdk-dev] [PATCH v8 1/2] doc: add generic compilation doc for all sample apps

2017-10-18 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---
 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 124 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 .../sample_app_ug/eventdev_pipeline_sw_pmd.rst |  21 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/tep_termination.rst   |  31 +-
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vhost_scsi.rst|  19 +---
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 42 files changed, 241 insertions(+), 801 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..882432f
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,124 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution

[dpdk-dev] [PATCH v8 2/2] doc: add new introduction to sample app guides

2017-10-18 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
---

V8:
   Fixed Build issue (John)


 doc/guides/sample_app_ug/index.rst |   2 +
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 2 files changed, 115 insertions(+), 40 deletions(-)

diff --git a/doc/guides/sample_app_ug/index.rst 
b/doc/guides/sample_app_ug/index.rst
index 4f8340a..163b468 100644
--- a/doc/guides/sample_app_ug/index.rst
+++ b/doc/guides/sample_app_ug/index.rst
@@ -1,4 +1,5 @@
 ..  BSD LICENSE
+
 Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
 All rights reserved.
 
@@ -28,6 +29,7 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+
 Sample Applications User Guides
 ===
 
diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..ae12503 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Documentation Roadmap
--
-
-The following is a list of DPDK documents in suggested reading order:
-
-*   **Release Notes** : Provides release-specific information, including 
supported features,
-limitations, fixed issues, known issues and so on.
-Also, provides the answers to frequently asked questions in FAQ format.
-
-*   **Getting Started Guides** : Describes how to install and
-configure the DPDK software for your operating system;
-designed to get users up and running quickly with the software.
-
-*   **Programmer's Guide:**  Describes:
-
-*   The software architecture and how to use it (through examples),
-specifically in a Linux* application (linuxapp) environment.
-
-*   The content of the DPDK, the build system
-(including the commands that can be used in the root DPDK Makefile to 
build the development kit and an application)
-   and guidelines for porting an application.
-
-*   Optimizations used in the software and those that should be considered 
for new development
-
-A glossary of terms is also provided.
-
-*   **API Reference**  : Provides detailed information about DPDK functions,
-data structures and other programming constructs.
-
-*   **Sample Applications User Guide**  : Describes a set of sample 
applications.
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample 
application.
+Introduction to the DPDK Sample Applications
+
+
+The DPDK Sample Applications are small standalone applications which
+demonstrate various features of DPDK. They can be considered as a cookbook of
+DPDK features.  Users interested in getting started with DPDK can take the
+applications, try out the features, and then extend them to fit their needs.
+
+
+The DPDK Sample Applications
+
+
+Table :numref:`table_sample_apps` shows a list of some of the main sample
+applications that are available in the examples directory of DPDK:
+
+ .. _table_sample_apps:
+
+ .. table:: **Some of the DPDK Sample applications**
+
+
+---+--+
+| Bonding   | Netmap Compatibility 
|
+
+---+--+
+| Command Line  | Packet Ordering  
|
+
+---+--+
+| Distributor   | Performance Thread   
|
+
+---+--+
+| Ethtool   | Precision Time Protocol (PTP) 
Client |
+
+---+--+
+| Exception Path| Quality of Service (QoS) 
Metering|
+
+---+--+
+| Hello 

[dpdk-dev] [PATCH] examples/power: add turbo commands to help text

2017-10-19 Thread Marko Kovacevic
From: David Hunt 

Fixes: d191f0853378 ("examples/vm_power_manager: add per-core turbo CLI")

Signed-off-by: Marko Kovacevic 
---
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c 
b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index dc9efc2..63f711e 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -131,8 +131,9 @@ cmdline_parse_token_string_t cmd_set_cpu_freq_cmd_cmd =
 cmdline_parse_inst_t cmd_set_cpu_freq_set = {
.f = cmd_set_cpu_freq_parsed,
.data = NULL,
-   .help_str = "set_cpu_freq  , Set the current 
"
-   "frequency for the specified core by scaling 
up/down/min/max",
+   .help_str = "set_cpu_freq  "
+   ", "
+   "adjust the frequency for the specified core.",
.tokens = {
(void *)&cmd_set_cpu_freq,
(void *)&cmd_set_cpu_freq_core_num,
-- 
2.5.5



[dpdk-dev] [PATCH v9 1/2] doc: add generic compilation doc for all sample apps

2017-10-19 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
Reviewed-by: John McNamara 
---
 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 124 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 .../sample_app_ug/eventdev_pipeline_sw_pmd.rst |  21 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/tep_termination.rst   |  31 +-
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vhost_scsi.rst|  19 +---
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 42 files changed, 241 insertions(+), 801 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..7ea0dea 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :ref:`sample_app_compilation`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..882432f
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,124 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution

[dpdk-dev] [PATCH v9 2/2] doc: add new introduction to sample app guides

2017-10-19 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
---
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 1 file changed, 113 insertions(+), 40 deletions(-)

diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..ae12503 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Documentation Roadmap
--
-
-The following is a list of DPDK documents in suggested reading order:
-
-*   **Release Notes** : Provides release-specific information, including 
supported features,
-limitations, fixed issues, known issues and so on.
-Also, provides the answers to frequently asked questions in FAQ format.
-
-*   **Getting Started Guides** : Describes how to install and
-configure the DPDK software for your operating system;
-designed to get users up and running quickly with the software.
-
-*   **Programmer's Guide:**  Describes:
-
-*   The software architecture and how to use it (through examples),
-specifically in a Linux* application (linuxapp) environment.
-
-*   The content of the DPDK, the build system
-(including the commands that can be used in the root DPDK Makefile to 
build the development kit and an application)
-   and guidelines for porting an application.
-
-*   Optimizations used in the software and those that should be considered 
for new development
-
-A glossary of terms is also provided.
-
-*   **API Reference**  : Provides detailed information about DPDK functions,
-data structures and other programming constructs.
-
-*   **Sample Applications User Guide**  : Describes a set of sample 
applications.
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample 
application.
+Introduction to the DPDK Sample Applications
+
+
+The DPDK Sample Applications are small standalone applications which
+demonstrate various features of DPDK. They can be considered as a cookbook of
+DPDK features.  Users interested in getting started with DPDK can take the
+applications, try out the features, and then extend them to fit their needs.
+
+
+The DPDK Sample Applications
+
+
+Table :numref:`table_sample_apps` shows a list of some of the main sample
+applications that are available in the examples directory of DPDK:
+
+ .. _table_sample_apps:
+
+ .. table:: **Some of the DPDK Sample applications**
+
+
+---+--+
+| Bonding   | Netmap Compatibility 
|
+
+---+--+
+| Command Line  | Packet Ordering  
|
+
+---+--+
+| Distributor   | Performance Thread   
|
+
+---+--+
+| Ethtool   | Precision Time Protocol (PTP) 
Client |
+
+---+--+
+| Exception Path| Quality of Service (QoS) 
Metering|
+
+---+--+
+| Hello World   | QoS Scheduler
|
+
+---+--+
+| Internet Protocol (IP) Fragmentation  | Quota and Watermark  
|
+
+---+--+
+| IP Pipeline   | RX/TX Callbacks  
|
+
+---+--+
+| IP Reassembly | Server nod

[dpdk-dev] [PATCH v10 2/2] doc: add new introduction to sample app guides

2017-10-25 Thread Marko Kovacevic
Add new Introduction Section into the sample app guides.

Signed-off-by: Marko Kovacevic 
Acked-by: John McNamara 
---
 doc/guides/sample_app_ug/intro.rst | 153 +++--
 1 file changed, 113 insertions(+), 40 deletions(-)

diff --git a/doc/guides/sample_app_ug/intro.rst 
b/doc/guides/sample_app_ug/intro.rst
index d3f261b..ae12503 100644
--- a/doc/guides/sample_app_ug/intro.rst
+++ b/doc/guides/sample_app_ug/intro.rst
@@ -1,5 +1,5 @@
 ..  BSD LICENSE
-Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
 All rights reserved.
 
 Redistribution and use in source and binary forms, with or without
@@ -28,42 +28,115 @@
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-Introduction
-
-
-This document describes the sample applications that are included in the Data 
Plane Development Kit (DPDK).
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample application.
-
-Documentation Roadmap
--
-
-The following is a list of DPDK documents in suggested reading order:
-
-*   **Release Notes** : Provides release-specific information, including 
supported features,
-limitations, fixed issues, known issues and so on.
-Also, provides the answers to frequently asked questions in FAQ format.
-
-*   **Getting Started Guides** : Describes how to install and
-configure the DPDK software for your operating system;
-designed to get users up and running quickly with the software.
-
-*   **Programmer's Guide:**  Describes:
-
-*   The software architecture and how to use it (through examples),
-specifically in a Linux* application (linuxapp) environment.
-
-*   The content of the DPDK, the build system
-(including the commands that can be used in the root DPDK Makefile to 
build the development kit and an application)
-   and guidelines for porting an application.
-
-*   Optimizations used in the software and those that should be considered 
for new development
-
-A glossary of terms is also provided.
-
-*   **API Reference**  : Provides detailed information about DPDK functions,
-data structures and other programming constructs.
-
-*   **Sample Applications User Guide**  : Describes a set of sample 
applications.
-Each chapter describes a sample application that showcases specific 
functionality and
-provides instructions on how to compile, run and use the sample 
application.
+Introduction to the DPDK Sample Applications
+
+
+The DPDK Sample Applications are small standalone applications which
+demonstrate various features of DPDK. They can be considered as a cookbook of
+DPDK features.  Users interested in getting started with DPDK can take the
+applications, try out the features, and then extend them to fit their needs.
+
+
+The DPDK Sample Applications
+
+
+Table :numref:`table_sample_apps` shows a list of some of the main sample
+applications that are available in the examples directory of DPDK:
+
+ .. _table_sample_apps:
+
+ .. table:: **Some of the DPDK Sample applications**
+
+
+---+--+
+| Bonding   | Netmap Compatibility 
|
+
+---+--+
+| Command Line  | Packet Ordering  
|
+
+---+--+
+| Distributor   | Performance Thread   
|
+
+---+--+
+| Ethtool   | Precision Time Protocol (PTP) 
Client |
+
+---+--+
+| Exception Path| Quality of Service (QoS) 
Metering|
+
+---+--+
+| Hello World   | QoS Scheduler
|
+
+---+--+
+| Internet Protocol (IP) Fragmentation  | Quota and Watermark  
|
+
+---+--+
+| IP Pipeline   | RX/TX Callbacks  
|
+
+---+--+
+| IP Reassembly | Server nod

[dpdk-dev] [PATCH v10 1/2] doc: add generic compilation doc for all sample apps

2017-10-25 Thread Marko Kovacevic
From: Herakliusz Lipiec 

Moved duplicated, and occasionally outdated, doc sections from each
of the sample app guides chapters to a common chapter at the start.

This reduces the duplication in the docs and provides a single
point of reference for compiling the sample apps.

Signed-off-by: Herakliusz Lipiec 
Signed-off-by: Marko Kovacevic 
---
 doc/guides/sample_app_ug/cmd_line.rst  |  21 +---
 doc/guides/sample_app_ug/compiling.rst | 122 +
 doc/guides/sample_app_ug/dist_app.rst  |  22 +---
 doc/guides/sample_app_ug/ethtool.rst   |  23 +---
 .../sample_app_ug/eventdev_pipeline_sw_pmd.rst |  21 +---
 doc/guides/sample_app_ug/exception_path.rst|  23 +---
 doc/guides/sample_app_ug/hello_world.rst   |  21 +---
 doc/guides/sample_app_ug/index.rst |   1 +
 doc/guides/sample_app_ug/ip_frag.rst   |  27 +
 doc/guides/sample_app_ug/ip_reassembly.rst |  22 +---
 doc/guides/sample_app_ug/ipsec_secgw.rst   |  19 +---
 doc/guides/sample_app_ug/ipv4_multicast.rst|  33 +-
 doc/guides/sample_app_ug/keep_alive.rst|  22 +---
 doc/guides/sample_app_ug/kernel_nic_interface.rst  |  24 +---
 doc/guides/sample_app_ug/l2_forward_cat.rst|  34 ++
 doc/guides/sample_app_ug/l2_forward_crypto.rst |  21 +---
 doc/guides/sample_app_ug/l2_forward_job_stats.rst  |  21 +---
 .../sample_app_ug/l2_forward_real_virtual.rst  |  21 +---
 doc/guides/sample_app_ug/l3_forward.rst|  23 +---
 .../sample_app_ug/l3_forward_access_ctrl.rst   |  23 +---
 doc/guides/sample_app_ug/l3_forward_power_man.rst  |  23 +---
 doc/guides/sample_app_ug/l3_forward_virtual.rst|  29 +
 doc/guides/sample_app_ug/link_status_intr.rst  |  27 +
 doc/guides/sample_app_ug/load_balancer.rst |  19 +---
 doc/guides/sample_app_ug/multi_process.rst |  22 +---
 doc/guides/sample_app_ug/netmap_compatibility.rst  |  25 +
 doc/guides/sample_app_ug/packet_ordering.rst   |  23 +---
 doc/guides/sample_app_ug/performance_thread.rst|  22 +---
 doc/guides/sample_app_ug/ptpclient.rst |  33 ++
 doc/guides/sample_app_ug/qos_metering.rst  |  24 +---
 doc/guides/sample_app_ug/qos_scheduler.rst |  21 +---
 doc/guides/sample_app_ug/quota_watermark.rst   |  22 +---
 doc/guides/sample_app_ug/rxtx_callbacks.rst|  25 +
 doc/guides/sample_app_ug/server_node_efd.rst   |  21 +---
 doc/guides/sample_app_ug/skeleton.rst  |  25 +
 doc/guides/sample_app_ug/tep_termination.rst   |  31 +-
 doc/guides/sample_app_ug/test_pipeline.rst |  20 +---
 doc/guides/sample_app_ug/timer.rst |  21 +---
 doc/guides/sample_app_ug/vhost.rst |  16 +--
 doc/guides/sample_app_ug/vhost_scsi.rst|  19 +---
 doc/guides/sample_app_ug/vm_power_management.rst   |   9 +-
 doc/guides/sample_app_ug/vmdq_dcb_forwarding.rst   |  19 +---
 42 files changed, 239 insertions(+), 801 deletions(-)
 create mode 100644 doc/guides/sample_app_ug/compiling.rst

diff --git a/doc/guides/sample_app_ug/cmd_line.rst 
b/doc/guides/sample_app_ug/cmd_line.rst
index 36c7971..eabbac1 100644
--- a/doc/guides/sample_app_ug/cmd_line.rst
+++ b/doc/guides/sample_app_ug/cmd_line.rst
@@ -68,26 +68,9 @@ There are three simple commands:
 Compiling the Application
 -
 
-#.  Go to example directory:
+To compile the sample application see :doc:`compiling`
 
-.. code-block:: console
-
-export RTE_SDK=/path/to/rte_sdk
-cd ${RTE_SDK}/examples/cmdline
-
-#.  Set the target (a default target is used if not specified). For example:
-
-.. code-block:: console
-
-export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-Refer to the *DPDK Getting Started Guide* for possible RTE_TARGET values.
-
-#.  Build the application:
-
-.. code-block:: console
-
-make
+The application is located in the ``cmd_line`` sub-directory.
 
 Running the Application
 ---
diff --git a/doc/guides/sample_app_ug/compiling.rst 
b/doc/guides/sample_app_ug/compiling.rst
new file mode 100644
index 000..8bedaa7
--- /dev/null
+++ b/doc/guides/sample_app_ug/compiling.rst
@@ -0,0 +1,122 @@
+ ..  BSD LICENSE
+ Copyright(c) 2015 Intel Corporation. All rights reserved.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Intel Corporation nor

[dpdk-dev] [PATCH v1 1/4] power: changed unsigned to unsigned int

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 

---
  V1: Changed unsigned to unsigned int
---
 lib/librte_power/guest_channel.c  |  6 +++---
 lib/librte_power/guest_channel.h  |  6 +++---
 lib/librte_power/rte_power.c  |  4 ++--
 lib/librte_power/rte_power.h  | 12 ++--
 lib/librte_power/rte_power_acpi_cpufreq.c | 16 
 lib/librte_power/rte_power_kvm_vm.c   | 20 ++--
 lib/librte_power/rte_power_kvm_vm.h   | 18 +-
 7 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index fa5de0f..e7ffc80 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -51,7 +51,7 @@
 static int global_fds[RTE_MAX_LCORE];
 
 int
-guest_channel_host_connect(const char *path, unsigned lcore_id)
+guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
int flags, ret;
struct channel_packet pkt;
@@ -118,7 +118,7 @@ guest_channel_host_connect(const char *path, unsigned 
lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id)
+guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 {
int ret, buffer_len = sizeof(*pkt);
void *buffer = pkt;
@@ -156,7 +156,7 @@ int rte_power_guest_channel_send_msg(struct channel_packet 
*pkt,
 
 
 void
-guest_channel_host_disconnect(unsigned lcore_id)
+guest_channel_host_disconnect(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 
0...%d\n",
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 741339c..12c2587 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -53,7 +53,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int guest_channel_host_connect(const char *path, unsigned lcore_id);
+int guest_channel_host_connect(const char *path, unsigned int lcore_id);
 
 /**
  * Disconnect from an already connected Virtio-Serial Endpoint.
@@ -63,7 +63,7 @@ int guest_channel_host_connect(const char *path, unsigned 
lcore_id);
  *  lcore_id.
  *
  */
-void guest_channel_host_disconnect(unsigned lcore_id);
+void guest_channel_host_disconnect(unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
@@ -79,7 +79,7 @@ void guest_channel_host_disconnect(unsigned lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id);
+int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index b327a86..e7f35cf 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -106,7 +106,7 @@ rte_power_get_env(void) {
 }
 
 int
-rte_power_init(unsigned lcore_id)
+rte_power_init(unsigned int lcore_id)
 {
int ret = -1;
 
@@ -138,7 +138,7 @@ rte_power_init(unsigned lcore_id)
 }
 
 int
-rte_power_exit(unsigned lcore_id)
+rte_power_exit(unsigned int lcore_id)
 {
if (global_default_env == PM_ENV_ACPI_CPUFREQ)
return rte_power_acpi_cpufreq_exit(lcore_id);
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index b17b7a5..9b54039 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -91,7 +91,7 @@ enum power_management_env rte_power_get_env(void);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_init(unsigned lcore_id);
+int rte_power_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. This will call the environment
@@ -104,7 +104,7 @@ int rte_power_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_exit(unsigned lcore_id);
+int rte_power_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore.
@@ -121,7 +121,7 @@ int rte_power_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-typedef uint32_t (*rte_power_freqs_t)(unsigned lcore_id, uint32_t *freqs,
+typedef uint32_t (*rte_power_freqs_t)(unsigned int lcore_id, uint32_t *freqs,
uint32_t num);
 
 extern rte_power_freqs_t rte_power_freqs;
@@ -137,7 +137,7 @@ extern rte_power_freqs_t rte_power_freqs;
  * @return
  *  The current index of available frequencies.
  */
-typedef uint32_t (*rte_power_get_freq_t)(unsigned lcore_id);
+typedef uint32_t (*rte_power_get_freq_t)(unsigned int lcore_id);
 
 extern rte_power_get_freq_t rte_power_get_freq;
 
@@ -157,7 +157,7 @@ extern rte_power_get_freq_t rte_power_get_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on e

[dpdk-dev] [PATCH v1 2/4] power: clean up of acpi files

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 

---
   V1: Clean up of acpi files
---
 lib/librte_power/Makefile  |  2 +-
 ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++---
 ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +--
 lib/librte_power/rte_power.c   | 28 +--
 4 files changed, 45 insertions(+), 45 deletions(-)
 rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} 
(94%)
 rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} 
(88%)

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 1b1491d..bf5a55e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -42,7 +42,7 @@ EXPORT_MAP := rte_power_version.map
 LIBABIVER := 1
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 
 # install this header file
diff --git a/lib/librte_power/rte_power_acpi_cpufreq.c 
b/lib/librte_power/power_acpi_cpufreq.c
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c
index 618bf45..165ec97 100644
--- a/lib/librte_power/rte_power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -44,7 +44,7 @@
 #include 
 #include 
 
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned int lcore_id)
+power_acpi_cpufreq_init(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -352,7 +352,7 @@ rte_power_acpi_cpufreq_init(unsigned int lcore_id)
}
 
/* Set freq to max by default */
-   if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+   if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
"to max\n", lcore_id);
goto fail;
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
+power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -461,7 +461,7 @@ rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
+power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t 
*freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
+power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -492,7 +492,7 @@ rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
+power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t 
index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
+power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
+power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
+power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
+power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -578,7 +578,7 @@ rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_turbo_status(unsigned int lcore_id)
+power_acpi_turbo_status(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -594,7 +594,7 @@ rte_power_acpi_turbo_status(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_enable_turbo(unsigned int lcore_id)
+power_acpi_enable_turbo(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -616,7 +616,7 @@ rte_power_ac

[dpdk-dev] [PATCH v1 3/4] power: clean up of kvm files

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
   V1: Clean of of kvm power files
---
 lib/librte_power/Makefile  |  2 +-
 .../{rte_power_kvm_vm.c => power_kvm_vm.c} | 28 +++---
 .../{rte_power_kvm_vm.h => power_kvm_vm.h} | 28 +++---
 lib/librte_power/rte_power.c   | 28 +++---
 4 files changed, 43 insertions(+), 43 deletions(-)
 rename lib/librte_power/{rte_power_kvm_vm.c => power_kvm_vm.c} (83%)
 rename lib/librte_power/{rte_power_kvm_vm.h => power_kvm_vm.h} (85%)

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index bf5a55e..a35c50a 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -43,7 +43,7 @@ LIBABIVER := 1
 
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += power_kvm_vm.c guest_channel.c
 
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
diff --git a/lib/librte_power/rte_power_kvm_vm.c 
b/lib/librte_power/power_kvm_vm.c
similarity index 83%
rename from lib/librte_power/rte_power_kvm_vm.c
rename to lib/librte_power/power_kvm_vm.c
index 52cac0c..4b796f9 100644
--- a/lib/librte_power/rte_power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -37,8 +37,8 @@
 
 #include "guest_channel.h"
 #include "channel_commands.h"
-#include "rte_power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_kvm_vm.h"
+#include "power_common.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
@@ -46,7 +46,7 @@ static struct channel_packet 
pkt[CHANNEL_CMDS_MAX_VM_CHANNELS];
 
 
 int
-rte_power_kvm_vm_init(unsigned int lcore_id)
+power_kvm_vm_init(unsigned int lcore_id)
 {
if (lcore_id >= CHANNEL_CMDS_MAX_VM_CHANNELS) {
RTE_LOG(ERR, POWER, "Core(%u) is out of range 0...%d\n",
@@ -59,14 +59,14 @@ rte_power_kvm_vm_init(unsigned int lcore_id)
 }
 
 int
-rte_power_kvm_vm_exit(unsigned int lcore_id)
+power_kvm_vm_exit(unsigned int lcore_id)
 {
guest_channel_host_disconnect(lcore_id);
return 0;
 }
 
 uint32_t
-rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id,
+power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id,
__attribute__((unused)) uint32_t *freqs,
__attribute__((unused)) uint32_t num)
 {
@@ -76,7 +76,7 @@ rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int 
lcore_id,
 }
 
 uint32_t
-rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id)
+power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id)
 {
RTE_LOG(ERR, POWER, "rte_power_get_freq is not implemented "
"for Virtual Machine Power Management\n");
@@ -84,7 +84,7 @@ rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned 
int lcore_id)
 }
 
 int
-rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id,
+power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id,
__attribute__((unused)) uint32_t index)
 {
RTE_LOG(ERR, POWER, "rte_power_set_freq is not implemented "
@@ -112,44 +112,44 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 }
 
 int
-rte_power_kvm_vm_freq_up(unsigned int lcore_id)
+power_kvm_vm_freq_up(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_UP);
 }
 
 int
-rte_power_kvm_vm_freq_down(unsigned int lcore_id)
+power_kvm_vm_freq_down(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
 }
 
 int
-rte_power_kvm_vm_freq_max(unsigned int lcore_id)
+power_kvm_vm_freq_max(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
 }
 
 int
-rte_power_kvm_vm_freq_min(unsigned int lcore_id)
+power_kvm_vm_freq_min(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
 }
 
 int
-rte_power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id)
+power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id)
 {
RTE_LOG(ERR, POWER, "rte_power_turbo_status is not implemented for 
Virtual Machine Power Management\n");
return -ENOTSUP;
 }
 
 int
-rte_power_kvm_vm_enable_turbo(unsigned int lcore_id)
+power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
 }
 
 int
-rte_power_kvm_vm_disable_turbo(unsigned int lcore_id)
+power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
 }
diff --git a/lib/librte_power/rte_power_kvm_vm.h 
b/lib/librte_power/power_kvm_vm.h
similarity index 85%
rename from lib/librte_power/rte_power_kvm_vm.h
rename to lib/librte_power/power_kvm_vm.h
index 96349c5..8cd5e09 1

[dpdk-dev] [PATCH v1 4/4] power: clean up of power common header

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
   V1: Clean up of power common header
---
 lib/librte_power/power_acpi_cpufreq.c   | 2 +-
 lib/librte_power/{rte_power_common.h => power_common.h} | 6 +++---
 lib/librte_power/rte_power.c| 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename lib/librte_power/{rte_power_common.h => power_common.h} (95%)

diff --git a/lib/librte_power/power_acpi_cpufreq.c 
b/lib/librte_power/power_acpi_cpufreq.c
index 165ec97..fd1931f 100644
--- a/lib/librte_power/power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -45,7 +45,7 @@
 #include 
 
 #include "power_acpi_cpufreq.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) do { \
diff --git a/lib/librte_power/rte_power_common.h 
b/lib/librte_power/power_common.h
similarity index 95%
rename from lib/librte_power/rte_power_common.h
rename to lib/librte_power/power_common.h
index 64bd168..29daed3 100644
--- a/lib/librte_power/rte_power_common.h
+++ b/lib/librte_power/power_common.h
@@ -31,9 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_POWER_COMMON_H_
-#define RTE_POWER_COMMON_H_
+#ifndef POWER_COMMON_H_
+#define POWER_COMMON_H_
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
-#endif /* RTE_POWER_COMMON_H_ */
+#endif /* POWER_COMMON_H_ */
diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index af9b504..e76f3fd 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -36,7 +36,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 enum power_management_env global_default_env = PM_ENV_NOT_SET;
 
-- 
2.9.5



[dpdk-dev] [PATCH v2 1/4] power: changed unsigned to unsigned int

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
 lib/librte_power/guest_channel.c  |  6 +++---
 lib/librte_power/guest_channel.h  |  6 +++---
 lib/librte_power/rte_power.c  |  4 ++--
 lib/librte_power/rte_power.h  | 12 ++--
 lib/librte_power/rte_power_acpi_cpufreq.c | 16 
 lib/librte_power/rte_power_kvm_vm.c   | 20 ++--
 lib/librte_power/rte_power_kvm_vm.h   | 18 +-
 7 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index fa5de0f..e7ffc80 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -51,7 +51,7 @@
 static int global_fds[RTE_MAX_LCORE];
 
 int
-guest_channel_host_connect(const char *path, unsigned lcore_id)
+guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
int flags, ret;
struct channel_packet pkt;
@@ -118,7 +118,7 @@ guest_channel_host_connect(const char *path, unsigned 
lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id)
+guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 {
int ret, buffer_len = sizeof(*pkt);
void *buffer = pkt;
@@ -156,7 +156,7 @@ int rte_power_guest_channel_send_msg(struct channel_packet 
*pkt,
 
 
 void
-guest_channel_host_disconnect(unsigned lcore_id)
+guest_channel_host_disconnect(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 
0...%d\n",
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 741339c..12c2587 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -53,7 +53,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int guest_channel_host_connect(const char *path, unsigned lcore_id);
+int guest_channel_host_connect(const char *path, unsigned int lcore_id);
 
 /**
  * Disconnect from an already connected Virtio-Serial Endpoint.
@@ -63,7 +63,7 @@ int guest_channel_host_connect(const char *path, unsigned 
lcore_id);
  *  lcore_id.
  *
  */
-void guest_channel_host_disconnect(unsigned lcore_id);
+void guest_channel_host_disconnect(unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
@@ -79,7 +79,7 @@ void guest_channel_host_disconnect(unsigned lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id);
+int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index b327a86..e7f35cf 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -106,7 +106,7 @@ rte_power_get_env(void) {
 }
 
 int
-rte_power_init(unsigned lcore_id)
+rte_power_init(unsigned int lcore_id)
 {
int ret = -1;
 
@@ -138,7 +138,7 @@ rte_power_init(unsigned lcore_id)
 }
 
 int
-rte_power_exit(unsigned lcore_id)
+rte_power_exit(unsigned int lcore_id)
 {
if (global_default_env == PM_ENV_ACPI_CPUFREQ)
return rte_power_acpi_cpufreq_exit(lcore_id);
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index b17b7a5..9b54039 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -91,7 +91,7 @@ enum power_management_env rte_power_get_env(void);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_init(unsigned lcore_id);
+int rte_power_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. This will call the environment
@@ -104,7 +104,7 @@ int rte_power_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_exit(unsigned lcore_id);
+int rte_power_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore.
@@ -121,7 +121,7 @@ int rte_power_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-typedef uint32_t (*rte_power_freqs_t)(unsigned lcore_id, uint32_t *freqs,
+typedef uint32_t (*rte_power_freqs_t)(unsigned int lcore_id, uint32_t *freqs,
uint32_t num);
 
 extern rte_power_freqs_t rte_power_freqs;
@@ -137,7 +137,7 @@ extern rte_power_freqs_t rte_power_freqs;
  * @return
  *  The current index of available frequencies.
  */
-typedef uint32_t (*rte_power_get_freq_t)(unsigned lcore_id);
+typedef uint32_t (*rte_power_get_freq_t)(unsigned int lcore_id);
 
 extern rte_power_get_freq_t rte_power_get_freq;
 
@@ -157,7 +157,7 @@ extern rte_power_get_freq_t rte_power_get_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-typedef int (*rte_power_set_freq_t)(unsigned l

[dpdk-dev] [PATCH v2 3/4] power: clean up of kvm files

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
 lib/librte_power/Makefile  |  2 +-
 .../{rte_power_kvm_vm.c => power_kvm_vm.c} | 28 +++---
 .../{rte_power_kvm_vm.h => power_kvm_vm.h} | 28 +++---
 lib/librte_power/rte_power.c   | 28 +++---
 4 files changed, 43 insertions(+), 43 deletions(-)
 rename lib/librte_power/{rte_power_kvm_vm.c => power_kvm_vm.c} (83%)
 rename lib/librte_power/{rte_power_kvm_vm.h => power_kvm_vm.h} (85%)

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index bf5a55e..a35c50a 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -43,7 +43,7 @@ LIBABIVER := 1
 
 # all source are stored in SRCS-y
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) += power_kvm_vm.c guest_channel.c
 
 # install this header file
 SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h
diff --git a/lib/librte_power/rte_power_kvm_vm.c 
b/lib/librte_power/power_kvm_vm.c
similarity index 83%
rename from lib/librte_power/rte_power_kvm_vm.c
rename to lib/librte_power/power_kvm_vm.c
index 52cac0c..4b796f9 100644
--- a/lib/librte_power/rte_power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -37,8 +37,8 @@
 
 #include "guest_channel.h"
 #include "channel_commands.h"
-#include "rte_power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_kvm_vm.h"
+#include "power_common.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
@@ -46,7 +46,7 @@ static struct channel_packet 
pkt[CHANNEL_CMDS_MAX_VM_CHANNELS];
 
 
 int
-rte_power_kvm_vm_init(unsigned int lcore_id)
+power_kvm_vm_init(unsigned int lcore_id)
 {
if (lcore_id >= CHANNEL_CMDS_MAX_VM_CHANNELS) {
RTE_LOG(ERR, POWER, "Core(%u) is out of range 0...%d\n",
@@ -59,14 +59,14 @@ rte_power_kvm_vm_init(unsigned int lcore_id)
 }
 
 int
-rte_power_kvm_vm_exit(unsigned int lcore_id)
+power_kvm_vm_exit(unsigned int lcore_id)
 {
guest_channel_host_disconnect(lcore_id);
return 0;
 }
 
 uint32_t
-rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id,
+power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id,
__attribute__((unused)) uint32_t *freqs,
__attribute__((unused)) uint32_t num)
 {
@@ -76,7 +76,7 @@ rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int 
lcore_id,
 }
 
 uint32_t
-rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id)
+power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id)
 {
RTE_LOG(ERR, POWER, "rte_power_get_freq is not implemented "
"for Virtual Machine Power Management\n");
@@ -84,7 +84,7 @@ rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned 
int lcore_id)
 }
 
 int
-rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id,
+power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id,
__attribute__((unused)) uint32_t index)
 {
RTE_LOG(ERR, POWER, "rte_power_set_freq is not implemented "
@@ -112,44 +112,44 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 }
 
 int
-rte_power_kvm_vm_freq_up(unsigned int lcore_id)
+power_kvm_vm_freq_up(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_UP);
 }
 
 int
-rte_power_kvm_vm_freq_down(unsigned int lcore_id)
+power_kvm_vm_freq_down(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
 }
 
 int
-rte_power_kvm_vm_freq_max(unsigned int lcore_id)
+power_kvm_vm_freq_max(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
 }
 
 int
-rte_power_kvm_vm_freq_min(unsigned int lcore_id)
+power_kvm_vm_freq_min(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
 }
 
 int
-rte_power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id)
+power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id)
 {
RTE_LOG(ERR, POWER, "rte_power_turbo_status is not implemented for 
Virtual Machine Power Management\n");
return -ENOTSUP;
 }
 
 int
-rte_power_kvm_vm_enable_turbo(unsigned int lcore_id)
+power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
 }
 
 int
-rte_power_kvm_vm_disable_turbo(unsigned int lcore_id)
+power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
 }
diff --git a/lib/librte_power/rte_power_kvm_vm.h 
b/lib/librte_power/power_kvm_vm.h
similarity index 85%
rename from lib/librte_power/rte_power_kvm_vm.h
rename to lib/librte_power/power_kvm_vm.h
index 96349c5..8cd5e09 100644
--- a/lib/librte_power/rte_power_kvm

[dpdk-dev] [PATCH v2 2/4] power: clean up of acpi files

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
 lib/librte_power/Makefile  |  2 +-
 ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++---
 ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +--
 lib/librte_power/rte_power.c   | 28 +--
 4 files changed, 45 insertions(+), 45 deletions(-)
 rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} 
(94%)
 rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} 
(88%)

diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 1b1491d..bf5a55e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -42,7 +42,7 @@ EXPORT_MAP := rte_power_version.map
 LIBABIVER := 1
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c
 SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c
 
 # install this header file
diff --git a/lib/librte_power/rte_power_acpi_cpufreq.c 
b/lib/librte_power/power_acpi_cpufreq.c
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c
index 618bf45..165ec97 100644
--- a/lib/librte_power/rte_power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -44,7 +44,7 @@
 #include 
 #include 
 
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned int lcore_id)
+power_acpi_cpufreq_init(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -352,7 +352,7 @@ rte_power_acpi_cpufreq_init(unsigned int lcore_id)
}
 
/* Set freq to max by default */
-   if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+   if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
"to max\n", lcore_id);
goto fail;
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
+power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -461,7 +461,7 @@ rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
+power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t 
*freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
+power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -492,7 +492,7 @@ rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
+power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t 
index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
+power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
+power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
+power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
if (lcore_id >= RTE_MAX_LCORE) {
RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
+power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -578,7 +578,7 @@ rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_turbo_status(unsigned int lcore_id)
+power_acpi_turbo_status(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -594,7 +594,7 @@ rte_power_acpi_turbo_status(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_enable_turbo(unsigned int lcore_id)
+power_acpi_enable_turbo(unsigned int lcore_id)
 {
struct rte_power_info *pi;
 
@@ -616,7 +616,7 @@ rte_power_acpi_enable_turbo(unsigned int lcore_id)

[dpdk-dev] [PATCH v2 4/4] power: clean up of power common header

2017-11-28 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
 lib/librte_power/power_acpi_cpufreq.c   | 2 +-
 lib/librte_power/{rte_power_common.h => power_common.h} | 6 +++---
 lib/librte_power/rte_power.c| 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename lib/librte_power/{rte_power_common.h => power_common.h} (95%)

diff --git a/lib/librte_power/power_acpi_cpufreq.c 
b/lib/librte_power/power_acpi_cpufreq.c
index 165ec97..fd1931f 100644
--- a/lib/librte_power/power_acpi_cpufreq.c
+++ b/lib/librte_power/power_acpi_cpufreq.c
@@ -45,7 +45,7 @@
 #include 
 
 #include "power_acpi_cpufreq.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) do { \
diff --git a/lib/librte_power/rte_power_common.h 
b/lib/librte_power/power_common.h
similarity index 95%
rename from lib/librte_power/rte_power_common.h
rename to lib/librte_power/power_common.h
index 64bd168..cbf3b7f 100644
--- a/lib/librte_power/rte_power_common.h
+++ b/lib/librte_power/power_common.h
@@ -31,9 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_POWER_COMMON_H_
-#define RTE_POWER_COMMON_H_
+#ifndef _POWER_COMMON_H_
+#define _POWER_COMMON_H_
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
-#endif /* RTE_POWER_COMMON_H_ */
+#endif /* POWER_COMMON_H_ */
diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c
index af9b504..e76f3fd 100644
--- a/lib/librte_power/rte_power.c
+++ b/lib/librte_power/rte_power.c
@@ -36,7 +36,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 enum power_management_env global_default_env = PM_ENV_NOT_SET;
 
-- 
2.9.5



Re: [dpdk-dev] [PATCH v2 1/4] power: changed unsigned to unsigned int

2017-11-29 Thread Marko Kovacevic
As i saw that many other variables were changed from unsigned to 
unsigned int

and since i was cleaning up the code i thought it would be beneficial
to change it now not to cause checkpatch problems or other problems down 
the line.


Marko

On 28/11/2017 14:16, Bruce Richardson wrote:
On Tue, Nov 28, 2017 at 01:22:00PM +, Marko Kovacevic wrote:  >> Signed-off-by: Marko Kovacevic  --- > 
While I know that checkpatch complains about unsigned vs unsigned > int, 
is there some other reason for making this change wholesale in > the 
code? > > /Bruce




Re: [dpdk-dev] [PATCH v2 2/4] power: clean up of acpi files

2017-11-29 Thread Marko Kovacevic
Apologies for not clearing up what was in the clean up. In the cleanups 
i have removed "rte_" from the file
names and also variable names as the issue was that many APIs were 
exposed in the documentation.

In doing so it leaves rte_power.h as the only header file that's installed.


On 28/11/2017 14:17, Bruce Richardson wrote:

On Tue, Nov 28, 2017 at 01:22:01PM +, Marko Kovacevic wrote:

Signed-off-by: Marko Kovacevic 
---

Please include a description of the work involved in the "cleanup".
Makes life easier for reviewers to know what to expect and check that
nothing was missed.

Thanks,
/Bruce




[dpdk-dev] [PATCH] maintainers: claim co maintainership of docs

2017-12-05 Thread Marko Kovacevic
Signed-off-by: Marko Kovacevic 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index f0baeb4..3ed7eb8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -36,6 +36,7 @@ M: maintain...@dpdk.org
 
 Documentation (with overlaps)
 M: John McNamara 
+M: Marko Kovacevic 
 F: README
 F: doc/
 
-- 
2.9.5



[dpdk-dev] [PATCH v1] doc: update definition of lcore id and lcore index

2018-01-31 Thread Marko Kovacevic
Added examples in lcore index for better
explanation on various examples,
Sited examples for lcore id.

Signed-off-by: Marko Kovacevic 
---
 lib/librte_eal/common/include/rte_lcore.h | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_lcore.h 
b/lib/librte_eal/common/include/rte_lcore.h
index d84bcff..349ac36 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -57,7 +57,9 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread 
"lcore id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
- * Return the ID of the execution unit we are running on.
+ * Return the Application thread ID of the execution unit.
+ * If option '-l' or '-c' is provided the lcore ID is the actual
+ * CPU ID.
  * @return
  *  Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread)
  */
@@ -94,8 +96,19 @@ rte_lcore_count(void)
 
 /**
  * Return the index of the lcore starting from zero.
- * The order is physical or given by command line (-l option).
  *
+ * For example: 
+ * 1. '-c 0xf0' - CPU core ID 4 is index 0, 5
+ * is 1 and so on.
+ *
+ * 2. '-l 22-25' - CPU core ID 22 is index 0
+ * 23 is 1 and so on.
+ *
+ * 3. '-l 22,18' - CPU core ID 22 is index 0 and
+ * 18 is 1
+ *
+ * 4. '-c 0xcc' - CPU core ID 2 is index 0, 3 is index 1,
+ * 6 is index 2 and 7 is index 3.
  * @param lcore_id
  *   The targeted lcore, or -1 for the current one.
  * @return
-- 
2.9.5



[dpdk-dev] [PATCH v1] eal: add error check for core options

2018-02-01 Thread Marko Kovacevic
Error information on the current core
usage list,mask and map were incomplete.
Added states to differentiate core usage
and to inform user.

Signed-off-by: Marko Kovacevic 
---
 doc/guides/testpmd_app_ug/run_app.rst  |  4 
 lib/librte_eal/common/eal_common_options.c | 33 +++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 46da1df..26500bf 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -62,6 +62,10 @@ See the DPDK Getting Started Guides for more information on 
these options.
 The grouping ``()`` can be omitted for single element group.
 The ``@`` can be omitted if cpus and lcores have the same value.
 
+.. Note::
+   When ``--lcores`` is in use, the options ``-l`` and ``-c`` cannot be used.
+
+
 *   ``--master-lcore ID``
 
 Core ID that is used as master.
diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index b6d2762..6604c64 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -57,6 +57,9 @@
 #include "eal_filesystem.h"
 
 #define BITS_PER_HEX 4
+#define LCORE_OPT_LST 1
+#define LCORE_OPT_MSK 2
+#define LCORE_OPT_MAP 3
 
 const char
 eal_short_options[] =
@@ -1028,7 +1031,15 @@ eal_parse_common_option(int opt, const char *optarg,
RTE_LOG(ERR, EAL, "invalid coremask\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Core Mask Option is ignored, because 
core (%s) is set!\n",
+   (core_parsed == LCORE_OPT_LST)?"LIST" :
+   (core_parsed == LCORE_OPT_MAP)?"MAP" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_MSK;
break;
/* corelist */
case 'l':
@@ -1036,7 +1047,15 @@ eal_parse_common_option(int opt, const char *optarg,
RTE_LOG(ERR, EAL, "invalid core list\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Core List Option is ignored, because 
core (%s) is set!\n",
+   (core_parsed == LCORE_OPT_MSK)?"LIST" :
+   (core_parsed == LCORE_OPT_MAP)?"MAP" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_LST;
break;
/* service coremask */
case 's':
@@ -1156,7 +1175,15 @@ eal_parse_common_option(int opt, const char *optarg,
OPT_LCORES "\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Core Map Option is ignored, because 
core (%s) is set!\n",
+   (core_parsed == LCORE_OPT_LST)?"LIST" :
+   (core_parsed == LCORE_OPT_MSK)?"MASK" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_MAP;
break;
 
/* don't know what to do, leave this to caller */
-- 
2.9.5



[dpdk-dev] [PATCH v2] doc: update definition of lcore id and lcore index

2018-02-01 Thread Marko Kovacevic
Added examples in lcore index for better
explanation on various examples,
Sited examples for lcore id.

Signed-off-by: Marko Kovacevic 

---
V2:
 - Added clearer description to lcore id - Bruce
 - Reframed examples for lcore index - Bruce
---
 lib/librte_eal/common/include/rte_lcore.h | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_lcore.h 
b/lib/librte_eal/common/include/rte_lcore.h
index d84bcff..44c5780 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -57,7 +57,12 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread 
"lcore id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
- * Return the ID of the execution unit we are running on.
+ * Return the Application thread ID of the execution unit.
+ *
+ * If option '-l' or '-c' is provided the lcore ID is the actual
+ * CPU ID. If option '--lcore' is provided the lcore ID is the
+ * index starting from 0.
+ *
  * @return
  *  Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread)
  */
@@ -94,7 +99,12 @@ rte_lcore_count(void)
 
 /**
  * Return the index of the lcore starting from zero.
- * The order is physical or given by command line (-l option).
+ *
+ * When option -c or -l is given, the index corresponds
+ * to the order in the list.
+ * For example:
+ * -c 0x30, lcore 4 has index 0, and 5 has index 1.
+ * -l 22,18 lcore 22 has index 0, and 18 has index 1.
  *
  * @param lcore_id
  *   The targeted lcore, or -1 for the current one.
-- 
2.9.5



[dpdk-dev] [PATCH v2] doc: update definition of lcore id and lcore index

2018-02-01 Thread Marko Kovacevic
Added examples in lcore index for better
explanation on various examples,
Sited examples for lcore id.

Signed-off-by: Marko Kovacevic 

---
V2:
 - Added clearer description to lcore id - Bruce
 - Reframed examples for lcore index - Bruce
---
 lib/librte_eal/common/include/rte_lcore.h | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/rte_lcore.h 
b/lib/librte_eal/common/include/rte_lcore.h
index d84bcff..44c5780 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -57,7 +57,12 @@ RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread 
"lcore id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
- * Return the ID of the execution unit we are running on.
+ * Return the Application thread ID of the execution unit.
+ *
+ * If option '-l' or '-c' is provided the lcore ID is the actual
+ * CPU ID. If option '--lcore' is provided the lcore ID is the
+ * index starting from 0.
+ *
  * @return
  *  Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread)
  */
@@ -94,7 +99,12 @@ rte_lcore_count(void)
 
 /**
  * Return the index of the lcore starting from zero.
- * The order is physical or given by command line (-l option).
+ *
+ * When option -c or -l is given, the index corresponds
+ * to the order in the list.
+ * For example:
+ * -c 0x30, lcore 4 has index 0, and 5 has index 1.
+ * -l 22,18 lcore 22 has index 0, and 18 has index 1.
  *
  * @param lcore_id
  *   The targeted lcore, or -1 for the current one.
-- 
2.9.5



[dpdk-dev] [PATCH v2] eal: add error check for core options

2018-02-01 Thread Marko Kovacevic
Error information on the current core
usage list,mask and map were incomplete.
Added states to differentiate core usage
and to inform user.

Signed-off-by: Marko Kovacevic 

---
V2:
 - Cleaned up the logging for error cases - Anatoly
---
 doc/guides/testpmd_app_ug/run_app.rst  |  4 
 lib/librte_eal/common/eal_common_options.c | 33 +++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/doc/guides/testpmd_app_ug/run_app.rst 
b/doc/guides/testpmd_app_ug/run_app.rst
index 46da1df..26500bf 100644
--- a/doc/guides/testpmd_app_ug/run_app.rst
+++ b/doc/guides/testpmd_app_ug/run_app.rst
@@ -62,6 +62,10 @@ See the DPDK Getting Started Guides for more information on 
these options.
 The grouping ``()`` can be omitted for single element group.
 The ``@`` can be omitted if cpus and lcores have the same value.
 
+.. Note::
+   When ``--lcores`` is in use, the options ``-l`` and ``-c`` cannot be used.
+
+
 *   ``--master-lcore ID``
 
 Core ID that is used as master.
diff --git a/lib/librte_eal/common/eal_common_options.c 
b/lib/librte_eal/common/eal_common_options.c
index b6d2762..459b093 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -57,6 +57,9 @@
 #include "eal_filesystem.h"
 
 #define BITS_PER_HEX 4
+#define LCORE_OPT_LST 1
+#define LCORE_OPT_MSK 2
+#define LCORE_OPT_MAP 3
 
 const char
 eal_short_options[] =
@@ -1028,7 +1031,15 @@ eal_parse_common_option(int opt, const char *optarg,
RTE_LOG(ERR, EAL, "invalid coremask\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Option -c is ignored, because (%s) 
is set!\n",
+   (core_parsed == LCORE_OPT_LST)?"-l" :
+   (core_parsed == LCORE_OPT_MAP)?"--lcore" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_MSK;
break;
/* corelist */
case 'l':
@@ -1036,7 +1047,15 @@ eal_parse_common_option(int opt, const char *optarg,
RTE_LOG(ERR, EAL, "invalid core list\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Option -l is ignored, because (%s) 
is set!\n",
+   (core_parsed == LCORE_OPT_MSK)?"-c" :
+   (core_parsed == LCORE_OPT_MAP)?"--lcore" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_LST;
break;
/* service coremask */
case 's':
@@ -1156,7 +1175,15 @@ eal_parse_common_option(int opt, const char *optarg,
OPT_LCORES "\n");
return -1;
}
-   core_parsed = 1;
+
+   if (core_parsed) {
+   RTE_LOG(ERR, EAL, "Option --lcore is ignored, because 
(%s) is set!\n",
+   (core_parsed == LCORE_OPT_LST)?"-l" :
+   (core_parsed == LCORE_OPT_MSK)?"-c" : 
"Unknown");
+   return -1;
+   }
+
+   core_parsed = LCORE_OPT_MAP;
break;
 
/* don't know what to do, leave this to caller */
-- 
2.9.5



  1   2   >