diff mbox

validation: packet: do not require a max packet length

Message ID 20170313140215.26841-1-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer March 13, 2017, 2:02 p.m. UTC
Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by checking
the pool capability max packet length and modifying the test in
test_extend_ref() to account for implementations that do not limit
packet lengths.

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

---
 test/common_plat/validation/api/packet/packet.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.12.0.rc1

Comments

Balasubramanian Manoharan March 13, 2017, 2:26 p.m. UTC | #1
Reviewed-by: Balasubramanian Manoharan <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>>


> On 13-Mar-2017, at 7:32 PM, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> 

> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by checking

> the pool capability max packet length and modifying the test in

> test_extend_ref() to account for implementations that do not limit

> packet lengths.

> 

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

> test/common_plat/validation/api/packet/packet.c | 9 +++++++--

> 1 file changed, 7 insertions(+), 2 deletions(-)

> 

> diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c

> index 900c4263..5544c237 100644

> --- a/test/common_plat/validation/api/packet/packet.c

> +++ b/test/common_plat/validation/api/packet/packet.c

> @@ -1847,6 +1847,9 @@ void packet_test_extend_ref(void)

> {

> 	odp_packet_t max_pkt, ref;

> 	uint32_t hr, tr, max_len;

> +	odp_pool_capability_t capa;

> +

> +	CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);

> 

> 	max_pkt = odp_packet_copy(segmented_test_packet,

> 				  odp_packet_pool(segmented_test_packet));

> @@ -1860,8 +1863,10 @@ void packet_test_extend_ref(void)

> 	odp_packet_push_tail(max_pkt, tr);

> 

> 	/* Max packet should not be extendable at either end */

> -	CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);

> -	CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);

> +	if (max_len == capa.pkt.max_len) {

> +		CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);

> +		CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);

> +	}

> 

> 	/* See if we can trunc and extend anyway */

> 	CU_ASSERT(odp_packet_trunc_tail(&max_pkt, hr + tr + 1,

> -- 

> 2.12.0.rc1

>
Balakrishna Garapati March 13, 2017, 2:41 p.m. UTC | #2
On 13 March 2017 at 15:02, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by checking

> the pool capability max packet length and modifying the test in

> test_extend_ref() to account for implementations that do not limit

> packet lengths.

>

> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

> ---

>  test/common_plat/validation/api/packet/packet.c | 9 +++++++--

>  1 file changed, 7 insertions(+), 2 deletions(-)

>

> diff --git a/test/common_plat/validation/api/packet/packet.c

> b/test/common_plat/validation/api/packet/packet.c

> index 900c4263..5544c237 100644

> --- a/test/common_plat/validation/api/packet/packet.c

> +++ b/test/common_plat/validation/api/packet/packet.c

> @@ -1847,6 +1847,9 @@ void packet_test_extend_ref(void)

>  {

>         odp_packet_t max_pkt, ref;

>         uint32_t hr, tr, max_len;

> +       odp_pool_capability_t capa;

> +

> +       CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);

>

>         max_pkt = odp_packet_copy(segmented_test_packet,

>                                   odp_packet_pool(segmented_test_packet));

> @@ -1860,8 +1863,10 @@ void packet_test_extend_ref(void)

>         odp_packet_push_tail(max_pkt, tr);

>

>         /* Max packet should not be extendable at either end */

> -       CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);

> -       CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);

> +       if (max_len == capa.pkt.max_len) {

>

This capability is already defined in odp-dpdk as an internal capability.
And used to calculate & make sure at least one packet fits in the pool. So
my question was if odp-dpdk should use this internal capability to check
against the max packet size since dpdk has no such capability ?.

/Krishna

> +               CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL)

> < 0);

> +               CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL)

> < 0);

> +       }

>

>         /* See if we can trunc and extend anyway */

