]> git.itanic.dy.fi Git - linux-stable/commitdiff
qca_spi: Fix reset behavior
authorStefan Wahren <wahrenst@gmx.net>
Wed, 6 Dec 2023 14:12:22 +0000 (15:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2023 14:44:27 +0000 (15:44 +0100)
[ Upstream commit 1057812d146dd658c9a9a96d869c2551150207b5 ]

In case of a reset triggered by the QCA7000 itself, the behavior of the
qca_spi driver was not quite correct:
- in case of a pending RX frame decoding the drop counter must be
  incremented and decoding state machine reseted
- also the reset counter must always be incremented regardless of sync
  state

Fixes: 291ab06ecf67 ("net: qualcomm: new Ethernet over SPI driver for QCA7000")
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Link: https://lore.kernel.org/r/20231206141222.52029-4-wahrenst@gmx.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/qualcomm/qca_spi.c

index b08a4b2a6a9964e03a14da9508f0e9301e2360e7..ffa1846f5b4c41043d8d738ed711db516529a571 100644 (file)
@@ -613,11 +613,17 @@ qcaspi_spi_thread(void *data)
                        if (intr_cause & SPI_INT_CPU_ON) {
                                qcaspi_qca7k_sync(qca, QCASPI_EVENT_CPUON);
 
+                               /* Frame decoding in progress */
+                               if (qca->frm_handle.state != qca->frm_handle.init)
+                                       qca->net_dev->stats.rx_dropped++;
+
+                               qcafrm_fsm_init_spi(&qca->frm_handle);
+                               qca->stats.device_reset++;
+
                                /* not synced. */
                                if (qca->sync != QCASPI_SYNC_READY)
                                        continue;
 
-                               qca->stats.device_reset++;
                                netif_wake_queue(qca->net_dev);
                                netif_carrier_on(qca->net_dev);
                        }