diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2014-05-30 12:40:07 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-02 19:16:05 -0400 |
commit | 2e3173a3d38bbb5e29a6a734e7366855c12efbe9 (patch) | |
tree | 7a13e38888596dbceb401a7fae2a87481426fa39 | |
parent | ba7e46ef9d4550f76efb70739728c50bbf94c3a9 (diff) |
net: mvneta: Avoid unmapping the TSO header buffers
The buffers for the TSO headers belong to a DMA coherent region which is
allocated at ndo_open() time, and released at ndo_stop() time.
Therefore, and contrary to the TSO payload descriptor buffers, the TSO header
buffers don't need to be unmapped. This commit adds a check to detect a
TSO header buffer and explicitly prevent the unmap.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/marvell/mvneta.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index f95e7cadb01b..45beca17fa50 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c | |||
@@ -264,6 +264,10 @@ | |||
264 | ETH_HLEN + ETH_FCS_LEN, \ | 264 | ETH_HLEN + ETH_FCS_LEN, \ |
265 | MVNETA_CPU_D_CACHE_LINE_SIZE) | 265 | MVNETA_CPU_D_CACHE_LINE_SIZE) |
266 | 266 | ||
267 | #define IS_TSO_HEADER(txq, addr) \ | ||
268 | ((addr >= txq->tso_hdrs_phys) && \ | ||
269 | (addr < txq->tso_hdrs_phys + txq->size * TSO_HEADER_SIZE)) | ||
270 | |||
267 | #define MVNETA_RX_BUF_SIZE(pkt_size) ((pkt_size) + NET_SKB_PAD) | 271 | #define MVNETA_RX_BUF_SIZE(pkt_size) ((pkt_size) + NET_SKB_PAD) |
268 | 272 | ||
269 | struct mvneta_pcpu_stats { | 273 | struct mvneta_pcpu_stats { |
@@ -1291,8 +1295,10 @@ static void mvneta_txq_bufs_free(struct mvneta_port *pp, | |||
1291 | 1295 | ||
1292 | mvneta_txq_inc_get(txq); | 1296 | mvneta_txq_inc_get(txq); |
1293 | 1297 | ||
1294 | dma_unmap_single(pp->dev->dev.parent, tx_desc->buf_phys_addr, | 1298 | if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) |
1295 | tx_desc->data_size, DMA_TO_DEVICE); | 1299 | dma_unmap_single(pp->dev->dev.parent, |
1300 | tx_desc->buf_phys_addr, | ||
1301 | tx_desc->data_size, DMA_TO_DEVICE); | ||
1296 | if (!skb) | 1302 | if (!skb) |
1297 | continue; | 1303 | continue; |
1298 | dev_kfree_skb_any(skb); | 1304 | dev_kfree_skb_any(skb); |
@@ -1642,7 +1648,7 @@ err_release: | |||
1642 | */ | 1648 | */ |
1643 | for (i = desc_count - 1; i >= 0; i--) { | 1649 | for (i = desc_count - 1; i >= 0; i--) { |
1644 | struct mvneta_tx_desc *tx_desc = txq->descs + i; | 1650 | struct mvneta_tx_desc *tx_desc = txq->descs + i; |
1645 | if (!(tx_desc->command & MVNETA_TXD_F_DESC)) | 1651 | if (!IS_TSO_HEADER(txq, tx_desc->buf_phys_addr)) |
1646 | dma_unmap_single(pp->dev->dev.parent, | 1652 | dma_unmap_single(pp->dev->dev.parent, |
1647 | tx_desc->buf_phys_addr, | 1653 | tx_desc->buf_phys_addr, |
1648 | tx_desc->data_size, | 1654 | tx_desc->data_size, |