From: Simon Wunderlich <sw@simonwunderlich.de>
To: kuba@kernel.org, davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
Sven Eckelmann <sven@narfation.org>,
Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH 08/10] batman-adv: Use actual packet count for aggregated packets
Date: Thu, 13 Mar 2025 17:45:17 +0100 [thread overview]
Message-ID: <20250313164519.72808-9-sw@simonwunderlich.de> (raw)
In-Reply-To: <20250313164519.72808-1-sw@simonwunderlich.de>
From: Sven Eckelmann <sven@narfation.org>
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 | 5 +++--
net/batman-adv/send.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
index 87c1af540457..a20d7f3004c1 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 85478fdc8ce8..735ac8077821 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;
--
2.39.5
next prev parent reply other threads:[~2025-03-13 16:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 16:45 [PATCH 00/10] pull request for net-next: batman-adv 2025-03-13 Simon Wunderlich
2025-03-13 16:45 ` [PATCH 01/10] batman-adv: Start new development cycle Simon Wunderlich
2025-03-18 11:30 ` patchwork-bot+netdevbpf
2025-03-13 16:45 ` [PATCH 02/10] batman-adv: Drop batadv_priv_debug_log struct Simon Wunderlich
2025-03-13 16:45 ` [PATCH 03/10] batman-adv: adopt netdev_hold() / netdev_put() Simon Wunderlich
2025-03-13 16:45 ` [PATCH 04/10] batman-adv: Add support for jumbo frames Simon Wunderlich
2025-03-13 16:45 ` [PATCH 05/10] batman-adv: Use consistent name for mesh interface Simon Wunderlich
2025-03-13 16:45 ` [PATCH 06/10] batman-adv: Limit number of aggregated packets directly Simon Wunderlich
2025-03-13 16:45 ` [PATCH 07/10] batman-adv: Switch to bitmap helper for aggregation handling Simon Wunderlich
2025-03-13 16:45 ` Simon Wunderlich [this message]
2025-03-13 16:45 ` [PATCH 09/10] batman-adv: Limit aggregation size to outgoing MTU Simon Wunderlich
2025-03-13 16:45 ` [PATCH 10/10] batman-adv: add missing newlines for log macros 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=20250313164519.72808-9-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.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