diff mbox

[v1] validation: classification: Use events instead of buffers

Message ID 1422352046-8618-1-git-send-email-bala.manoharan@linaro.org
State New
Headers show

Commit Message

Balasubramanian Manoharan Jan. 27, 2015, 9:47 a.m. UTC
From: Balasubramanian Manoharan <bala.manoharan@linaro.org>

Replaces odp_buffer_t and odp_buffer_pool_t into odp_event_t and odp_pool_t respectively

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 .../classification/odp_classification_tests.c      | 39 +++++++++++-----------
 1 file changed, 20 insertions(+), 19 deletions(-)

Comments

Mike Holmes Jan. 27, 2015, 9:55 a.m. UTC | #1
Can we get a review of this asap - especially you if you have time Petri,
we can squash it in and apply Events with this change without breaking a
bisect in future.

On 27 January 2015 at 04:47, <bala.manoharan@linaro.org> wrote:

> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Replaces odp_buffer_t and odp_buffer_pool_t into odp_event_t and
> odp_pool_t respectively
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>  .../classification/odp_classification_tests.c      | 39
> +++++++++++-----------
>  1 file changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_tests.c
> b/test/validation/classification/odp_classification_tests.c
> index 4ab8b0d..8a65920 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -58,7 +58,7 @@ static odp_pmr_t pmr_list[CLS_ENTRIES];
>  static odp_queue_t queue_list[CLS_ENTRIES];
>  static odp_pmr_set_t pmr_set;
>
> -static odp_buffer_pool_t pool_default;
> +static odp_pool_t pool_default;
>  static odp_pktio_t pktio_loop;
>
>  /** sequence number of IP packets */
> @@ -104,18 +104,18 @@ int parse_ipv4_string(const char *ipaddress,
> uint32_t *addr, uint32_t *mask)
>  static inline
>  void enqueue_loop_interface(odp_packet_t pkt)
>  {
> +       odp_event_t ev;
>         odp_queue_t defqueue = odp_pktio_outq_getdef(pktio_loop);
> -       odp_queue_enq(defqueue, odp_packet_to_buffer(pkt));
> +       ev = odp_packet_to_event(pkt);
> +       CU_ASSERT(odp_queue_enq(defqueue, ev) == 0);
>  }
>
>  static inline
>  odp_packet_t receive_packet(odp_queue_t *queue, uint64_t ns)
>  {
> -       odp_buffer_t buf;
> -       odp_packet_t pkt;
> -       buf = odp_schedule(queue, ns);
> -       pkt = odp_packet_from_buffer(buf);
> -       return pkt;
> +       odp_event_t ev;
> +       ev = odp_schedule(queue, ns);
> +       return odp_packet_from_event(ev);
>  }
>
>  static int cls_pkt_set_seq(odp_packet_t pkt)
> @@ -238,26 +238,27 @@ odp_packet_t create_packet(bool vlan)
>
>  int classification_tests_init(void)
>  {
> -       odp_buffer_pool_t pool;
> -       odp_buffer_pool_param_t param;
> +       odp_pool_t pool;
> +       odp_pool_param_t param;
>         odp_queue_t inq_def;
>         odp_queue_param_t qparam;
>         char queuename[ODP_QUEUE_NAME_LEN];
>         int i;
>
> -       param.buf_size = SHM_PKT_BUF_SIZE;
> -       param.num_bufs = SHM_PKT_NUM_BUFS;
> -       param.buf_type = ODP_BUFFER_TYPE_PACKET;
> -       param.buf_align = 0;
> -       pool = odp_buffer_pool_create("classification_pool",
> +       param.buf.size = SHM_PKT_BUF_SIZE;
> +       param.buf.num = SHM_PKT_NUM_BUFS;
> +       param.buf.align = 0;
> +       param.type = ODP_POOL_PACKET;
> +
> +       pool = odp_pool_create("classification_pool",
>                                       ODP_SHM_NULL, &param);
> -       if (ODP_BUFFER_POOL_INVALID == pool) {
> +       if (ODP_POOL_INVALID == pool) {
>                 fprintf(stderr, "Packet pool creation failed.\n");
>                 return -1;
>         }
>
> -       pool_default = odp_buffer_pool_lookup("classification_pool");
> -       if (pool_default == ODP_BUFFER_POOL_INVALID)
> +       pool_default = odp_pool_lookup("classification_pool");
> +       if (pool_default == ODP_POOL_INVALID)
>                 goto error_pool_default;
>
>         pktio_loop = odp_pktio_open("loop", pool_default);
> @@ -284,7 +285,7 @@ int classification_tests_init(void)
>         return 0;
>
>  error_pktio_loop:
> -       odp_buffer_pool_destroy(pool_default);
> +       odp_pool_destroy(pool_default);
>
>  error_pool_default:
>         return -1;
> @@ -296,7 +297,7 @@ int classification_tests_finalize(void)
>         if (0 > odp_pktio_close(pktio_loop))
>                 return -1;
>
> -       if (0 != odp_buffer_pool_destroy(pool_default))
> +       if (0 != odp_pool_destroy(pool_default))
>                 return -1;
>
>         for (i = 0; i < CLS_ENTRIES; i++)
> --
> 2.0.1.472.g6f92e5f
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Jan. 27, 2015, noon UTC | #2
Most of changes are renaming to fit new patch. I think it's ok to be 
merged to event commit.

Maxim.

On 01/27/2015 12:47 PM, bala.manoharan@linaro.org wrote:
> From: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>
> Replaces odp_buffer_t and odp_buffer_pool_t into odp_event_t and odp_pool_t respectively
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
> ---
>   .../classification/odp_classification_tests.c      | 39 +++++++++++-----------
>   1 file changed, 20 insertions(+), 19 deletions(-)
>
> diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
> index 4ab8b0d..8a65920 100644
> --- a/test/validation/classification/odp_classification_tests.c
> +++ b/test/validation/classification/odp_classification_tests.c
> @@ -58,7 +58,7 @@ static odp_pmr_t pmr_list[CLS_ENTRIES];
>   static odp_queue_t queue_list[CLS_ENTRIES];
>   static odp_pmr_set_t pmr_set;
>   
> -static odp_buffer_pool_t pool_default;
> +static odp_pool_t pool_default;
>   static odp_pktio_t pktio_loop;
>   
>   /** sequence number of IP packets */
> @@ -104,18 +104,18 @@ int parse_ipv4_string(const char *ipaddress, uint32_t *addr, uint32_t *mask)
>   static inline
>   void enqueue_loop_interface(odp_packet_t pkt)
>   {
> +	odp_event_t ev;
>   	odp_queue_t defqueue = odp_pktio_outq_getdef(pktio_loop);
> -	odp_queue_enq(defqueue, odp_packet_to_buffer(pkt));
> +	ev = odp_packet_to_event(pkt);
> +	CU_ASSERT(odp_queue_enq(defqueue, ev) == 0);
>   }
>   
>   static inline
>   odp_packet_t receive_packet(odp_queue_t *queue, uint64_t ns)
>   {
> -	odp_buffer_t buf;
> -	odp_packet_t pkt;
> -	buf = odp_schedule(queue, ns);
> -	pkt = odp_packet_from_buffer(buf);
> -	return pkt;
> +	odp_event_t ev;
> +	ev = odp_schedule(queue, ns);
> +	return odp_packet_from_event(ev);
>   }
>   
>   static int cls_pkt_set_seq(odp_packet_t pkt)
> @@ -238,26 +238,27 @@ odp_packet_t create_packet(bool vlan)
>   
>   int classification_tests_init(void)
>   {
> -	odp_buffer_pool_t pool;
> -	odp_buffer_pool_param_t param;
> +	odp_pool_t pool;
> +	odp_pool_param_t param;
>   	odp_queue_t inq_def;
>   	odp_queue_param_t qparam;
>   	char queuename[ODP_QUEUE_NAME_LEN];
>   	int i;
>   
> -	param.buf_size = SHM_PKT_BUF_SIZE;
> -	param.num_bufs = SHM_PKT_NUM_BUFS;
> -	param.buf_type = ODP_BUFFER_TYPE_PACKET;
> -	param.buf_align = 0;
> -	pool = odp_buffer_pool_create("classification_pool",
> +	param.buf.size = SHM_PKT_BUF_SIZE;
> +	param.buf.num = SHM_PKT_NUM_BUFS;
> +	param.buf.align = 0;
> +	param.type = ODP_POOL_PACKET;
> +
> +	pool = odp_pool_create("classification_pool",
>   				      ODP_SHM_NULL, &param);
> -	if (ODP_BUFFER_POOL_INVALID == pool) {
> +	if (ODP_POOL_INVALID == pool) {
>   		fprintf(stderr, "Packet pool creation failed.\n");
>   		return -1;
>   	}
>   
> -	pool_default = odp_buffer_pool_lookup("classification_pool");
> -	if (pool_default == ODP_BUFFER_POOL_INVALID)
> +	pool_default = odp_pool_lookup("classification_pool");
> +	if (pool_default == ODP_POOL_INVALID)
>   		goto error_pool_default;
>   
>   	pktio_loop = odp_pktio_open("loop", pool_default);
> @@ -284,7 +285,7 @@ int classification_tests_init(void)
>   	return 0;
>   
>   error_pktio_loop:
> -	odp_buffer_pool_destroy(pool_default);
> +	odp_pool_destroy(pool_default);
>   
>   error_pool_default:
>   	return -1;
> @@ -296,7 +297,7 @@ int classification_tests_finalize(void)
>   	if (0 > odp_pktio_close(pktio_loop))
>   		return -1;
>   
> -	if (0 != odp_buffer_pool_destroy(pool_default))
> +	if (0 != odp_pool_destroy(pool_default))
>   		return -1;
>   
>   	for (i = 0; i < CLS_ENTRIES; i++)
diff mbox

Patch

diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c
index 4ab8b0d..8a65920 100644
--- a/test/validation/classification/odp_classification_tests.c
+++ b/test/validation/classification/odp_classification_tests.c
@@ -58,7 +58,7 @@  static odp_pmr_t pmr_list[CLS_ENTRIES];
 static odp_queue_t queue_list[CLS_ENTRIES];
 static odp_pmr_set_t pmr_set;
 
-static odp_buffer_pool_t pool_default;
+static odp_pool_t pool_default;
 static odp_pktio_t pktio_loop;
 
 /** sequence number of IP packets */
@@ -104,18 +104,18 @@  int parse_ipv4_string(const char *ipaddress, uint32_t *addr, uint32_t *mask)
 static inline
 void enqueue_loop_interface(odp_packet_t pkt)
 {
+	odp_event_t ev;
 	odp_queue_t defqueue = odp_pktio_outq_getdef(pktio_loop);
-	odp_queue_enq(defqueue, odp_packet_to_buffer(pkt));
+	ev = odp_packet_to_event(pkt);
+	CU_ASSERT(odp_queue_enq(defqueue, ev) == 0);
 }
 
 static inline
 odp_packet_t receive_packet(odp_queue_t *queue, uint64_t ns)
 {
-	odp_buffer_t buf;
-	odp_packet_t pkt;
-	buf = odp_schedule(queue, ns);
-	pkt = odp_packet_from_buffer(buf);
-	return pkt;
+	odp_event_t ev;
+	ev = odp_schedule(queue, ns);
+	return odp_packet_from_event(ev);
 }
 
 static int cls_pkt_set_seq(odp_packet_t pkt)
@@ -238,26 +238,27 @@  odp_packet_t create_packet(bool vlan)
 
 int classification_tests_init(void)
 {
-	odp_buffer_pool_t pool;
-	odp_buffer_pool_param_t param;
+	odp_pool_t pool;
+	odp_pool_param_t param;
 	odp_queue_t inq_def;
 	odp_queue_param_t qparam;
 	char queuename[ODP_QUEUE_NAME_LEN];
 	int i;
 
-	param.buf_size = SHM_PKT_BUF_SIZE;
-	param.num_bufs = SHM_PKT_NUM_BUFS;
-	param.buf_type = ODP_BUFFER_TYPE_PACKET;
-	param.buf_align = 0;
-	pool = odp_buffer_pool_create("classification_pool",
+	param.buf.size = SHM_PKT_BUF_SIZE;
+	param.buf.num = SHM_PKT_NUM_BUFS;
+	param.buf.align = 0;
+	param.type = ODP_POOL_PACKET;
+
+	pool = odp_pool_create("classification_pool",
 				      ODP_SHM_NULL, &param);
-	if (ODP_BUFFER_POOL_INVALID == pool) {
+	if (ODP_POOL_INVALID == pool) {
 		fprintf(stderr, "Packet pool creation failed.\n");
 		return -1;
 	}
 
-	pool_default = odp_buffer_pool_lookup("classification_pool");
-	if (pool_default == ODP_BUFFER_POOL_INVALID)
+	pool_default = odp_pool_lookup("classification_pool");
+	if (pool_default == ODP_POOL_INVALID)
 		goto error_pool_default;
 
 	pktio_loop = odp_pktio_open("loop", pool_default);
@@ -284,7 +285,7 @@  int classification_tests_init(void)
 	return 0;
 
 error_pktio_loop:
-	odp_buffer_pool_destroy(pool_default);
+	odp_pool_destroy(pool_default);
 
 error_pool_default:
 	return -1;
@@ -296,7 +297,7 @@  int classification_tests_finalize(void)
 	if (0 > odp_pktio_close(pktio_loop))
 		return -1;
 
-	if (0 != odp_buffer_pool_destroy(pool_default))
+	if (0 != odp_pool_destroy(pool_default))
 		return -1;
 
 	for (i = 0; i < CLS_ENTRIES; i++)