From patchwork Fri Jun 1 15:58:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 10443903 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5FAEF6028F for ; Fri, 1 Jun 2018 15:59:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53F4B28CDF for ; Fri, 1 Jun 2018 15:59:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47C7E28CEF; Fri, 1 Jun 2018 15:59:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32DA928CDF for ; Fri, 1 Jun 2018 15:59:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752019AbeFAP7B (ORCPT ); Fri, 1 Jun 2018 11:59:01 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:53472 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751687AbeFAP7B (ORCPT ); Fri, 1 Jun 2018 11:59:01 -0400 Received: by mail-it0-f66.google.com with SMTP id a195-v6so2294472itd.3 for ; Fri, 01 Jun 2018 08:59:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=BLxOUQfd1UZrYpv2hWyAUF95XA1Fxh99w7p5sigzSG0=; b=LK70jn221t1lr26mT5Wfmdxy5TtEmTa9bQRWfnDCO8RPhT7kBNF9FDxfGaFta53QDY nLIhKZw7kfF3Y655q7HvFXRtJYvKammEbbpciJbt8BTMwmoLY72dhKZShBj3yFe1/FJL fwrQdm5rNhqQu/Y001rFFfrJvkfwLlX6ZZ44dkBfCXDbQz7rQTguneI44AQvKQsaTm2p InXxsYBN8X5wvHRgQBArsixFLwD8i+DOyc+NsaWxAWzLEUiMdrR1aLlB7MeSGnRpp3Z9 sUetjFIsyGQC00qZCwyky0Zr/M7AXpsTJqw/p0S8KmiaMi1Jomx7xz7shl4+DXX2IvY3 H9aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BLxOUQfd1UZrYpv2hWyAUF95XA1Fxh99w7p5sigzSG0=; b=RUFVZkNFRSKuwO/rQ400gRxmDKQWnpL2un79DTklbJ9MaZdJAGr7gX62gveMwBU+aF NSkcRfDOYj9fOgD292R7Ip2TD0VxeBV6fiyEsnCxP5tmyPjHY2QnYt2sXtoHc/CEU2K8 Yexo49vFw8FPso2Kjgc9LLdchK9vk/41CenN/sS/OuTvKLiOGxmWGANer26ecn/vDCjL BMxb3FnjqoWQIIchtcz69ik0tVbvs4dCfaWKiTv4sxV5bYJ6kCpc2fCreiQPlhmm+p1h Ck+xoAhmJRkCEhp2UOw4vrGs1AZqX854QRINhVWkqpLx8oOktwXgrTPXfcSQjdjUC4O2 cZOw== X-Gm-Message-State: APt69E3p/dwMu4L9RLrkYSkKsWgyNfWPFcymYfvQqz+G7TxorPcj7QnV WggOkKQ7luQwU07A3JUH385reSXw X-Google-Smtp-Source: ADUXVKIgXWV2pfUQJc0F/e2ODJD+qgTs++nIgwdJ2AQ9sHbekROhnei36s6Y6BYauK9wQl3+s99DDw== X-Received: by 2002:a24:45a3:: with SMTP id c35-v6mr4951101itd.125.1527868740370; Fri, 01 Jun 2018 08:59:00 -0700 (PDT) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id j10-v6sm1608082iod.1.2018.06.01.08.58.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 08:58:59 -0700 (PDT) From: Alexander Aring To: stefan@osg.samsung.com Cc: linux-wpan@vger.kernel.org, kernel@mojatatu.com, Alexander Aring Subject: [PATCH RFC wpan] net: 6lowpan: fix reserved space for single frames Date: Fri, 1 Jun 2018 11:58:43 -0400 Message-Id: <20180601155843.29724-1-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch fixes patch add handling to take care tail and headroom for single 6lowpan frames. We need to be sure we have a skb with the right head and tailroom for single frames. This patch do it by using skb_copy_expand(). Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195059 Signed-off-by: Alexander Aring --- I hope the refcounting doesn't change here... anyway it also copy skb. Anyway, it fix something... we can think about perfomance later. Also I thought the upper layer would allocate the right needed_headroom and needed_tailroom for me, so I don't need to realloc in transmit. Maybe this is a bigger issue in the upper layer? I am pretty sure these extra bytes should be allocated when skb is created according the net_device which ndo_xmit() will be called from. I will ask this question to netdev mailinglist..., if no answer then simple apply this patch @stefan. (If it's looking okay for you). net/ieee802154/6lowpan/tx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ieee802154/6lowpan/tx.c b/net/ieee802154/6lowpan/tx.c index e6ff5128e61a..2d74918431e3 100644 --- a/net/ieee802154/6lowpan/tx.c +++ b/net/ieee802154/6lowpan/tx.c @@ -265,7 +265,8 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev) /* We must take a copy of the skb before we modify/replace the ipv6 * header as the header could be used elsewhere */ - skb = skb_unshare(skb, GFP_ATOMIC); + skb = skb_copy_expand(skb, ldev->needed_headroom, + ldev->needed_tailroom, GFP_ATOMIC); if (!skb) return NET_XMIT_DROP;