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 61C99A04C8; Fri, 18 Sep 2020 12:43:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F2BD1D8F3; Fri, 18 Sep 2020 12:43:13 +0200 (CEST) Received: from userp2120.oracle.com (userp2120.oracle.com [156.151.31.85]) by dpdk.org (Postfix) with ESMTP id 5B1421D8EE; Fri, 18 Sep 2020 12:43:11 +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 08IAcSmm119582; Fri, 18 Sep 2020 10:43:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : cc : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Q71dQw0VEJ6bqqT6zV5ZqBxqruiNSGac8qfjAyWLF+o=; b=hoU9Zvx0RMXCKmqwRY6pO6knxS0QhVtB9hLDxtYT5doh5kzF8YQRx1SYf5eGhrBHqdOY kBU9cJeycef/tj4YPAlEmTwNL6FsGMHN5+AvHGJlXw8rb2jP49cgVMO/eD/VxJaHoham AIxO4CAfUiUeGuTBvgEsOhbvf/WM+E4yxJoAhZ87BU0O57i75Xf0t+glu/kG6ZUHoS+m DQEBQIqtpKkzWq7Sos1tDy3i6+ZnGbeySH6zKPRPdm7YDSIpnJ/53HJRYDAY51I25RXh nfaHq7SgkasOQyNqUMWI2UiNk6ctRmC83x34XiNA7Z0+r/Iz+w63LshtB8to09J8ivM2 xQ== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 33j91e03wv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 18 Sep 2020 10:43:10 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08IAVkcZ062926; Fri, 18 Sep 2020 10:41:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 33h88e5ng6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Sep 2020 10:41:09 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 08IAf6Dd005203; Fri, 18 Sep 2020 10:41:07 GMT MIME-Version: 1.0 Message-ID: <4293b160-6fa0-4413-b674-dd245a3d18c8@default> Date: Fri, 18 Sep 2020 10:41:04 +0000 (UTC) From: Vipul Ashri To: Andrew Rybchenko , dev@dpdk.org Cc: chenbo.xia@intel.com, zhihong.wang@intel.com, maxime.coquelin@redhat.com, stable@dpdk.org References: <20200814092138.1692-1-vipul.ashri@oracle.com> <7a2d66d6-3961-5251-36d2-c702fe80379f@solarflare.com> In-Reply-To: <7a2d66d6-3961-5251-36d2-c702fe80379f@solarflare.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 15.0.5257.0 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9747 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 phishscore=0 malwarescore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009180086 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9747 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 mlxlogscore=999 clxscore=1015 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-2009180087 Subject: Re: [dpdk-dev] [PATCH] 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" Hi Andrew I like your suggestion and applied with [v5] net/virtio: fix wrong variable= assignment in helper macro V4 had a extra line typos., V5 is tested compiled and pushed carefully Thanks! Regards Vipul -----Original Message----- From: Andrew Rybchenko [mailto:arybchenko@solarflare.com]=20 Sent: Saturday, 29 August, 2020 16:53 To: Vipul Ashri ; dev@dpdk.org Cc: chenbo.xia@intel.com; zhihong.wang@intel.com; maxime.coquelin@redhat.co= m; stable@dpdk.org Subject: Re: [dpdk-dev] [PATCH] net/virtio: fix wrong variable assignment i= n helper macro On 8/14/20 12:21 PM, Vipul Ashri wrote: > Inside Macro ASSIGN_UNLESS_EQUAL(var, val), assignment to var is=20 > 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=20 > 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 | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/virtio/virtqueue.h=20 > 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) > =20 > /* avoid write operation when necessary, to lessen cache issues */ > #define ASSIGN_UNLESS_EQUAL(var, val) do {=09\ > -=09typeof(var) var_ =3D (var);=09=09\ > -=09typeof(val) val_ =3D (val);=09=09\ > -=09if ((var_) !=3D (val_))=09=09=09\ > -=09=09(var_) =3D (val_);=09=09\ > +=09if ((var) !=3D (val))=09=09=09\ > +=09=09(var) =3D (val);=09=09=09\ Good catch. As I understand the old code tries to avoid processing of var a= nd val expressions twice. It looks it could be kept for val at least. Just = keep if condition as in old code and fix the last line above: =C2=A0=C2=A0=C2=A0 (var) =3D val_; Since var_ and val_are local variables there is no necessity to enclose it = in parenthesis (but does not harm if done). var_ may be really removed since since resulting code will use it only once= .