浏览代码

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
bings 7 年之前
父节点
当前提交
582830a20e
共有 1 个文件被更改,包括 43 次插入0 次删除
  1. 43 0
      core/pld/inc/pld_common.h

+ 43 - 0
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
@@ -561,4 +565,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