B.A.T.M.A.N Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Cc: simonwunderlich <sw@simonwunderlich.de>
Subject: Re: [PATCH RFC batadv v2 4/5] batman-adv: limit numbers of parallel learned BLA backbones
Date: Tue, 19 May 2026 11:10:52 +0200	[thread overview]
Message-ID: <6472795.lOV4Wx5bFT@ripper> (raw)
In-Reply-To: <20260519-resource-limit-v2-4-489c3c919a54@narfation.org>

[-- Attachment #1: Type: text/plain, Size: 1888 bytes --]

On Tuesday, 19 May 2026 09:02:18 CEST Sven Eckelmann wrote:
> @@ -505,6 +507,11 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *orig,
>                    "%s(): not found (%pM, %d), creating new entry\n", __func__,
>                    orig, batadv_print_vid(vid));
>  
> +       bla_backbone_max_learned = READ_ONCE(bat_priv->bla_backbone_max_learned);
> +       bla_backbone_learned = atomic_read(&bat_priv->bla_backbone_learned);
> +       if (bla_backbone_max_learned && bla_backbone_learned >= bla_backbone_max_learned)
> +               return NULL;
> +
>         entry = kzalloc_obj(*entry, GFP_ATOMIC);
>         if (!entry)
>                 return NULL;

@Simon: remark from Sashiko, should we actually exempt own_gateway?


@@ -508,10 +508,12 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *orig,
 		   "%s(): not found (%pM, %d), creating new entry\n", __func__,
 		   orig, batadv_print_vid(vid));
 
-	bla_backbone_max_learned = READ_ONCE(bat_priv->bla_backbone_max_learned);
-	bla_backbone_learned = atomic_read(&bat_priv->bla_backbone_learned);
-	if (bla_backbone_max_learned && bla_backbone_learned >= bla_backbone_max_learned)
-		return NULL;
+	if (!own_backbone) {
+		bla_backbone_max_learned = READ_ONCE(bat_priv->bla_backbone_max_learned);
+		bla_backbone_learned = atomic_read(&bat_priv->bla_backbone_learned);
+		if (bla_backbone_max_learned && bla_backbone_learned >= bla_backbone_max_learned)
+			return NULL;
+	}
 
 	entry = kzalloc_obj(*entry, GFP_ATOMIC);
 	if (!entry)
@@ -539,7 +541,10 @@ batadv_bla_get_backbone_gw(struct batadv_priv *bat_priv, const u8 *orig,
 	if (unlikely(hash_added != 0)) {
 		/* hash failed, free the structure */
 		kfree(entry);
-		atomic_dec(&bat_priv->bla_backbone_learned);
+
+		if (!own_backbone)
+			atomic_dec(&bat_priv->bla_backbone_learned);
+
 		return NULL;
 	}
 
Regards,
	Sven

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-05-19  9:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  7:02 [PATCH RFC batadv v2 0/5] batman-adv: allow to specify limits for remote learned objects Sven Eckelmann
2026-05-19  7:02 ` [PATCH RFC batadv v2 1/5] batman-adv: limit numbers of parallel learned neighbors Sven Eckelmann
2026-05-19  7:02 ` [PATCH RFC batadv v2 2/5] batman-adv: limit numbers of parallel learned originators Sven Eckelmann
2026-05-19  7:02 ` [PATCH RFC batadv v2 3/5] batman-adv: limit numbers of parallel learned DAT entries Sven Eckelmann
2026-05-19  7:02 ` [PATCH RFC batadv v2 4/5] batman-adv: limit numbers of parallel learned BLA backbones Sven Eckelmann
2026-05-19  9:10   ` Sven Eckelmann [this message]
2026-05-20  8:16   ` Simon Wunderlich
2026-05-19  7:02 ` [PATCH RFC batadv v2 5/5] batman-adv: limit numbers of parallel learned BLA claims Sven Eckelmann
2026-05-19  8:37 ` [PATCH RFC batadv v2 0/5] batman-adv: allow to specify limits for remote learned objects Sven Eckelmann

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=6472795.lOV4Wx5bFT@ripper \
    --to=sven@narfation.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=sw@simonwunderlich.de \
    /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