diff mbox

examples: remove the use of ODP_UNUSED

Message ID 1416856771-39605-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 25cac3b6138678b2c8cfc6edd650d406164cfa32
Headers show

Commit Message

Mike Holmes Nov. 24, 2014, 7:19 p.m. UTC
ODP_UNUSED should be used internally to an ODP implementation and not by
an application. The declaration should never have specified ODP_UNUSED for
find_ipsec_cache_entry_out()

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 example/example_debug.h         | 5 +++++
 example/ipsec/odp_ipsec.c       | 5 +++--
 example/ipsec/odp_ipsec_cache.c | 2 +-
 example/ipsec/odp_ipsec_cache.h | 2 +-
 4 files changed, 10 insertions(+), 4 deletions(-)

Comments

Maxim Uvarov Nov. 24, 2014, 9:38 p.m. UTC | #1
Can it be simple UNUSED? And why we can not use ODP_UNUSED here?

Maxim.

On 11/24/2014 10:19 PM, Mike Holmes wrote:
> ODP_UNUSED should be used internally to an ODP implementation and not by
> an application. The declaration should never have specified ODP_UNUSED for
> find_ipsec_cache_entry_out()
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   example/example_debug.h         | 5 +++++
>   example/ipsec/odp_ipsec.c       | 5 +++--
>   example/ipsec/odp_ipsec_cache.c | 2 +-
>   example/ipsec/odp_ipsec_cache.h | 2 +-
>   4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/example/example_debug.h b/example/example_debug.h
> index b83667c..dd3aa7f 100644
> --- a/example/example_debug.h
> +++ b/example/example_debug.h
> @@ -78,6 +78,11 @@ do { \
>   		EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__)
>   
>   /**
> + * Intentionally unused variables to functions
> + */
> +#define EXAMPLE_UNUSED     __attribute__((__unused__))
> +
> +/**
>    * @}
>    */
>   
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index ec115fc..ad62436 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -619,7 +619,8 @@ void initialize_intf(char *intf)
>    * @return PKT_CONTINUE if good, supported packet else PKT_DROP
>    */
>   static
> -pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx ODP_UNUSED)
> +pkt_disposition_e do_input_verify(odp_packet_t pkt,
> +				  pkt_ctx_t *ctx EXAMPLE_UNUSED)
>   {
>   	if (odp_unlikely(odp_packet_error(pkt)))
>   		return PKT_DROP;
> @@ -1037,7 +1038,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
>    * @return NULL (should never return)
>    */
>   static
> -void *pktio_thread(void *arg ODP_UNUSED)
> +void *pktio_thread(void *arg EXAMPLE_UNUSED)
>   {
>   	int thr;
>   	odp_packet_t pkt;
> diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
> index fb53bb6..7a0c813 100644
> --- a/example/ipsec/odp_ipsec_cache.c
> +++ b/example/ipsec/odp_ipsec_cache.c
> @@ -171,7 +171,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>   
>   ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>   						uint32_t dst_ip,
> -						uint8_t proto ODP_UNUSED)
> +						uint8_t proto EXAMPLE_UNUSED)
>   {
>   	ipsec_cache_entry_t *entry = ipsec_cache->out_list;
>   
> diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
> index 5791cf8..2cbaabd 100644
> --- a/example/ipsec/odp_ipsec_cache.h
> +++ b/example/ipsec/odp_ipsec_cache.h
> @@ -118,7 +118,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>    */
>   ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>   						uint32_t dst_ip,
> -						uint8_t proto ODP_UNUSED);
> +						uint8_t proto);
>   
>   #ifdef __cplusplus
>   }
Mike Holmes Nov. 24, 2014, 10:02 p.m. UTC | #2
On 24 November 2014 16:38, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> Can it be simple UNUSED?


It could, be but that breaks the pattern with the prefixes we have
established so far.


> And why we can not use ODP_UNUSED here?
>

Because it is something in the current public API that only the
implementation needs, we want to keep the API minimal.
We want to abstract networking acceleration capabilities and not general
programming techniques, it is the same for ODP_DEBUG, ODP_ASSERT etc.


