Re: [B.A.T.M.A.N.] [PATCH v2 4/5] batman-adv: make GW election code protocol specific

Antonio Quartulli
2016-05-13T13:23:35Z

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

On Fri, May 13, 2016 at 07:07:52PM +0800, Marek Lindner wrote:
> On Tuesday, May 10, 2016 18:06:08 Antonio Quartulli wrote:
> > +static struct batadv_gw_node *
> > +batadv_iv_gw_get_best_gw_node(struct batadv_priv *bat_priv)
>
> > +static bool batadv_iv_gw_is_eligible(struct batadv_priv *bat_priv,
> > + struct batadv_orig_node *curr_gw_orig,
> > + struct batadv_orig_node *orig_node)
>
> > +/* fails if orig_node has no router */
> > +static int batadv_iv_gw_write_buffer_text(struct batadv_priv *bat_priv,
> > + struct seq_file *seq,
> > + const struct batadv_gw_node *gw_node)
>
> > +static void batadv_iv_gw_print(struct batadv_priv *bat_priv,
> > + struct seq_file *seq)
>
> How about some kernel doc ? :)

ok :)

>
>
> > +211,7 @@ void batadv_gw_election(struct batadv_priv *bat_priv) if
> > (!batadv_atomic_dec_not_zero(&bat_priv->gw.reselect) && curr_gw) goto out;
> >
> > - next_gw = batadv_gw_get_best_gw_node(bat_priv);
> > + next_gw = bat_priv->algo_ops->gw.get_best_gw_node(bat_priv);
>
> Either make the gw.get_best_gw_node() ops mandatory or check for its existence
> before using it.

I think we should always check the existence of this function.

However I also wanted to propose to reject any change of the GW mode if we do
not have these APIs implemented. But tihs can be done with a later patch.

>
>
> > @@ -1320,11 +1320,21 @@ struct batadv_algo_orig_ops {
> >
> > * struct batadv_algo_gw_ops - mesh algorithm callbacks (GW specific)
> > * @store_sel_class: parse and stores a new GW selection class
> > * @show_sel_class: prints the current GW selection class
> >
> > + * @get_best_gw_node: select the best GW from the list of available nodes
> > + * @is_eligible: check if a newly discovered GW is a potential candidate
> > for
> > + * the election as best GW
> > + * @print: print the gateway table (optional)
> >
> > */
>
> Shall we mark all optional ops as optional or .. ?

Dunno...this was a just a copy/paste from other "print" APIs. Maybe we just
remove the "optional" text from here for now.

Cheers,

--
Antonio Quartulli

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