ena module for Driver Update Program
CentOS Sources
2019-01-09 fc384122a7a805dde4dbbf3c4c4ef94a5ca0f2fe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Date: Tue, 30 Oct 2018 13:25:23 -0400
From: linville@redhat.com
To: rhkernel-list@redhat.com
Cc: Lin Liu <linl@redhat.com>
Subject: [RHEL7 08/28] net: ena: fix missing calls to READ_ONCE
 
From: "John W. Linville" <linville@redhat.com>
 
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1633418
Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=18850510
 
Add READ_ONCE calls where necessary (for example when iterating
over a memory field that gets updated by the hardware).
 
Signed-off-by: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 28abf4e9c9201eda5c4d29ea609d07e877b464b8)
Signed-off-by: John W. Linville <linville@redhat.com>
---
 drivers/net/ethernet/amazon/ena/ena_com.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
 
diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
index 17f12c18d225..c37deef3bcf1 100644
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
@@ -459,7 +459,7 @@ static void ena_com_handle_admin_completion(struct ena_com_admin_queue *admin_qu
     cqe = &admin_queue->cq.entries[head_masked];
 
     /* Go over all the completions */
-    while ((cqe->acq_common_descriptor.flags &
+    while ((READ_ONCE(cqe->acq_common_descriptor.flags) &
             ENA_ADMIN_ACQ_COMMON_DESC_PHASE_MASK) == phase) {
         /* Do not read the rest of the completion entry before the
          * phase bit was validated
@@ -637,7 +637,7 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
 
     mmiowb();
     for (i = 0; i < timeout; i++) {
-        if (read_resp->req_id == mmio_read->seq_num)
+        if (READ_ONCE(read_resp->req_id) == mmio_read->seq_num)
             break;
 
         udelay(1);
@@ -1796,8 +1796,8 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *dev, void *data)
     aenq_common = &aenq_e->aenq_common_desc;
 
     /* Go over all the events */
-    while ((aenq_common->flags & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) ==
-           phase) {
+    while ((READ_ONCE(aenq_common->flags) &
+        ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
         pr_debug("AENQ! Group[%x] Syndrom[%x] timestamp: [%llus]\n",
              aenq_common->group, aenq_common->syndrom,
              (u64)aenq_common->timestamp_low +
-- 
2.17.1