On Wednesday 09 October 2013 15:05:36 Simon Wunderlich wrote:
@@ -573,6 +561,13 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, if (!primary_if) goto out;
/* packet is not leaving on the same interface.
* TODO: some other parts here could be reworked as the
* outgoing interface is specified now.
*/
if (forw_packet->if_outgoing != if_outgoing)
goto out;
- /* packets without direct link flag and high TTL
*/
- are flooded through the net
What is the TODO trying tell us ?
@@ -895,9 +922,31 @@ static void batadv_iv_ogm_schedule(struct batadv_hard_iface *hard_iface) atomic_inc(&hard_iface->bat_iv.ogm_seqno);
batadv_iv_ogm_slide_own_bcast_window(hard_iface);
- batadv_iv_ogm_queue_add(bat_priv, hard_iface->bat_iv.ogm_buff,
hard_iface->bat_iv.ogm_buff_len, hard_iface, 1,
batadv_iv_ogm_emit_send_time(bat_priv));
- send_time = batadv_iv_ogm_emit_send_time(bat_priv);
- if (hard_iface == primary_if) {
/* OGMs from primary interfaces are scheduled on all
* interfaces.
*/
rcu_read_lock();
list_for_each_entry_rcu(tmp_hard_iface, &batadv_hardif_list,
list) {
if (tmp_hard_iface->soft_iface !=
hard_iface->soft_iface)
continue;
batadv_iv_ogm_queue_add(bat_priv, *ogm_buff,
*ogm_buff_len, hard_iface,
tmp_hard_iface, 1, send_time);
}
rcu_read_unlock();
- } else {
/* OGMs from secondary interfaces are only scheduled on their
* respective interfaces.
*/
batadv_iv_ogm_queue_add(bat_priv, *ogm_buff, *ogm_buff_len,
hard_iface, hard_iface, 1, send_time);
- }
The 2 line if-statement certainly won't pass. You could handle the hard_iface != primary_if case and then return. No need to have a big if-else block. That should give you enough space to move the if-statement to one line.
Cheers, Marek