diff options
| -rw-r--r-- | core/pld/inc/pld_common.h | 43 |
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 |
