blob: a4c00b9f9b108fcd70ab438556365c5c2fe5722d [file] [log] [blame]
Matthew Smith45d60492020-11-18 13:40:31 -06001From a1412e05caa2678757156d4de2755ab5140ecc24 Mon Sep 17 00:00:00 2001
2From: Vipul Ashri <vipul.ashri@oracle.com>
3Date: Fri, 18 Sep 2020 15:25:04 +0530
4Subject: [PATCH] net/virtio: fix variable assignment in helper macro
5
6Inside Macro ASSIGN_UNLESS_EQUAL(var, val), assignment to var is always
7failing as assignment done using var_ having local scope only.
8This leads to TX packets not going out and found broken due to cleanup
9malfunctioning. This patch fixes the wrong variable assignment.
10
11Fixes: 57f90f894588 ("net/virtio: reuse packed ring functions")
12Cc: stable@dpdk.org
13
14Signed-off-by: Vipul Ashri <vipul.ashri@oracle.com>
15Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
16Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
17---
18 drivers/net/virtio/virtqueue.h | 8 ++++----
19 1 file changed, 4 insertions(+), 4 deletions(-)
20
21diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
22index 105a9c00c..6ed50648c 100644
23--- a/drivers/net/virtio/virtqueue.h
24+++ b/drivers/net/virtio/virtqueue.h
25@@ -607,10 +607,10 @@ virtqueue_notify(struct virtqueue *vq)
26
27 /* avoid write operation when necessary, to lessen cache issues */
28 #define ASSIGN_UNLESS_EQUAL(var, val) do { \
29- typeof(var) var_ = (var); \
30- typeof(val) val_ = (val); \
31- if ((var_) != (val_)) \
32- (var_) = (val_); \
33+ typeof(var) *const var_ = &(var); \
34+ typeof(val) const val_ = (val); \
35+ if (*var_ != val_) \
36+ *var_ = val_; \
37 } while (0)
38
39 #define virtqueue_clear_net_hdr(hdr) do { \
40--
412.18.4
42