diff mbox

[API-NEXT] Revert user area init implementation

Message ID 1452606859-22778-1-git-send-email-zoltan.kiss@linaro.org
State New
Headers show

Commit Message

Zoltan Kiss Jan. 12, 2016, 1:54 p.m. UTC
This reverts commits:

2eb52b7277 "linux-generic: pool: implement user area init support"
9127b7408b "validation: packet: test if user area is properly set"

Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
---
 platform/linux-generic/odp_pool.c | 11 -----------
 test/validation/packet/packet.c   | 18 ++++--------------
 2 files changed, 4 insertions(+), 25 deletions(-)

Comments

Maxim Uvarov Jan. 12, 2016, 3:07 p.m. UTC | #1
Ok, I just reverted that 2 patches to better see match between original 
patch and reverted.
Added your sign-off there.

Maxim.

On 01/12/2016 16:54, Zoltan Kiss wrote:
> This reverts commits:
>
> 2eb52b7277 "linux-generic: pool: implement user area init support"
> 9127b7408b "validation: packet: test if user area is properly set"
>
> Signed-off-by: Zoltan Kiss <zoltan.kiss@linaro.org>
> ---
>   platform/linux-generic/odp_pool.c | 11 -----------
>   test/validation/packet/packet.c   | 18 ++++--------------
>   2 files changed, 4 insertions(+), 25 deletions(-)
>
> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
> index 125d8e6..84d35bf 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -147,15 +147,6 @@ int odp_pool_term_local(void)
>   	return 0;
>   }
>   
> -static void packet_uarea_init(odp_pool_param_t *params, odp_buffer_hdr_t *tmp)
> -{
> -	if (params->type == ODP_POOL_PACKET && params->pkt.uarea_init) {
> -		odp_packet_t pkt = _odp_packet_from_buffer(odp_hdr_to_buf(tmp));
> -
> -		params->pkt.uarea_init(pkt, params->pkt.uarea_init_arg);
> -	}
> -}
> -
>   /**
>    * Pool creation
>    */
> @@ -376,8 +367,6 @@ odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
>   				}
>   			}
>   
> -			packet_uarea_init(params, tmp);
> -
>   			/* Push buffer onto pool's freelist */
>   			ret_buf(&pool->s, tmp);
>   			buf  -= buf_stride;
> diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
> index 71282dc..2467dec 100644
> --- a/test/validation/packet/packet.c
> +++ b/test/validation/packet/packet.c
> @@ -33,14 +33,6 @@ static struct udata_struct {
>   	"abcdefg",
>   };
>   
> -static void packet_uarea_init(odp_packet_t pkt, void *uarea_init_arg)
> -{
> -	void *uarea = odp_packet_user_area(pkt);
> -	uint32_t uarea_size = odp_packet_user_area_size(pkt);
> -
> -	memcpy(uarea, uarea_init_arg, uarea_size);
> -}
> -
>   int packet_suite_init(void)
>   {
>   	odp_pool_param_t params = {
> @@ -49,8 +41,6 @@ int packet_suite_init(void)
>   			.len     = PACKET_BUF_LEN,
>   			.num     = 100,
>   			.uarea_size = sizeof(struct udata_struct),
> -			.uarea_init = packet_uarea_init,
> -			.uarea_init_arg = (void *)&test_packet_udata
>   		},
>   		.type  = ODP_POOL_PACKET,
>   	};
> @@ -80,16 +70,16 @@ int packet_suite_init(void)
>   
>   	udat = odp_packet_user_area(test_packet);
>   	udat_size = odp_packet_user_area_size(test_packet);
> -	if (!udat || udat_size != sizeof(struct udata_struct) ||
> -	    memcmp(udat, (void *)&test_packet_udata, udat_size))
> +	if (!udat || udat_size != sizeof(struct udata_struct))
>   		return -1;
>   	odp_pool_print(packet_pool);
> +	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
>   
>   	udat = odp_packet_user_area(segmented_test_packet);
>   	udat_size = odp_packet_user_area_size(segmented_test_packet);
> -	if (!udat || udat_size != sizeof(struct udata_struct) ||
> -	    memcmp(udat, (void *)&test_packet_udata, udat_size))
> +	if (udat == NULL || udat_size != sizeof(struct udata_struct))
>   		return -1;
> +	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
>   
>   	return 0;
>   }
diff mbox

Patch

diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index 125d8e6..84d35bf 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -147,15 +147,6 @@  int odp_pool_term_local(void)
 	return 0;
 }
 
-static void packet_uarea_init(odp_pool_param_t *params, odp_buffer_hdr_t *tmp)
-{
-	if (params->type == ODP_POOL_PACKET && params->pkt.uarea_init) {
-		odp_packet_t pkt = _odp_packet_from_buffer(odp_hdr_to_buf(tmp));
-
-		params->pkt.uarea_init(pkt, params->pkt.uarea_init_arg);
-	}
-}
-
 /**
  * Pool creation
  */
@@ -376,8 +367,6 @@  odp_pool_t odp_pool_create(const char *name, odp_pool_param_t *params)
 				}
 			}
 
-			packet_uarea_init(params, tmp);
-
 			/* Push buffer onto pool's freelist */
 			ret_buf(&pool->s, tmp);
 			buf  -= buf_stride;
diff --git a/test/validation/packet/packet.c b/test/validation/packet/packet.c
index 71282dc..2467dec 100644
--- a/test/validation/packet/packet.c
+++ b/test/validation/packet/packet.c
@@ -33,14 +33,6 @@  static struct udata_struct {
 	"abcdefg",
 };
 
-static void packet_uarea_init(odp_packet_t pkt, void *uarea_init_arg)
-{
-	void *uarea = odp_packet_user_area(pkt);
-	uint32_t uarea_size = odp_packet_user_area_size(pkt);
-
-	memcpy(uarea, uarea_init_arg, uarea_size);
-}
-
 int packet_suite_init(void)
 {
 	odp_pool_param_t params = {
@@ -49,8 +41,6 @@  int packet_suite_init(void)
 			.len     = PACKET_BUF_LEN,
 			.num     = 100,
 			.uarea_size = sizeof(struct udata_struct),
-			.uarea_init = packet_uarea_init,
-			.uarea_init_arg = (void *)&test_packet_udata
 		},
 		.type  = ODP_POOL_PACKET,
 	};
@@ -80,16 +70,16 @@  int packet_suite_init(void)
 
 	udat = odp_packet_user_area(test_packet);
 	udat_size = odp_packet_user_area_size(test_packet);
-	if (!udat || udat_size != sizeof(struct udata_struct) ||
-	    memcmp(udat, (void *)&test_packet_udata, udat_size))
+	if (!udat || udat_size != sizeof(struct udata_struct))
 		return -1;
 	odp_pool_print(packet_pool);
+	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
 	udat = odp_packet_user_area(segmented_test_packet);
 	udat_size = odp_packet_user_area_size(segmented_test_packet);
-	if (!udat || udat_size != sizeof(struct udata_struct) ||
-	    memcmp(udat, (void *)&test_packet_udata, udat_size))
+	if (udat == NULL || udat_size != sizeof(struct udata_struct))
 		return -1;
+	memcpy(udat, &test_packet_udata, sizeof(struct udata_struct));
 
 	return 0;
 }