Re: [B.A.T.M.A.N.] [PATCHv5 1/9] batman-adv: make struct batadv_neigh_node algorithm agnostic

Antonio Quartulli
2013-08-31T18:18:22Z

[-- Attachment #1: Type: text/plain, Size: 1830 bytes --]

On Fri, Aug 30, 2013 at 11:28:11PM +0200, Antonio Quartulli wrote:
> On Fri, Aug 30, 2013 at 11:22:34PM +0200, Antonio Quartulli wrote:
> > On Fri, Aug 30, 2013 at 12:20:01PM +0800, Marek Lindner wrote:
> > > On Thursday, August 29, 2013 04:54:43 Antonio Quartulli wrote:
> > > > - INIT_HLIST_NODE(&neigh_node->list);
> > > > -
> > > > memcpy(neigh_node->addr, neigh_addr, ETH_ALEN);
> > > > - spin_lock_init(&neigh_node->lq_update_lock);
> > > > + neigh_node->if_incoming = hard_iface;
> > > > + neigh_node->orig_node = orig_node;
> > > > +
> > > > + spin_lock_bh(&orig_node->neigh_list_lock);
> > > > + hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
> > > > + spin_unlock_bh(&orig_node->neigh_list_lock);
> > > > +
> > > > + INIT_LIST_HEAD(&neigh_node->bonding_list);
> > > >
> > > > /* extra reference for return */
> > > > atomic_set(&neigh_node->refcount, 2);
> > > >
> > > > - batadv_dbg(BATADV_DBG_BATMAN, bat_priv,
> > > > - "Creating new neighbor %pM on interface %s\n", neigh_addr,
> > > > - hard_iface->net_dev->name);
> > > > -
> > >
> > > The init problem remains unresolved ?
> >
> > Could you be more specific and tell me which fields are not properly
> > initialised?
>
> maybe you were taking about neigh_node->list ? actually that may be missing and
> we don't know if this neigh_noe is going to be immediately added to a list..so
> better to initialise it.

Ok, finally I got you were trying to tell me since the last patchset!!! :-)
I'm moving hlist_add_head_rcu(&neigh_node->list, &orig_node->neigh_list);
directly at the end of batadv_iv_ogm_neigh_new().

Each protocol will be in charge of adding the neigh_node item to the list.

Cheers,

--
Antonio Quartulli

..each of us alone is worth nothing..
Ernesto "Che" Guevara

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]