From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 9E858A034C;
	Tue, 18 Aug 2020 15:50:15 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 31E361C19A;
	Tue, 18 Aug 2020 15:47:20 +0200 (CEST)
Received: from userp2130.oracle.com (userp2130.oracle.com [156.151.31.86])
 by dpdk.org (Postfix) with ESMTP id 307DC1B53;
 Thu, 13 Aug 2020 09:30:53 +0200 (CEST)
Received: from pps.filterd (userp2130.oracle.com [127.0.0.1])
 by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07D7Rwfm122553;
 Thu, 13 Aug 2020 07:30:52 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com;
 h=from : to : cc :
 subject : date : message-id : in-reply-to : references : mime-version :
 content-transfer-encoding; s=corp-2020-01-29;
 bh=PyGERTMxQIjj1Gc+veOLRN0Vc7P2HSS60BlhuK2xveE=;
 b=D5WtOdHnstK3UgDCIyz6AkL8+ujAi8S8C4jDF1REoNk9uG3WHkrNRKVqsOEQ6+t/fprd
 0zXXrGvPXCXk4O7kM8MxyZQlkYWVbLmmEwbOxq9+o/dfYY2MREHmsUInsRcQyHPyTrJm
 QRAVcbrVALg3K6n5ej2cjeZL/7PRtMvp5CCxk0l2H0BdrJLDfnYGmTE74bWQeb8bc+FX
 51naTPQHgiML4400vxjV3DW7V+wsLNG/NNQsMTh6UZ896uZ86Qwa0TCFNOKvQeVzTrfZ
 tCxucbAB0Xj0v/f6e4O9bhyPtQqkfG7FNuYo3LWCuqYSa+KxmRY9PaNIMR/yfI5soPNp wg== 
Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79])
 by userp2130.oracle.com with ESMTP id 32t2ydwbdt-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL);
 Thu, 13 Aug 2020 07:30:52 +0000
Received: from pps.filterd (userp3020.oracle.com [127.0.0.1])
 by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07D7NY5J158187;
 Thu, 13 Aug 2020 07:28:51 GMT
Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72])
 by userp3020.oracle.com with ESMTP id 32u3h4uv0p-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Thu, 13 Aug 2020 07:28:51 +0000
Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9])
 by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 07D7SoHL010989;
 Thu, 13 Aug 2020 07:28:51 GMT
Received: from VASHRI-IN.in.oracle.com (/10.191.246.206)
 by default (Oracle Beehive Gateway v4.0)
 with ESMTP ; Thu, 13 Aug 2020 07:28:50 +0000
From: Vipul Ashri <vipul.ashri@oracle.com>
To: dev@dpdk.org
Cc: chenbo.xia@intel.com, vipul.ashri@oracle.com, edwin.leung@oracle.com,
 stable@dpdk.org
Date: Thu, 13 Aug 2020 12:58:37 +0530
Message-Id: <20200813072837.1468-1-vipul.ashri@oracle.com>
X-Mailer: git-send-email 2.28.0.windows.1
In-Reply-To: <20200812092306.1345-1-vipul.ashri@oracle.com>
References: <20200812092306.1345-1-vipul.ashri@oracle.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9711
 signatures=668679
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0
 mlxlogscore=999 mlxscore=0
 malwarescore=0 spamscore=0 suspectscore=1 phishscore=0 bulkscore=0
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000
 definitions=main-2008130056
X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9711
 signatures=668679
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999
 priorityscore=1501
 malwarescore=0 impostorscore=0 lowpriorityscore=0 mlxscore=0 bulkscore=0
 suspectscore=1 phishscore=0 adultscore=0 spamscore=0 clxscore=1015
 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000
 definitions=main-2008130056
X-Mailman-Approved-At: Tue, 18 Aug 2020 15:47:00 +0200
Subject: [dpdk-dev] [PATCH v3] net/virtio: fix wrong variable assignment in
	helper macro
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Inside Macro ASSIGN_UNLESS_EQUAL(var, val), assignment to var is always
failing as assignment done using var_ having local scope only.
This leads to TX packets not going out and found broken due to cleanup
malfunctioning. This patch fixes the wrong variable assignment.

Fixes: 57f90f894588 ("net/virtio: reuse packed ring functions")
Cc: stable@dpdk.org

Signed-off-by: Vipul Ashri <vipul.ashri@oracle.com>
---
 drivers/net/virtio/virtqueue.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 105a9c00c..20c95471e 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -607,10 +607,8 @@ virtqueue_notify(struct virtqueue *vq)
 
 /* avoid write operation when necessary, to lessen cache issues */
 #define ASSIGN_UNLESS_EQUAL(var, val) do {	\
-	typeof(var) var_ = (var);		\
-	typeof(val) val_ = (val);		\
-	if ((var_) != (val_))			\
-		(var_) = (val_);		\
+	if ((var) != (val))			\
+		(var) = (val);			\
 } while (0)
 
 #define virtqueue_clear_net_hdr(hdr) do {		\
-- 
2.28.0.windows.1