[v5,1/5] examples/l3fwd: fix port group mask generation

Message ID 20221011101207.4489-1-pbhagavatula@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [v5,1/5] examples/l3fwd: fix port group mask generation |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Bhagavatula Oct. 11, 2022, 10:12 a.m. UTC
  From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Fix port group mask generation in altivec, vec_any_eq returns
0 or 1 while port_groupx4 expects comparison mask result.

Fixes: 2193b7467f7a ("examples/l3fwd: optimize packet processing on powerpc")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 v5 Changes:
 - Fix compilation errors.

 v4 Changes:
 - Fix missing `rte_free`.

 v3 Changes:
 - PPC optimize port mask generation.
 - Fix aarch32 compilation.

 v2 Changes:
 - Fix PPC, RISC-V, aarch32 compilation.

 examples/common/altivec/port_group.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

--
2.25.1
  

Comments

Shijith Thotton Oct. 17, 2022, 12:05 p.m. UTC | #1
>
>Fix port group mask generation in altivec, vec_any_eq returns
>0 or 1 while port_groupx4 expects comparison mask result.
>
>Fixes: 2193b7467f7a ("examples/l3fwd: optimize packet processing on powerpc")
>Cc: stable@dpdk.org
>
>Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>

Acked-by: Shijith Thotton <sthotton@marvell.com>

>---
> v5 Changes:
> - Fix compilation errors.
>
> v4 Changes:
> - Fix missing `rte_free`.
>
> v3 Changes:
> - PPC optimize port mask generation.
> - Fix aarch32 compilation.
>
> v2 Changes:
> - Fix PPC, RISC-V, aarch32 compilation.
>
> examples/common/altivec/port_group.h | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
>diff --git a/examples/common/altivec/port_group.h
>b/examples/common/altivec/port_group.h
>index 5e209b02fa..1c05bc025a 100644
>--- a/examples/common/altivec/port_group.h
>+++ b/examples/common/altivec/port_group.h
>@@ -26,12 +26,17 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp,
> 		uint16_t u16[FWDSTEP + 1];
> 		uint64_t u64;
> 	} *pnum = (void *)pn;
>-
>+	__vector unsigned long long result;
>+	const __vector unsigned int perm_mask = {0x00204060, 0x80808080,
>+						 0x80808080, 0x80808080};
> 	int32_t v;
>
>-	v = vec_any_eq(dp1, dp2);
>-
>+	dp1 = (__vector unsigned short)vec_cmpeq(dp1, dp2);
>+	dp1 = vec_mergeh(dp1, dp1);
>+	result = (__vector unsigned long long)vec_vbpermq(
>+		(__vector unsigned char)dp1, (__vector unsigned
>char)perm_mask);
>
>+	v = result[1];
> 	/* update last port counter. */
> 	lp[0] += gptbl[v].lpv;
>
>--
>2.25.1
  
Pavan Nikhilesh Bhagavatula Oct. 20, 2022, 4:15 p.m. UTC | #2
> -----Original Message-----
> From: Shijith Thotton <sthotton@marvell.com>
> Sent: Monday, October 17, 2022 5:36 PM
> To: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>; Jerin Jacob
> Kollanukkaran <jerinj@marvell.com>; David Christensen
> <drc@linux.vnet.ibm.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavatula@marvell.com>; stable@dpdk.org
> Subject: RE: [EXT] [PATCH v5 1/5] examples/l3fwd: fix port group mask
> generation
> 
> >
> >Fix port group mask generation in altivec, vec_any_eq returns
> >0 or 1 while port_groupx4 expects comparison mask result.
> >
> >Fixes: 2193b7467f7a ("examples/l3fwd: optimize packet processing on
> powerpc")
> >Cc: stable@dpdk.org
> >
> >Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Acked-by: Shijith Thotton <sthotton@marvell.com>
> 

Thomas, 

Will this series make it into 22.11 release?

> >---
> > v5 Changes:
> > - Fix compilation errors.
> >
> > v4 Changes:
> > - Fix missing `rte_free`.
> >
> > v3 Changes:
> > - PPC optimize port mask generation.
> > - Fix aarch32 compilation.
> >
> > v2 Changes:
> > - Fix PPC, RISC-V, aarch32 compilation.
> >
> > examples/common/altivec/port_group.h | 11 ++++++++---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> >diff --git a/examples/common/altivec/port_group.h
> >b/examples/common/altivec/port_group.h
> >index 5e209b02fa..1c05bc025a 100644
> >--- a/examples/common/altivec/port_group.h
> >+++ b/examples/common/altivec/port_group.h
> >@@ -26,12 +26,17 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t
> *lp,
> > 		uint16_t u16[FWDSTEP + 1];
> > 		uint64_t u64;
> > 	} *pnum = (void *)pn;
> >-
> >+	__vector unsigned long long result;
> >+	const __vector unsigned int perm_mask = {0x00204060, 0x80808080,
> >+						 0x80808080, 0x80808080};
> > 	int32_t v;
> >
> >-	v = vec_any_eq(dp1, dp2);
> >-
> >+	dp1 = (__vector unsigned short)vec_cmpeq(dp1, dp2);
> >+	dp1 = vec_mergeh(dp1, dp1);
> >+	result = (__vector unsigned long long)vec_vbpermq(
> >+		(__vector unsigned char)dp1, (__vector unsigned
> >char)perm_mask);
> >
> >+	v = result[1];
> > 	/* update last port counter. */
> > 	lp[0] += gptbl[v].lpv;
> >
> >--
> >2.25.1
  

Patch

diff --git a/examples/common/altivec/port_group.h b/examples/common/altivec/port_group.h
index 5e209b02fa..1c05bc025a 100644
--- a/examples/common/altivec/port_group.h
+++ b/examples/common/altivec/port_group.h
@@ -26,12 +26,17 @@  port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp,
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
 	} *pnum = (void *)pn;
-
+	__vector unsigned long long result;
+	const __vector unsigned int perm_mask = {0x00204060, 0x80808080,
+						 0x80808080, 0x80808080};
 	int32_t v;

-	v = vec_any_eq(dp1, dp2);
-
+	dp1 = (__vector unsigned short)vec_cmpeq(dp1, dp2);
+	dp1 = vec_mergeh(dp1, dp1);
+	result = (__vector unsigned long long)vec_vbpermq(
+		(__vector unsigned char)dp1, (__vector unsigned char)perm_mask);

+	v = result[1];
 	/* update last port counter. */
 	lp[0] += gptbl[v].lpv;