From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E0CBEA00C5
	for <public@inbox.dpdk.org>; Sun, 11 Sep 2022 20:13:03 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D2D9141156;
	Sun, 11 Sep 2022 20:13:03 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174])
 by mails.dpdk.org (Postfix) with ESMTP id 329664003F;
 Sun, 11 Sep 2022 20:13:01 +0200 (CEST)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28BI1ORK015394;
 Sun, 11 Sep 2022 11:12:59 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding : content-type; s=pfpt0220;
 bh=5O9dBw1H8rozQBIEV+MREzmaC6p7M37Js0gCiJpe5mM=;
 b=FaWkcMTksP7tIEQQWi/KBn+yeUQqRbVi670Ux8KoqECbOHiJ9Eca2ooCdkg7HNZP4EdV
 TXoBVtp1YQPHp1Bf7iuvxGMSmy3aofc4g9e+wjpWL7L+CG183A+9iWF8cE2NzaIjqyu3
 n+gZtBLK6MNob5jER+nxlho1aAjGBjrov0fcvNFf/xdR8wXMoBjBzBZXKXRCnY3TF87e
 5Y+Vh5HrNgYeCB7NPKCplDv3tILAQmu3A1moXodiMnf8deMfNsUmtw0vxrquG5NXCWBr
 o6+UCG8SLTrdZ69bdS2tXVgkAJOEy+m/EbYgL+qmJFR3X6MQzWqeSmNigLC1xCkJk6Ev vQ== 
Received: from dc5-exch01.marvell.com ([199.233.59.181])
 by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3jgqxq45kb-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Sun, 11 Sep 2022 11:12:59 -0700
Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2;
 Sun, 11 Sep 2022 11:12:58 -0700
Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com
 (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend
 Transport; Sun, 11 Sep 2022 11:12:58 -0700
Received: from MININT-80QBFE8.corp.innovium.com (unknown [10.193.65.138])
 by maili.marvell.com (Postfix) with ESMTP id 4A2CE3F706D;
 Sun, 11 Sep 2022 11:12:56 -0700 (PDT)
From: <pbhagavatula@marvell.com>
To: <jerinj@marvell.com>, David Christensen <drc@linux.vnet.ibm.com>
CC: <dev@dpdk.org>, Pavan Nikhilesh <pbhagavatula@marvell.com>,
 <stable@dpdk.org>
Subject: [PATCH v3 1/5] examples/l3fwd: fix port group mask generation
Date: Sun, 11 Sep 2022 23:42:45 +0530
Message-ID: <20220911181250.2286-1-pbhagavatula@marvell.com>
X-Mailer: git-send-email 2.25.1
In-Reply-To: <20220902091833.9074-1-pbhagavatula@marvell.com>
References: <20220902091833.9074-1-pbhagavatula@marvell.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain
X-Proofpoint-ORIG-GUID: C6Thru1lANXsacGw2m7HdN6l7Tvpq6gI
X-Proofpoint-GUID: C6Thru1lANXsacGw2m7HdN6l7Tvpq6gI
X-Proofpoint-Virus-Version: vendor=baseguard
 engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1
 definitions=2022-09-11_08,2022-09-09_01,2022-06-22_01
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

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>
---
 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