All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <aring@mojatatu.com>
To: stefan@osg.samsung.com
Cc: linux-wpan@vger.kernel.org, kernel@mojatatu.com,
	Alexander Aring <aring@mojatatu.com>
Subject: [PATCH RFC wpan] net: 6lowpan: fix reserved space for single frames
Date: Fri,  1 Jun 2018 11:58:43 -0400	[thread overview]
Message-ID: <20180601155843.29724-1-aring@mojatatu.com> (raw)

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 <aring@mojatatu.com>
---
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;
 
-- 
2.11.0


             reply	other threads:[~2018-06-01 15:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 15:58 Alexander Aring [this message]
2018-06-05 21:17 ` [PATCH RFC wpan] net: 6lowpan: fix reserved space for single frames Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180601155843.29724-1-aring@mojatatu.com \
    --to=aring@mojatatu.com \
    --cc=kernel@mojatatu.com \
    --cc=linux-wpan@vger.kernel.org \
    --cc=stefan@osg.samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.