summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbings <bings@codeaurora.org>2017-09-08 08:57:34 +0800
committersnandini <snandini@codeaurora.org>2017-09-14 13:51:24 -0700
commit727802014f8567f28862c6a47e7dc7dd7f6ee8c8 (patch)
tree2134a5dafd5275a03a1b8ab8d89fa7f0843189f0
parenta0820b93d5e5b5b59dc3092462fa45ac1d293058 (diff)
qcacld-3.0: Enable preAlloc support for SKB buffers
Enable support to use SKB Buffers allocated during bootup for low memory targets. CRs-Fixed: 2106466 Change-Id: Ia55c38767804c5915b9d29d3c61bff236d12cacd
-rw-r--r--core/pld/inc/pld_common.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h
index ac746479e662..c013d81c9965 100644
--- a/core/pld/inc/pld_common.h
+++ b/core/pld/inc/pld_common.h
@@ -45,6 +45,10 @@
#define PLD_EPPING_FILE "epping.bin"
#define PLD_EVICTED_FILE ""
+#ifdef CONFIG_WCNSS_MEM_PRE_ALLOC
+#include <net/cnss_prealloc.h>
+#endif
+
/**
* enum pld_bus_type - bus type
* @PLD_BUS_TYPE_NONE: invalid bus type, only return in error cases
@@ -529,4 +533,43 @@ unsigned int pld_socinfo_get_serial_number(struct device *dev);
int pld_is_qmi_disable(struct device *dev);
int pld_force_assert_target(struct device *dev);
bool pld_is_fw_dump_skipped(struct device *dev);
+
+#if defined(CONFIG_WCNSS_MEM_PRE_ALLOC) && defined(FEATURE_SKB_PRE_ALLOC)
+
+/**
+ * pld_nbuf_pre_alloc() - get allocated nbuf from platform driver.
+ * @size: Netbuf requested size
+ *
+ * Return: nbuf or NULL if no memory
+ */
+static inline struct sk_buff *pld_nbuf_pre_alloc(size_t size)
+{
+ struct sk_buff *skb = NULL;
+
+ if (size >= WCNSS_PRE_SKB_ALLOC_GET_THRESHOLD)
+ skb = wcnss_skb_prealloc_get(size);
+
+ return skb;
+}
+
+/**
+ * pld_nbuf_pre_alloc_free() - free the nbuf allocated in platform driver.
+ * @skb: Pointer to network buffer
+ *
+ * Return: TRUE if the nbuf is freed
+ */
+static inline int pld_nbuf_pre_alloc_free(struct sk_buff *skb)
+{
+ return wcnss_skb_prealloc_put(skb);
+}
+#else
+static inline struct sk_buff *pld_nbuf_pre_alloc(size_t size)
+{
+ return NULL;
+}
+static inline int pld_nbuf_pre_alloc_free(struct sk_buff *skb)
+{
+ return 0;
+}
+#endif
#endif