Re: [PATCH 1/1] net: fec: enable the XDP_TX support

From: Andrew Lunn
Date: Tue May 02 2023 - 16:17:04 EST


On Tue, May 02, 2023 at 02:32:19PM -0500, Shenwei Wang wrote:
> Enable the XDP_TX path and correct the return value of the xmit function.
>
> If any individual frame cannot transmit due to lack of BD entries, the
> function would still return success for sending all frames. This results
> in prematurely indicating frames were sent when they were actually dropped.
>
> The patch resolves 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.

Hi Shenwei

The patch subject is wrong. This do not enable the XDP_TX support, it
fixes the XDP_TX support.

Please also take a read of the netdev FAQ. You your put the tree in
the patch subject.

>
> Fixes: 6d6b39f180b8 ("net: fec: add initial XDP support")
> Signed-off-by: Gagandeep Singh <g.singh@xxxxxxx>
> Signed-off-by: Shenwei Wang <shenwei.wang@xxxxxxx>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 27 ++++++++++++++++-------
> 1 file changed, 19 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 160c1b3525f5..dfc1bcc9a8db 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -75,6 +75,10 @@
>
> static void set_multicast_list(struct net_device *ndev);
> static void fec_enet_itr_coal_set(struct net_device *ndev);
> +static int fec_enet_xdp_xmit(struct net_device *dev,
> + int num_frames,
> + struct xdp_frame **frames,
> + u32 flags);

For a minimal fix for net, this is O.K. But once net-next has opened,
please submit a patch which moves the code around to avoid the forward
declaration.

Andrew