Forráskód Böngészése

qcacmn: use debugfs to show ini configs

Create new interface ucfg_cfg_ini_config_print/cfg_ini_config_print
to save the ini configs to buffer.

Change-Id: I7bc80d56d3a806a53c299d1347d4a656a6856248
CRs-Fixed: 2579558
Paul Zhang 5 éve
szülő
commit
c1b915da06
2 módosított fájl, 98 hozzáadás és 0 törlés
  1. 13 0
      cfg/inc/cfg_ucfg_api.h
  2. 85 0
      cfg/src/cfg.c

+ 13 - 0
cfg/inc/cfg_ucfg_api.h

@@ -181,6 +181,19 @@ QDF_STATUS cfg_parse_to_global_store(const char *path);
  */
 QDF_STATUS ucfg_cfg_store_print(struct wlan_objmgr_psoc *psoc);
 
+/**
+ * ucfg_cfg_ini_config_print() prints the cfg ini/non ini to buffer
+ * @psoc: psoc
+ * @buf: cache to save ini config
+ * @plen: the pointer to length
+ * @buflen: total buf length
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_cfg_ini_config_print(struct wlan_objmgr_psoc *psoc,
+				     uint8_t *buf, ssize_t *plen,
+				     ssize_t buflen);
+
 /**
  * cfg_get() - lookup the configured value for @id from @psoc
  * @psoc: The psoc from which to lookup the configured value

+ 85 - 0
cfg/src/cfg.c

@@ -569,11 +569,96 @@ cfg_store_print(struct wlan_objmgr_psoc *psoc)
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS
+cfg_ini_config_print(struct wlan_objmgr_psoc *psoc, uint8_t *buf,
+		     ssize_t *plen, ssize_t buflen)
+{
+	struct cfg_value_store *store;
+	struct cfg_psoc_ctx *psoc_ctx;
+	ssize_t len;
+	ssize_t total_len = buflen;
+
+	cfg_enter();
+
+	psoc_ctx = cfg_psoc_get_ctx(psoc);
+	if (!psoc_ctx)
+		return QDF_STATUS_E_FAILURE;
+
+	store = psoc_ctx->store;
+	if (!store)
+		return QDF_STATUS_E_FAILURE;
+
+#undef __CFG_INI_MAC
+#define __CFG_INI_MAC(id, mtype, ctype, name, desc, def...) \
+	do { \
+		len = qdf_scnprintf(buf, buflen, "%s %pM\n", name, \
+				    (&store->values.id##_internal)->bytes); \
+		buf += len; \
+		buflen -= len; \
+	} while (0);
+
+#undef __CFG_INI_IPV4
+#define __CFG_INI_IPV4(id, mtype, ctype, name, desc, def...) \
+	do { \
+		len = qdf_scnprintf(buf, buflen, "%s %pI4\n", name, \
+				    (&store->values.id##_internal)->bytes); \
+		buf += len; \
+		buflen -= len; \
+	} while (0);
+
+#undef __CFG_INI_IPV6
+#define __CFG_INI_IPV6(id, mtype, ctype, name, desc, def...) \
+	do { \
+		len = qdf_scnprintf(buf, buflen, "%s %pI6c\n", name, \
+				    (&store->values.id##_internal)->bytes); \
+		buf += len; \
+		buflen -= len; \
+	} while (0);
+
+#undef __CFG_INI
+#define __CFG_INI(id, mtype, ctype, name, min, max, fallback, desc, def...) \
+	do { \
+		len = qdf_scnprintf(buf, buflen, "%s %u\n", name, \
+				    *(ctype *)&store->values.id##_internal); \
+		buf += len; \
+		buflen -= len; \
+	} while (0);
+
+#undef __CFG_INI_STRING
+#define __CFG_INI_STRING(id, mtype, ctype, name, min_len, max_len, ...) \
+	do { \
+		len = qdf_scnprintf(buf, buflen, "%s %s\n", name, \
+				    (char *)&store->values.id##_internal); \
+		buf += len; \
+		buflen -= len; \
+	} while (0);
+
+	CFG_ALL
+
+#undef __CFG_INI_MAC
+#undef __CFG_INI_IPV4
+#undef __CFG_INI_IPV6
+#undef __CFG_INI
+#undef __CFG_INI_STRING
+
+	*plen = total_len - buflen;
+	cfg_exit();
+
+	return QDF_STATUS_SUCCESS;
+}
+
 QDF_STATUS ucfg_cfg_store_print(struct wlan_objmgr_psoc *psoc)
 {
 	return cfg_store_print(psoc);
 }
 
+QDF_STATUS ucfg_cfg_ini_config_print(struct wlan_objmgr_psoc *psoc,
+				     uint8_t *buf, ssize_t *plen,
+				     ssize_t buflen)
+{
+	return cfg_ini_config_print(psoc, buf, plen, buflen);
+}
+
 static QDF_STATUS
 cfg_on_psoc_create(struct wlan_objmgr_psoc *psoc, void *context)
 {