From patchwork Thu Nov 26 12:52:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18222 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id BCDB78147C; Thu, 26 Nov 2020 14:02:04 +0100 (CET) Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 012AA8009A for ; Thu, 26 Nov 2020 14:02:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1606395197; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=u9brxP8N0Zad68RDWJ6eU6Uvj+b8EOgYlFMeuq6xuxs=; b=P8W/YmhcdPLxb73c6tYExpaaeX0D3QinuxJz9eVJOdwWiECUgQI4YSQGS1zE0Fha1CiIMZ fTIu8AYvOnPYsbK6ULiGhmT3WE76Or/i/X40vq40v2+Wy+ZRQ11mWFs1MYcIrP+vb/gowU Xlg8GATDkz+tutA7cotNBETv8pL+nbU= From: Sven Eckelmann To: netdev@vger.kernel.org Subject: [PATCH 1/2] vxlan: Add needed_headroom for lower device Date: Thu, 26 Nov 2020 13:52:46 +0100 Message-Id: <20201126125247.1047977-1-sven@narfation.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1606395722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=u9brxP8N0Zad68RDWJ6eU6Uvj+b8EOgYlFMeuq6xuxs=; b=2laKxS8rXVDnwvBaJXfBixW0r+Ngf8OllRJQPUIWyW4gH9BaslxR28Ll443/ZZcO70v7DM 10KPH9haD82Cbl/oc60mrJdzsR4yY/h+rrtrwQN4M/W+sxb4J8ZSnpfUOFkStEWkbJnMH6 iHmLYeF9JB5azoiFMhlmokdz89C6cZo= ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1606395722; a=rsa-sha256; cv=none; b=o3Sa6XlVhEjERHTVPJsrPxIQF1Gc1giZfjPRKJhtFxgnXitMrH2PadJAajpLZMYj+cBbBL IzudEUsbnGbKeGG88KAmP0PftzPigKQuuGaA5lnIVzS6E6nhDijYeqM5tKi1f8rWaAr3Qv 7uCUdlAEe497d+8Tt1rgIT7fvdxvFcs= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=P8W/Ymhc; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org Message-ID-Hash: 2SUWRI6VVSCHRXIRGTQ3TIOTLU64UZY2 X-Message-ID-Hash: 2SUWRI6VVSCHRXIRGTQ3TIOTLU64UZY2 X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, Annika Wickert X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: It was observed that sending data via batadv over vxlan (on top of wireguard) reduced the performance massively compared to raw ethernet or batadv on raw ethernet. A check of perf data showed that the vxlan_build_skb was calling all the time pskb_expand_head to allocate enough headroom for: min_headroom = LL_RESERVED_SPACE(dst->dev) + dst->header_len + VXLAN_HLEN + iphdr_len; But the vxlan_config_apply only requested needed headroom for: lowerdev->hard_header_len + VXLAN6_HEADROOM or VXLAN_HEADROOM So it completely ignored the needed_headroom of the lower device. The first caller of net_dev_xmit could therefore never make sure that enough headroom was allocated for the rest of the transmit path. Cc: Annika Wickert Signed-off-by: Sven Eckelmann Tested-by: Annika Wickert --- drivers/net/vxlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 236fcc55a5fd..25b5b5a2dfea 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3799,6 +3799,7 @@ static void vxlan_config_apply(struct net_device *dev, dev->gso_max_segs = lowerdev->gso_max_segs; needed_headroom = lowerdev->hard_header_len; + needed_headroom += lowerdev->needed_headroom; max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); From patchwork Thu Nov 26 12:52:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18223 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 525A981A80; Thu, 26 Nov 2020 14:02:05 +0100 (CET) Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 2E1B08121A for ; Thu, 26 Nov 2020 14:02:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1606395200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zV9ZqDHzPB9d6PtOImamgvuZOteIZ+VW/oQO+TRb7O4=; b=sq37VNJcpPUyveuutj+PATo+Uq9ER3tH2NTmSO/Ymq+2rWJByIjSZsbSO3D8KnbeAYSOWD h+vj9d0RVPDjKVJ0uhAJRD+YuvDCUJqL4ZjMfwgPbGnW+nKoBe6bm1Bgi/U0Mair7BtMBH yj656QvWwdBxWj/6VXVP6WZpcZmAl9A= From: Sven Eckelmann To: netdev@vger.kernel.org Subject: [PATCH 2/2] vxlan: Copy needed_tailroom from lowerdev Date: Thu, 26 Nov 2020 13:52:47 +0100 Message-Id: <20201126125247.1047977-2-sven@narfation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201126125247.1047977-1-sven@narfation.org> References: <20201126125247.1047977-1-sven@narfation.org> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1606395722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=zV9ZqDHzPB9d6PtOImamgvuZOteIZ+VW/oQO+TRb7O4=; b=rLccsLzUsD4WOivYumxj33S0W6KsI9lIJoaVBd9HeCcWIR1Hn03834TC4aNJFLhjfNqlfD j8jR1ZiQyw6W1s0MWSn06W+ua+ux609r7vW+gt9xhcLhvNu4O6xs6j2jpmhSpeSSEuha+/ hPflFoLeqcPDWUOBgSvla9uv/WFxgq4= ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1606395722; a=rsa-sha256; cv=none; b=iHHwh8rbzv1lBZmglIf+ms0sbykLZrv28iJ6PlUtROgyJwf/pzKlEFbxl/Z5VRaHwuy5af 6AGRRmXOJz6MkSuzQ61ij8vw4gRI/4T+Z1N7jUaR6NLun7FL7Mq1n7BRNf9Ofp+YBc3pCE CraiTGhIy6fVejjt4r6IKbBUQ5QWSyI= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=sq37VNJc; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org Message-ID-Hash: GG3UMOVUEE3F6A6VS6IFVCARA5OU7UKG X-Message-ID-Hash: GG3UMOVUEE3F6A6VS6IFVCARA5OU7UKG X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org X-Mailman-Version: 3.2.1 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: While vxlan doesn't need any extra tailroom, the lowerdev might need it. In that case, copy it over to reduce the chance for additional (re)allocations in the transmit path. Signed-off-by: Sven Eckelmann --- drivers/net/vxlan.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 25b5b5a2dfea..44bb02122526 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -3801,6 +3801,8 @@ static void vxlan_config_apply(struct net_device *dev, needed_headroom = lowerdev->hard_header_len; needed_headroom += lowerdev->needed_headroom; + dev->needed_tailroom = lowerdev->needed_tailroom; + max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); if (max_mtu < ETH_MIN_MTU)