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

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Pavan Nikhilesh Bhagavatula Aug. 29, 2022, 9:44 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>
---
 examples/common/altivec/port_group.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
  

Patch

diff --git a/examples/common/altivec/port_group.h b/examples/common/altivec/port_group.h
index 5e209b02fa..7a6ef390ff 100644
--- a/examples/common/altivec/port_group.h
+++ b/examples/common/altivec/port_group.h
@@ -26,12 +26,19 @@  port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp,
 		uint16_t u16[FWDSTEP + 1];
 		uint64_t u64;
 	} *pnum = (void *)pn;
+	union u_vec {
+		__vector unsigned short v_us;
+		unsigned short s[8];
+	};
 
+	union u_vec res;
 	int32_t v;
 
-	v = vec_any_eq(dp1, dp2);
-
+	dp1 = vec_cmpeq(dp1, dp2);
+	res.v_us = dp1;
 
+	v = (res.s[0] & 0x1) | (res.s[1] & 0x2) | (res.s[2] & 0x4) |
+	    (res.s[3] & 0x8);
 	/* update last port counter. */
 	lp[0] += gptbl[v].lpv;