On Sat, Sep 28, 2013 at 11:15:43PM +0200, Alexander Aring wrote:
> The current implementation does many copies of the sk_buff for
> increasing headroom which are not necessary.
> 
> This patch increases the headroom in the maclayer for a worst case
> scenario of (sizeof(struct ipv6hdr) + sizeof(struct udphdr)).
> 
> Signed-off-by: Alexander Aring <alex.ar...@gmail.com>
> Acked-by: Werner Almesberger <wer...@almesberger.net>
> ---
>  net/ieee802154/6lowpan.c | 86 
> +++++++++---------------------------------------
>  net/mac802154/wpan.c     |  4 ++-
>  2 files changed, 19 insertions(+), 71 deletions(-)
> 
> diff --git a/net/ieee802154/6lowpan.c b/net/ieee802154/6lowpan.c
> index f4cdf46..cb1997c 100644
> --- a/net/ieee802154/6lowpan.c
> +++ b/net/ieee802154/6lowpan.c
> @@ -706,21 +706,15 @@ static int lowpan_header_create(struct sk_buff *skb,
>  static int lowpan_give_skb_to_devices(struct sk_buff *skb)
>  {
>       struct lowpan_dev_record *entry;
> -     struct sk_buff *skb_cp;
>       int stat = NET_RX_SUCCESS;
>  
>       rcu_read_lock();
> -     list_for_each_entry_rcu(entry, &lowpan_devices, list)
> +     list_for_each_entry_rcu(entry, &lowpan_devices, list) {
>               if (lowpan_dev_info(entry->ldev)->real_dev == skb->dev) {
> -                     skb_cp = skb_copy(skb, GFP_ATOMIC);
> -                     if (!skb_cp) {
> -                             stat = -ENOMEM;
> -                             break;
> -                     }
> -
> -                     skb_cp->dev = entry->ldev;
> -                     stat = netif_rx(skb_cp);
> +                     skb->dev = entry->ldev;
> +                     stat = netif_rx(skb);

Mhh, I think we can put a break here because we have only one real_dev.
A little improvement for a crazy setup with more than one lowpan device
on more than one virtual wpan device which all running on a physical
wpan device, or something else :-)

>               }
> +     }
>       rcu_read_unlock();
>  
>       return stat;

- Alex

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60133471&iu=/4140/ostg.clktrk
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to