From patchwork Sun Feb 2 16:04:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18803 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 47A1684239 for ; Sun, 2 Feb 2025 17:05:18 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1738512318; b=PrC/eTGXNUXbGyb7XcVVeNW/LUQwR+mkviB4TXS1PonPHW0VSBr4bV2FFIaj+W4WJkeSU rMn0rY42HBSNtH3WZVcK3YcwT5jg/xw7NdWY5T3Bd/PTXt/6i3lvPGGmXLJaQL48+7g5NYl Q/NHo1hT3JK5d/ebNGU6ryOSQHk5RD8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512318; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=YgrCSDq6DZm6daeGa1Q4Mww4WCOanWsZvajvGBlHH+U=; b=l8yFpX3KZJFAJk3Ks8CM+qU6KWiA5hbl2fAKPWWyGgKunkigBQkIhoGhL1x6IR4akICew UpbNWRCNqde6rSvGxVtY21yYcQkvyGIHFhkDUrwoht+bECT4SpdixqqSFK4xNyXnzpLT//s oqUMPU6AaYI17jpqxqS2x7I1SHpiOv8= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with UTF8SMTPS id C0A9F83B28 for ; Sun, 2 Feb 2025 17:04:22 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YgrCSDq6DZm6daeGa1Q4Mww4WCOanWsZvajvGBlHH+U=; b=dXV+udVurcOP6ZN5C8BFwm0Oko1vWFxq7kB+qEPyoUFf3Zn1/JBOtHqudT4WoDkyuJiYph s46DYO0qUYWiyv4biU/93VXairwN8pKq3MKLr2Gg0a3YZX+XRVK2uPxR3rLDPCsfPrDeJh hU5izS/q5FHgydmtMeLpZbTnw/yGkSE= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=bo3WMoLS; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1738512262; a=rsa-sha256; cv=none; b=WCji+dQOn3uHS2fvZLj4VhHT3kh+o5H+YTEgGIaRx4LC85bwC5vR55vbXWAqv42+ChJs+8 AK2iLtA2OYjYg7Z8ANMRkodZBLKO0ax5AJQeSEjFy2Sb7meJKNA4FrrzfKvlnf3VUU6TF/ mybA+3gzvWtL0tTga1e1w7lYJ7MA/5E= Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:2efc::ab85]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id 499561FFC7; Sun, 2 Feb 2025 16:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1738512262; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YgrCSDq6DZm6daeGa1Q4Mww4WCOanWsZvajvGBlHH+U=; b=bo3WMoLSXxd9puv7gWs4G7dgYjYsLMah1/0JiRdeeLk0osmsA1DX/RukRCKag65E9/+iZx GcmGkpaVHNhnXDbrMm0hlc0gCkjhGlOm/0W4VbEaBWEyKoZ220Lce0HWqr+b9hbilp0+JB Q7KWIEC2vYRJoE0/RLieKhXnDGllDR8= From: Sven Eckelmann Date: Sun, 02 Feb 2025 17:04:10 +0100 Subject: [PATCH 1/5] batman-adv: Limit number of aggregated packets directly MIME-Version: 1.0 Message-Id: <20250202-bitmap_aggregation-v1-1-6542a10e6fad@narfation.org> References: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> In-Reply-To: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2089; i=sven@narfation.org; h=from:subject:message-id; bh=Mo384W5TkszZ/UWxNIgfx4vWspdZg814mLFDWVOqBNI=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDOnzp1c/+Or3aML0afbyl8q0nvNbm7lYn59cHFkbm/96V dU+JWGzjlIWBjEuBlkxRZY9V/LPb2Z/K/952sejMHNYmUCGMHBxCsBEyr8zMnwU/vqsdvPmrBjf BbV+7bXGGy0W/fd+ID+zc6qw3CrFi+2MDO/jessDFI8+CDw++elKp+N/+Y5dDNh87suUH8yf7ln 5BnAAAA== X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: MPNM3LVAA2RBHCGDBP2UZ5LE4WNCWSRS X-Message-ID-Hash: MPNM3LVAA2RBHCGDBP2UZ5LE4WNCWSRS X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The currently selected size in BATADV_MAX_AGGREGATION_BYTES (512) is chosen such that the number of possible aggregated packets is lower than 32. This number must be limited so that the type of batadv_forw_packet->direct_link_flags has enough bits to represent each packet (with the size of at least 24 bytes). This requirement is better implemented in code instead of having it inside a comment. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 4 ++++ net/batman-adv/main.h | 3 --- 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 07ae5dd1f150b062e97897b269d45b041e8b4dfe..b316cfc5b8769928a77ac936e5935ae780d5ad68 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -446,6 +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; bool res = false; unsigned long aggregation_end_time; @@ -468,6 +469,9 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, if (aggregated_bytes > BATADV_MAX_AGGREGATION_BYTES) return false; + if (packet_num >= BITS_PER_TYPE(forw_packet->direct_link_flags)) + return false; + /* packet is not leaving on the same interface. */ if (forw_packet->if_outgoing != if_outgoing) return false; diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 964f3088af5b52d3ad1d709fb964dc2c3d79d7a5..485e68a06835b48923278da7b9aa79db6968945f 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -102,9 +102,6 @@ */ #define BATADV_TQ_SIMILARITY_THRESHOLD 50 -/* should not be bigger than 512 bytes or change the size of - * forw_packet->direct_link_flags - */ #define BATADV_MAX_AGGREGATION_BYTES 512 #define BATADV_MAX_AGGREGATION_MS 100 From patchwork Sun Feb 2 16:04:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18804 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 70B8983AEC for ; Sun, 2 Feb 2025 17:05:59 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1738512359; b=0iT/fbdaU0fb5btfwEjaDWXWd1C2VEPLys3PYGP01P1InGNVpzPXr7TmqgYAcfL6VK3rP 76ro2f6Vcu/ITvewAajTzFLg1oZppWndKBO5xvv7NNJX9+ABNpuh+cmkfKRC5yChQUJe7Jp YAZiEIZjYa6BtgmTJYv71Xm2SI/+Nok= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512359; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=9DO0OS0iP//y8NaZaBcboW8/w6LphWSlaUrv8aEFX8Y=; b=IGhog7Y6KzJGbqYZ3hd4leWK+4xQCt++al6+cIngawLYpcPj7z5dKo6Ch1kpR3z80hIEC hZFk+d5k3rPR7oIWb1uc5/IlNllM12zV8rYhQCEJQLpDM21737h1/pQE+rEqcjRHVxKA+Zp XN2/xsyFzph+A5gCq1rhzsX7XDHscpI= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with UTF8SMTPS id 765AB83E48 for ; Sun, 2 Feb 2025 17:04:27 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9DO0OS0iP//y8NaZaBcboW8/w6LphWSlaUrv8aEFX8Y=; b=TQqpcLcUl/RcVvniTlF1B+SG+EdA7YHiGw/2ojHHGRTGfBDMuUU5ay/KA7ykpadvfKxLVa l5F08FnF3FgsHVs5sROJgeCvPJVP0jXpxHHP6u4panMwuFVzC3HhpTc2cF+GlIuS3jQQV6 lpOEJbAfb6Q6RVEcTJTmUbajSpJbaoc= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b="u1/lTDEd"; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1738512267; a=rsa-sha256; cv=none; b=teW0GiwGRORWdiv9pdCjuaCxNdGzKsc7x7MKH3FYn2Emu9L+O262RbYC8ZgfSdFKDcCCU/ Ip2APtWI9gbuH/7skZz/SbpZXB1haKhHQH/85WoMSDwHRS9gxZI2CstCba0vPPPLLU+R02 975yb28asb+dRO+xZoeFL/U5MPCptfM= Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:2efc::ab85]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id E57481FFC7; Sun, 2 Feb 2025 16:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1738512267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9DO0OS0iP//y8NaZaBcboW8/w6LphWSlaUrv8aEFX8Y=; b=u1/lTDEdaAka9N5vRizEaGnyr0cFcXJJdkFUP5bRvdmVrUpMnrTm3sG3Ntdcng5ZjNDnfy /25P2Fm3ETQujytrl6/A5YmUfDKkVO1JxwUHCt78E7AehVixvAcnGObHhmSmK+8bif9YjY PnipRBQ/ujdq5cmFJJIVlwXZ2qiLmOM= From: Sven Eckelmann Date: Sun, 02 Feb 2025 17:04:11 +0100 Subject: [PATCH 2/5] batman-adv: Switch to bitmap helper for aggregation handling MIME-Version: 1.0 Message-Id: <20250202-bitmap_aggregation-v1-2-6542a10e6fad@narfation.org> References: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> In-Reply-To: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4319; i=sven@narfation.org; h=from:subject:message-id; bh=jdAh5ulqweFErBLdOWqijj2GZpNNAaL6QFv6stn041c=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDOnzp1fv6T0bUhwVM3uXx/wN5ZkT4y5KVAVUTHBrPG+hK 3Qj9sj2jlIWBjEuBlkxRZY9V/LPb2Z/K/952sejMHNYmUCGMHBxCsBEHggy/BV59WyjRZ2Q7rzP G5p1WVtOsj6QzD6YO3nBbOVr7AfcHyowMjS+c3jtoma5T8GGf+KySinrKebB+pceL5V81Vc1UWT HFHYA X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: 5OQANCUT6IJJDI7FB6LWYCXKLUZMCLWE X-Message-ID-Hash: 5OQANCUT6IJJDI7FB6LWYCXKLUZMCLWE X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The aggregation code duplicates code which already exists in the the bitops and bitmap helper. By switching to the bitmap helpers, operating on larger aggregations becomes possible without touching the different portions of the code which read/modify direct_link_flags. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 19 +++++++++---------- net/batman-adv/main.h | 1 + net/batman-adv/types.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index b316cfc5b8769928a77ac936e5935ae780d5ad68..47967a53c416abc6ac37cdd269b5277e8e47f680 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -355,7 +355,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet, /* we might have aggregated direct link packets with an * ordinary base packet */ - if (forw_packet->direct_link_flags & BIT(packet_num) && + if (test_bit(packet_num, forw_packet->direct_link_flags) && forw_packet->if_incoming == hard_iface) batadv_ogm_packet->flags |= BATADV_DIRECTLINK; else @@ -460,6 +460,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, * - the send time is within our MAX_AGGREGATION_MS time * - the resulting packet won't be bigger than * MAX_AGGREGATION_BYTES + * - the number of packets is lower than MAX_AGGREGATION_PACKETS * otherwise aggregation is not possible */ if (!time_before(send_time, forw_packet->send_time) || @@ -469,7 +470,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, if (aggregated_bytes > BATADV_MAX_AGGREGATION_BYTES) return false; - if (packet_num >= BITS_PER_TYPE(forw_packet->direct_link_flags)) + if (packet_num >= BATADV_MAX_AGGREGATION_PACKETS) return false; /* packet is not leaving on the same interface. */ @@ -578,12 +579,13 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, memcpy(skb_buff, packet_buff, packet_len); forw_packet_aggr->own = own_packet; - forw_packet_aggr->direct_link_flags = BATADV_NO_FLAGS; + bitmap_zero(forw_packet_aggr->direct_link_flags, + BATADV_MAX_AGGREGATION_PACKETS); forw_packet_aggr->send_time = send_time; /* save packet direct link flag status */ if (direct_link) - forw_packet_aggr->direct_link_flags |= 1; + set_bit(0, forw_packet_aggr->direct_link_flags); INIT_DELAYED_WORK(&forw_packet_aggr->delayed_work, batadv_iv_send_outstanding_bat_ogm_packet); @@ -596,17 +598,14 @@ static void batadv_iv_ogm_aggregate(struct batadv_forw_packet *forw_packet_aggr, const unsigned char *packet_buff, int packet_len, bool direct_link) { - unsigned long new_direct_link_flag; - 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) { - new_direct_link_flag = BIT(forw_packet_aggr->num_packets); - forw_packet_aggr->direct_link_flags |= new_direct_link_flag; - } + if (direct_link) + set_bit(forw_packet_aggr->num_packets, + forw_packet_aggr->direct_link_flags); } /** diff --git a/net/batman-adv/main.h b/net/batman-adv/main.h index 485e68a06835b48923278da7b9aa79db6968945f..541fce90ec4188c993e5df16da5b61f493b5a5e0 100644 --- a/net/batman-adv/main.h +++ b/net/batman-adv/main.h @@ -102,6 +102,7 @@ */ #define BATADV_TQ_SIMILARITY_THRESHOLD 50 +#define BATADV_MAX_AGGREGATION_PACKETS 32 #define BATADV_MAX_AGGREGATION_BYTES 512 #define BATADV_MAX_AGGREGATION_MS 100 diff --git a/net/batman-adv/types.h b/net/batman-adv/types.h index fe89f08533fe694e137bf31594c60915d4783c7a..4216d01aac803339528943762b55076b5387df4a 100644 --- a/net/batman-adv/types.h +++ b/net/batman-adv/types.h @@ -2161,7 +2161,7 @@ struct batadv_forw_packet { u16 packet_len; /** @direct_link_flags: direct link flags for aggregated OGM packets */ - u32 direct_link_flags; + DECLARE_BITMAP(direct_link_flags, BATADV_MAX_AGGREGATION_PACKETS); /** @num_packets: counter for aggregated OGMv1 packets */ u8 num_packets; From patchwork Sun Feb 2 16:04:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18805 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 55BB384220 for ; Sun, 2 Feb 2025 17:06:42 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1738512402; b=aOEAiuUe/HtXKrGjD2CJtnXgyTXHtOPMF25ljphcyGEQEHnQuXhs0sHZ/QNZgr94Qe1v7 VC1+/EcIC0hnUPZ7apxOoumOSwzabH1bASjyit7/dAF7rsHKidFI3cTudqEG6qYkTi0HwEm TsgX13HMBt5nbPDpEQoCqcqfdQP8FXc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512402; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=Jax4OfMDlLnzxygPQwFf+ztsLYuOEJ7WreN/cjBk/o0=; b=lbdx+LoDPaO4ympuIrfQu36OSMIWZj1yGyP8SUXCGK9wqLHjeNclJ6FwPTp874SnQrqSL OAGYN2lKOx+AU6x3jhcCop/2q8ls1nYQQtLFBukfPY4uSE8JRvoeaX5jyjnFgRHnAvg4Y3T dw5zydWulGza+IcJPLnMWuORXJjJOj0= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with UTF8SMTPS id 38DF283FDB for ; Sun, 2 Feb 2025 17:04:32 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512272; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Jax4OfMDlLnzxygPQwFf+ztsLYuOEJ7WreN/cjBk/o0=; b=geygwq7ECSr07jQdSmUNBow0buQ+R0O/U3SCZQYI52VB5snAVTeu4RRCJqRUVkgBM5U4/g +srU9vUwTMOcAQEsp/lUUA7mtB1if5N5Nm7T2W0fPictRfsQKNdjrq8I0Dmf2t4I3L6vO5 ax0wMtZ+2eFKiCVYfGPuFE0Y1M966jo= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=s4UZE90+; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1738512272; a=rsa-sha256; cv=none; b=mfy/bf6/CzD2AIYyVFlWusNynbsT3upENL+z5PfnXgGS/TayxOVZmmyjIaXA0LBnGYSNw3 5f2dcF07zIRkfs375va9VWr5NFgRr2hgdYHcA26RcADgtRkx1IeybhL9sHH5pANO47JqeH OGhIBS8nj5nFRA+38JiIZle1IDulJNw= Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:2efc::ab85]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id 702181FFC7; Sun, 2 Feb 2025 16:04:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1738512271; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jax4OfMDlLnzxygPQwFf+ztsLYuOEJ7WreN/cjBk/o0=; b=s4UZE90+/uZbetJdHfgvNcfzL3Hnynp/HRAPXdZbL6xlVWOSih53+dFH2fEESVJhMbStyS oCHDulpXGjqk300kGp/Aa/IwuAQafZJwEpYmnHHFhad4lI5qoo93V1LhmeN5gMrtXh1x8N vabJewalvmbqRm1DyCNpbE1O9dllfRY= From: Sven Eckelmann Date: Sun, 02 Feb 2025 17:04:12 +0100 Subject: [PATCH 3/5] batman-adv: Use actual packet count for aggregated packets MIME-Version: 1.0 Message-Id: <20250202-bitmap_aggregation-v1-3-6542a10e6fad@narfation.org> References: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> In-Reply-To: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2083; i=sven@narfation.org; h=from:subject:message-id; bh=3sKDOuTUNgY5FrvutHENWknYwEjvMXDevs4VwM5pUxI=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDOnzp9cs6X9pad1WwPVfJSNS65SguEXy0h2zDPwV3m7mz 5upwi/XUcrCIMbFICumyLLnSv75zexv5T9P+3gUZg4rE8gQBi5OAZgIfzojw29HixXl/5e5Blfk cbPqR+Voz+IVmjdnqt1s+Wtz8rj6MxkZWrx/yHdwTBU9fJpterbPG4n5TZpGdYcZd51a/dLMV6S NCwA= X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: FYA4XOFMSY5U4472ARRNG7LUNWLJL45N X-Message-ID-Hash: FYA4XOFMSY5U4472ARRNG7LUNWLJL45N X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 --- 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 47967a53c416abc6ac37cdd269b5277e8e47f680..a43c268b2a3028c9a36fe8ce060cfb23ac5f9381 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 0379b126865d7c07b84c08c93eca38279fe6df9c..39a13664dc4dae46f49851af738bca4c3b8891ef 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; From patchwork Sun Feb 2 16:04:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18806 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 189B5842B7 for ; Sun, 2 Feb 2025 17:07:23 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1738512443; b=IGceAdp+sRs3KHsBXJkbuD47fPPckwPDfIuZZZ9RvxKWZrkNUaYqsjTYb8hHI7jrT20RY HRb2BRls6TeLO77hIjHZPGY9umzN/RtMGwnEPg9n5EJzvxOdCEmdJCsXmDAapYlKiJR1bJj 9fYMAgxuj8aaXhX6QP2RQI5uIBn8YSY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512443; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=oGapBlmMw9gEkPQs8Ge7PbYGBZyCEN9nPgYV9QYHe3c=; b=iK9gISovij6IT2l/iRRD2UEhsyg5n3gHJQy5NmcY8ejXTEC5+D7ANX6luYUvzLY+Vk6XY D+9/wXM7aUa3NwRvzflAwEE5PvL1EVS6aig/au4YpzQCWlLiZ40elAIIPqdqIKEdNwZYQUt hhuK33qi5/8CZKLTWhbLWQGPWTFMOjE= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [213.160.73.56]) by diktynna.open-mesh.org (Postfix) with UTF8SMTPS id 4CFEC840AE for ; Sun, 2 Feb 2025 17:04:36 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=oGapBlmMw9gEkPQs8Ge7PbYGBZyCEN9nPgYV9QYHe3c=; b=sShYmZLZc/I5lKUuUdp0saEmAYsprRzH0yvfti3zd1ZhHzYLlkO6FafUaUXv/60wtvyuss +P+RMqokCtzeEsg97o3fUMrAgI41BtST9xQSAbu4SoyOH4xQftEfxdd46m1mv2V4+fkwTo bNMUwJ4muEWLgv5o0zBendL3kV+HYt0= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=hGnD5Ihd; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 213.160.73.56 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1738512276; a=rsa-sha256; cv=none; b=st+CRj74LhEp4/MlJ11k8YgHcDPN38y/IOjKzNYUjZ8ELrQSty8U84taMG9AHfBzDaiF3L s29TJVRBmfV7yrHhWZbhhi0S4xI7NSMU2aKl4rHubidGsiIbweOhuXK+ELbQXd41mpQ0D2 +tAOyhcxMeA5zGqbAszd4FHW+4yadak= Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:2efc::ab85]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id 04D0A1FFC7; Sun, 2 Feb 2025 16:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1738512276; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oGapBlmMw9gEkPQs8Ge7PbYGBZyCEN9nPgYV9QYHe3c=; b=hGnD5IhdK3OeaMoz4bLGMzD8wmp3qEUg5GoSezxfDNXRBYW0GLxu9oRp2m4/fRqAtMQyC2 xM4uyWhMm7qZsY31BIewVBAP24VhXQPJD5rbm2iSU1rB20F1qAd6ro74gk3YcZbmf2HbP7 td3WoDm5T0YFc7cVnj6B6Ny8BcR5gns= From: Sven Eckelmann Date: Sun, 02 Feb 2025 17:04:13 +0100 Subject: [PATCH 4/5] batman-adv: Ignore own maximum aggregation size during RX MIME-Version: 1.0 Message-Id: <20250202-bitmap_aggregation-v1-4-6542a10e6fad@narfation.org> References: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> In-Reply-To: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1995; i=sven@narfation.org; h=from:subject:message-id; bh=krp5/3huzASscHdXC5MUgCNE3wYmU1VSwpJUmfOImcU=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDOnzp9eUehT1X47vqlNy1V/cGdEo7KRfwzpxavTagCK+V QJf2Ys7SlkYxLgYZMUUWfZcyT+/mf2t/OdpH4/CzGFlAhnCwMUpABOJjmRkeJKaa8FZza1bOu3K AS3bfjbe9Qnqf6Y5738up6q7/njAd4b/nm36HMkLYx6HfrCZKL3/TOuv512OhtfPhfakqV3I1ln EDgA= X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: DHMUUSIHRICQXO72WCTWT4LTG3ZDHOLC X-Message-ID-Hash: DHMUUSIHRICQXO72WCTWT4LTG3ZDHOLC X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: An OGMv1 and OGMv2 packet receive processing were not only limited by the number of bytes in the received packet but also by the nodes maximum aggregation packet size limit. But this limit is relevant for TX and not for RX. It should thefore not be enforced by batadv_(i)v_ogm_aggr_packet This has a minor side effect for B.A.T.M.A.N. IV because the batadv_iv_ogm_aggr_packet is also used for the preprocessing for the TX. But since the aggregation code itself will not allow more than BATADV_MAX_AGGREGATION_BYTES bytes, this check was never triggering prior of removing it. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 3 +-- net/batman-adv/bat_v_ogm.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index a43c268b2a3028c9a36fe8ce060cfb23ac5f9381..769d5ff779eb88de8b9d889bb3e4a3304875ea32 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -325,8 +325,7 @@ batadv_iv_ogm_aggr_packet(int buff_pos, int packet_len, /* check if there is enough space for the optional TVLV */ next_buff_pos += ntohs(ogm_packet->tvlv_len); - return (next_buff_pos <= packet_len) && - (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); + return next_buff_pos <= packet_len; } /* send a batman ogm to a given interface */ diff --git a/net/batman-adv/bat_v_ogm.c b/net/batman-adv/bat_v_ogm.c index e503ee0d896bd52bb5827102a7a57fc07279f0bd..8f89ffe6020ced5668dc90ac438ecd6dcd1d74b6 100644 --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -839,8 +839,7 @@ batadv_v_ogm_aggr_packet(int buff_pos, int packet_len, /* check if there is enough space for the optional TVLV */ next_buff_pos += ntohs(ogm2_packet->tvlv_len); - return (next_buff_pos <= packet_len) && - (next_buff_pos <= BATADV_MAX_AGGREGATION_BYTES); + return next_buff_pos <= packet_len; } /** From patchwork Sun Feb 2 16:04:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 18807 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id 6E1F78410E for ; Sun, 2 Feb 2025 17:08:13 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1738512493; b=hMyeF5af3EyzbWZTfFIxdI8ERNbauEr5AE1OmYxNjGnQxxWnGbTY810dslG5uCxQ9xx3M 0c09D3A23qCX9BxEt3yiiDcB4D1dKrwui3tEK8d9rcBqjhjmi/Ds0aC60w/nknvxj2sGyxo GaDD3TtBsnHuUeJV3TEQi2WrEpqiiM8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512493; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=4A2VgP/niVHsikbpR6VqhacnmPk4pooFkJl3TZPcHNo=; b=fp9hXUe1imgcnq2Uj/I9sKlODXsfmMxvpy25JWoqB0WYFWru9bXeC+4ZRN4mGbJpkUsuy CzBGqTV7y2hgAC8m7CQL6mi9QukbCj3d5qa0jI5UrIWOo6qLBYBtVc+kCaF4goAQXhZHKFU Ima4nj7npIKG65ir0Zm3qM1VjYfai1g= ARC-Authentication-Results: i=2; open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Authentication-Results: open-mesh.org; dkim=pass header.d=narfation.org; arc=pass; dmarc=pass (Used From Domain Record) header.from=narfation.org policy.dmarc=none Received: from dvalin.narfation.org (dvalin.narfation.org [IPv6:2a00:17d8:100::8b1]) by diktynna.open-mesh.org (Postfix) with UTF8SMTPS id 2D6A6840F0 for ; Sun, 2 Feb 2025 17:04:41 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1738512281; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=4A2VgP/niVHsikbpR6VqhacnmPk4pooFkJl3TZPcHNo=; b=Os4zFcmcQOl04p1bSBA6BCVHqHlSun0rpy+uiTNtYKFmao8YCw3yqSMgux5QuSOtvqhaTa T+E4RXTV91Kco24x+LllnwKk6qfDO/UDQQOgn/C0HPCY3o9SV4nAa/lNc+rZ7MY09i8s8i VhduR/6lrrJMdP0ooOkfDe9sC0+5yEY= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=pass header.d=narfation.org header.s=20121 header.b=a76w0AO+; spf=pass (diktynna.open-mesh.org: domain of sven@narfation.org designates 2a00:17d8:100::8b1 as permitted sender) smtp.mailfrom=sven@narfation.org; dmarc=pass (policy=none) header.from=narfation.org ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1738512281; a=rsa-sha256; cv=none; b=wpQwNRs+QVxq/M3ngzMoWMWoQoD2AG0ROy+en3znVjbE+pItLYcQ2GHocM66tykQpY6O07 MZkqx3ee5/KBwf3Mn7bAdmiUMA5kTr/xL7IBAAG6T1R6xsbpX3MfRaVVhW7HOyMMbJ3ecr AoPejjApbabJnq1C2gXeCsSl54+sKVg= Received: from sven-desktop.home.narfation.org (unknown [IPv6:2a00:1ca0:1d86:2efc::ab85]) by dvalin.narfation.org (Postfix) with UTF8SMTPSA id D1AA61FFC7; Sun, 2 Feb 2025 16:04:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1738512280; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4A2VgP/niVHsikbpR6VqhacnmPk4pooFkJl3TZPcHNo=; b=a76w0AO+jyXBQCuAbzHUYEDll/27gS17PtpolKR1mzD0UL0gU/zb0mBv114rsGD8ptQl9u GcXYVe776hmHJYBmqGZ7B5q9q4suXI2DRM2WfR5hy9qAjpwwAhdLLLx/x5ILjNKK416IKJ vHGheu2G+Cf9MyLQRvubFYe7Hq6i0bY= From: Sven Eckelmann Date: Sun, 02 Feb 2025 17:04:14 +0100 Subject: [PATCH 5/5] batman-adv: Limit aggregation size to outgoing MTU MIME-Version: 1.0 Message-Id: <20250202-bitmap_aggregation-v1-5-6542a10e6fad@narfation.org> References: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> In-Reply-To: <20250202-bitmap_aggregation-v1-0-6542a10e6fad@narfation.org> To: b.a.t.m.a.n@lists.open-mesh.org Cc: Sven Eckelmann X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2901; i=sven@narfation.org; h=from:subject:message-id; bh=UNsjzAvyrCK+RI3xQQEacYRYBfrE8644FEAbtApZa00=; b=owGbwMvMwCXmy1+ufVnk62nG02pJDOnzp9fIM86fHdd6L3djYVnXtN2HFm8qFf/5lWXClfkGm hNX+C606ShlYRDjYpAVU2TZcyX//Gb2t/Kfp308CjOHlQlkCAMXpwBM5GMow/+K7F61xxLXVJb9 6uJzd370gZn1162bWjK567+vMREyzQtj+B8zvc6O4YHNitVWwQ/bGY+ESj2bKHmx5FO+Q6rRE9k P9owA X-Developer-Key: i=sven@narfation.org; a=openpgp; fpr=522D7163831C73A635D12FE5EC371482956781AF Message-ID-Hash: 66D7JH5R5RTHCMW4AKTUL76GGNRNKW2I X-Message-ID-Hash: 66D7JH5R5RTHCMW4AKTUL76GGNRNKW2I X-MailFrom: sven@narfation.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If a B.A.T.M.A.N. IV aggregated OGM was prepared, it was always assumed that 512 bytes (BATADV_MAX_AGGREGATION_BYTES) can be transmitted. But the outgoing MTU might be too small for these 512 bytes and the aggregation size must be adjusted in this case. Otherwise, the aggregates will cause unnecessary packet loss. For now, the non-aggregated packet length is not touched. Signed-off-by: Sven Eckelmann --- net/batman-adv/bat_iv_ogm.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 769d5ff779eb88de8b9d889bb3e4a3304875ea32..dbad6007871a97ee01f7295c005ab3deeff86efd 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -443,22 +443,26 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, const struct batadv_forw_packet *forw_packet) { struct batadv_ogm_packet *batadv_ogm_packet; - int aggregated_bytes = forw_packet->packet_len + packet_len; + unsigned int aggregated_bytes = forw_packet->packet_len + packet_len; struct batadv_hard_iface *primary_if = NULL; u8 packet_num = forw_packet->num_packets; bool res = false; unsigned long aggregation_end_time; + unsigned int max_bytes; batadv_ogm_packet = (struct batadv_ogm_packet *)forw_packet->skb->data; aggregation_end_time = send_time; aggregation_end_time += msecs_to_jiffies(BATADV_MAX_AGGREGATION_MS); + max_bytes = min_t(unsigned int, if_outgoing->net_dev->mtu, + BATADV_MAX_AGGREGATION_BYTES); + /* we can aggregate the current packet to this aggregated packet * if: * * - the send time is within our MAX_AGGREGATION_MS time * - the resulting packet won't be bigger than - * MAX_AGGREGATION_BYTES + * MAX_AGGREGATION_BYTES and MTU of the outgoing interface * - the number of packets is lower than MAX_AGGREGATION_PACKETS * otherwise aggregation is not possible */ @@ -466,7 +470,7 @@ batadv_iv_ogm_can_aggregate(const struct batadv_ogm_packet *new_bat_ogm_packet, !time_after_eq(aggregation_end_time, forw_packet->send_time)) return false; - if (aggregated_bytes > BATADV_MAX_AGGREGATION_BYTES) + if (aggregated_bytes > max_bytes) return false; if (packet_num >= BATADV_MAX_AGGREGATION_PACKETS) @@ -551,9 +555,9 @@ static void batadv_iv_ogm_aggregate_new(const unsigned char *packet_buff, unsigned int skb_size; atomic_t *queue_left = own_packet ? NULL : &bat_priv->batman_queue_left; - if (atomic_read(&bat_priv->aggregated_ogms) && - packet_len < BATADV_MAX_AGGREGATION_BYTES) - skb_size = BATADV_MAX_AGGREGATION_BYTES; + if (atomic_read(&bat_priv->aggregated_ogms)) + skb_size = max_t(unsigned int, BATADV_MAX_AGGREGATION_BYTES, + packet_len); else skb_size = packet_len;