public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Simon Wunderlich <simon.wunderlich@s2003.tu-chemnitz.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Antonio Quartulli <antonio@open-mesh.com>
Subject: Re: [B.A.T.M.A.N.] [RFCv2 01/10] batman-adv: make struct batadv_neigh_node algorithm agnostic
Date: Sat, 3 Aug 2013 22:57:36 +0200	[thread overview]
Message-ID: <20130803205736.GA12891@pandem0nium> (raw)
In-Reply-To: <1375303667-3018-2-git-send-email-ordex@autistici.org>

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

On Wed, Jul 31, 2013 at 10:47:38PM +0200, Antonio Quartulli wrote:
> @@ -974,6 +973,7 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
>  	uint32_t seqno = ntohl(batadv_ogm_packet->seqno);
>  	uint8_t *neigh_addr;
>  	uint8_t packet_count;
> +	unsigned long (*bitmap)[];
> [...]
> @@ -1010,13 +1010,13 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr,
>  		}
>  
>  		/* if the window moved, set the update flag. */
> -		need_update |= batadv_bit_get_packet(bat_priv,
> -						     tmp_neigh_node->real_bits,
> +		bitmap = &tmp_neigh_node->bat_iv.real_bits;
> +		need_update |= batadv_bit_get_packet(bat_priv, *bitmap,
>  						     seq_diff, set_mark);
Why referencing and derefencing here? That looks odd, you don't use the bitmap after that, do you?
>  
> -		packet_count = bitmap_weight(tmp_neigh_node->real_bits,
> +		packet_count = bitmap_weight(tmp_neigh_node->bat_iv.real_bits,
>  					     BATADV_TQ_LOCAL_WINDOW_SIZE);
> -		tmp_neigh_node->real_packet_count = packet_count;
> +		tmp_neigh_node->bat_iv.real_packet_count = packet_count;
>  	}
>  	rcu_read_unlock();
>  
>  	/* ... and is good enough to be considered */
> -	if (neigh_node->tq_avg < router->tq_avg - BATADV_BONDING_TQ_THRESHOLD)
> +	if (neigh_node->bat_iv.tq_avg <
> +	    router->bat_iv.tq_avg - BATADV_BONDING_TQ_THRESHOLD)
>  		goto candidate_del;

alignment looks a little weird, although this will probably replaced anyway in the later patches?

>  /**
> - * struct batadv_neigh_node - structure for single hop neighbors
> - * @list: list node for batadv_orig_node::neigh_list
> - * @addr: mac address of neigh node
> + * struct batadv_neigh_bat_iv - structure for single hop neighbors
>   * @tq_recv: ring buffer of received TQ values from this neigh node
>   * @tq_index: ring buffer index
>   * @tq_avg: averaged tq of all tq values in the ring buffer (tq_recv)
> - * @last_ttl: last received ttl from this neigh node
> - * @bonding_list: list node for batadv_orig_node::bond_list
> - * @last_seen: when last packet via this neighbor was received
>   * @real_bits: bitfield containing the number of OGMs received from this neigh
>   *  node (relative to orig_node->last_real_seqno)
>   * @real_packet_count: counted result of real_bits
> - * @orig_node: pointer to corresponding orig_node
> - * @if_incoming: pointer to incoming hard interface
>   * @lq_update_lock: lock protecting tq_recv & tq_index
>   * @refcount: number of contexts the object is used
> - * @rcu: struct used for freeing in an RCU-safe manner
>   */
> -struct batadv_neigh_node {
> -	struct hlist_node list;
> -	uint8_t addr[ETH_ALEN];
> +struct batadv_neigh_bat_iv {
>  	uint8_t tq_recv[BATADV_TQ_GLOBAL_WINDOW_SIZE];
>  	uint8_t tq_index;
>  	uint8_t tq_avg;
> -	uint8_t last_ttl;
> -	struct list_head bonding_list;
> -	unsigned long last_seen;
>  	DECLARE_BITMAP(real_bits, BATADV_TQ_LOCAL_WINDOW_SIZE);
>  	uint8_t real_packet_count;
> +	spinlock_t lq_update_lock; /* protects tq_recv & tq_index */

I'd like to suggest to split out struct batadv_neigh_bat_iv in an own struct instead
of keeping it in batadv_neigh_node. If you want to keep it there, you should at least
do some indendation for the bat_iv specific parts (and maybe also the kernel doc?)

Cheers,
	Simon
 

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

  reply	other threads:[~2013-08-03 20:57 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 20:47 [B.A.T.M.A.N.] [RFCv2 00/10] Improving the routing protocol abstraction Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 01/10] batman-adv: make struct batadv_neigh_node algorithm agnostic Antonio Quartulli
2013-08-03 20:57   ` Simon Wunderlich [this message]
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 02/10] batman-adv: make struct batadv_orig_node " Antonio Quartulli
2013-08-03 21:05   ` Simon Wunderlich
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 03/10] batman-adv: add bat_orig_print function API Antonio Quartulli
2013-08-03 21:07   ` Simon Wunderlich
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 04/10] batman-adv: add bat_metric_get API function Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 05/10] batman-adv: add bat_metric_is_equiv_or_better " Antonio Quartulli
2013-08-03 21:10   ` Simon Wunderlich
2013-08-10 16:24     ` Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 06/10] batman-adv: add bat_metric_compare " Antonio Quartulli
2013-08-03 21:10   ` Simon Wunderlich
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 07/10] batman-adv: adapt bonding to use the new API functions Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 08/10] batman-adv: adapt the neighbor purging routine " Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 09/10] batman-adv: provide orig_node routing API Antonio Quartulli
2013-07-31 20:47 ` [B.A.T.M.A.N.] [RFCv2 10/10] batman-adv: adapt the TT component to use the new API functions Antonio Quartulli
2013-08-03 21:17   ` Simon Wunderlich
2013-08-03 21:19 ` [B.A.T.M.A.N.] [RFCv2 00/10] Improving the routing protocol abstraction Simon Wunderlich

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=20130803205736.GA12891@pandem0nium \
    --to=simon.wunderlich@s2003.tu-chemnitz.de \
    --cc=antonio@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /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