aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/staging-octeon-Add-a-workaround-for-the-issue-of-GCC.patch
blob: 89f790906d7d04bf3a565c6aec4c5b5fca922d45 (plain)
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
From 3373c0cf71f2812eeb9694839456df6f67fd32ac Mon Sep 17 00:00:00 2001
From: Kevin Hao <kexin.hao@windriver.com>
Date: Wed, 20 Jun 2018 18:41:55 +0800
Subject: [PATCH] staging: octeon: Add a workaround for the issue of GCC8

In function cvm_oct_xmit(), the packet length is set with code like
this:
  pko_command.s.total_bytes = skb->len;

But when building with gcc8, the pko_command.s.total_bytes doesn't
emit the right value when it is used in the following codes:
        /* Send the packet to the output queue */
        if (unlikely(cvmx_pko_send_packet_finish(priv->port,
                                                 priv->queue + qos,
                                                 pko_command, hw_buffer,
                                                 CVMX_PKO_LOCK_NONE))) {

Adding a barrier after the assignment would generate the right codes.

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
---
 drivers/staging/octeon/ethernet-tx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index 31f35025d19e..af9da2508e93 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -264,6 +264,9 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev)
 	pko_command.s.n2 = 1;	/* Don't pollute L2 with the outgoing packet */
 	pko_command.s.segs = 1;
 	pko_command.s.total_bytes = skb->len;
+#if GCC_VERSION >= 80000
+	barrier();
+#endif
 	pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
 	pko_command.s.subone0 = 1;
 
-- 
2.5.0