>
> Maxim.
>
>
> On 11/24/2014 10:19 PM, Mike Holmes wrote:
>
>> ODP_UNUSED should be used internally to an ODP implementation and not by
>> an application. The declaration should never have specified ODP_UNUSED for
>> find_ipsec_cache_entry_out()
>>
>> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>> ---
>>   example/example_debug.h         | 5 +++++
>>   example/ipsec/odp_ipsec.c       | 5 +++--
>>   example/ipsec/odp_ipsec_cache.c | 2 +-
>>   example/ipsec/odp_ipsec_cache.h | 2 +-
>>   4 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/example/example_debug.h b/example/example_debug.h
>> index b83667c..dd3aa7f 100644
>> --- a/example/example_debug.h
>> +++ b/example/example_debug.h
>> @@ -78,6 +78,11 @@ do { \
>>                 EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__)
>>     /**
>> + * Intentionally unused variables to functions
>> + */
>> +#define EXAMPLE_UNUSED     __attribute__((__unused__))
>> +
>> +/**
>>    * @}
>>    */
>>   diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
>> index ec115fc..ad62436 100644
>> --- a/example/ipsec/odp_ipsec.c
>> +++ b/example/ipsec/odp_ipsec.c
>> @@ -619,7 +619,8 @@ void initialize_intf(char *intf)
>>    * @return PKT_CONTINUE if good, supported packet else PKT_DROP
>>    */
>>   static
>> -pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx
>> ODP_UNUSED)
>> +pkt_disposition_e do_input_verify(odp_packet_t pkt,
>> +                                 pkt_ctx_t *ctx EXAMPLE_UNUSED)
>>   {
>>         if (odp_unlikely(odp_packet_error(pkt)))
>>                 return PKT_DROP;
>> @@ -1037,7 +1038,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t
>> pkt,
>>    * @return NULL (should never return)
>>    */
>>   static
>> -void *pktio_thread(void *arg ODP_UNUSED)
>> +void *pktio_thread(void *arg EXAMPLE_UNUSED)
>>   {
>>         int thr;
>>         odp_packet_t pkt;
>> diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_
>> cache.c
>> index fb53bb6..7a0c813 100644
>> --- a/example/ipsec/odp_ipsec_cache.c
>> +++ b/example/ipsec/odp_ipsec_cache.c
>> @@ -171,7 +171,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t
>> src_ip,
>>     ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>>                                                 uint32_t dst_ip,
>> -                                               uint8_t proto ODP_UNUSED)
>> +                                               uint8_t proto
>> EXAMPLE_UNUSED)
>>   {
>>         ipsec_cache_entry_t *entry = ipsec_cache->out_list;
>>   diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_
>> cache.h
>> index 5791cf8..2cbaabd 100644
>> --- a/example/ipsec/odp_ipsec_cache.h
>> +++ b/example/ipsec/odp_ipsec_cache.h
>> @@ -118,7 +118,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t
>> src_ip,
>>    */
>>   ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>>                                                 uint32_t dst_ip,
>> -                                               uint8_t proto ODP_UNUSED);
>> +                                               uint8_t proto);
>>     #ifdef __cplusplus
>>   }
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Ciprian Barbu Nov. 26, 2014, 10:03 a.m. UTC | #3
On Mon, Nov 24, 2014 at 9:19 PM, Mike Holmes <mike.holmes@linaro.org> wrote:
> ODP_UNUSED should be used internally to an ODP implementation and not by
> an application. The declaration should never have specified ODP_UNUSED for
> find_ipsec_cache_entry_out()
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>

Reviewed-by: Ciprian Barbu <ciprian.barbu@linaro.org>

> ---
>  example/example_debug.h         | 5 +++++
>  example/ipsec/odp_ipsec.c       | 5 +++--
>  example/ipsec/odp_ipsec_cache.c | 2 +-
>  example/ipsec/odp_ipsec_cache.h | 2 +-
>  4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/example/example_debug.h b/example/example_debug.h
> index b83667c..dd3aa7f 100644
> --- a/example/example_debug.h
> +++ b/example/example_debug.h
> @@ -78,6 +78,11 @@ do { \
>                 EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__)
>
>  /**
> + * Intentionally unused variables to functions
> + */
> +#define EXAMPLE_UNUSED     __attribute__((__unused__))
> +
> +/**
>   * @}
>   */
>
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index ec115fc..ad62436 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -619,7 +619,8 @@ void initialize_intf(char *intf)
>   * @return PKT_CONTINUE if good, supported packet else PKT_DROP
>   */
>  static
> -pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx ODP_UNUSED)
> +pkt_disposition_e do_input_verify(odp_packet_t pkt,
> +                                 pkt_ctx_t *ctx EXAMPLE_UNUSED)
>  {
>         if (odp_unlikely(odp_packet_error(pkt)))
>                 return PKT_DROP;
> @@ -1037,7 +1038,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
>   * @return NULL (should never return)
>   */
>  static
> -void *pktio_thread(void *arg ODP_UNUSED)
> +void *pktio_thread(void *arg EXAMPLE_UNUSED)
>  {
>         int thr;
>         odp_packet_t pkt;
> diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
> index fb53bb6..7a0c813 100644
> --- a/example/ipsec/odp_ipsec_cache.c
> +++ b/example/ipsec/odp_ipsec_cache.c
> @@ -171,7 +171,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>
>  ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>                                                 uint32_t dst_ip,
> -                                               uint8_t proto ODP_UNUSED)
> +                                               uint8_t proto EXAMPLE_UNUSED)
>  {
>         ipsec_cache_entry_t *entry = ipsec_cache->out_list;
>
> diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
> index 5791cf8..2cbaabd 100644
> --- a/example/ipsec/odp_ipsec_cache.h
> +++ b/example/ipsec/odp_ipsec_cache.h
> @@ -118,7 +118,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>   */
>  ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>                                                 uint32_t dst_ip,
> -                                               uint8_t proto ODP_UNUSED);
> +                                               uint8_t proto);
>
>  #ifdef __cplusplus
>  }
> --
> 2.1.0
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Nov. 26, 2014, 12:12 p.m. UTC | #4
Merged, thanks,

