From: Marek Lindner <lindner_marek@yahoo.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: "Linus Lüssing" <linus.luessing@ascom.ch>
Subject: Re: [B.A.T.M.A.N.] [PATCHv2 05/10] batman-adv: Creating neighbor structures, updating LQs
Date: Tue, 28 Dec 2010 14:59:34 +0100 [thread overview]
Message-ID: <201012281459.34952.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1292432969-7313-2-git-send-email-linus.luessing@ascom.ch>
On Wednesday 15 December 2010 18:09:29 Linus Lüssing wrote:
> It will now be checked if a neighbor discovery packet from a new
> neighbor on a certain interface has been received. If so,
> structures in memory will be allocated for further seqno-tracking
> and RQ calculations, and TQ reception, which will be updated
> frequently from this commit on.
Checkpatch found 8 errors - please make all your patches "checkpatch clean".
I also noticed that the new ndp files ndp.c / ndp.h lack a proper licence
header.
> @@ -1,6 +1,8 @@
> #include "main.h"
> #include "send.h"
> #include "ndp.h"
> +#include "soft-interface.h"
This include is not necessary as far as I can tell.
> +int ndp_update_neighbor(uint8_t my_tq, uint32_t seqno,
> + struct batman_if *batman_if, uint8_t *neigh_addr)
> +{
> + struct bat_priv *bat_priv = netdev_priv(batman_if->soft_iface);
> + struct neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL;
> + int ret = 1;
> +
> + spin_lock_bh(&batman_if->neigh_list_lock);
> + // old neighbor?
> + list_for_each_entry(tmp_neigh_node, &batman_if->neigh_list, list) {
> + if (!compare_orig(tmp_neigh_node->addr, neigh_addr))
> + continue;
> +
> + neigh_node = tmp_neigh_node;
A "break" could be added here.
> + }
> +
> + // new neighbor?
> + if (!neigh_node) {
> + neigh_node = ndp_create_neighbor(my_tq, seqno, neigh_addr,
> + bat_priv);
> + if (!neigh_node)
> + goto ret;
> +
> + list_add_tail(&neigh_node->list, &batman_if->neigh_list);
> + }
> +
> + ndp_update_neighbor_lq(my_tq, seqno, neigh_node, bat_priv);
> +
> + ret = 0;
> +
> +ret:
> + spin_unlock_bh(&batman_if->neigh_list_lock);
> + return ret;
> +}
Instead of holding a spinlock all the time to protect a single neigh_node
pointer you should protect the NDP neighbor list with RCU locks and the
pointers with refcounting.
> + ret = ndp_update_neighbor(my_tq, ntohl(packet->seqno),
> + batman_if, ethhdr->h_source);
> + if (ret)
> + return NET_RX_DROP;
> +
> + kfree_skb(skb);
> + return NET_RX_SUCCESS;
Why not simply returning NET_RX_DROP ?
> + struct list_head neigh_list;
> + spinlock_t neigh_list_lock;
We already have a neigh_list and a neigh_list_lock. Either the old one gets
removed or we should pick another name to avoid confusion.
> + TYPE_OF_WORD rq_real_bits[NUM_WORDS];
rq_real_bits is not a very good name. I know, the current OGM code uses the
same bad name but I believe we can safely break with the tradition here. How
about something more descriptive like "rq_ndp_window" ?
Cheers,
Marek
next prev parent reply other threads:[~2010-12-28 13:59 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-14 9:58 [B.A.T.M.A.N.] NDP patches v3 Linus Lüssing
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 01/10] batman-adv: Creating new neighbor discovery packet Linus Lüssing
2010-12-21 17:39 ` Marek Lindner
2010-12-21 18:01 ` Andrew Lunn
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 02/10] batman-adv: Adding jittering methods for ndp Linus Lüssing
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 03/10] batman-adv: Adding workqueue for new ndp packets Linus Lüssing
2010-12-21 23:52 ` Marek Lindner
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 04/10] batman-adv: Send neighbor discovery packets Linus Lüssing
2010-12-22 13:43 ` Marek Lindner
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 05/10] batman-adv: Creating neighbor structures, updating LQs Linus Lüssing
2010-12-15 17:09 ` [B.A.T.M.A.N.] linearize skb earlier Linus Lüssing
2010-12-15 17:09 ` [B.A.T.M.A.N.] [PATCHv2 05/10] batman-adv: Creating neighbor structures, updating LQs Linus Lüssing
2010-12-28 13:59 ` Marek Lindner [this message]
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 06/10] batman-adv: Purge outdated ndp neighbours Linus Lüssing
2010-12-28 14:09 ` Marek Lindner
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 07/10] batman-adv: Adding ndp debugfs output Linus Lüssing
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 08/10] batman-adv: Adding batman_if specific sysfs wrapper macros for UINT Linus Lüssing
2010-12-28 15:14 ` Marek Lindner
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 09/10] batman-adv: Adding sysfs parameter for ndp interval Linus Lüssing
2010-12-14 9:58 ` [B.A.T.M.A.N.] [PATCH 10/10] batman-adv: Use local tq values determined by NDP on OGMs Linus Lüssing
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=201012281459.34952.lindner_marek@yahoo.de \
--to=lindner_marek@yahoo.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=linus.luessing@ascom.ch \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox