Re: [PATCH bluetooth-next] 6lowpan: Use pskb_expand_head in IPHC decompression.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 07, 2014 at 06:14:20PM +0200, Alexander Aring wrote:
> Hi Martin,
> 
> On Tue, Oct 07, 2014 at 04:33:57PM +0100, Martin Townsend wrote:
> > Currently there are potentially 2 skb_copy_expand calls in IPHC
> > decompression.  This patch replaces this with one call to
> > pskb_expand_head.  It also checks to see if there is enough headroom
> > first to ensure it's only done if necessary.
> > As pskb_expand_head must only have one reference the calling code
> > now ensures this.
> > 
> > Signed-off-by: Martin Townsend <martin.townsend@xxxxxxxxxx>
> > ---
> >  net/6lowpan/iphc.c            | 53 ++++++++++++++++++++++---------------------
> >  net/bluetooth/6lowpan.c       | 19 ++++++++++++----
> >  net/ieee802154/6lowpan_rtnl.c | 13 +++++++++++
> >  3 files changed, 55 insertions(+), 30 deletions(-)
> > 
> > diff --git a/net/6lowpan/iphc.c b/net/6lowpan/iphc.c
> > index 142eef5..fa8f348 100644
> > --- a/net/6lowpan/iphc.c
> > +++ b/net/6lowpan/iphc.c
> > @@ -174,30 +174,22 @@ static int uncompress_context_based_src_addr(struct sk_buff *skb,
> >  static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
> >  		       struct net_device *dev, skb_delivery_cb deliver_skb)
> >  {
> > -	struct sk_buff *new;
> >  	int stat;
> >  
> > -	new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
> > -			      GFP_ATOMIC);
> > -	kfree_skb(skb);
> > -
> > -	if (!new)
> > -		return -ENOMEM;
> > -
> > -	skb_push(new, sizeof(struct ipv6hdr));
> > -	skb_reset_network_header(new);
> > -	skb_copy_to_linear_data(new, hdr, sizeof(struct ipv6hdr));
> > +	skb_push(skb, sizeof(struct ipv6hdr));
> > +	skb_reset_network_header(skb);
> > +	skb_copy_to_linear_data(skb, hdr, sizeof(struct ipv6hdr));
> >  
> > -	new->protocol = htons(ETH_P_IPV6);
> > -	new->pkt_type = PACKET_HOST;
> > -	new->dev = dev;
> > +	skb->protocol = htons(ETH_P_IPV6);
> > +	skb->pkt_type = PACKET_HOST;
> > +	skb->dev = dev;
> >  
> >  	raw_dump_table(__func__, "raw skb data dump before receiving",
> > -		       new->data, new->len);
> > +		       skb->data, skb->len);
> >  
> > -	stat = deliver_skb(new, dev);
> > +	stat = deliver_skb(skb, dev);
> >  
> > -	kfree_skb(new);
> > +	kfree_skb(skb);
> >  
> I know what before but "consume_skb"
> 

oh this sentence wasn't complete. I meant:

"I know you didn't touch it but it's consume_skb here:

- Alex
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux