[dpdk-dev,v3,03/12] linuxapp: eal: arm: Always return 0 for rte_eal_iopl_init()

Message ID 1452184390-5994-4-git-send-email-sshukla@mvista.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Santosh Shukla Jan. 7, 2016, 4:33 p.m. UTC
  iopl() syscall not supported in linux-arm/arm64 so always return 0 value.

Signed-off-by: Santosh Shukla <sshukla@mvista.com>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
---
 lib/librte_eal/linuxapp/eal/eal.c |    3 +++
 1 file changed, 3 insertions(+)
  

Comments

Stephen Hemminger Jan. 7, 2016, 6:14 p.m. UTC | #1
On Thu,  7 Jan 2016 22:03:00 +0530
Santosh Shukla <sshukla@mvista.com> wrote:

>  #else
> +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
> +	return 0; /* iopl syscall not supported for ARM/ARM64 */
> +#endif
>  	return -1;
>  #endif

Minor net why not:

#elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
	return -1
#else

That way you won't generate two return statements and potentially
trigger warnings from static checkers.
  
Santosh Shukla Jan. 9, 2016, 1:18 p.m. UTC | #2
On Thu, Jan 7, 2016 at 11:44 PM, Stephen Hemminger
<stephen@networkplumber.org> wrote:
> On Thu,  7 Jan 2016 22:03:00 +0530
> Santosh Shukla <sshukla@mvista.com> wrote:
>
>>  #else
>> +#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
>> +     return 0; /* iopl syscall not supported for ARM/ARM64 */
>> +#endif
>>       return -1;
>>  #endif
>
> Minor net why not:
>
> #elif defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
>         return -1
> #else
>
> That way you won't generate two return statements and potentially
> trigger warnings from static checkers.

returning -1 would fail for arm/arm64. I guess you meant return 0,
right? if so then would need one more return for non-x86/non-arm case.

Also I am working on another patchset suggested by Jerin [1] on iopl()
in v2 series, That new patchset intended to get rid-off ifdef X_86
clutter for sys/io.h and more iop() definition to arch/platform file.
I don't want to include those changes in v3 series as because it seems
like two different topic.

[1] http://dpdk.org/dev/patchwork/patch/9533/
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 635ec36..2617037 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -716,6 +716,9 @@  rte_eal_iopl_init(void)
 		return -1;
 	return 0;
 #else
+#if defined(RTE_ARCH_ARM) || defined(RTE_ARCH_ARM64)
+	return 0; /* iopl syscall not supported for ARM/ARM64 */
+#endif
 	return -1;
 #endif
 }