From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF6A7A04C7; Wed, 16 Sep 2020 08:01:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 911241C1A6; Wed, 16 Sep 2020 08:01:00 +0200 (CEST) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by dpdk.org (Postfix) with ESMTP id 7F75E1C1A3; Wed, 16 Sep 2020 08:00:58 +0200 (CEST) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08G5sxfj013263; Wed, 16 Sep 2020 06:00:57 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=nayDR1gORJX4/JOc4xymewZslBcl+iScv7uyPbEYJ2A=; b=r4m0fI4xlWB3Ig3IM/E8M00LI8atVU2edU/V2AMZC4oY5Xx6CdhGhu9PutFTABuCizpA tyAaZghF2nea5082eIOZjdWoz+4YELon49goBUruZOmMSta4QGQ5sPeNe8EiH+DSgj42 kf8fRcXPDiSGXJylqqIHHSVgmWh+iqHIY/8yIfZH9VpVypEyOdEzdgw+yrnEirMOcOD7 iFvxRg0ouzK0upj674DudECyxzci163b7ISXA6t5r8GYCEJLULxigBlGWgSic8fffmKB OuEHPhTiiA+HtpaVXHW5uIcpm4hda3Fe9UJ1rwRRJca12ALD27rcwX6/Z/whE2myzxQi jA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 33j91djj3y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 16 Sep 2020 06:00:57 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08G5nxaH139778; Wed, 16 Sep 2020 05:58:56 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 33h7wq98yh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Sep 2020 05:58:56 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08G5wsB9002869; Wed, 16 Sep 2020 05:58:54 GMT Received: from VASHRI-IN.in.oracle.com (/203.81.240.52) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 16 Sep 2020 05:58:54 +0000 From: Vipul Ashri To: dev@dpdk.org Cc: chenbo.xia@intel.com, vipul.ashri@oracle.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com, arybchenko@solarflare.com, makarov@kraftway.ru, stable@dpdk.org Date: Wed, 16 Sep 2020 11:27:24 +0530 Message-Id: <20200916055725.1473-1-vipul.ashri@oracle.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200813072837.1468-1-vipul.ashri@oracle.com> References: <20200813072837.1468-1-vipul.ashri@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9745 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 adultscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009160045 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9745 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=1 mlxlogscore=999 clxscore=1011 adultscore=0 lowpriorityscore=0 spamscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009160045 Subject: [dpdk-dev] [PATCH v4] 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- drivers/net/virtio/virtqueue.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 105a9c00c..7f8a3976f 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -607,10 +607,11 @@ 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_); \ + typeof(var) *const var_ = &(var); \ + typeof(val) const val_ = (val); \ + if (*var_ != val_) \ + *var_ = val_; \ + } while (0) #define virtqueue_clear_net_hdr(hdr) do { \ -- 2.28.0.windows.1