Author: marek Date: 2010-03-20 15:51:42 +0100 (Sat, 20 Mar 2010) New Revision: 1599
Modified: trunk/batman-adv-kernelland/aggregation.c trunk/batman-adv-kernelland/send.c Log: batman-adv: fix aggregation timing bug
batman-adv aggregates routing packets to reduce the number of packets in the air. Every outgoing packet is compared with other packets in the buffer to determine whether it can be aggregated or not. Packets sent at a lower interval can be held back longer to maximize the aggregation. Due to insufficient checking batman-adv held back all packets for a certain time depending on its own lowest interval rate which slowed down all other nodes.
Reported-by: Linus Luessing linus.luessing@web.de Signed-off-by: Marek Lindner lindner_marek@yahoo.de
Modified: trunk/batman-adv-kernelland/aggregation.c =================================================================== --- trunk/batman-adv-kernelland/aggregation.c 2010-03-14 17:52:17 UTC (rev 1598) +++ trunk/batman-adv-kernelland/aggregation.c 2010-03-20 14:51:42 UTC (rev 1599) @@ -52,6 +52,8 @@ */
if (time_before(send_time, forw_packet->send_time) && + time_after_eq(send_time + msecs_to_jiffies(MAX_AGGREGATION_MS), + forw_packet->send_time) && (aggregated_bytes <= MAX_AGGREGATION_BYTES)) {
/** @@ -196,6 +198,16 @@ if (forw_packet_aggr == NULL) { /* the following section can run without the lock */ spin_unlock_irqrestore(&forw_bat_list_lock, flags); + + /** + * if we could not aggregate this packet with one of the others + * we hold it back for a while, so that it might be aggregated + * later on + */ + if ((!own_packet) && + (atomic_read(&bat_priv->aggregation_enabled))) + send_time += msecs_to_jiffies(MAX_AGGREGATION_MS); + new_aggregated_packet(packet_buff, packet_len, send_time, direct_link, if_incoming, own_packet);
Modified: trunk/batman-adv-kernelland/send.c =================================================================== --- trunk/batman-adv-kernelland/send.c 2010-03-14 17:52:17 UTC (rev 1598) +++ trunk/batman-adv-kernelland/send.c 2010-03-20 14:51:42 UTC (rev 1599) @@ -49,15 +49,7 @@ /* when do we schedule a forwarded packet to be sent */ static unsigned long forward_send_time(struct bat_priv *bat_priv) { - unsigned long send_time = jiffies; /* Starting now plus... */ - - if (atomic_read(&bat_priv->aggregation_enabled)) - send_time += (((MAX_AGGREGATION_MS - (JITTER/2) + - (random32() % JITTER)) * HZ) / 1000); - else - send_time += (((random32() % (JITTER/2)) * HZ) / 1000); - - return send_time; + return jiffies + (((random32() % (JITTER/2)) * HZ) / 1000); }
/* send out an already prepared packet to the given address via the