net: fec: correct the counting of XDP sent frames
authorShenwei Wang <shenwei.wang@nxp.com>
Thu, 4 May 2023 15:35:17 +0000 (10:35 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 May 2023 08:58:06 +0000 (09:58 +0100)
commit26312c685ae0bca61e06ac75ee158b1e69546415
tree0b945b53cd3a9b36b820e4a6ad214c3edb8797ee
parent299efdc2380aac588557f4d0b2ce7bee05bd0cf2
net: fec: correct the counting of XDP sent frames

In the current xdp_xmit implementation, if any single frame fails to
transmit due to insufficient buffer descriptors, the function nevertheless
reports success in sending all frames. This results in erroneously
indicating that frames were transmitted when in fact they were dropped.

This patch fixes the issue by ensureing the return value properly
indicates the actual number of frames successfully transmitted, rather than
potentially reporting success for all frames when some could not transmit.

Fixes: 6d6b39f180b8 ("net: fec: add initial XDP support")
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c