Skip to content

Commit 0ed577e

Browse files
Siddharth-Vadapalli-at-TIkuba-moo
authored andcommitted
net: ethernet: ti: am65-cpsw: Add RX DMA Channel Teardown Quirk
In TI's AM62x/AM64x SoCs, successful teardown of RX DMA Channel raises an interrupt. The process of servicing this interrupt involves flushing all pending RX DMA descriptors and clearing the teardown completion marker (TDCM). The am65_cpsw_nuss_rx_packets() function invoked from the RX NAPI callback services the interrupt. Thus, it is necessary to wait for this handler to run, drain all packets and clear TDCM, before calling napi_disable() in am65_cpsw_nuss_common_stop() function post channel teardown. If napi_disable() executes before ensuring that TDCM is cleared, the TDCM remains set when the interfaces are down, resulting in an interrupt storm when the interfaces are brought up again. Since the interrupt raised to indicate the RX DMA Channel teardown is specific to the AM62x and AM64x SoCs, add a quirk for it. Fixes: 4f7cce2 ("net: ethernet: ti: am65-cpsw: add support for am64x cpsw3g") Co-developed-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Vignesh Raghavendra <[email protected]> Signed-off-by: Siddharth Vadapalli <[email protected]> Reviewed-by: Roger Quadros <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ec76d0c commit 0ed577e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,15 @@ static int am65_cpsw_nuss_common_stop(struct am65_cpsw_common *common)
501501
k3_udma_glue_disable_tx_chn(common->tx_chns[i].tx_chn);
502502
}
503503

504+
reinit_completion(&common->tdown_complete);
504505
k3_udma_glue_tdown_rx_chn(common->rx_chns.rx_chn, true);
506+
507+
if (common->pdata.quirks & AM64_CPSW_QUIRK_DMA_RX_TDOWN_IRQ) {
508+
i = wait_for_completion_timeout(&common->tdown_complete, msecs_to_jiffies(1000));
509+
if (!i)
510+
dev_err(common->dev, "rx teardown timeout\n");
511+
}
512+
505513
napi_disable(&common->napi_rx);
506514

507515
for (i = 0; i < AM65_CPSW_MAX_RX_FLOWS; i++)
@@ -721,6 +729,8 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_common *common,
721729

722730
if (cppi5_desc_is_tdcm(desc_dma)) {
723731
dev_dbg(dev, "%s RX tdown flow: %u\n", __func__, flow_idx);
732+
if (common->pdata.quirks & AM64_CPSW_QUIRK_DMA_RX_TDOWN_IRQ)
733+
complete(&common->tdown_complete);
724734
return 0;
725735
}
726736

@@ -2672,7 +2682,7 @@ static const struct am65_cpsw_pdata j721e_pdata = {
26722682
};
26732683

26742684
static const struct am65_cpsw_pdata am64x_cpswxg_pdata = {
2675-
.quirks = 0,
2685+
.quirks = AM64_CPSW_QUIRK_DMA_RX_TDOWN_IRQ,
26762686
.ale_dev_id = "am64-cpswxg",
26772687
.fdqring_mode = K3_RINGACC_RING_MODE_RING,
26782688
};

drivers/net/ethernet/ti/am65-cpsw-nuss.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ struct am65_cpsw_rx_chn {
9090
};
9191

9292
#define AM65_CPSW_QUIRK_I2027_NO_TX_CSUM BIT(0)
93+
#define AM64_CPSW_QUIRK_DMA_RX_TDOWN_IRQ BIT(1)
9394

9495
struct am65_cpsw_pdata {
9596
u32 quirks;

0 commit comments

Comments
 (0)