From: Sven Eckelmann Date: Sun, 2 Feb 2025 16:04:12 +0000 (+0100) Subject: batman-adv: Use actual packet count for aggregated packets X-Git-Tag: v6.15-rc1~160^2~90^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0db110059e7900c3c197281e2ed11ff08484e3ed;p=thirdparty%2Fkernel%2Flinux.git batman-adv: Use actual packet count for aggregated packets 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 Signed-off-by: Simon Wunderlich --- diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 87c1af540457b..a20d7f3004c11 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -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++; } /** diff --git a/net/batman-adv/send.c b/net/batman-adv/send.c index 85478fdc8ce88..735ac80778219 100644 --- a/net/batman-adv/send.c +++ b/net/batman-adv/send.c @@ -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;