๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7793

Re: [PATCH net 02/10] batman-adv: Close OGM aggregation before transmission

#7793
From: netdev-bot+sashiko
Date: Tue, 27 Oct 2026 08:55
68 lines
10443 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch gives `struct batadv_forw_packet::num_packets` a second
  meaning without updating its kernel-doc.

--

batman-adv: Close OGM aggregation before transmission

This patch makes the OGM send worker mark the forwarding packet as a full
aggregate under forw_bat_list_lock before it calls batadv_iv_ogm_emit().
After that, no other context can append OGMs while the packet is being
emitted and cloned. The packet stays on forw_bat_list so interface purging
can still find it.

> diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c
> index 158d2b8f04036..85e99506a53f5 100644
> --- a/net/batman-adv/bat_iv_ogm.c
> +++ b/net/batman-adv/bat_iv_ogm.c
> @@ -1909,6 +1909,11 @@ static void batadv_iv_send_outstanding_bat_ogm_packet(struct work_struct *work)
>  		goto out;
>  	}
>  
> +	/* Mark aggregate as full before forcing emit. */
> +	spin_lock_bh(&bat_priv->forw_bat_list_lock);
> +	forw_packet->num_packets = BATADV_MAX_AGGREGATION_PACKETS;
> +	spin_unlock_bh(&bat_priv->forw_bat_list_lock);

[Severity: Low]
This isn't a bug, but should the kernel-doc for num_packets be updated
to match this new use?

In net/batman-adv/types.h the field is still documented as a plain
counter:

	/** @num_packets: counter for aggregated OGMv1 packets */
	u8 num_packets;

After this change, the worker in
batadv_iv_send_outstanding_bat_ogm_packet() replaces the real count with
BATADV_MAX_AGGREGATION_PACKETS, whatever the number of queued OGMs is.
For example, an aggregate holding 3 OGMs reports 32 from then on. The
field is now both a counter and a "closed for aggregation" marker, and
only the comment at this call site says so.

As far as I can tell, nothing reads the inflated value today:

- batadv_iv_ogm_can_aggregate() rejects packet_num >=
  BATADV_MAX_AGGREGATION_PACKETS under the same lock.
- batadv_iv_ogm_aggregate() is only reached after that check passes, so
  set_bit(num_packets, direct_link_flags) cannot index past the bitmap.
- batadv_iv_ogm_send_to_if() walks the OGMs using packet_len and a local
  counter.

A short note in the struct documentation would help later readers who
rely on the field description.

