net: fec: dynamically set the NETDEV_XDP_ACT_NDO_XMIT feature of XDP
authorWei Fang <wei.fang@nxp.com>
Thu, 6 Jul 2023 08:10:09 +0000 (16:10 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 11 Jul 2023 08:00:49 +0000 (10:00 +0200)
commitbe7ecbe7ec7df7320db4b810fef438bf67144011
tree80c09e0f8cba74562d49f5a7f1f7f39e3410e854
parent9d0aba98316d00f9c0a4506fc15f5ed9241bc1fd
net: fec: dynamically set the NETDEV_XDP_ACT_NDO_XMIT feature of XDP

When a XDP program is installed or uninstalled, fec_restart() will
be invoked to reset MAC and buffer descriptor rings. It's reasonable
not to transmit any packet during the process of reset. However, the
NETDEV_XDP_ACT_NDO_XMIT bit of xdp_features is enabled by default,
that is to say, it's possible that the fec_enet_xdp_xmit() will be
invoked even if the process of reset is not finished. In this case,
the redirected XDP frames might be dropped and available transmit BDs
may be incorrectly deemed insufficient. So this patch disable the
NETDEV_XDP_ACT_NDO_XMIT feature by default and dynamically configure
this feature when the bpf program is installed or uninstalled.

Fixes: e4ac7cc6e5a4 ("net: fec: turn on XDP features")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/freescale/fec_main.c