>         CU_ASSERT(odp_packet_trunc_tail(&max_pkt, hr + tr + 1,

> --

> 2.12.0.rc1

>

>
Bill Fischofer March 13, 2017, 3:09 p.m. UTC | #3
On Mon, Mar 13, 2017 at 9:41 AM, Krishna Garapati <
balakrishna.garapati@linaro.org> wrote:

>

>

> On 13 March 2017 at 15:02, Bill Fischofer <bill.fischofer@linaro.org>

> wrote:

>

>> Address bug https://bugs.linaro.org/show_bug.cgi?id=2908 by checking

>> the pool capability max packet length and modifying the test in

>> test_extend_ref() to account for implementations that do not limit

>> packet lengths.

>>

>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>> ---

>>  test/common_plat/validation/api/packet/packet.c | 9 +++++++--

>>  1 file changed, 7 insertions(+), 2 deletions(-)

>>

>> diff --git a/test/common_plat/validation/api/packet/packet.c

>> b/test/common_plat/validation/api/packet/packet.c

>> index 900c4263..5544c237 100644

>> --- a/test/common_plat/validation/api/packet/packet.c

>> +++ b/test/common_plat/validation/api/packet/packet.c

>> @@ -1847,6 +1847,9 @@ void packet_test_extend_ref(void)

>>  {

>>         odp_packet_t max_pkt, ref;

>>         uint32_t hr, tr, max_len;

>> +       odp_pool_capability_t capa;

>> +

>> +       CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);

>>

>>         max_pkt = odp_packet_copy(segmented_test_packet,

>>                                   odp_packet_pool(segmented_test

>> _packet));

>> @@ -1860,8 +1863,10 @@ void packet_test_extend_ref(void)

>>         odp_packet_push_tail(max_pkt, tr);

>>

>>         /* Max packet should not be extendable at either end */

>> -       CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);

>> -       CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);

>> +       if (max_len == capa.pkt.max_len) {

>>

> This capability is already defined in odp-dpdk as an internal capability.

> And used to calculate & make sure at least one packet fits in the pool. So

> my question was if odp-dpdk should use this internal capability to check

> against the max packet size since dpdk has no such capability ?.

>


The various odp_xxx_capability() APIs are how ODP implementations
communicate various limits. For odp-dpdk it just needs to set the
capability pkt.max_len value to 0 to indicate that there are no predefined
limits. With this patch this test should then skip these two tests since in
this case odp_packet_extend_head/tail() would succeed on that platform.


>

> /Krishna

>

>> +               CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL,

>> NULL) < 0);

>> +               CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL,

>> NULL) < 0);

>> +       }

>>

>>         /* See if we can trunc and extend anyway */

>>         CU_ASSERT(odp_packet_trunc_tail(&max_pkt, hr + tr + 1,

>> --

>> 2.12.0.rc1

>>

>>

>
diff mbox

Patch

diff --git a/test/common_plat/validation/api/packet/packet.c b/test/common_plat/validation/api/packet/packet.c
index 900c4263..5544c237 100644
--- a/test/common_plat/validation/api/packet/packet.c
+++ b/test/common_plat/validation/api/packet/packet.c
@@ -1847,6 +1847,9 @@  void packet_test_extend_ref(void)
 {
 	odp_packet_t max_pkt, ref;
 	uint32_t hr, tr, max_len;
+	odp_pool_capability_t capa;
+
+	CU_ASSERT_FATAL(odp_pool_capability(&capa) == 0);
 
 	max_pkt = odp_packet_copy(segmented_test_packet,
 				  odp_packet_pool(segmented_test_packet));
@@ -1860,8 +1863,10 @@  void packet_test_extend_ref(void)
 	odp_packet_push_tail(max_pkt, tr);
 
 	/* Max packet should not be extendable at either end */
-	CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);
-	CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);
+	if (max_len == capa.pkt.max_len) {
+		CU_ASSERT(odp_packet_extend_tail(&max_pkt, 1, NULL, NULL) < 0);
+		CU_ASSERT(odp_packet_extend_head(&max_pkt, 1, NULL, NULL) < 0);
+	}
 
 	/* See if we can trunc and extend anyway */
 	CU_ASSERT(odp_packet_trunc_tail(&max_pkt, hr + tr + 1,