The core clears HW-GRO and LRO before ndo_bpf runs and keeps them off for as long as a program is attached. mlx5e_fix_features() never sees either with params->xdp_prog set, and packet merge is always off by the time mlx5e_xdp_set() gets called, packet_merge.type only follows the two feature handlers. If tcp-data-split keeps HW-GRO on, the core refuses the attach with -EBUSY before calling the driver. The AF_XDP check stays, the core doesn't know about XSK pools. This does change user visible behavior: attaching XDP with HW-GRO or LRO on used to fail with -EINVAL and now succeeds with them turned off. Signed-off-by: Jakub Kicinski --- .../net/ethernet/mellanox/mlx5/core/en_main.c | 32 ++----------------- 1 file changed, 3 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index d8563f863844..e462dfc725ae 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -4585,17 +4585,6 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, } } - if (params->xdp_prog) { - if (features & NETIF_F_LRO) { - netdev_warn(netdev, "LRO is incompatible with XDP\n"); - features &= ~NETIF_F_LRO; - } - if (features & NETIF_F_GRO_HW) { - netdev_warn(netdev, "HW GRO is incompatible with XDP\n"); - features &= ~NETIF_F_GRO_HW; - } - } - if (priv->xsk.refcnt) { if (features & NETIF_F_LRO) { netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n", @@ -5177,20 +5166,6 @@ static void mlx5e_tx_timeout(struct net_device *dev, unsigned int txqueue) queue_work(priv->wq, &priv->tx_timeout_work); } -static int mlx5e_xdp_allowed(struct net_device *netdev, struct mlx5_core_dev *mdev, - struct mlx5e_params *params) -{ - if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) { - netdev_warn(netdev, "can't set XDP while HW-GRO/LRO is on, disable them first\n"); - return -EINVAL; - } - - if (!mlx5e_params_validate_xdp(netdev, mdev, params)) - return -EINVAL; - - return 0; -} - static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog) { struct bpf_prog *old_prog; @@ -5215,10 +5190,9 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog) new_params = priv->channels.params; new_params.xdp_prog = prog; - if (prog) { - err = mlx5e_xdp_allowed(netdev, priv->mdev, &new_params); - if (err) - goto unlock; + if (prog && !mlx5e_params_validate_xdp(netdev, priv->mdev, &new_params)) { + err = -EINVAL; + goto unlock; } /* no need for full reset when exchanging programs */ -- 2.56.1