From patchwork Tue Mar 12 16:05:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ignat Korchagin X-Patchwork-Id: 13590254 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A20557D071 for ; Tue, 12 Mar 2024 16:10:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710259806; cv=none; b=MjYv7oyUPcgt8WkrcbJI+hX4RoSUeq6k9RjRTc9gWINp2bn2jKkpBpIJGlTrNUDdfbmzX5z+TpTYCP9FbShEHQADE1xInS2Wc0FrUEd7h19U1bBZI+tHd6zBVKB5UMXjASb2sgUa16WRB19VXEfL9KCCj3QiAbIizj5pNTFfqf4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710259806; c=relaxed/simple; bh=G8C1oEjdrYjzoN8BtMudNJ3vM/Hhj9cwGQ+yfqEivJk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=ep8p6spDuw/FeOgcFQET1rC+HoKdfd3zidp1vO4LgWrPFg24NGxJZXCKmPfFAf6xpq3fShtzadT6hrYlPZX0L4QpSQhjwdcFBmsQxanyDxSw+leUvcursjeTup5RkrXKUi+wTJzUEN+2vYBrV2P/Kv7KfQeKyO24Z2YtqA3X6LU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com; spf=pass smtp.mailfrom=cloudflare.com; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b=TKm3kokM; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="TKm3kokM" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-413328344acso7539465e9.3 for ; Tue, 12 Mar 2024 09:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1710259803; x=1710864603; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T8y9cotcn2YcwHYQkWcYzADrL0CgjgqPVI4Ap8W1Z/w=; b=TKm3kokMRVibK+WzOzuaGfhJbhQ4n22ai8Auf/duBPG0PIWjk1rm+6uH9Ga7ndfbh5 XlejJexZyRAICGAwSM8VUg0fPlhf+gq9JDjmchvi8MYY4rY1xhAuNZnfLloOgG/nGOom VPGzmRrxN8apNaq9l8hPzuL6z7DNZjGCAqilVETc822LkGVPDhm2ey7UgkIGomg36wpo l/hq5gxqkaEmh5RRTsGicqmMl+UbMAwaMr7DHav13jyXNqvH+kFpJHDKka2po3rVrEvM h0zCEhk4ZJMwpXDwNFctnykCxiX1yWJbf0lQvDAtYiu6++7iHrBxY0IVfAXxGZ+OUuGB wuJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710259803; x=1710864603; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T8y9cotcn2YcwHYQkWcYzADrL0CgjgqPVI4Ap8W1Z/w=; b=WlaRbTX+gCVyQIyUYzM4xZuvawkualIFapfD2idNWVl4A11r8lF/bt0pxarrO2nFm8 cMhvQa+Oa4SmKcuOMDl7P4271EAriQl6Jg0uzhE3ON91Tp8oo1i6p624wpb+098AeT4v NunJuXy99K0FVoD7DGyh7mVy6KfRqLM31xsprWS0RecQHVu/MJPzbob0nI5QYXQUPuhP rYYUnyU5d15dwFQ6bE1IOS8XnWLyt3KqPg1Cdr/3D1/zCC4Af/VNREnVhNRKOqt56DPL /h8ETZb4n58CV3Fuc/XacJ8Gq1p7SqdH3tjAxkYkCLBbqOyT919+KWGZ1cpVEto6HrdS qqZA== X-Forwarded-Encrypted: i=1; AJvYcCUGbTXiyvtbiY+fsR3m4FCDvGHCuDcnxq/mX5MrSryAcwKZnXNGd+r1IiyQWUDbnGp2v5WOzFLQ19URvWqjpWTzI4I9NRsk X-Gm-Message-State: AOJu0YySNNz/jUAIuS7HC44LBnuuPgQOpp4eWubpSdFtljnYqHb1x/xj IHXvd0Vx8yZj1EXQ+FXFMCdUR/SGIzPDyUVouAOmvPwWs0FTYgbgDqmwEbhBiJGJmha+30a6FoR 4bg8= X-Google-Smtp-Source: AGHT+IHqfxZojQFqGYalatcTwN7r4+eqL0JqCeWkKtamZQWH4DLqUok57Uowustec7URYbqzuvnK8w== X-Received: by 2002:a05:600c:4508:b0:413:2a10:8a29 with SMTP id t8-20020a05600c450800b004132a108a29mr4223456wmo.13.1710259802871; Tue, 12 Mar 2024 09:10:02 -0700 (PDT) Received: from localhost.localdomain ([104.28.232.7]) by smtp.gmail.com with ESMTPSA id fl8-20020a05600c0b8800b00413e523b7f9sm474253wmb.43.2024.03.12.09.10.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Mar 2024 09:10:02 -0700 (PDT) From: Ignat Korchagin To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kernel-team@cloudflare.com, Ignat Korchagin , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= Subject: [PATCH net v2 1/2] net: veth: do not manipulate GRO when using XDP Date: Tue, 12 Mar 2024 16:05:51 +0000 Message-Id: <20240312160551.73184-2-ignat@cloudflare.com> X-Mailer: git-send-email 2.39.3 (Apple Git-146) In-Reply-To: <20240312160551.73184-1-ignat@cloudflare.com> References: <20240312160551.73184-1-ignat@cloudflare.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Commit d3256efd8e8b ("veth: allow enabling NAPI even without XDP") tried to fix the fact that GRO was not possible without XDP, because veth did not use NAPI without XDP. However, it also introduced the behaviour that GRO is always enabled, when XDP is enabled. While it might be desired for most cases, it is confusing for the user at best as the GRO flag suddenly changes, when an XDP program is attached. It also introduces some complexities in state management as was partially addressed in commit fe9f801355f0 ("net: veth: clear GRO when clearing XDP even when down"). But the biggest problem is that it is not possible to disable GRO at all, when an XDP program is attached, which might be needed for some use cases. Fix this by not touching the GRO flag on XDP enable/disable as the code already supports switching to NAPI if either GRO or XDP is requested. Changes in v2: * add Fixes reference to commit description * fix commit message spelling Link: https://lore.kernel.org/lkml/20240311124015.38106-1-ignat@cloudflare.com/ Fixes: d3256efd8e8b ("veth: allow enabling NAPI even without XDP") Fixes: fe9f801355f0 ("net: veth: clear GRO when clearing XDP even when down") Signed-off-by: Ignat Korchagin Reviewed-by: Toke Høiland-Jørgensen --- drivers/net/veth.c | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index cd4a6fe458f9..f0b2c4d5fe43 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -1533,8 +1533,6 @@ static netdev_features_t veth_fix_features(struct net_device *dev, if (peer_priv->_xdp_prog) features &= ~NETIF_F_GSO_SOFTWARE; } - if (priv->_xdp_prog) - features |= NETIF_F_GRO; return features; } @@ -1638,14 +1636,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, } if (!old_prog) { - if (!veth_gro_requested(dev)) { - /* user-space did not require GRO, but adding - * XDP is supposed to get GRO working - */ - dev->features |= NETIF_F_GRO; - netdev_features_change(dev); - } - peer->hw_features &= ~NETIF_F_GSO_SOFTWARE; peer->max_mtu = max_mtu; } @@ -1661,14 +1651,6 @@ static int veth_xdp_set(struct net_device *dev, struct bpf_prog *prog, if (dev->flags & IFF_UP) veth_disable_xdp(dev); - /* if user-space did not require GRO, since adding XDP - * enabled it, clear it now - */ - if (!veth_gro_requested(dev)) { - dev->features &= ~NETIF_F_GRO; - netdev_features_change(dev); - } - if (peer) { peer->hw_features |= NETIF_F_GSO_SOFTWARE; peer->max_mtu = ETH_MAX_MTU;