mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mac80211: mesh: tolerate missing mesh RMC cache
@ 2025-11-09 11:43 Sayooj K Karun
  2025-11-10  7:36 ` Johannes Berg
  2025-11-10 16:22 ` [PATCH v2] mac80211: mesh: handle RMC cache allocation failure Sayooj K Karun
  0 siblings, 2 replies; 3+ messages in thread
From: Sayooj K Karun @ 2025-11-09 11:43 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, linux-kernel, sayooj

Allow kmem_cache_create() to fail gracefully when the mesh RMC slab
cannot be created so multicast forwarding continues even without
duplicate filtering.

Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
---
 net/mac80211/mesh.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index f37068a533f4..20f25226d2f2 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -2,10 +2,13 @@
 /*
  * Copyright (c) 2008, 2009 open80211s Ltd.
  * Copyright (C) 2018 - 2024 Intel Corporation
+ * Copyright (C) 2025 Aerlync Labs Inc.
  * Authors:    Luis Carlos Cobo <luisca@cozybit.com>
  * 	       Javier Cardona <javier@cozybit.com>
+ *	       Sayooj K Karun <sayooj@aerlync.com>
  */
 
+#include <linux/printk.h>
 #include <linux/slab.h>
 #include <linux/unaligned.h>
 #include <net/sock.h>
@@ -25,9 +28,14 @@ bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt)
 
 void ieee80211s_init(void)
 {
-	mesh_allocated = 1;
 	rm_cache = kmem_cache_create("mesh_rmc", sizeof(struct rmc_entry),
 				     0, 0, NULL);
+	if (!rm_cache) {
+		pr_warn("mac80211: failed to allocate mesh RMC cache; duplicate filtering disabled\n");
+		return;
+	}
+
+	mesh_allocated = 1;
 }
 
 void ieee80211s_stop(void)
@@ -35,6 +43,8 @@ void ieee80211s_stop(void)
 	if (!mesh_allocated)
 		return;
 	kmem_cache_destroy(rm_cache);
+	rm_cache = NULL;
+	mesh_allocated = 0;
 }
 
 static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
@@ -231,8 +241,8 @@ int mesh_rmc_check(struct ieee80211_sub_if_data *sdata,
 	struct rmc_entry *p;
 	struct hlist_node *n;
 
-	if (!rmc)
-		return -1;
+	if (!rmc || !rm_cache)
+		return 0;
 
 	/* Don't care about endianness since only match matters */
 	memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: mesh: tolerate missing mesh RMC cache
  2025-11-09 11:43 [PATCH] mac80211: mesh: tolerate missing mesh RMC cache Sayooj K Karun
@ 2025-11-10  7:36 ` Johannes Berg
  2025-11-10 16:22 ` [PATCH v2] mac80211: mesh: handle RMC cache allocation failure Sayooj K Karun
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2025-11-10  7:36 UTC (permalink / raw)
  To: Sayooj K Karun; +Cc: linux-wireless, linux-kernel

You need to fix the subject.


>  void ieee80211s_init(void)
>  {
> -	mesh_allocated = 1;
>  	rm_cache = kmem_cache_create("mesh_rmc", sizeof(struct rmc_entry),
>  				     0, 0, NULL);
> +	if (!rm_cache) {
> +		pr_warn("mac80211: failed to allocate mesh RMC cache; duplicate filtering disabled\n");

A message after an allocation failure is almost always pointless since
it's already a really big scary warning... Maybe there's a way to
supress the original warning in this case (not sure) and then have this
message.

johannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] mac80211: mesh: handle RMC cache allocation failure
  2025-11-09 11:43 [PATCH] mac80211: mesh: tolerate missing mesh RMC cache Sayooj K Karun
  2025-11-10  7:36 ` Johannes Berg
@ 2025-11-10 16:22 ` Sayooj K Karun
  1 sibling, 0 replies; 3+ messages in thread
From: Sayooj K Karun @ 2025-11-10 16:22 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, linux-kernel, sayooj

Allow kmem_cache_create() in ieee80211s_init() to fail gracefully
when the mesh RMC slab cannot be created so multicast forwarding
continues even without duplicate filtering.

Signed-off-by: Sayooj K Karun <sayooj@aerlync.com>
---
Changes in v2:
 - Retitled the patch to “mac80211: mesh: handle RMC cache allocation failure”
 - Added more clarity to the commit message
 - dropped the extra pr_warn() after kmem_cache_create() failure

 net/mac80211/mesh.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index f37068a533f4..eae78d9528ac 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -2,8 +2,10 @@
 /*
  * Copyright (c) 2008, 2009 open80211s Ltd.
  * Copyright (C) 2018 - 2024 Intel Corporation
+ * Copyright (C) 2025 Aerlync Labs Inc.
  * Authors:    Luis Carlos Cobo <luisca@cozybit.com>
  * 	       Javier Cardona <javier@cozybit.com>
+ *	       Sayooj K Karun <sayooj@aerlync.com>
  */
 
 #include <linux/slab.h>
@@ -25,9 +27,12 @@ bool mesh_action_is_path_sel(struct ieee80211_mgmt *mgmt)
 
 void ieee80211s_init(void)
 {
-	mesh_allocated = 1;
 	rm_cache = kmem_cache_create("mesh_rmc", sizeof(struct rmc_entry),
 				     0, 0, NULL);
+	if (!rm_cache)
+		return;
+
+	mesh_allocated = 1;
 }
 
 void ieee80211s_stop(void)
@@ -35,6 +40,8 @@ void ieee80211s_stop(void)
 	if (!mesh_allocated)
 		return;
 	kmem_cache_destroy(rm_cache);
+	rm_cache = NULL;
+	mesh_allocated = 0;
 }
 
 static void ieee80211_mesh_housekeeping_timer(struct timer_list *t)
@@ -231,8 +238,8 @@ int mesh_rmc_check(struct ieee80211_sub_if_data *sdata,
 	struct rmc_entry *p;
 	struct hlist_node *n;
 
-	if (!rmc)
-		return -1;
+	if (!rmc || !rm_cache)
+		return 0;
 
 	/* Don't care about endianness since only match matters */
 	memcpy(&seqnum, &mesh_hdr->seqnum, sizeof(mesh_hdr->seqnum));
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-10 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-09 11:43 [PATCH] mac80211: mesh: tolerate missing mesh RMC cache Sayooj K Karun
2025-11-10  7:36 ` Johannes Berg
2025-11-10 16:22 ` [PATCH v2] mac80211: mesh: handle RMC cache allocation failure Sayooj K Karun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®