Skip to content

Commit 271f31d

Browse files
committed
Merge branch 'qca_spi-collection-of-major-fixes'
Stefan Wahren says: ==================== qca_spi: collection of major fixes This series contains a collection of major fixes for the qca_spi driver, which has been recently discovered. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a1664b9 + 1057812 commit 271f31d

File tree

2 files changed

+28
-9
lines changed

2 files changed

+28
-9
lines changed

drivers/net/ethernet/qualcomm/qca_debug.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030

3131
#define QCASPI_MAX_REGS 0x20
3232

33+
#define QCASPI_RX_MAX_FRAMES 4
34+
3335
static const u16 qcaspi_spi_regs[] = {
3436
SPI_REG_BFR_SIZE,
3537
SPI_REG_WRBUF_SPC_AVA,
@@ -252,9 +254,9 @@ qcaspi_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring,
252254
{
253255
struct qcaspi *qca = netdev_priv(dev);
254256

255-
ring->rx_max_pending = 4;
257+
ring->rx_max_pending = QCASPI_RX_MAX_FRAMES;
256258
ring->tx_max_pending = TX_RING_MAX_LEN;
257-
ring->rx_pending = 4;
259+
ring->rx_pending = QCASPI_RX_MAX_FRAMES;
258260
ring->tx_pending = qca->txr.count;
259261
}
260262

@@ -263,22 +265,21 @@ qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring,
263265
struct kernel_ethtool_ringparam *kernel_ring,
264266
struct netlink_ext_ack *extack)
265267
{
266-
const struct net_device_ops *ops = dev->netdev_ops;
267268
struct qcaspi *qca = netdev_priv(dev);
268269

269-
if ((ring->rx_pending) ||
270+
if (ring->rx_pending != QCASPI_RX_MAX_FRAMES ||
270271
(ring->rx_mini_pending) ||
271272
(ring->rx_jumbo_pending))
272273
return -EINVAL;
273274

274-
if (netif_running(dev))
275-
ops->ndo_stop(dev);
275+
if (qca->spi_thread)
276+
kthread_park(qca->spi_thread);
276277

277278
qca->txr.count = max_t(u32, ring->tx_pending, TX_RING_MIN_LEN);
278279
qca->txr.count = min_t(u16, qca->txr.count, TX_RING_MAX_LEN);
279280

280-
if (netif_running(dev))
281-
ops->ndo_open(dev);
281+
if (qca->spi_thread)
282+
kthread_unpark(qca->spi_thread);
282283

283284
return 0;
284285
}

drivers/net/ethernet/qualcomm/qca_spi.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,18 @@ qcaspi_spi_thread(void *data)
580580
netdev_info(qca->net_dev, "SPI thread created\n");
581581
while (!kthread_should_stop()) {
582582
set_current_state(TASK_INTERRUPTIBLE);
583+
if (kthread_should_park()) {
584+
netif_tx_disable(qca->net_dev);
585+
netif_carrier_off(qca->net_dev);
586+
qcaspi_flush_tx_ring(qca);
587+
kthread_parkme();
588+
if (qca->sync == QCASPI_SYNC_READY) {
589+
netif_carrier_on(qca->net_dev);
590+
netif_wake_queue(qca->net_dev);
591+
}
592+
continue;
593+
}
594+
583595
if ((qca->intr_req == qca->intr_svc) &&
584596
!qca->txr.skb[qca->txr.head])
585597
schedule();
@@ -608,11 +620,17 @@ qcaspi_spi_thread(void *data)
608620
if (intr_cause & SPI_INT_CPU_ON) {
609621
qcaspi_qca7k_sync(qca, QCASPI_EVENT_CPUON);
610622

623+
/* Frame decoding in progress */
624+
if (qca->frm_handle.state != qca->frm_handle.init)
625+
qca->net_dev->stats.rx_dropped++;
626+
627+
qcafrm_fsm_init_spi(&qca->frm_handle);
628+
qca->stats.device_reset++;
629+
611630
/* not synced. */
612631
if (qca->sync != QCASPI_SYNC_READY)
613632
continue;
614633

615-
qca->stats.device_reset++;
616634
netif_wake_queue(qca->net_dev);
617635
netif_carrier_on(qca->net_dev);
618636
}

0 commit comments

Comments
 (0)