Skip to contentSkip to conversation

net: microchip: sparx5: correctly free skb in xmit

PATCH Applied Casper Andersson 2 participants 2 messages Dec 2, 2022 – Dec 5, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: microchip: sparx5: correctly free skb in xmit

consume_skb on transmitted, kfree_skb on dropped, do not free on TX_BUSY.

Previously the xmit function could return -EBUSY without freeing, which supposedly is interpreted as a drop. And was using kfree on successfully transmitted packets.

sparx5_fdma_xmit and sparx5_inject returns error code, where -EBUSY indicates TX_BUSY and any other error code indicates dropped.

Fixes f3cad2611a77 ("net: sparx5: add hostmode with phylink support")

---
v2->v3:
Removed empty line between Fixes and Signed-off-by

 .../ethernet/microchip/sparx5/sparx5_fdma.c   |  2 +-
 .../ethernet/microchip/sparx5/sparx5_packet.c | 41 +++++++++++--------
 2 files changed, 25 insertions(+), 18 deletions(-)
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c +1 -1
index 66360c8c5a38..141897dfe388 100644
@@ -317,7 +317,7 @@ int sparx5_fdma_xmit(struct sparx5 *sparx5, u32 *ifh, struct sk_buff *skb)
 	next_dcb_hw = sparx5_fdma_next_dcb(tx, tx->curr_entry);
 	db_hw = &next_dcb_hw->db[0];
 	if (!(db_hw->status & FDMA_DCB_STATUS_DONE))
-		tx->dropped++;
+		return -EINVAL;
 	db = list_first_entry(&tx->db_list, struct sparx5_db, list);
 	list_move_tail(&db->list, &tx->db_list);
 	next_dcb_hw->nextptr = FDMA_DCB_INVALID_DATA;
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +24 -17

56 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 8 lines · On Fri, 2 Dec 2022 09:35:44 +0100 you wrote:

consume_skb on transmitted, kfree_skb on dropped, do not free on TX_BUSY.

Previously the xmit function could return -EBUSY without freeing, which supposedly is interpreted as a drop. And was using kfree on successfully transmitted packets.

[...]

Here is the summary with links:
- [v3,net] net: microchip: sparx5: correctly free skb in xmit

    https://git.kernel.org/netdev/net/c/121c6672b019

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html