@@ -1719,7 +1719,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
}
ring->dma = dma_alloc_coherent(eth->dma_dev,
- rx_dma_size * sizeof(*ring->dma),
+ rx_dma_size * eth->soc->txrx.rxd_size,
&ring->phys, GFP_ATOMIC);
if (!ring->dma)
return -ENOMEM;
@@ -1777,9 +1777,8 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring)
if (ring->dma) {
dma_free_coherent(eth->dma_dev,
- ring->dma_size * sizeof(*ring->dma),
- ring->dma,
- ring->phys);
+ ring->dma_size * eth->soc->txrx.rxd_size,
+ ring->dma, ring->phys);
ring->dma = NULL;
}
}
@@ -3370,6 +3369,7 @@ static const struct mtk_soc_data mt2701_data = {
.required_pctl = true,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -3381,6 +3381,7 @@ static const struct mtk_soc_data mt7621_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -3393,6 +3394,7 @@ static const struct mtk_soc_data mt7622_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -3404,6 +3406,7 @@ static const struct mtk_soc_data mt7623_data = {
.offload_version = 2,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -3415,6 +3418,7 @@ static const struct mtk_soc_data mt7629_data = {
.required_pctl = false,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -3425,6 +3429,7 @@ static const struct mtk_soc_data rt5350_data = {
.required_pctl = false,
.txrx = {
.txd_size = sizeof(struct mtk_tx_dma),
+ .rxd_size = sizeof(struct mtk_rx_dma),
},
};
@@ -866,6 +866,7 @@ struct mtk_tx_dma_desc_info {
* @required_pctl A bool value to show whether the SoC requires
* the extra setup for those pins used by GMAC.
* @txd_size TX DMA descriptor size.
+ * @rxd_size RX DMA descriptor size.
*/
struct mtk_soc_data {
u32 ana_rgc3;
@@ -876,6 +877,7 @@ struct mtk_soc_data {
netdev_features_t hw_features;
struct {
u32 txd_size;
+ u32 rxd_size;
} txrx;
};