>  	batadv_iv_ogm_emit(forw_packet);
>  
>  	/* we have to have at least one packet in the queue to determine the

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261026085309.1074911-2-sw%40simonwunderlich.de
Technical Details
Message-ID: <179309132139.3134.350154128482754175@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352291-linux-kernel-netdev=dewy.ru
References: <20261026085309.1074911-3-sw@simonwunderlich.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352291-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 02/10] batman-adv: Close OGM aggregation before transmission
Date: Tue, 27 Oct 2026 08:55:21 +0000
Organization: Usenet Network
Message-ID: <179309132139.3134.350154128482754175@kernel.org>
References: <20261026085309.1074911-3-sw@simonwunderlich.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1496861"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BynYGhH2OLTQos0QPLni8xCmzhI= sha256:HvOl96oTmGuYpPptfMdkEElkcKVqAHW2ucHukeQenno=
	sha1:1IHiXvEWDC3GIZWm1KQEg55MGQ0= sha256:BooHpb2RX/MIIZ9E2mRHNxDMWYUxmBtjjq/tZeiVOJs=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 26B4D125BE3; Tue, 27 Oct 2026 11:55:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7yfhiMq5hPFG;
	Tue, 27 Oct 2026 11:55:39 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352291-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id C71F8125BDE; Tue, 27 Oct 2026 11:55:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 5F7C82637E; Tue, 27 Oct 2026 08:55:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793091324;
	b=YfAuPaPKYTmQTItvaZ7XvUrkPYRK/+GLOsVDX2KHHrI+7XDm53ga6Luds6HWvU2QhsA2
	 Jr86H0E59Szt4k8nNKNixriAMmDanDS1QEB3JxG4hDohqQ4gxhbGMi70UD2MPedGuxaOd
	 Rfp0rlqAwZnkTLe7Tl0yI+5FtBLDtCpyXge4Uoq38QN4fWMOAxhyHN/2hlwZdmcJ7E6Kr
	 KOH+SAh1jYbsn/1vcB3iN0ntya3/+9lPArOO+zVFGO0Zo0H2s/Wjx7kfAAmXbKIFNNOEa
	 85PlqinbK2m/2S14M1SIvUC0SKkGXAIN3uHAqmv4h6d7T9ny/OrH3l7I14bN8lN6Qtw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793091324;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=RYGIIRLJleypOVfIwOcBtPmaAc6iH0lPsv0VdUsb1Xs=;
	b=ESh/oD0+RM+tiPE//qz0jdTws//EfLBLRM7RpGqljR+LWX/yy3Vl0soWY4pkQ5jrjV6g
	 P/zoQwbcZLGE3VuhKaGCSYekydXPiJgbsWFoZRMzINGxzmHFZAk3W0+HyeFNDBZ1VpjPb
	 IFBh7DuFjb96SoUerBntAI1Gg9hizAhLAPV8pTUXJzeifRkon+yVENlR1ZEUTDwJKNhx2
	 xKU5u6CvDGO2+BMTkyO3Zf0mSemLlDxBejGVa4DI3yjaNY53y8TzUPuzJYzSYhDS3GINQ
	 BCiMeV24rtxNqcHpQcxVfkhR/ladKm3DrW5YXmOYNX29EmoaM28up6CtuQzfakqv2XQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Lu0au9NQ;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 10259606A322;
	Tue, 27 Oct 2026 08:55:24 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Lu0au9NQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793091323;
	b=OgxOnCiTfn4XK41oc/hn/4XgpnO1j+k7XkDx3+gWfHlMDCtP41XBUJqvqipB0U5x91Uo
	 GI89D2rK4BOh+Kg3LQrenJMy1owiWf/ihQwCmIJhGvTL7JaOOGctBzw4ZTxoLVN/AREHh
	 qVOfRRB7mKkcwVGwA8qJX3hbGN9JCvtRgKNiWPL9SyRmCRR+8fCp9LZQgF6pjv1ZV2IIa
	 6E/sFEOAGZa2RO+hpkNpmeI2WbpMQ4lYy7MstuxNs0DNT4tU3FyRlMj8LxvgZL+78pvqP
	 dI10tx4eCSqKMQMUZ4H5lcJF7w8PYV9CyrM4+iVcU3m4Wv1Yp/jeRFbGgHK09ioBFTA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793091323;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=RYGIIRLJleypOVfIwOcBtPmaAc6iH0lPsv0VdUsb1Xs=;
	b=CORSzb/grMdyYNvVoBCTo2I8mYRDRsOiqoGC05Bwm3ToZRNPPFByZ02etwp3RhTZN5P+
	 wjQG3b3CigdCnp8qNhUUsU13LAW2gZvaeyaVaECnfrMlVagsEP9eoluVfkt01GRLOvgpd
	 B4gvnPsThXthZml5dc20qIvkaOnnIgpLvpU4bgVVEQ6K76uC1aIv6ERks51T1YijeK1JR
	 YQLKvQaveb/nFISSuALqgTMYanphRQQpbiXVUzcT69P5YZcw583dbfGLvGOYakZypugnu
	 yzr/lnnjsvXhuS4+zigLuC/o0K0Vk/Q9nPe5e5ZfKeQvUUYWj5HEbeyusEYgiImaLuQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Lu0au9NQ;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2D84606A31A
	for <netdev@vger.kernel.org>; Tue, 27 Oct 2026 08:55:22 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE01F1F01825;
	Tue, 27 Oct 2026 08:55:21 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793091322;
	bh=RYGIIRLJleypOVfIwOcBtPmaAc6iH0lPsv0VdUsb1Xs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Lu0au9NQOg9keKTYJj7WeCRVO90Eq2tSmN9ByyTtDkS6oU+5au9Q0RIAK0+cau/lL
	 nObTrk+TA3SsUfMLzd06/qccxOVFRddLXgAp2fHA2b+TS3iXqplVOOpqZ91zb+IuPI
	 L6MwNzO/q+cN75I66amTKFETAZNxsYPz3P6OetNQoApDGaJg1Afg/whzmzkh3r4UaV
	 hvvJ/U0tzuieH5sXa7gsPzHpOuVPPobb1lAJdiB+NlizmNUyVpreHkzSviI6aY6SgM
	 G+5xPpfKAfz+oat+E/2gVyjIW3vghunq0V7NUQ5vd31KkQ72XjeY53kVYwAq1jRaU2
	 vkdS0mfNXMUPg==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
 kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
 b.a.t.m.a.n@lists.open-mesh.org, sven@narfation.org, sashiko-bot@kernel.org
X-In-Reply-To: <20261026085309.1074911-3-sw@simonwunderlich.de>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list