From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD39BC433EF for ; Wed, 18 May 2022 06:35:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231386AbiERGfN (ORCPT ); Wed, 18 May 2022 02:35:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231382AbiERGez (ORCPT ); Wed, 18 May 2022 02:34:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C1AE7320 for ; Tue, 17 May 2022 23:34:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A28D0B81E99 for ; Wed, 18 May 2022 06:34:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44139C385AA; Wed, 18 May 2022 06:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652855686; bh=jnYiqRk62h+M+0VkaqKxjXVMOnuc3xDlpExaQA4QSrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wk3PdCyXtBNy10hZ6KrjFr12kqqi7rL1cXRwlWbNYuabNKO6jHQP5nM67Gj4zWX8w NzHjEfr5ACziQLFfTGM3rW/2c26fETJvacII7SuiJT8ZGYsEQLjgFigpahAVJYCT0y Zikei9RG1qQugqAD4YOxcI/d0l495I1/NZ9CoHW3rTYBWmi5WnsDvlpOQyUKGCbRSi wyWAJ3+DxDcb9Q6Y1dY6mW9PCSMajaDiA3k0FNkIPs+tDHR1EKlagFHHC1D3lnIArV 4PcaLjfztZPUKETzg9wZKsMEXZcKpyd/M6TH0FYWa90BvP25rAfTkseADDyb3PEVy5 1hs9PuI4JPW6A== From: Saeed Mahameed To: "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: netdev@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed Subject: [net 07/11] net/mlx5e: Properly block HW GRO when XDP is enabled Date: Tue, 17 May 2022 23:34:23 -0700 Message-Id: <20220518063427.123758-8-saeed@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220518063427.123758-1-saeed@kernel.org> References: <20220518063427.123758-1-saeed@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Maxim Mikityanskiy HW GRO is incompatible and mutually exclusive with XDP and XSK. However, the needed checks are only made when enabling XDP. If HW GRO is enabled when XDP is already active, the command will succeed, and XDP will be skipped in the data path, although still enabled. This commit fixes the bug by checking the XDP and XSK status in mlx5e_fix_features and disabling HW GRO if XDP is enabled. Fixes: 83439f3c37aa ("net/mlx5e: Add HW-GRO offload") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed --- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c index 3969916cfafe..6afd07901a10 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c @@ -3905,6 +3905,18 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev, 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_GRO_HW) { + netdev_warn(netdev, "HW GRO is incompatible with AF_XDP (%u XSKs are active)\n", + priv->xsk.refcnt); + features &= ~NETIF_F_GRO_HW; + } } if (MLX5E_GET_PFLAG(params, MLX5E_PFLAG_RX_CQE_COMPRESS)) { -- 2.36.1