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: 334107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA32CC56202 for ; Thu, 26 Nov 2020 12:53:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3682821D1A for ; Thu, 26 Nov 2020 12:53:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="P8W/Ymhc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389644AbgKZMxU (ORCPT ); Thu, 26 Nov 2020 07:53:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389266AbgKZMxT (ORCPT ); Thu, 26 Nov 2020 07:53:19 -0500 X-Greylist: delayed 16271 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 26 Nov 2020 04:53:19 PST Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACD91C0613D4 for ; Thu, 26 Nov 2020 04:53:19 -0800 (PST) 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 Cc: b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, Sven Eckelmann , Annika Wickert 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 --- 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: 333500 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFE45C64E7B for ; Thu, 26 Nov 2020 12:53:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5EA9021D1A for ; Thu, 26 Nov 2020 12:53:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="sq37VNJc" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389744AbgKZMxX (ORCPT ); Thu, 26 Nov 2020 07:53:23 -0500 Received: from dvalin.narfation.org ([213.160.73.56]:39320 "EHLO dvalin.narfation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389703AbgKZMxW (ORCPT ); Thu, 26 Nov 2020 07:53:22 -0500 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 Cc: b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org, Sven Eckelmann 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 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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)