Re: [B.A.T.M.A.N.] [PATCHv2 3/7] batman-adv: Detect coding nodes and remove these after timeout

Antonio Quartulli
2012-12-18T22:54:55Z

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

On Fri, Dec 14, 2012 at 07:32:48 +0100, Martin Hundebøll wrote:
[...]

> +/**
> + * batadv_nc_purge_orig_nc_nodes - go through list of nc nodes and purge stale
> + * entries
> + * @bat_priv: the bat priv with all the soft interface information
> + * @list: list of nc nodes
> + * @lock: nc node list lock
> + * @to_purge: function in charge to decide whether an entry has to be purged or
> + * not. This function takes the nc node as argument and has to return
> + * a boolean value: true is the entry has to be deleted, false

typo here? is -> if ?

> + * otherwise
> + */
> +static void
> +batadv_nc_purge_orig_nc_nodes(struct batadv_priv *bat_priv,
> + struct list_head *list,
> + spinlock_t *lock,
> + bool (*to_purge)(struct batadv_priv *,
> + struct batadv_nc_node *))

[...]

> /**
> + * batadv_can_nc_with_orig - checks whether the given orig node is suitable for
> + * coding or not
> + * @bat_priv: the bat priv with all the soft interface information
> + * @orig_node: neighboring orig node which may be used as nc candidate
> + * @ogm_packet: incoming ogm packet also used for the checks
> + *
> + * Returns true if:
> + * 1) The OGM must have the most recent sequence number.
> + * 2) The TTL must be incremented by one and only one.

mh..should be decremented here? or maybe I misunderstood the condition.

> + * 3) The OGM must be received from the first hop from orig_node.
> + * 4) The TQ value of the OGM must be above bat_priv->nc.min_tq.
> + */
> +static bool batadv_can_nc_with_orig(struct batadv_priv *bat_priv,
> + struct batadv_orig_node *orig_node,
> + struct batadv_ogm_packet *ogm_packet)
> +{
> + if (orig_node->last_real_seqno != ogm_packet->seqno)
> + return false;
> + if (orig_node->last_ttl != ogm_packet->header.ttl + 1)
> + return false;
> + if (!batadv_compare_eth(ogm_packet->orig, ogm_packet->prev_sender))
> + return false;
> + if (ogm_packet->tq < bat_priv->nc.min_tq)
> + return false;
> +
> + return true;
> +}

Cheers,

--
Antonio Quartulli

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

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