net: microchip: sparx5: correctly free skb in xmit
authorCasper Andersson <casper.casan@gmail.com>
Fri, 2 Dec 2022 08:35:44 +0000 (09:35 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 5 Dec 2022 11:33:09 +0000 (11:33 +0000)
commit121c6672b0191ffcebff4b88ec022c39e0a95789
tree9a97153cbc47a322749ead815cee2a7fdc996d25
parentfbf33f5ac76f2cdb47ad9763f620026d5cfa57ce
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")
Signed-off-by: Casper Andersson <casper.casan@gmail.com>
Reviewed-by: Horatiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/sparx5/sparx5_fdma.c
drivers/net/ethernet/microchip/sparx5/sparx5_packet.c