[dpdk-dev,v2] sched: add neon optimizations

Message ID 20170428061548.44424-1-ashwin.sekhar@caviumnetworks.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Ashwin Sekhar T K April 28, 2017, 6:15 a.m. UTC
  * Removed setting CONFIG_RTE_SCHED_VECTOR=n from armv8a config
  so that the setting from common_base is taken as the default
  setting for armv8a
* Verified the changes with sched_autotest unit test case

Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
---
v2:
* Removed line CONFIG_RTE_SCHED_VECTOR=n from config/defconfig_arm64-armv8a-linuxapp-gcc
* Modified the commit message and body to reflect the changes

 config/defconfig_arm64-armv8a-linuxapp-gcc |  2 --
 lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
  

Comments

Jianbo Liu April 28, 2017, 8:50 a.m. UTC | #1
On 28 April 2017 at 14:15, Ashwin Sekhar T K
<ashwin.sekhar@caviumnetworks.com> wrote:
> * Removed setting CONFIG_RTE_SCHED_VECTOR=n from armv8a config
>   so that the setting from common_base is taken as the default
>   setting for armv8a
> * Verified the changes with sched_autotest unit test case
>
> Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
> ---
> v2:
> * Removed line CONFIG_RTE_SCHED_VECTOR=n from config/defconfig_arm64-armv8a-linuxapp-gcc
> * Modified the commit message and body to reflect the changes
>
>  config/defconfig_arm64-armv8a-linuxapp-gcc |  2 --
>  lib/librte_sched/rte_sched.c               | 22 ++++++++++++++++++++++
>  2 files changed, 22 insertions(+), 2 deletions(-)
>
> diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
> index 65888ce..6415f46 100644
> --- a/config/defconfig_arm64-armv8a-linuxapp-gcc
> +++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
> @@ -47,5 +47,3 @@ CONFIG_RTE_EAL_IGB_UIO=n
>  CONFIG_RTE_LIBRTE_FM10K_PMD=n
>  CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
>  CONFIG_RTE_LIBRTE_AVP_PMD=n
> -
> -CONFIG_RTE_SCHED_VECTOR=n
> diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
> index 614705d..4ba476a 100644
> --- a/lib/librte_sched/rte_sched.c
> +++ b/lib/librte_sched/rte_sched.c
> @@ -58,6 +58,8 @@
>
>  #if defined(__SSE4__)
>  #define SCHED_VECTOR_SSE4
> +#elif defined(RTE_MACHINE_CPUFLAG_NEON)
> +#define SCHED_VECTOR_NEON
>  #endif
>
>  #endif
> @@ -1732,6 +1734,26 @@ grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
>         return 1;
>  }
>
> +#elif defined(SCHED_VECTOR_NEON)
> +
> +static inline int
> +grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
> +{
> +       uint32x4_t index, pipes;
> +       uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos;
> +
> +       index = vmovq_n_u32(base_pipe);
> +       pipes = vld1q_u32(pos);
> +       if (!vminvq_u32(veorq_u32(pipes, index)))
> +               return 1;
> +
> +       pipes = vld1q_u32(pos + 4);
> +       if (!vminvq_u32(veorq_u32(pipes, index)))
> +               return 1;
> +
> +       return 0;
> +}
> +
>  #else
>
>  static inline int
> --
> 2.7.4
>

Acked-by: Jianbo Liu <jianbo.liu@linaro.org>
  
Thomas Monjalon July 3, 2017, 1:15 p.m. UTC | #2
28/04/2017 10:50, Jianbo Liu:
> On 28 April 2017 at 14:15, Ashwin Sekhar T K
> <ashwin.sekhar@caviumnetworks.com> wrote:
> > * Removed setting CONFIG_RTE_SCHED_VECTOR=n from armv8a config
> >   so that the setting from common_base is taken as the default
> >   setting for armv8a
> > * Verified the changes with sched_autotest unit test case
> >
> > Signed-off-by: Ashwin Sekhar T K <ashwin.sekhar@caviumnetworks.com>
> 
> Acked-by: Jianbo Liu <jianbo.liu@linaro.org>

Applied, thanks
  

Patch

diff --git a/config/defconfig_arm64-armv8a-linuxapp-gcc b/config/defconfig_arm64-armv8a-linuxapp-gcc
index 65888ce..6415f46 100644
--- a/config/defconfig_arm64-armv8a-linuxapp-gcc
+++ b/config/defconfig_arm64-armv8a-linuxapp-gcc
@@ -47,5 +47,3 @@  CONFIG_RTE_EAL_IGB_UIO=n
 CONFIG_RTE_LIBRTE_FM10K_PMD=n
 CONFIG_RTE_LIBRTE_SFC_EFX_PMD=n
 CONFIG_RTE_LIBRTE_AVP_PMD=n
-
-CONFIG_RTE_SCHED_VECTOR=n
diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c
index 614705d..4ba476a 100644
--- a/lib/librte_sched/rte_sched.c
+++ b/lib/librte_sched/rte_sched.c
@@ -58,6 +58,8 @@ 
 
 #if defined(__SSE4__)
 #define SCHED_VECTOR_SSE4
+#elif defined(RTE_MACHINE_CPUFLAG_NEON)
+#define SCHED_VECTOR_NEON
 #endif
 
 #endif
@@ -1732,6 +1734,26 @@  grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
 	return 1;
 }
 
+#elif defined(SCHED_VECTOR_NEON)
+
+static inline int
+grinder_pipe_exists(struct rte_sched_port *port, uint32_t base_pipe)
+{
+	uint32x4_t index, pipes;
+	uint32_t *pos = (uint32_t *)port->grinder_base_bmp_pos;
+
+	index = vmovq_n_u32(base_pipe);
+	pipes = vld1q_u32(pos);
+	if (!vminvq_u32(veorq_u32(pipes, index)))
+		return 1;
+
+	pipes = vld1q_u32(pos + 4);
+	if (!vminvq_u32(veorq_u32(pipes, index)))
+		return 1;
+
+	return 0;
+}
+
 #else
 
 static inline int