Maxim.

On 11/24/2014 10:19 PM, Mike Holmes wrote:
> ODP_UNUSED should be used internally to an ODP implementation and not by
> an application. The declaration should never have specified ODP_UNUSED for
> find_ipsec_cache_entry_out()
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
> ---
>   example/example_debug.h         | 5 +++++
>   example/ipsec/odp_ipsec.c       | 5 +++--
>   example/ipsec/odp_ipsec_cache.c | 2 +-
>   example/ipsec/odp_ipsec_cache.h | 2 +-
>   4 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/example/example_debug.h b/example/example_debug.h
> index b83667c..dd3aa7f 100644
> --- a/example/example_debug.h
> +++ b/example/example_debug.h
> @@ -78,6 +78,11 @@ do { \
>   		EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__)
>   
>   /**
> + * Intentionally unused variables to functions
> + */
> +#define EXAMPLE_UNUSED     __attribute__((__unused__))
> +
> +/**
>    * @}
>    */
>   
> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
> index ec115fc..ad62436 100644
> --- a/example/ipsec/odp_ipsec.c
> +++ b/example/ipsec/odp_ipsec.c
> @@ -619,7 +619,8 @@ void initialize_intf(char *intf)
>    * @return PKT_CONTINUE if good, supported packet else PKT_DROP
>    */
>   static
> -pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx ODP_UNUSED)
> +pkt_disposition_e do_input_verify(odp_packet_t pkt,
> +				  pkt_ctx_t *ctx EXAMPLE_UNUSED)
>   {
>   	if (odp_unlikely(odp_packet_error(pkt)))
>   		return PKT_DROP;
> @@ -1037,7 +1038,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
>    * @return NULL (should never return)
>    */
>   static
> -void *pktio_thread(void *arg ODP_UNUSED)
> +void *pktio_thread(void *arg EXAMPLE_UNUSED)
>   {
>   	int thr;
>   	odp_packet_t pkt;
> diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
> index fb53bb6..7a0c813 100644
> --- a/example/ipsec/odp_ipsec_cache.c
> +++ b/example/ipsec/odp_ipsec_cache.c
> @@ -171,7 +171,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>   
>   ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>   						uint32_t dst_ip,
> -						uint8_t proto ODP_UNUSED)
> +						uint8_t proto EXAMPLE_UNUSED)
>   {
>   	ipsec_cache_entry_t *entry = ipsec_cache->out_list;
>   
> diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
> index 5791cf8..2cbaabd 100644
> --- a/example/ipsec/odp_ipsec_cache.h
> +++ b/example/ipsec/odp_ipsec_cache.h
> @@ -118,7 +118,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
>    */
>   ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
>   						uint32_t dst_ip,
> -						uint8_t proto ODP_UNUSED);
> +						uint8_t proto);
>   
>   #ifdef __cplusplus
>   }
diff mbox

Patch

diff --git a/example/example_debug.h b/example/example_debug.h
index b83667c..dd3aa7f 100644
--- a/example/example_debug.h
+++ b/example/example_debug.h
@@ -78,6 +78,11 @@  do { \
 		EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__)
 
 /**
+ * Intentionally unused variables to functions
+ */
+#define EXAMPLE_UNUSED     __attribute__((__unused__))
+
+/**
  * @}
  */
 
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index ec115fc..ad62436 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -619,7 +619,8 @@  void initialize_intf(char *intf)
  * @return PKT_CONTINUE if good, supported packet else PKT_DROP
  */
 static
-pkt_disposition_e do_input_verify(odp_packet_t pkt, pkt_ctx_t *ctx ODP_UNUSED)
+pkt_disposition_e do_input_verify(odp_packet_t pkt,
+				  pkt_ctx_t *ctx EXAMPLE_UNUSED)
 {
 	if (odp_unlikely(odp_packet_error(pkt)))
 		return PKT_DROP;
@@ -1037,7 +1038,7 @@  pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt,
  * @return NULL (should never return)
  */
 static
-void *pktio_thread(void *arg ODP_UNUSED)
+void *pktio_thread(void *arg EXAMPLE_UNUSED)
 {
 	int thr;
 	odp_packet_t pkt;
diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c
index fb53bb6..7a0c813 100644
--- a/example/ipsec/odp_ipsec_cache.c
+++ b/example/ipsec/odp_ipsec_cache.c
@@ -171,7 +171,7 @@  ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
 
 ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
 						uint32_t dst_ip,
-						uint8_t proto ODP_UNUSED)
+						uint8_t proto EXAMPLE_UNUSED)
 {
 	ipsec_cache_entry_t *entry = ipsec_cache->out_list;
 
diff --git a/example/ipsec/odp_ipsec_cache.h b/example/ipsec/odp_ipsec_cache.h
index 5791cf8..2cbaabd 100644
--- a/example/ipsec/odp_ipsec_cache.h
+++ b/example/ipsec/odp_ipsec_cache.h
@@ -118,7 +118,7 @@  ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
  */
 ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip,
 						uint32_t dst_ip,
-						uint8_t proto ODP_UNUSED);
+						uint8_t proto);
 
 #ifdef __cplusplus
 }