diff mbox

[4/5] validation: classification: add odp_cls_cos_pool_set() api

Message ID 1447741013-7333-4-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Nov. 17, 2015, 6:16 a.m. UTC
Assigns a packet pool to CoS using odp_cls_cos_pool_set() api.

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 .../classification/odp_classification_test_pmr.c   | 15 ++++++++++++++
 .../classification/odp_classification_tests.c      | 24 ++++++++++++++++++++++
 2 files changed, 39 insertions(+)

Comments

Stuart Haslam Nov. 19, 2015, 11:13 a.m. UTC | #1
On Tue, Nov 17, 2015 at 11:46:52AM +0530, Balasubramanian Manoharan wrote:
> Assigns a packet pool to CoS using odp_cls_cos_pool_set() api.
> 

This tests that you can assign a pool to a CoS but since it uses the
same default_pool it doesn't actually test that it's possible to deliver
packets into multiple different pools. I think that's OK for a first
instance but it should be tracked (in jira/bugzilla?) so that it can be
improved at some point.

> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>  .../classification/odp_classification_test_pmr.c   | 15 ++++++++++++++
>  .../classification/odp_classification_tests.c      | 24 ++++++++++++++++++++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
> index 3f49d4c..5f51a03 100644
> --- a/test/validation/classification/odp_classification_test_pmr.c
> +++ b/test/validation/classification/odp_classification_test_pmr.c
> @@ -153,6 +153,9 @@ static void classification_test_pmr_term_tcp_dport(void)
>  	queue = queue_create(queuename, true);
>  	CU_ASSERT(queue != ODP_QUEUE_INVALID);
>  
> +	retval = odp_cls_cos_pool_set(cos, pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_cos_queue_set(cos, queue);
>  	CU_ASSERT(retval == 0);
>  
> @@ -240,6 +243,9 @@ static void classification_test_pmr_term_tcp_sport(void)
>  	queue = queue_create(queuename, true);
>  	CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
>  
> +	retval = odp_cls_cos_pool_set(cos, pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_cos_queue_set(cos, queue);
>  	CU_ASSERT(retval == 0);
>  
> @@ -328,6 +334,9 @@ static void classification_test_pmr_term_udp_dport(void)
>  	retval = odp_cos_queue_set(cos, queue);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos, pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>  	CU_ASSERT(retval == 0);
>  
> @@ -414,6 +423,9 @@ static void classification_test_pmr_term_udp_sport(void)
>  	retval = odp_cos_queue_set(cos, queue);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos, pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>  	CU_ASSERT(retval == 0);
>  
> @@ -498,6 +510,9 @@ static void classification_test_pmr_term_ipproto(void)
>  	retval = odp_cos_queue_set(cos, queue);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos, pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>  	CU_ASSERT(retval == 0);
>  
> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
> index 3944d94..bec7053 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -154,6 +154,10 @@ void configure_cls_pmr_chain(void)
>  				   queue_list[CLS_PMR_CHAIN_SRC]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_SRC],
> +				      pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	sprintf(cosname, "DstCos");
>  	cos_list[CLS_PMR_CHAIN_DST] = odp_cos_create(cosname);
>  	CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_DST] != ODP_COS_INVALID);
> @@ -173,6 +177,10 @@ void configure_cls_pmr_chain(void)
>  				   queue_list[CLS_PMR_CHAIN_DST]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_DST],
> +				      pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>  	match.term = ODP_PMR_SIP_ADDR;
>  	match.val = &addr;
> @@ -273,6 +281,9 @@ void configure_pktio_default_cos(void)
>  				   queue_list[CLS_DEFAULT]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_DEFAULT], pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_default_cos_set(pktio_loop, cos_list[CLS_DEFAULT]);
>  	CU_ASSERT(retval == 0);
>  }
> @@ -323,6 +334,9 @@ void configure_pktio_error_cos(void)
>  	retval = odp_cos_queue_set(cos_list[CLS_ERROR], queue_list[CLS_ERROR]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_ERROR], pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_error_cos_set(pktio_loop, cos_list[CLS_ERROR]);
>  	CU_ASSERT(retval == 0);
>  }
> @@ -411,6 +425,10 @@ void configure_cos_with_l2_priority(void)
>  		queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i];
>  		retval = odp_cos_queue_set(cos_tbl[i], queue_tbl[i]);
>  		CU_ASSERT(retval == 0);
> +
> +		retval = odp_cls_cos_pool_set(cos_tbl[i], pool_default);
> +		CU_ASSERT(retval == 0);
> +
>  		qos_tbl[i] = i;
>  	}
>  	/* count 'i' is passed instead of num_qos to handle the rare scenario
> @@ -483,6 +501,9 @@ void configure_pmr_cos(void)
>  				   queue_list[CLS_PMR]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR], pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop,
>  				   cos_list[CLS_PMR]);
>  	CU_ASSERT(retval == 0);
> @@ -557,6 +578,9 @@ void configure_pktio_pmr_match_set_cos(void)
>  				   queue_list[CLS_PMR_SET]);
>  	CU_ASSERT(retval == 0);
>  
> +	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_SET], pool_default);
> +	CU_ASSERT(retval == 0);
> +
>  	retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop,
>  					     cos_list[CLS_PMR_SET]);
>  	CU_ASSERT(retval == 0);
> -- 
> 1.9.1
>
Balasubramanian Manoharan Nov. 19, 2015, 11:31 a.m. UTC | #2
On 19 November 2015 at 16:43, Stuart Haslam <stuart.haslam@linaro.org> wrote:
> On Tue, Nov 17, 2015 at 11:46:52AM +0530, Balasubramanian Manoharan wrote:
>> Assigns a packet pool to CoS using odp_cls_cos_pool_set() api.
>>
>
> This tests that you can assign a pool to a CoS but since it uses the
> same default_pool it doesn't actually test that it's possible to deliver
> packets into multiple different pools. I think that's OK for a first
> instance but it should be tracked (in jira/bugzilla?) so that it can be
> improved at some point.

I completely agree. These changes were just to have compatibility with
the api change
We need to add a separate TCs as you have mentioned.
I will create a bug for the same.

Regards,
Bala
>
>> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>> ---
>>  .../classification/odp_classification_test_pmr.c   | 15 ++++++++++++++
>>  .../classification/odp_classification_tests.c      | 24 ++++++++++++++++++++++
>>  2 files changed, 39 insertions(+)
>>
>> diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
>> index 3f49d4c..5f51a03 100644
>> --- a/test/validation/classification/odp_classification_test_pmr.c
>> +++ b/test/validation/classification/odp_classification_test_pmr.c
>> @@ -153,6 +153,9 @@ static void classification_test_pmr_term_tcp_dport(void)
>>       queue = queue_create(queuename, true);
>>       CU_ASSERT(queue != ODP_QUEUE_INVALID);
>>
>> +     retval = odp_cls_cos_pool_set(cos, pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_cos_queue_set(cos, queue);
>>       CU_ASSERT(retval == 0);
>>
>> @@ -240,6 +243,9 @@ static void classification_test_pmr_term_tcp_sport(void)
>>       queue = queue_create(queuename, true);
>>       CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
>>
>> +     retval = odp_cls_cos_pool_set(cos, pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_cos_queue_set(cos, queue);
>>       CU_ASSERT(retval == 0);
>>
>> @@ -328,6 +334,9 @@ static void classification_test_pmr_term_udp_dport(void)
>>       retval = odp_cos_queue_set(cos, queue);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos, pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>>       CU_ASSERT(retval == 0);
>>
>> @@ -414,6 +423,9 @@ static void classification_test_pmr_term_udp_sport(void)
>>       retval = odp_cos_queue_set(cos, queue);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos, pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>>       CU_ASSERT(retval == 0);
>>
>> @@ -498,6 +510,9 @@ static void classification_test_pmr_term_ipproto(void)
>>       retval = odp_cos_queue_set(cos, queue);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos, pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_pmr_cos(pmr, pktio, cos);
>>       CU_ASSERT(retval == 0);
>>
>> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
>> index 3944d94..bec7053 100644
>> --- a/test/validation/classification/odp_classification_tests.c
>> +++ b/test/validation/classification/odp_classification_tests.c
>> @@ -154,6 +154,10 @@ void configure_cls_pmr_chain(void)
>>                                  queue_list[CLS_PMR_CHAIN_SRC]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_SRC],
>> +                                   pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       sprintf(cosname, "DstCos");
>>       cos_list[CLS_PMR_CHAIN_DST] = odp_cos_create(cosname);
>>       CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_DST] != ODP_COS_INVALID);
>> @@ -173,6 +177,10 @@ void configure_cls_pmr_chain(void)
>>                                  queue_list[CLS_PMR_CHAIN_DST]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_DST],
>> +                                   pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
>>       match.term = ODP_PMR_SIP_ADDR;
>>       match.val = &addr;
>> @@ -273,6 +281,9 @@ void configure_pktio_default_cos(void)
>>                                  queue_list[CLS_DEFAULT]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_DEFAULT], pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_default_cos_set(pktio_loop, cos_list[CLS_DEFAULT]);
>>       CU_ASSERT(retval == 0);
>>  }
>> @@ -323,6 +334,9 @@ void configure_pktio_error_cos(void)
>>       retval = odp_cos_queue_set(cos_list[CLS_ERROR], queue_list[CLS_ERROR]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_ERROR], pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_error_cos_set(pktio_loop, cos_list[CLS_ERROR]);
>>       CU_ASSERT(retval == 0);
>>  }
>> @@ -411,6 +425,10 @@ void configure_cos_with_l2_priority(void)
>>               queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i];
>>               retval = odp_cos_queue_set(cos_tbl[i], queue_tbl[i]);
>>               CU_ASSERT(retval == 0);
>> +
>> +             retval = odp_cls_cos_pool_set(cos_tbl[i], pool_default);
>> +             CU_ASSERT(retval == 0);
>> +
>>               qos_tbl[i] = i;
>>       }
>>       /* count 'i' is passed instead of num_qos to handle the rare scenario
>> @@ -483,6 +501,9 @@ void configure_pmr_cos(void)
>>                                  queue_list[CLS_PMR]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_PMR], pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop,
>>                                  cos_list[CLS_PMR]);
>>       CU_ASSERT(retval == 0);
>> @@ -557,6 +578,9 @@ void configure_pktio_pmr_match_set_cos(void)
>>                                  queue_list[CLS_PMR_SET]);
>>       CU_ASSERT(retval == 0);
>>
>> +     retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_SET], pool_default);
>> +     CU_ASSERT(retval == 0);
>> +
>>       retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop,
>>                                            cos_list[CLS_PMR_SET]);
>>       CU_ASSERT(retval == 0);
>> --
>> 1.9.1
>>
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_test_pmr.c b/test/validation/classification/odp_classification_test_pmr.c
index 3f49d4c..5f51a03 100644
--- a/test/validation/classification/odp_classification_test_pmr.c
+++ b/test/validation/classification/odp_classification_test_pmr.c
@@ -153,6 +153,9 @@  static void classification_test_pmr_term_tcp_dport(void)
 	queue = queue_create(queuename, true);
 	CU_ASSERT(queue != ODP_QUEUE_INVALID);
 
+	retval = odp_cls_cos_pool_set(cos, pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_cos_queue_set(cos, queue);
 	CU_ASSERT(retval == 0);
 
@@ -240,6 +243,9 @@  static void classification_test_pmr_term_tcp_sport(void)
 	queue = queue_create(queuename, true);
 	CU_ASSERT_FATAL(queue != ODP_QUEUE_INVALID);
 
+	retval = odp_cls_cos_pool_set(cos, pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_cos_queue_set(cos, queue);
 	CU_ASSERT(retval == 0);
 
@@ -328,6 +334,9 @@  static void classification_test_pmr_term_udp_dport(void)
 	retval = odp_cos_queue_set(cos, queue);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos, pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
 	CU_ASSERT(retval == 0);
 
@@ -414,6 +423,9 @@  static void classification_test_pmr_term_udp_sport(void)
 	retval = odp_cos_queue_set(cos, queue);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos, pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
 	CU_ASSERT(retval == 0);
 
@@ -498,6 +510,9 @@  static void classification_test_pmr_term_ipproto(void)
 	retval = odp_cos_queue_set(cos, queue);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos, pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_pmr_cos(pmr, pktio, cos);
 	CU_ASSERT(retval == 0);
 
diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index 3944d94..bec7053 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -154,6 +154,10 @@  void configure_cls_pmr_chain(void)
 				   queue_list[CLS_PMR_CHAIN_SRC]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_SRC],
+				      pool_default);
+	CU_ASSERT(retval == 0);
+
 	sprintf(cosname, "DstCos");
 	cos_list[CLS_PMR_CHAIN_DST] = odp_cos_create(cosname);
 	CU_ASSERT_FATAL(cos_list[CLS_PMR_CHAIN_DST] != ODP_COS_INVALID);
@@ -173,6 +177,10 @@  void configure_cls_pmr_chain(void)
 				   queue_list[CLS_PMR_CHAIN_DST]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_CHAIN_DST],
+				      pool_default);
+	CU_ASSERT(retval == 0);
+
 	parse_ipv4_string(CLS_PMR_CHAIN_SADDR, &addr, &mask);
 	match.term = ODP_PMR_SIP_ADDR;
 	match.val = &addr;
@@ -273,6 +281,9 @@  void configure_pktio_default_cos(void)
 				   queue_list[CLS_DEFAULT]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_DEFAULT], pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_default_cos_set(pktio_loop, cos_list[CLS_DEFAULT]);
 	CU_ASSERT(retval == 0);
 }
@@ -323,6 +334,9 @@  void configure_pktio_error_cos(void)
 	retval = odp_cos_queue_set(cos_list[CLS_ERROR], queue_list[CLS_ERROR]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_ERROR], pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_error_cos_set(pktio_loop, cos_list[CLS_ERROR]);
 	CU_ASSERT(retval == 0);
 }
@@ -411,6 +425,10 @@  void configure_cos_with_l2_priority(void)
 		queue_list[CLS_L2_QOS_0 + i] = queue_tbl[i];
 		retval = odp_cos_queue_set(cos_tbl[i], queue_tbl[i]);
 		CU_ASSERT(retval == 0);
+
+		retval = odp_cls_cos_pool_set(cos_tbl[i], pool_default);
+		CU_ASSERT(retval == 0);
+
 		qos_tbl[i] = i;
 	}
 	/* count 'i' is passed instead of num_qos to handle the rare scenario
@@ -483,6 +501,9 @@  void configure_pmr_cos(void)
 				   queue_list[CLS_PMR]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR], pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_pmr_cos(pmr_list[CLS_PMR], pktio_loop,
 				   cos_list[CLS_PMR]);
 	CU_ASSERT(retval == 0);
@@ -557,6 +578,9 @@  void configure_pktio_pmr_match_set_cos(void)
 				   queue_list[CLS_PMR_SET]);
 	CU_ASSERT(retval == 0);
 
+	retval = odp_cls_cos_pool_set(cos_list[CLS_PMR_SET], pool_default);
+	CU_ASSERT(retval == 0);
+
 	retval = odp_pktio_pmr_match_set_cos(pmr_set, pktio_loop,
 					     cos_list[CLS_PMR_SET]);
 	CU_ASSERT(retval == 0);