Subject: Re: [PATCH net v2 7/8] net/mlx5e: take into account device reconfiguration for xdp_features flag

From: Jakub Kicinski <[email-masked]>
Date: Wed, 15 Mar 2023 16:39:00 -0700

On Thu,  9 Mar 2023 13:25:31 +0100 Lorenzo Bianconi wrote:
> Take into account LRO and GRO configuration setting device xdp_features
> flag. Consider channel rq_wq_type enabling rx scatter-gatter support in
> xdp_features flag and disable NETDEV_XDP_ACT_NDO_XMIT_SG since it is not
> supported yet by the driver.
> Moreover always enable NETDEV_XDP_ACT_NDO_XMIT as the ndo_xdp_xmit
> callback does not require to load a dummy xdp program on the NIC.
> 
> Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> Co-developed-by: Tariq Toukan <[email-masked]>
> Signed-off-by: Tariq Toukan <[email-masked]>
> Signed-off-by: Lorenzo Bianconi <[email-masked]>

This one hits ASSERT_RTNL(), I think. Don't we need something like:

diff --git a/net/core/xdp.c b/net/core/xdp.c
index 87e654b7d06c..5722a1fc6e9e 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -781,6 +781,9 @@ void xdp_set_features_flag(struct net_device *dev, xdp_features_t val)
                return;
 
        dev->xdp_features = val;
+
+       if (dev->reg_state < NETREG_REGISTERED)
+               return;
        call_netdevice_notifiers(NETDEV_XDP_FEAT_CHANGE, dev);
 }
 EXPORT_SYMBOL_GPL(xdp_set_features_flag);

? The notifiers are not needed until the device is actually live.