All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@gmx.de>
To: b.a.t.m.a.n@lists.open-mesh.org,
	Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Cc: netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [B.A.T.M.A.N.] [PATCH] net: Add batman-adv meshing protocol
Date: Tue, 20 Jul 2010 10:28:10 +0200	[thread overview]
Message-ID: <201007201028.12470.sven.eckelmann@gmx.de> (raw)
In-Reply-To: <20100719.212625.255369607.davem@davemloft.net>

[-- Attachment #1: Type: Text/Plain, Size: 1657 bytes --]

Thanks a lot for your review and for your hints.

David Miller wrote:
> From: Sven Eckelmann <sven.eckelmann@gmx.de>
> Date: Fri, 16 Jul 2010 16:39:16 +0200
[...]
> 
> The kernel has a hamming weight library function which takes advantage
> of population count instructions on cpus that suport it, and also has
> a sw version than is faster than what you're doing here, please use
> it.
> 
> The interfaces are called "hweight{8,16,32,64}()" where the number in
> the name indicates the bit-size of the word the interface operates on.

Correct, the inner loop is a quite straight forward implementation without any 
kind of optimization. I will change that.

> I also notice that this code uses it's own internal buffering scheme
> with kmalloc()'d buffers, then seperately allocates actual SKB's and
> copies the data there.
> 
> Just use the SKB facilities how they were designed to be used, instead
> of needlessly inventing new things.  Allocate your initial SKB and put
> the initial forwarding header in it, then when you want to send a copy
> off, skb_clone() it, and push the other bits you want at the head
> and/or the tail of the cloned SKB, then simply send it off.

Good catch. That comes from a time when batman-adv was a minimalistic 
conversation of the userspace proof of concept implementation. This happens 
for example in vis.c, icmp_socket.c and send.c (just grepping for 
send_raw_packet is a good way to find those places). But is also happening 
with batman_if->packet_buff in schedule_own_packet and similar places.

I would leave that to the original author of those functions.

thanks,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Sven Eckelmann <sven.eckelmann-Mmb7MZpHnFY@public.gmane.org>
To: b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org,
	Simon Wunderlich
	<siwu-MaAgPAbsBIVS8oHt8HbXEIQuADTiUCJX@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
Subject: Re: [PATCH] net: Add batman-adv meshing protocol
Date: Tue, 20 Jul 2010 10:28:10 +0200	[thread overview]
Message-ID: <201007201028.12470.sven.eckelmann@gmx.de> (raw)
In-Reply-To: <20100719.212625.255369607.davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>

[-- Attachment #1: Type: Text/Plain, Size: 1679 bytes --]

Thanks a lot for your review and for your hints.

David Miller wrote:
> From: Sven Eckelmann <sven.eckelmann-Mmb7MZpHnFY@public.gmane.org>
> Date: Fri, 16 Jul 2010 16:39:16 +0200
[...]
> 
> The kernel has a hamming weight library function which takes advantage
> of population count instructions on cpus that suport it, and also has
> a sw version than is faster than what you're doing here, please use
> it.
> 
> The interfaces are called "hweight{8,16,32,64}()" where the number in
> the name indicates the bit-size of the word the interface operates on.

Correct, the inner loop is a quite straight forward implementation without any 
kind of optimization. I will change that.

> I also notice that this code uses it's own internal buffering scheme
> with kmalloc()'d buffers, then seperately allocates actual SKB's and
> copies the data there.
> 
> Just use the SKB facilities how they were designed to be used, instead
> of needlessly inventing new things.  Allocate your initial SKB and put
> the initial forwarding header in it, then when you want to send a copy
> off, skb_clone() it, and push the other bits you want at the head
> and/or the tail of the cloned SKB, then simply send it off.

Good catch. That comes from a time when batman-adv was a minimalistic 
conversation of the userspace proof of concept implementation. This happens 
for example in vis.c, icmp_socket.c and send.c (just grepping for 
send_raw_packet is a good way to find those places). But is also happening 
with batman_if->packet_buff in schedule_own_packet and similar places.

I would leave that to the original author of those functions.

thanks,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2010-07-20  8:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16 14:39 [B.A.T.M.A.N.] [PATCH 0/1] Reviewing batman-adv for net/ Sven Eckelmann
2010-07-16 14:39 ` Sven Eckelmann
2010-07-16 14:39 ` [B.A.T.M.A.N.] [PATCH] net: Add batman-adv meshing protocol Sven Eckelmann
2010-07-16 14:39   ` Sven Eckelmann
2010-07-20  4:26   ` [B.A.T.M.A.N.] " David Miller
2010-07-20  4:26     ` David Miller
2010-07-20  8:28     ` Sven Eckelmann [this message]
2010-07-20  8:28       ` Sven Eckelmann
2010-07-20 16:59       ` [B.A.T.M.A.N.] " David Miller
2010-07-20 16:59         ` David Miller
2010-07-20 17:16         ` [B.A.T.M.A.N.] " Sven Eckelmann
2010-07-20 17:16           ` Sven Eckelmann
2010-07-20 18:23         ` [B.A.T.M.A.N.] " Marek Lindner
2010-07-20 18:23           ` Marek Lindner
2010-07-20 18:41           ` [B.A.T.M.A.N.] " Abraham Arce
2010-07-20 18:41             ` Abraham Arce
2010-07-20 18:49             ` Sven Eckelmann
2010-07-20 18:49               ` Sven Eckelmann
2010-07-20 18:57               ` [B.A.T.M.A.N.] " Ben Hutchings
2010-07-20 18:57                 ` Ben Hutchings
2010-07-20 19:21                 ` Sven Eckelmann
2010-07-20 19:21                   ` Sven Eckelmann
2010-07-16 19:41 ` [B.A.T.M.A.N.] [PATCH 0/1] Reviewing batman-adv for net/ David Miller
2010-07-16 19:41   ` David Miller
2010-07-16 19:47   ` [B.A.T.M.A.N.] " Sven Eckelmann
2010-07-16 19:47     ` Sven Eckelmann
  -- strict thread matches above, loose matches on Subject: below --
2010-06-26  0:14 [B.A.T.M.A.N.] " Sven Eckelmann
2010-06-26  0:14 ` [B.A.T.M.A.N.] [PATCH] net: Add batman-adv meshing protocol Sven Eckelmann

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=201007201028.12470.sven.eckelmann@gmx.de \
    --to=sven.eckelmann@gmx.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=siwu@hrz.tu-chemnitz.de \
    /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.