[lng-odp] [PATCH API-NEXT v3 2/2] api: ipsec: reuse checksum checking flags from packet API

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Reuse odp_packet_parse_chksum_t from packet API to ease passing checksum
flags to packet parsing functions.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 2550976ae1c39e57b39a5e760aebb7f1c8715de8
 **/
 include/odp/api/spec/ipsec.h | 27 +--
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 4a33af8ea..15d7d25ff 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -159,32 +159,7 @@ typedef struct odp_ipsec_inbound_config_t {
 *  level. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Mapping for individual bits */
-   struct {
-   /** Check IPv4 header checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t sctp_chksum   : 1;
-   } check;
-
-   /** All bits of the bit field structure
- *
- * This field can be used to set/clear all flags, or bitwise
- * operations over the entire structure. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_ipsec_inbound_config_t;
 



[lng-odp] [PATCH API-NEXT v3 1/2] api: packet: separate checksum check flags

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Separate union controlling different checksum checks. It will be used by
IPsec API.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 2550976ae1c39e57b39a5e760aebb7f1c8715de8
 **/
 include/odp/api/spec/packet.h   | 46 +
 test/validation/api/packet/packet.c | 10 
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index b897c9d3c..e04f85f7f 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1178,6 +1178,31 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t 
dst_offset,
  *
  */
 
+/**
+ * Flags to control payload checksum checking
+ */
+typedef union odp_packet_parse_chksum_t {
+   /** Individual check bits. */
+   struct {
+   /** Check IPv4 header checksum */
+   uint32_t ipv4_chksum   : 1;
+
+   /** Check UDP checksum */
+   uint32_t udp_chksum: 1;
+
+   /** Check TCP checksum */
+   uint32_t tcp_chksum: 1;
+
+   /** Check SCTP checksum */
+   uint32_t sctp_chksum   : 1;
+
+   } check;
+
+   /** All check bits. This can be used to set/clear all flags. */
+   uint32_t all_check;
+
+} odp_packet_parse_chksum_t;
+
 /**
  * Packet parse parameters
  */
@@ -1194,26 +1219,7 @@ typedef struct odp_packet_parse_param_t {
 *  layer. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Individual check bits. */
-   struct {
-   /** Check IPv4 header checksum */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum */
-   uint32_t sctp_chksum   : 1;
-
-   } check;
-
-   /** All check bits. This can be used to set/clear all flags. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_packet_parse_param_t;
 
diff --git a/test/validation/api/packet/packet.c 
b/test/validation/api/packet/packet.c
index ce4d66c0b..3f0f957f2 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2451,7 +2451,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_ALL;
-   parse.all_check = 0;
+   parse.chksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2482,7 +2482,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_IPV4;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.chksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2512,7 +2512,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.chksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2542,7 +2542,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.chksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2573,7 +2573,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_ALL;
-   parse.all_check = 0;
+   parse.chksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],



[lng-odp] [PATCH API-NEXT v3 0/2] IPsec checksumming API

2017-11-29 Thread Github ODP bot
Separate checksumming flags into separate type to be used by both packet parse 
and IPsec functions.

github
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 2550976ae1c39e57b39a5e760aebb7f1c8715de8
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 98 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 33 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v2 0/2] IPsec checksumming API

2017-11-29 Thread Github ODP bot
Separate checksumming flags into separate type to be used by both packet parse 
and IPsec functions.

github
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5150c0fba177f4e9a7d0b37c7d02639d54be
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 98 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 33 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH API-NEXT v2 1/2] api: packet: separate checksum check flags

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Separate union controlling different checksum checks. It will be used by
IPsec API.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5150c0fba177f4e9a7d0b37c7d02639d54be
 **/
 include/odp/api/spec/packet.h   | 46 +
 test/validation/api/packet/packet.c | 10 
 2 files changed, 31 insertions(+), 25 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index b897c9d3c..e04f85f7f 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1178,6 +1178,31 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t 
dst_offset,
  *
  */
 
+/**
+ * Flags to control payload checksum checking
+ */
+typedef union odp_packet_parse_chksum_t {
+   /** Individual check bits. */
+   struct {
+   /** Check IPv4 header checksum */
+   uint32_t ipv4_chksum   : 1;
+
+   /** Check UDP checksum */
+   uint32_t udp_chksum: 1;
+
+   /** Check TCP checksum */
+   uint32_t tcp_chksum: 1;
+
+   /** Check SCTP checksum */
+   uint32_t sctp_chksum   : 1;
+
+   } check;
+
+   /** All check bits. This can be used to set/clear all flags. */
+   uint32_t all_check;
+
+} odp_packet_parse_chksum_t;
+
 /**
  * Packet parse parameters
  */
@@ -1194,26 +1219,7 @@ typedef struct odp_packet_parse_param_t {
 *  layer. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Individual check bits. */
-   struct {
-   /** Check IPv4 header checksum */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum */
-   uint32_t sctp_chksum   : 1;
-
-   } check;
-
-   /** All check bits. This can be used to set/clear all flags. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_packet_parse_param_t;
 
diff --git a/test/validation/api/packet/packet.c 
b/test/validation/api/packet/packet.c
index ce4d66c0b..acf5ebf3b 100644
--- a/test/validation/api/packet/packet.c
+++ b/test/validation/api/packet/packet.c
@@ -2451,7 +2451,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_ALL;
-   parse.all_check = 0;
+   parse.checksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2482,7 +2482,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_IPV4;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.checksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2512,7 +2512,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.checksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2542,7 +2542,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_L4;
-   parse.all_check = 0;
+   parse.checksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],
@@ -2573,7 +2573,7 @@ void packet_test_parse(void)
 
parse.proto = ODP_PROTO_ETH;
parse.layer = ODP_PROTO_LAYER_ALL;
-   parse.all_check = 0;
+   parse.checksum.all_check = 0;
 
CU_ASSERT(odp_packet_parse(pkt[0], offset[0], ) == 0);
CU_ASSERT(odp_packet_parse_multi([1], [1],



[lng-odp] [PATCH API-NEXT v2 2/2] api: ipsec: reuse checksum checking flags from packet API

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Reuse odp_packet_parse_chksum_t from packet API to ease passing checksum
flags to packet parsing functions.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5150c0fba177f4e9a7d0b37c7d02639d54be
 **/
 include/odp/api/spec/ipsec.h | 27 +--
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 4a33af8ea..15d7d25ff 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -159,32 +159,7 @@ typedef struct odp_ipsec_inbound_config_t {
 *  level. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Mapping for individual bits */
-   struct {
-   /** Check IPv4 header checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t sctp_chksum   : 1;
-   } check;
-
-   /** All bits of the bit field structure
- *
- * This field can be used to set/clear all flags, or bitwise
- * operations over the entire structure. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_ipsec_inbound_config_t;
 



[lng-odp] [PATCH API-NEXT v1 1/2] api: packet: separate checksum check flags

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Separate union controlling different checksum checks. It will be used by
IPsec API.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 9750daf1153b3a13935f26f866bb2a23548e6e16
 **/
 include/odp/api/spec/packet.h | 46 ---
 1 file changed, 26 insertions(+), 20 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index b897c9d3c..e04f85f7f 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1178,6 +1178,31 @@ int odp_packet_move_data(odp_packet_t pkt, uint32_t 
dst_offset,
  *
  */
 
+/**
+ * Flags to control payload checksum checking
+ */
+typedef union odp_packet_parse_chksum_t {
+   /** Individual check bits. */
+   struct {
+   /** Check IPv4 header checksum */
+   uint32_t ipv4_chksum   : 1;
+
+   /** Check UDP checksum */
+   uint32_t udp_chksum: 1;
+
+   /** Check TCP checksum */
+   uint32_t tcp_chksum: 1;
+
+   /** Check SCTP checksum */
+   uint32_t sctp_chksum   : 1;
+
+   } check;
+
+   /** All check bits. This can be used to set/clear all flags. */
+   uint32_t all_check;
+
+} odp_packet_parse_chksum_t;
+
 /**
  * Packet parse parameters
  */
@@ -1194,26 +1219,7 @@ typedef struct odp_packet_parse_param_t {
 *  layer. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Individual check bits. */
-   struct {
-   /** Check IPv4 header checksum */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum */
-   uint32_t sctp_chksum   : 1;
-
-   } check;
-
-   /** All check bits. This can be used to set/clear all flags. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_packet_parse_param_t;
 



[lng-odp] [PATCH API-NEXT v1 2/2] api: ipsec: reuse checksum checking flags from packet API

2017-11-29 Thread Github ODP bot
From: Dmitry Eremin-Solenikov 

Reuse odp_packet_parse_chksum_t from packet API to ease passing checksum
flags to packet parsing functions.

Signed-off-by: Dmitry Eremin-Solenikov 
---
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 9750daf1153b3a13935f26f866bb2a23548e6e16
 **/
 include/odp/api/spec/ipsec.h | 27 +--
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h
index 4a33af8ea..15d7d25ff 100644
--- a/include/odp/api/spec/ipsec.h
+++ b/include/odp/api/spec/ipsec.h
@@ -159,32 +159,7 @@ typedef struct odp_ipsec_inbound_config_t {
 *  level. Checksum checking status can be queried for each packet with
 *  odp_packet_l3_chksum_status() and odp_packet_l4_chksum_status().
 */
-   union {
-   /** Mapping for individual bits */
-   struct {
-   /** Check IPv4 header checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t ipv4_chksum   : 1;
-
-   /** Check UDP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t udp_chksum: 1;
-
-   /** Check TCP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t tcp_chksum: 1;
-
-   /** Check SCTP checksum in IPSEC payload.
-*  Default value is 0. */
-   uint32_t sctp_chksum   : 1;
-   } check;
-
-   /** All bits of the bit field structure
- *
- * This field can be used to set/clear all flags, or bitwise
- * operations over the entire structure. */
-   uint32_t all_check;
-   };
+   odp_packet_parse_chksum_t chksum;
 
 } odp_ipsec_inbound_config_t;
 



[lng-odp] [PATCH API-NEXT v1 0/2] IPsec checksumming API

2017-11-29 Thread Github ODP bot
Separate checksumming flags into separate type to be used by both packet parse 
and IPsec functions.

github
/** Email created from pull request 314 (lumag:ipsec-chksum)
 ** https://github.com/Linaro/odp/pull/314
 ** Patch: https://github.com/Linaro/odp/pull/314.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 9750daf1153b3a13935f26f866bb2a23548e6e16
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 58 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 33 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] [PATCH 2.0 v3 2/2] linux-dpdk: pool: Remove unused CONFIG_POOL_MAX_NUM

2017-11-29 Thread Github ODP bot
From: Honnappa Nagarahalli 

CONFIG_POOL_MAX_NUM is not used in linux-dpdk.

Signed-off-by: Honnappa Nagarahalli 
Reviewed-by: Ola Liljedahl 
---
/** Email created from pull request 312 (nagarahalli:2.0-pool-ring-alloc-mem)
 ** https://github.com/Linaro/odp/pull/312
 ** Patch: https://github.com/Linaro/odp/pull/312.patch
 ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537
 ** Merge commit sha: 68fae56ca59e4dbc053c018ac8d4520b26e0d528
 **/
 platform/linux-dpdk/include/odp_config_internal.h |  5 -
 platform/linux-dpdk/pool/dpdk.c   | 21 +++--
 2 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/platform/linux-dpdk/include/odp_config_internal.h 
b/platform/linux-dpdk/include/odp_config_internal.h
index 6aadc93f3..f36fcb929 100644
--- a/platform/linux-dpdk/include/odp_config_internal.h
+++ b/platform/linux-dpdk/include/odp_config_internal.h
@@ -119,11 +119,6 @@ extern "C" {
  */
 #define CONFIG_BURST_SIZE 16
 
-/*
- * Maximum number of events in a pool
- */
-#define CONFIG_POOL_MAX_NUM (1 * 1024 * 1024)
-
 /*
  * Maximum number of events in a thread local pool cache
  */
diff --git a/platform/linux-dpdk/pool/dpdk.c b/platform/linux-dpdk/pool/dpdk.c
index 90d2d7c61..94143dfe8 100644
--- a/platform/linux-dpdk/pool/dpdk.c
+++ b/platform/linux-dpdk/pool/dpdk.c
@@ -137,12 +137,12 @@ static int dpdk_pool_capability(odp_pool_capability_t 
*capa)
capa->buf.max_pools = ODP_CONFIG_POOLS;
capa->buf.max_align = ODP_CONFIG_BUFFER_ALIGN_MAX;
capa->buf.max_size  = MAX_SIZE;
-   capa->buf.max_num   = CONFIG_POOL_MAX_NUM;
+   capa->buf.max_num   = 0;
 
/* Packet pools */
capa->pkt.max_pools= ODP_CONFIG_POOLS;
capa->pkt.max_len  = 0;
-   capa->pkt.max_num  = CONFIG_POOL_MAX_NUM;
+   capa->pkt.max_num  = 0;
capa->pkt.min_headroom = CONFIG_PACKET_HEADROOM;
capa->pkt.min_tailroom = CONFIG_PACKET_TAILROOM;
capa->pkt.max_segs_per_pkt = CONFIG_PACKET_MAX_SEGS;
@@ -152,7 +152,7 @@ static int dpdk_pool_capability(odp_pool_capability_t *capa)
 
/* Timeout pools */
capa->tmo.max_pools = ODP_CONFIG_POOLS;
-   capa->tmo.max_num   = CONFIG_POOL_MAX_NUM;
+   capa->tmo.max_num   = 0;
 
return 0;
 }
@@ -258,11 +258,6 @@ static int check_params(odp_pool_param_t *params)
 
switch (params->type) {
case ODP_POOL_BUFFER:
-   if (params->buf.num > capa.buf.max_num) {
-   printf("buf.num too large %u\n", params->buf.num);
-   return -1;
-   }
-
if (params->buf.size > capa.buf.max_size) {
printf("buf.size too large %u\n", params->buf.size);
return -1;
@@ -276,12 +271,6 @@ static int check_params(odp_pool_param_t *params)
break;
 
case ODP_POOL_PACKET:
-   if (params->pkt.num > capa.pkt.max_num) {
-   printf("pkt.num too large %u\n", params->pkt.num);
-
-   return -1;
-   }
-
if (params->pkt.seg_len > capa.pkt.max_seg_len) {
printf("pkt.seg_len too large %u\n",
   params->pkt.seg_len);
@@ -297,10 +286,6 @@ static int check_params(odp_pool_param_t *params)
break;
 
case ODP_POOL_TIMEOUT:
-   if (params->tmo.num > capa.tmo.max_num) {
-   printf("tmo.num too large %u\n", params->tmo.num);
-   return -1;
-   }
break;
 
default:



[lng-odp] [PATCH 2.0 v3 1/2] linux-generic: pool: allocate ring memory based on pool size

2017-11-29 Thread Github ODP bot
From: Honnappa Nagarahalli 

Adjust the size of ring based on configured number of
buffers in the pool.

Signed-off-by: Honnappa Nagarahalli 
Reviewed-by: Ola Liljedahl 
---
/** Email created from pull request 312 (nagarahalli:2.0-pool-ring-alloc-mem)
 ** https://github.com/Linaro/odp/pull/312
 ** Patch: https://github.com/Linaro/odp/pull/312.patch
 ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537
 ** Merge commit sha: 68fae56ca59e4dbc053c018ac8d4520b26e0d528
 **/
 .../linux-generic/include/odp_config_internal.h|  5 ---
 platform/linux-generic/include/odp_pool_internal.h |  2 +-
 platform/linux-generic/pool/generic.c  | 37 ++
 3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/platform/linux-generic/include/odp_config_internal.h 
b/platform/linux-generic/include/odp_config_internal.h
index 9b334df49..9720581a3 100644
--- a/platform/linux-generic/include/odp_config_internal.h
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -147,11 +147,6 @@
  */
 #define CONFIG_BURST_SIZE 16
 
-/*
- * Maximum number of events in a pool
- */
-#define CONFIG_POOL_MAX_NUM (1 * 1024 * 1024)
-
 /*
  * Maximum number of events in a thread local pool cache
  */
diff --git a/platform/linux-generic/include/odp_pool_internal.h 
b/platform/linux-generic/include/odp_pool_internal.h
index 5004e283c..72e550ce2 100644
--- a/platform/linux-generic/include/odp_pool_internal.h
+++ b/platform/linux-generic/include/odp_pool_internal.h
@@ -41,7 +41,7 @@ typedef struct {
ring_t   hdr;
 
/* Ring data: buffer handles */
-   uint32_t buf[CONFIG_POOL_MAX_NUM];
+   uint32_t buf[];
 
 } pool_ring_t ODP_ALIGNED_CACHE;
 
diff --git a/platform/linux-generic/pool/generic.c 
b/platform/linux-generic/pool/generic.c
index c55f67575..7a068472c 100644
--- a/platform/linux-generic/pool/generic.c
+++ b/platform/linux-generic/pool/generic.c
@@ -156,11 +156,12 @@ static int generic_pool_term_local(void)
return 0;
 }
 
-static pool_t *reserve_pool(void)
+static pool_t *reserve_pool(uint32_t ring_size)
 {
int i;
pool_t *pool;
char ring_name[ODP_POOL_NAME_LEN];
+   uint32_t ring_shm_size;
 
for (i = 0; i < ODP_CONFIG_POOLS; i++) {
pool = pool_entry(i);
@@ -169,10 +170,13 @@ static pool_t *reserve_pool(void)
if (pool->reserved == 0) {
pool->reserved = 1;
UNLOCK(>lock);
-   sprintf(ring_name, "pool_ring_%d", i);
+   snprintf(ring_name, ODP_POOL_NAME_LEN,
+"pool_ring_%d", i);
+   ring_shm_size = sizeof(pool_ring_t) +
+   sizeof(pool->ring->buf[0]) * ring_size;
pool->ring_shm =
odp_shm_reserve(ring_name,
-   sizeof(pool_ring_t),
+   ring_shm_size,
ODP_CACHE_LINE_SIZE, 0);
if (odp_unlikely(pool->ring_shm == ODP_SHM_INVALID)) {
ODP_ERR("Unable to alloc pool ring %d\n", i);
@@ -395,7 +399,12 @@ static odp_pool_t pool_create(const char *name, 
odp_pool_param_t *params,
if (uarea_size)
uarea_size = ROUNDUP_CACHE_LINE(uarea_size);
 
-   pool = reserve_pool();
+   if (num <= RING_SIZE_MIN)
+   ring_size = RING_SIZE_MIN;
+   else
+   ring_size = ROUNDUP_POWER2_U32(num);
+
+   pool = reserve_pool(ring_size);
 
if (pool == NULL) {
ODP_ERR("No more free pools");
@@ -431,11 +440,6 @@ static odp_pool_t pool_create(const char *name, 
odp_pool_param_t *params,
FIRST_HP_SIZE - 1) / FIRST_HP_SIZE);
}
 
-   if (num <= RING_SIZE_MIN)
-   ring_size = RING_SIZE_MIN;
-   else
-   ring_size = ROUNDUP_POWER2_U32(num);
-
pool->ring_mask  = ring_size - 1;
pool->num= num;
pool->align  = align;
@@ -506,11 +510,6 @@ static int check_params(odp_pool_param_t *params)
 
switch (params->type) {
case ODP_POOL_BUFFER:
-   if (params->buf.num > capa.buf.max_num) {
-   printf("buf.num too large %u\n", params->buf.num);
-   return -1;
-   }
-
if (params->buf.size > capa.buf.max_size) {
printf("buf.size too large %u\n", params->buf.size);
return -1;
@@ -550,10 +549,6 @@ static int check_params(odp_pool_param_t *params)
break;
 
case ODP_POOL_TIMEOUT:
-   if (params->tmo.num > capa.tmo.max_num) {
-   printf("tmo.num too large %u\n", 

[lng-odp] [PATCH 2.0 v3 0/2] allocate ring memory based on pool size

2017-11-29 Thread Github ODP bot
The maximum size of the pool ring is 1M entries as it uses an array. However, 
the application provides the number of buffers in a pool during pool creation. 
Hence, the maximum pool ring size can be dynamic.

github
/** Email created from pull request 312 (nagarahalli:2.0-pool-ring-alloc-mem)
 ** https://github.com/Linaro/odp/pull/312
 ** Patch: https://github.com/Linaro/odp/pull/312.patch
 ** Base sha: 00c7441fae53949dd87855d48102f932f8f64537
 ** Merge commit sha: 68fae56ca59e4dbc053c018ac8d4520b26e0d528
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 114 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 66 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] VPP and ODP webinar: Event Registration 9am 11/30 PT

2017-11-29 Thread Francois Ozog
Dear all,

You may be interested to register for a webinar 9-10am tomorrow Thursday PT.

https://event.on24.com/eventRegistration/EventLobbyServlet?target=
reg20.jsp=speaker=1539471=1=
58BAA4CAC57783D388386F55C1585A0D®Tag==register

Bob Monkman and Bill Fischofer will give a presentation on “Accelerated
Packet Processing with Arm and FD.io ”.

Extracted summary:
The Arm ecosystem and FD.io  community are actively
involved, bringing unique value to the end users in terms of TCO delivered
by hardware and software innovation. Join us for an overview of the current
and planned focused efforts we are engaged on to deliver multi-architecture
support, network offload, as well as optimizations for compute, power and
economic efficiencies. Additionally, through specific relevant use cases,
attendees will get an overview of how this innovation will be realized.


-- 
[image: Linaro] 
François-Frédéric Ozog | *Director Linaro Networking Group*
T: +33.67221.6485
francois.o...@linaro.org | Skype: ffozog


[lng-odp] [PATCH API-NEXT v1 4/5] test: l2fwd: add checksum offload option

2017-11-29 Thread Github ODP bot
From: Petri Savolainen 

Added option to enable checksum insertion at packet output. This
can be used to test checksum offload in various packet IO
combinations.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
 test/performance/odp_l2fwd.c | 104 +++
 1 file changed, 75 insertions(+), 29 deletions(-)

diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index 42d8f49a2..874e6cf67 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -92,6 +92,7 @@ static inline int sched_mode(pktin_mode_t in_mode)
  * Parsed command line application arguments
  */
 typedef struct {
+   int extra_check;/**< Some extra checks have been enabled */
int cpu_count;
int if_count;   /**< Number of interfaces to be used */
int addr_count; /**< Number of dst addresses to be used */
@@ -106,6 +107,7 @@ typedef struct {
int dst_change; /**< Change destination eth addresses */
int src_change; /**< Change source eth addresses */
int error_check;/**< Check packet errors */
+   int chksum; /**< Checksum offload */
int sched_mode; /**< Scheduler mode */
int num_groups; /**< Number of scheduling groups */
 } appl_args_t;
@@ -292,6 +294,18 @@ static inline int event_queue_send(odp_queue_t queue, 
odp_packet_t *pkt_tbl,
return sent;
 }
 
+static inline void chksum_insert(odp_packet_t *pkt_tbl, int pkts)
+{
+   odp_packet_t pkt;
+   int i;
+
+   for (i = 0; i < pkts; i++) {
+   pkt = pkt_tbl[i];
+   odp_packet_l3_chksum_insert(pkt, 1);
+   odp_packet_l4_chksum_insert(pkt, 1);
+   }
+}
+
 /**
  * Packet IO worker thread using scheduled queues
  *
@@ -365,18 +379,23 @@ static int run_worker_sched_mode(void *arg)
for (i = 0; i < pkts; i++)
pkt_tbl[i] = odp_packet_from_event(ev_tbl[i]);
 
-   if (gbl_args->appl.error_check) {
-   int rx_drops;
+   if (odp_unlikely(gbl_args->appl.extra_check)) {
+   if (gbl_args->appl.chksum)
+   chksum_insert(pkt_tbl, pkts);
 
-   /* Drop packets with errors */
-   rx_drops = drop_err_pkts(pkt_tbl, pkts);
+   if (gbl_args->appl.error_check) {
+   int rx_drops;
 
-   if (odp_unlikely(rx_drops)) {
-   stats->s.rx_drops += rx_drops;
-   if (pkts == rx_drops)
-   continue;
+   /* Drop packets with errors */
+   rx_drops = drop_err_pkts(pkt_tbl, pkts);
 
-   pkts -= rx_drops;
+   if (odp_unlikely(rx_drops)) {
+   stats->s.rx_drops += rx_drops;
+   if (pkts == rx_drops)
+   continue;
+
+   pkts -= rx_drops;
+   }
}
}
 
@@ -486,18 +505,23 @@ static int run_worker_plain_queue_mode(void *arg)
for (i = 0; i < pkts; i++)
pkt_tbl[i] = odp_packet_from_event(event[i]);
 
-   if (gbl_args->appl.error_check) {
-   int rx_drops;
+   if (odp_unlikely(gbl_args->appl.extra_check)) {
+   if (gbl_args->appl.chksum)
+   chksum_insert(pkt_tbl, pkts);
 
-   /* Drop packets with errors */
-   rx_drops = drop_err_pkts(pkt_tbl, pkts);
+   if (gbl_args->appl.error_check) {
+   int rx_drops;
 
-   if (odp_unlikely(rx_drops)) {
-   stats->s.rx_drops += rx_drops;
-   if (pkts == rx_drops)
-   continue;
+   /* Drop packets with errors */
+   rx_drops = drop_err_pkts(pkt_tbl, pkts);
 
-   pkts -= rx_drops;
+   if (odp_unlikely(rx_drops)) {
+   stats->s.rx_drops += rx_drops;
+   if (pkts == rx_drops)
+   continue;
+
+

[lng-odp] [PATCH API-NEXT v1 5/5] linux-gen: dpdk: checksum insert enabled flag

2017-11-29 Thread Github ODP bot
From: Petri Savolainen 

Added interface level flag to optimize checksum insertion
checks. If checksum insertion has not been enabled, further
configuration or packet level checks are not performed.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
 platform/linux-generic/include/odp_packet_io_internal.h |  3 ++-
 platform/linux-generic/pktio/dpdk.c | 11 +++
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/platform/linux-generic/include/odp_packet_io_internal.h 
b/platform/linux-generic/include/odp_packet_io_internal.h
index f323d5c31..598b1ad50 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -113,7 +113,8 @@ struct pktio_entry {
/* These two locks together lock the whole pktio device */
odp_ticketlock_t rxl;   /**< RX ticketlock */
odp_ticketlock_t txl;   /**< TX ticketlock */
-   int cls_enabled;/**< is classifier enabled */
+   uint8_t cls_enabled;/**< classifier enabled */
+   uint8_t chksum_insert_ena;  /**< pktout checksum offload enabled */
odp_pktio_t handle; /**< pktio handle */
union {
pkt_loop_t pkt_loop;/**< Using loopback for IO */
diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index 430eb8df4..7e493ad86 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -546,6 +546,9 @@ static inline void pkt_set_ol_tx(odp_pktout_config_opt_t 
*pktout_cfg,
odp_bool_t ipv4_chksum_pkt, udp_chksum_pkt, tcp_chksum_pkt;
packet_parser_t *pkt_p = _hdr->p;
 
+   if (pkt_p->l3_offset == ODP_PACKET_OFFSET_INVALID)
+   return;
+
l3_hdr = (void *)(mbuf_data + pkt_p->l3_offset);
 
if (check_proto(l3_hdr, _proto_v4, _proto))
@@ -633,7 +636,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
 
odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, data);
 
-   if (pkt_hdr->p.l3_offset != ODP_PACKET_OFFSET_INVALID) {
+   if (odp_unlikely(pktio_entry->s.chksum_insert_ena)) {
odp_pktout_config_opt_t *pktout_capa =
_entry->s.capa.config.pktout;
 
@@ -748,7 +751,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t 
*pktio_entry,
   pkt_hdr->extra_type == PKT_EXTRA_TYPE_DPDK)) {
mbuf_update(mbuf, pkt_hdr, pkt_len);
 
-   if (pkt_hdr->p.l3_offset != ODP_PACKET_OFFSET_INVALID)
+   if (odp_unlikely(pktio_entry->s.chksum_insert_ena))
pkt_set_ol_tx(pktout_cfg, pktout_capa, pkt_hdr,
  mbuf, _odp_packet_data(pkt));
} else {
@@ -771,8 +774,7 @@ static inline int pkt_to_mbuf_zero(pktio_entry_t 
*pktio_entry,
mbuf_init((struct rte_mempool *)
  pool_entry->ext_desc, mbuf, pkt_hdr);
mbuf_update(mbuf, pkt_hdr, pkt_len);
-   if (pkt_hdr->p.l3_offset !=
-   ODP_PACKET_OFFSET_INVALID)
+   if (pktio_entry->s.chksum_insert_ena)
pkt_set_ol_tx(pktout_cfg, pktout_capa,
  pkt_hdr, mbuf,
  _odp_packet_data(pkt));
@@ -1425,6 +1427,7 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
rte_eth_dev_info_get(port_id, _info);
dev_info.default_txconf.txq_flags = txq_flags;
txconf = _info.default_txconf;
+   pktio_entry->s.chksum_insert_ena = 1;
}
 
ret = rte_eth_tx_queue_setup(port_id, i, DPDK_NM_TX_DESC,



[lng-odp] [PATCH API-NEXT v1 3/5] linux-gen: dpdk: use checksum insert enable config

2017-11-29 Thread Github ODP bot
From: Petri Savolainen 

Enable checksum insertion only when requested. DPDK uses less
optimized driver code (on Intel NICs at least) when any of the
L4 checksum offloads is enabled.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
 platform/linux-generic/pktio/dpdk.c | 48 -
 1 file changed, 47 insertions(+), 1 deletion(-)

diff --git a/platform/linux-generic/pktio/dpdk.c 
b/platform/linux-generic/pktio/dpdk.c
index c0a8a..430eb8df4 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -123,6 +123,7 @@ static inline void mbuf_update(struct rte_mbuf *mbuf, 
odp_packet_hdr_t *pkt_hdr,
mbuf->data_len = pkt_len;
mbuf->pkt_len = pkt_len;
mbuf->refcnt = 1;
+   mbuf->ol_flags = 0;
 
if (odp_unlikely(pkt_hdr->buf_hdr.base_data !=
 pkt_hdr->buf_hdr.seg[0].data))
@@ -1246,6 +1247,13 @@ static void dpdk_init_capability(pktio_entry_t 
*pktio_entry,
(dev_info->tx_offload_capa & DEV_TX_OFFLOAD_UDP_CKSUM) ? 1 : 0;
capa->config.pktout.bit.tcp_chksum =
(dev_info->tx_offload_capa & DEV_TX_OFFLOAD_TCP_CKSUM) ? 1 : 0;
+
+   capa->config.pktout.bit.ipv4_chksum_ena =
+   capa->config.pktout.bit.ipv4_chksum;
+   capa->config.pktout.bit.udp_chksum_ena =
+   capa->config.pktout.bit.udp_chksum;
+   capa->config.pktout.bit.tcp_chksum_ena =
+   capa->config.pktout.bit.tcp_chksum;
 }
 
 static int dpdk_open(odp_pktio_t id ODP_UNUSED,
@@ -1381,9 +1389,47 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
}
/* Init TX queues */
for (i = 0; i < pktio_entry->s.num_out_queue; i++) {
+   struct rte_eth_dev_info dev_info;
+   const struct rte_eth_txconf *txconf = NULL;
+   int ip_ena  = pktio_entry->s.config.pktout.bit.ipv4_chksum_ena;
+   int udp_ena = pktio_entry->s.config.pktout.bit.udp_chksum_ena;
+   int tcp_ena = pktio_entry->s.config.pktout.bit.tcp_chksum_ena;
+   int sctp_ena = pktio_entry->s.config.pktout.bit.sctp_chksum_ena;
+   int chksum_ena = ip_ena | udp_ena | tcp_ena | sctp_ena;
+
+   if (chksum_ena) {
+   /* Enable UDP, TCP, STCP checksum offload */
+   uint32_t txq_flags = 0;
+
+   if (udp_ena == 0)
+   txq_flags |= ETH_TXQ_FLAGS_NOXSUMUDP;
+
+   if (tcp_ena == 0)
+   txq_flags |= ETH_TXQ_FLAGS_NOXSUMTCP;
+
+   if (sctp_ena == 0)
+   txq_flags |= ETH_TXQ_FLAGS_NOXSUMSCTP;
+
+   /* When IP checksum is requested alone, enable UDP
+* offload. DPDK IP checksum offload is enabled only
+* when one of the L4 checksum offloads is requested.*/
+   if ((udp_ena == 0) && (tcp_ena == 0) && (sctp_ena == 0))
+   txq_flags = ETH_TXQ_FLAGS_NOXSUMTCP |
+   ETH_TXQ_FLAGS_NOXSUMSCTP;
+
+   txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS |
+ETH_TXQ_FLAGS_NOREFCOUNT |
+ETH_TXQ_FLAGS_NOMULTMEMP |
+ETH_TXQ_FLAGS_NOVLANOFFL;
+
+   rte_eth_dev_info_get(port_id, _info);
+   dev_info.default_txconf.txq_flags = txq_flags;
+   txconf = _info.default_txconf;
+   }
+
ret = rte_eth_tx_queue_setup(port_id, i, DPDK_NM_TX_DESC,
 rte_eth_dev_socket_id(port_id),
-NULL);
+txconf);
if (ret < 0) {
ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n",
ret, port_id);



[lng-odp] [PATCH API-NEXT v1 2/5] example: generator use checksum enable

2017-11-29 Thread Github ODP bot
From: Petri Savolainen 

Use new checksum insert enable bits.

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
 example/generator/odp_generator.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/example/generator/odp_generator.c 
b/example/generator/odp_generator.c
index e1d98539f..81d954662 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -523,6 +523,10 @@ static int create_pktio(const char *dev, odp_pool_t pool,
capa.config.pktin.bit.drop_ipv4_err;
itf->config.pktin.bit.drop_udp_err = capa.config.pktin.bit.drop_udp_err;
 
+   itf->config.pktout.bit.ipv4_chksum_ena =
+   capa.config.pktout.bit.ipv4_chksum_ena;
+   itf->config.pktout.bit.udp_chksum_ena =
+   capa.config.pktout.bit.udp_chksum_ena;
itf->config.pktout.bit.ipv4_chksum = capa.config.pktout.bit.ipv4_chksum;
itf->config.pktout.bit.udp_chksum = capa.config.pktout.bit.udp_chksum;
 



[lng-odp] [PATCH API-NEXT v1 1/5] api: pktio: add checksum insert enable bits

2017-11-29 Thread Github ODP bot
From: Petri Savolainen 

Added bits to control if checksum insertion is enabled /
disabled at packet output. Current configuration options
control if checksum is inserted / not inserted by default,
but leaves it open for application to request checksum
always with override functions. Explicit disable allows
implementation to optimize performance (e.g. DPDK does this).

Signed-off-by: Petri Savolainen 
---
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
 include/odp/api/spec/packet.h|  4 +--
 include/odp/api/spec/packet_io.h | 62 
 2 files changed, 46 insertions(+), 20 deletions(-)

diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h
index b897c9d3c..1dbbfafe6 100644
--- a/include/odp/api/spec/packet.h
+++ b/include/odp/api/spec/packet.h
@@ -1531,7 +1531,7 @@ odp_packet_chksum_status_t 
odp_packet_l4_chksum_status(odp_packet_t pkt);
  *
  * Calling this function is always allowed but the checksum will not be
  * inserted if the packet is output through a pktio that does not have
- * the relevant pktout chksum bit set in the pktio capability.
+ * the relevant checksum insertion enabled.
  *
  * @param pkt Packet handle
  * @param insert  0: do not insert L3 checksum
@@ -1548,7 +1548,7 @@ void odp_packet_l3_chksum_insert(odp_packet_t pkt, int 
insert);
  *
  * Calling this function is always allowed but the checksum will not be
  * inserted if the packet is output through a pktio that does not have
- * the relevant pktout chksum bit set in the pktio capability.
+ * the relevant checksum insertion enabled.
  *
  * @param pkt Packet handle
  * @param insert  0: do not insert L4 checksum
diff --git a/include/odp/api/spec/packet_io.h b/include/odp/api/spec/packet_io.h
index 6e4f88100..3798c048e 100644
--- a/include/odp/api/spec/packet_io.h
+++ b/include/odp/api/spec/packet_io.h
@@ -329,15 +329,29 @@ typedef union odp_pktin_config_opt_t {
  * Packet output configuration options bit field
  *
  * Packet output configuration options listed in a bit field structure. Packet
- * output checksum insertion may be enabled or disabled. When it is enabled,
- * implementation will calculate and insert checksum into every outgoing packet
- * by default. Application may disable checksum insertion (e.g.
- * odp_packet_l4_chksum_insert()) on per packet basis. For correct operation,
- * packet metadata must provide valid offsets for the appropriate protocols.
- * For example, UDP checksum calculation needs both L3 and L4 offsets (to 
access
- * IP and UDP headers). When application (e.g. a switch) does not modify L3/L4
- * data and thus checksum does not need to be updated, output checksum 
insertion
- * should be disabled for optimal performance.
+ * output checksum insertion may be enabled or disabled (e.g. ipv4_chksum_ena):
+ *
+ *  0: Disable checksum insertion. Application will not request checksum
+ * insertion for any packet. This is the default value for xxx_chksum_ena
+ * bits.
+ *  1: Enable checksum insertion. Application will request checksum insertion
+ * for some packets.
+ *
+ * When checksum insertion is enabled, application may use configuration 
options
+ * to set the default behaviour on packet output (e.g. ipv4_chksum):
+ *
+ *  0: Do not insert checksum by default. This is the default value for
+ * xxx_chksum bits.
+ *  1: Calculate and insert checksum by default.
+ *
+ * These defaults may be overridden on per packet basis using e.g.
+ * odp_packet_l4_chksum_insert().
+ *
+ * For correct operation, packet metadata must provide valid offsets for the
+ * appropriate protocols. For example, UDP checksum calculation needs both L3
+ * and L4 offsets (to access IP and UDP headers). When application
+ * (e.g. a switch) does not modify L3/L4 data and thus checksum does not need
+ * to be updated, checksum insertion should be disabled for optimal 
performance.
  *
  * Packet flags (odp_packet_has_*()) are ignored for the purpose of checksum
  * insertion in packet output.
@@ -354,19 +368,31 @@ typedef union odp_pktin_config_opt_t {
  * insertion.
  */
 typedef union odp_pktout_config_opt_t {
-   /** Option flags */
+   /** Option flags for packet output */
struct {
-   /** Insert IPv4 header checksum on packet output */
-   uint64_t ipv4_chksum  : 1;
+   /** Enable IPv4 header checksum insertion. */
+   uint64_t ipv4_chksum_ena : 1;
+
+   /** Enable UDP checksum insertion */
+   uint64_t udp_chksum_ena  : 1;
+
+   /** Enable TCP checksum insertion */
+   uint64_t tcp_chksum_ena  : 1;
+
+   /** Enable SCTP 

[lng-odp] [PATCH API-NEXT v1 0/5] api: pktio: add checksum insert enable bits

2017-11-29 Thread Github ODP bot
Added bits to control if checksum insertion is enabled /
disabled at packet output. Current configuration options
control if checksum is inserted / not inserted by default,
but leaves it open for application to request checksum
always with override functions. Explicit disable allows
implementation to optimize performance. E.g. DPDK does
uses more optimized driver code on Intel NICs when checksum
offload is disabled.

github
/** Email created from pull request 313 (psavol:next-pktout-config)
 ** https://github.com/Linaro/odp/pull/313
 ** Patch: https://github.com/Linaro/odp/pull/313.patch
 ** Base sha: 4cb02e1caccb9179575e95448fd46979e17d0905
 ** Merge commit sha: 5d0d0efcb77baf5b9db803a8a8b89450e27aff38
 **/
/github

checkpatch.pl
total: 0 errors, 0 warnings, 0 checks, 94 lines checked


to_send-p-000.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 10 lines checked


to_send-p-001.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 68 lines checked


to_send-p-002.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 192 lines checked


to_send-p-003.patch has no obvious style problems and is ready for submission.
total: 0 errors, 0 warnings, 0 checks, 50 lines checked


to_send-p-004.patch has no obvious style problems and is ready for submission.
/checkpatch.pl


[lng-odp] L4 offset

2017-11-29 Thread Liron Himi
Hi,

I'm trying to understand when pktio implementation should set the L4 offset.
In point of view, if there is a known L3 header than the L4 offset should be 
set to the L3-offset + L3 header length.
I noticed that Linux generic implementation is not as above. E.g. if there is 
only IP header and payload, than L4 offset is set to 
'ODP_PACKET_OFFSET_INVALID'.
Is the above is the real intention?
The API is documented as foolowed:
/**
* Layer 4 start offset
*
* Returns offset to the start of the layer 4 header. The offset is calculated
* from the current odp_packet_data() position in bytes.
*
* User is responsible to update the offset when modifying the packet data
* pointer position.
*
* @param pkt  Packet handle
*
* @return  Layer 4 start offset
* @retval ODP_PACKET_OFFSET_INVALID packet does not contain a valid L4 header
*
* @see odp_packet_l4_offset_set(), odp_packet_has_l4()
*/
uint32_t odp_packet_l4_offset(odp_packet_t pkt);

What is the meaning of a valid L4 header? A payload is a valid L4? Maybe you 
should remove the 'header' and just mention that there is a L4 layer.

In order to calculate IP checksum, the IP-Header-length is needed and in 
absence of this exact value, the L4 offset can be used to calculate it.

Regards,
Liron