]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.181/net-mvpp2-fix-bad-mvpp2_txq_sched_token_cntr_reg-queue-value.patch
Linux 4.4.181
[thirdparty/kernel/stable-queue.git] / releases / 4.4.181 / net-mvpp2-fix-bad-mvpp2_txq_sched_token_cntr_reg-queue-value.patch
CommitLineData
51324e95
GKH
1From foo@baz Fri 31 May 2019 03:24:14 PM PDT
2From: Antoine Tenart <antoine.tenart@bootlin.com>
3Date: Wed, 29 May 2019 15:59:48 +0200
4Subject: net: mvpp2: fix bad MVPP2_TXQ_SCHED_TOKEN_CNTR_REG queue value
5
6From: Antoine Tenart <antoine.tenart@bootlin.com>
7
8[ Upstream commit 21808437214637952b61beaba6034d97880fbeb3 ]
9
10MVPP2_TXQ_SCHED_TOKEN_CNTR_REG() expects the logical queue id but
11the current code is passing the global tx queue offset, so it ends
12up writing to unknown registers (between 0x8280 and 0x82fc, which
13seemed to be unused by the hardware). This fixes the issue by using
14the logical queue id instead.
15
16Fixes: 3f518509dedc ("ethernet: Add new driver for Marvell Armada 375 network unit")
17Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
18Signed-off-by: David S. Miller <davem@davemloft.net>
19Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20---
21 drivers/net/ethernet/marvell/mvpp2.c | 10 ++++------
22 1 file changed, 4 insertions(+), 6 deletions(-)
23
24--- a/drivers/net/ethernet/marvell/mvpp2.c
25+++ b/drivers/net/ethernet/marvell/mvpp2.c
26@@ -3940,7 +3940,7 @@ static inline void mvpp2_gmac_max_rx_siz
27 /* Set defaults to the MVPP2 port */
28 static void mvpp2_defaults_set(struct mvpp2_port *port)
29 {
30- int tx_port_num, val, queue, ptxq, lrxq;
31+ int tx_port_num, val, queue, lrxq;
32
33 /* Configure port to loopback if needed */
34 if (port->flags & MVPP2_F_LOOPBACK)
35@@ -3960,11 +3960,9 @@ static void mvpp2_defaults_set(struct mv
36 mvpp2_write(port->priv, MVPP2_TXP_SCHED_CMD_1_REG, 0);
37
38 /* Close bandwidth for all queues */
39- for (queue = 0; queue < MVPP2_MAX_TXQ; queue++) {
40- ptxq = mvpp2_txq_phys(port->id, queue);
41+ for (queue = 0; queue < MVPP2_MAX_TXQ; queue++)
42 mvpp2_write(port->priv,
43- MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(ptxq), 0);
44- }
45+ MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(queue), 0);
46
47 /* Set refill period to 1 usec, refill tokens
48 * and bucket size to maximum
49@@ -4722,7 +4720,7 @@ static void mvpp2_txq_deinit(struct mvpp
50 txq->descs_phys = 0;
51
52 /* Set minimum bandwidth for disabled TXQs */
53- mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->id), 0);
54+ mvpp2_write(port->priv, MVPP2_TXQ_SCHED_TOKEN_CNTR_REG(txq->log_id), 0);
55
56 /* Set Tx descriptors queue starting address and size */
57 mvpp2_write(port->priv, MVPP2_TXQ_NUM_REG, txq->id);