diff mbox series

[2/3] cfg80211: Add provision for changing mesh header cache size

Message ID 1654857639-12346-3-git-send-email-quic_srirrama@quicinc.com
State New
Headers show
Series Mesh Fast xmit support | expand

Commit Message

Sriram R June 10, 2022, 10:40 a.m. UTC
Add provision to update the header cache size. The default cache size
is 50 header entries corresponding to different external destination.
In case there is a need for a bigger cache depending on the network
topology, the hdr_cache_size config can be updated.

Signed-off-by: Sriram R <quic_srirrama@quicinc.com>
---
 include/net/cfg80211.h       | 3 +++
 include/uapi/linux/nl80211.h | 4 ++++
 net/wireless/mesh.c          | 3 +++
 net/wireless/nl80211.c       | 6 +++++-
 4 files changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 34bdf1d..ec19c62 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2155,6 +2155,8 @@  struct bss_parameters {
  *      not be the optimal decision as a multi-hop route might be better. So
  *      if using this setting you will likely also want to disable
  *      dot11MeshForwarding and use another mesh routing protocol on top.
+ * @hdr_cache_size: Maximum number of entries the mesh header cache will
+ *	hold before flushing old entries.
  */
 struct mesh_config {
 	u16 dot11MeshRetryTimeout;
@@ -2188,6 +2190,7 @@  struct mesh_config {
 	u16 dot11MeshAwakeWindowDuration;
 	u32 plink_timeout;
 	bool dot11MeshNolearn;
+	u16 hdr_cache_size;
 };
 
 /**
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index d9490e3..b22c497 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -4556,6 +4556,9 @@  enum nl80211_mesh_power_mode {
  *	will advertise that it is connected to a authentication server
  *	in the mesh formation field.
  *
+ * @NL80211_MESHCONF_HEADER_CACHE_SIZE: Maximum size of the header cache
+ *	used for caching headers corresponding to an external destination.
+ *
  * @__NL80211_MESHCONF_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_meshconf_params {
@@ -4591,6 +4594,7 @@  enum nl80211_meshconf_params {
 	NL80211_MESHCONF_CONNECTED_TO_GATE,
 	NL80211_MESHCONF_NOLEARN,
 	NL80211_MESHCONF_CONNECTED_TO_AS,
+	NL80211_MESHCONF_HEADER_CACHE_SIZE,
 
 	/* keep last */
 	__NL80211_MESHCONF_ATTR_AFTER_LAST,
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index e4e3631..f606777 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -21,6 +21,8 @@ 
 #define MESH_ROOT_CONFIRMATION_INTERVAL 2000
 #define MESH_DEFAULT_PLINK_TIMEOUT	1800 /* timeout in seconds */
 
+#define MESH_DEFAULT_HEADER_CACHE_SIZE		50
+
 /*
  * Minimum interval between two consecutive PREQs originated by the same
  * interface
@@ -79,6 +81,7 @@  const struct mesh_config default_mesh_config = {
 	.dot11MeshAwakeWindowDuration = MESH_DEFAULT_AWAKE_WINDOW,
 	.plink_timeout = MESH_DEFAULT_PLINK_TIMEOUT,
 	.dot11MeshNolearn = false,
+	.hdr_cache_size = MESH_DEFAULT_HEADER_CACHE_SIZE,
 };
 
 const struct mesh_setup default_mesh_setup = {
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index dee0fa9..eae69ea 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7672,7 +7672,9 @@  static int nl80211_get_mesh_config(struct sk_buff *skb,
 	    nla_put_u8(msg, NL80211_MESHCONF_NOLEARN,
 		       cur_params.dot11MeshNolearn) ||
 	    nla_put_u8(msg, NL80211_MESHCONF_CONNECTED_TO_AS,
-		       cur_params.dot11MeshConnectedToAuthServer))
+		       cur_params.dot11MeshConnectedToAuthServer) ||
+	    nla_put_u16(msg, NL80211_MESHCONF_HEADER_CACHE_SIZE,
+			cur_params.hdr_cache_size))
 		goto nla_put_failure;
 	nla_nest_end(msg, pinfoattr);
 	genlmsg_end(msg, hdr);
@@ -7888,6 +7890,8 @@  do {									\
 				  NL80211_MESHCONF_PLINK_TIMEOUT, nla_get_u32);
 	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, dot11MeshNolearn, mask,
 				  NL80211_MESHCONF_NOLEARN, nla_get_u8);
+	FILL_IN_MESH_PARAM_IF_SET(tb, cfg, hdr_cache_size, mask,
+				  NL80211_MESHCONF_HEADER_CACHE_SIZE, nla_get_u16);
 	if (mask_out)
 		*mask_out = mask;