Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2807670pxu; Mon, 14 Dec 2020 11:20:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJylhy4H5U9cDMuvuBAcgVhAPRMlVqNFyIwlfqHbRZ0/f1Iu83opZNl/V8k5U49bPfAKeHeT X-Received: by 2002:a05:6402:379:: with SMTP id s25mr4535313edw.367.1607973599902; Mon, 14 Dec 2020 11:19:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607973599; cv=none; d=google.com; s=arc-20160816; b=mlJF/y7JD0yWEH/cic3/PLJsQzTlDFgKs/KNwgydK9AHEkmMYcBtbxswUAR6n5/mWP U43zvgzEu6oa2TZwf8l3+ac4oh3Hmi0tHm3thTYgY798abiVclc1hbfmmxt7T2OidbMS 8ftkxPa8AD3B/zJRcjsgSAQhlMyKC2mOCKvyDn9Wnj8ftJkKuLMb5gogRnWENu724n0P d1woDGm84AKcCybNJy0DfV1Q06Xg2WfcpYpBiIkmCwBsrPFJfUADYJzE5MNfllmR41pe 8Aq5mwvOd5i6Y0DLfsvBtITypGiin52GlXRuapowVeLfgZjsQ8mOSCe2WqQDreu4MD79 8V3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=vM3QKjzDGBBZv/tXSpoCCkvcgJJXS/m6h6DNI6E+8hU=; b=Hqe5mbEziWTVqQH3kLbRoLNnz1ZaoLK29O1lGS0nJzEt4pl3U/A2bsQqRr4i16Wr6W J4Z0gMKrVImp+pGsDWcz3BIQEMY8+aib/8yVV+U4ABW5oXYMUA02y0BXDPToJaBBemXg WyZUpxzdW2IHOHtP0QhQzmHwHRyV/Gl5ZdcTeOvNGesTFmWyMGf4H2pcXZ02kYYtREUG hPaMwcRVHR093nuzuhudHEOp4wJiAYL57tqjfq8mnse1tdWCGbYvnrGvbc3SOS6MkbUw vJ0JYO+zy0fbvrf3A0cQi2dXTLpms7g/yeU2NIkHcWVQsNHPD03x7lIX820CRj4KJ3Fp 2/Hg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zc8si10319401ejb.662.2020.12.14.11.19.37; Mon, 14 Dec 2020 11:19:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502360AbgLNTLM (ORCPT + 99 others); Mon, 14 Dec 2020 14:11:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:46002 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502231AbgLNRgz (ORCPT ); Mon, 14 Dec 2020 12:36:55 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 5.9 012/105] batman-adv: Reserve needed_*room for fragments Date: Mon, 14 Dec 2020 18:27:46 +0100 Message-Id: <20201214172555.864369006@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201214172555.280929671@linuxfoundation.org> References: <20201214172555.280929671@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Eckelmann [ Upstream commit c5cbfc87558168ef4c3c27ce36eba6b83391db19 ] The batadv net_device is trying to propagate the needed_headroom and needed_tailroom from the lower devices. This is needed to avoid cost intensive reallocations using pskb_expand_head during the transmission. But the fragmentation code split the skb's without adding extra room at the end/beginning of the various fragments. This reduced the performance of transmissions over complex scenarios (batadv on vxlan on wireguard) because the lower devices had to perform the reallocations at least once. Fixes: ee75ed88879a ("batman-adv: Fragment and send skbs larger than mtu") Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin --- net/batman-adv/fragmentation.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/net/batman-adv/fragmentation.c b/net/batman-adv/fragmentation.c index 9fdbe30681537..dbd913bac9dd1 100644 --- a/net/batman-adv/fragmentation.c +++ b/net/batman-adv/fragmentation.c @@ -391,6 +391,7 @@ out: /** * batadv_frag_create() - create a fragment from skb + * @net_dev: outgoing device for fragment * @skb: skb to create fragment from * @frag_head: header to use in new fragment * @fragment_size: size of new fragment @@ -401,22 +402,25 @@ out: * * Return: the new fragment, NULL on error. */ -static struct sk_buff *batadv_frag_create(struct sk_buff *skb, +static struct sk_buff *batadv_frag_create(struct net_device *net_dev, + struct sk_buff *skb, struct batadv_frag_packet *frag_head, unsigned int fragment_size) { + unsigned int ll_reserved = LL_RESERVED_SPACE(net_dev); + unsigned int tailroom = net_dev->needed_tailroom; struct sk_buff *skb_fragment; unsigned int header_size = sizeof(*frag_head); unsigned int mtu = fragment_size + header_size; - skb_fragment = netdev_alloc_skb(NULL, mtu + ETH_HLEN); + skb_fragment = dev_alloc_skb(ll_reserved + mtu + tailroom); if (!skb_fragment) goto err; skb_fragment->priority = skb->priority; /* Eat the last mtu-bytes of the skb */ - skb_reserve(skb_fragment, header_size + ETH_HLEN); + skb_reserve(skb_fragment, ll_reserved + header_size); skb_split(skb, skb_fragment, skb->len - fragment_size); /* Add the header */ @@ -439,11 +443,12 @@ int batadv_frag_send_packet(struct sk_buff *skb, struct batadv_orig_node *orig_node, struct batadv_neigh_node *neigh_node) { + struct net_device *net_dev = neigh_node->if_incoming->net_dev; struct batadv_priv *bat_priv; struct batadv_hard_iface *primary_if = NULL; struct batadv_frag_packet frag_header; struct sk_buff *skb_fragment; - unsigned int mtu = neigh_node->if_incoming->net_dev->mtu; + unsigned int mtu = net_dev->mtu; unsigned int header_size = sizeof(frag_header); unsigned int max_fragment_size, num_fragments; int ret; @@ -503,7 +508,7 @@ int batadv_frag_send_packet(struct sk_buff *skb, goto put_primary_if; } - skb_fragment = batadv_frag_create(skb, &frag_header, + skb_fragment = batadv_frag_create(net_dev, skb, &frag_header, max_fragment_size); if (!skb_fragment) { ret = -ENOMEM; -- 2.27.0