Skip to content

Commit d7ecae7

Browse files
tpetazzonigregkh
authored andcommitted
net: mvpp2: release reference to txq_cpu[] entry after unmapping
[ Upstream commit 36fb7435b6ac4d288a2d4deea8934f9456ab46b6 ] The mvpp2_txq_bufs_free() function is called upon TX completion to DMA unmap TX buffers, and free the corresponding SKBs. It gets the references to the SKB to free and the DMA buffer to unmap from a per-CPU txq_pcpu data structure. However, the code currently increments the pointer to the next entry before doing the DMA unmap and freeing the SKB. It does not cause any visible problem because for a given SKB the TX completion is guaranteed to take place on the CPU where the TX was started. However, it is much more logical to increment the pointer to the next entry once the current entry has been completely unmapped/released. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Acked-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 693e651 commit d7ecae7

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • drivers/net/ethernet/marvell

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4415,13 +4415,12 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
44154415
struct mvpp2_txq_pcpu_buf *tx_buf =
44164416
txq_pcpu->buffs + txq_pcpu->txq_get_index;
44174417

4418-
mvpp2_txq_inc_get(txq_pcpu);
4419-
44204418
dma_unmap_single(port->dev->dev.parent, tx_buf->phys,
44214419
tx_buf->size, DMA_TO_DEVICE);
4422-
if (!tx_buf->skb)
4423-
continue;
4424-
dev_kfree_skb_any(tx_buf->skb);
4420+
if (tx_buf->skb)
4421+
dev_kfree_skb_any(tx_buf->skb);
4422+
4423+
mvpp2_txq_inc_get(txq_pcpu);
44254424
}
44264425
}
44274426

0 commit comments

Comments
 (0)