]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
batman-adv: Use actual packet count for aggregated packets
authorSven Eckelmann <sven@narfation.org>
Sun, 2 Feb 2025 16:04:12 +0000 (17:04 +0100)
committerSimon Wunderlich <sw@simonwunderlich.de>
Sat, 22 Feb 2025 10:36:25 +0000 (11:36 +0100)
The batadv_forw_packet->num_packets didn't store the number of packets but
the the number of packets - 1. This didn't had any effects on the actual
handling of aggregates but can easily be a source of confusion when reading
the code.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/send.c

index 87c1af540457b2a71a0254a9e0ec966d6132b8be..a20d7f3004c11b2626f330385237c6aaad0284f6 100644 (file)
@@ -446,7 +446,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet,
        struct batadv_ogm_packet *batadv_ogm_packet;
        int aggregated_bytes = forw_packet->packet_len + packet_len;
        struct batadv_hard_iface *primary_if = NULL;
-       u8 packet_num = forw_packet->num_packets + 1;
+       u8 packet_num = forw_packet->num_packets;
        bool res = false;
        unsigned long aggregation_end_time;
 
@@ -600,12 +600,13 @@ static void batadv_iv_ogm_aggregate(struct batadv_forw_packet *forw_packet_aggr,
 {
        skb_put_data(forw_packet_aggr->skb, packet_buff, packet_len);
        forw_packet_aggr->packet_len += packet_len;
-       forw_packet_aggr->num_packets++;
 
        /* save packet direct link flag status */
        if (direct_link)
                set_bit(forw_packet_aggr->num_packets,
                        forw_packet_aggr->direct_link_flags);
+
+       forw_packet_aggr->num_packets++;
 }
 
 /**
index 85478fdc8ce88e2825692d3dcbfbfbacb30d6128..735ac807782198f47ae1d4c2d1347dde9728a247 100644 (file)
@@ -532,7 +532,7 @@ batadv_forw_packet_alloc(struct batadv_hard_iface *if_incoming,
        forw_packet->queue_left = queue_left;
        forw_packet->if_incoming = if_incoming;
        forw_packet->if_outgoing = if_outgoing;
-       forw_packet->num_packets = 0;
+       forw_packet->num_packets = 1;
 
        return forw_packet;