diff --git a/pld_stub/inc/pld_common.h b/pld_stub/inc/pld_common.h index 750aeb1a7906..ce8e237f70a0 100644 --- a/pld_stub/inc/pld_common.h +++ b/pld_stub/inc/pld_common.h @@ -268,6 +268,14 @@ static inline void *pld_hif_sdio_get_virt_ramdump_mem(struct device *dev, static inline void pld_hif_sdio_release_ramdump_mem(unsigned long *address) { } +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 diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index efb27bbd1d8c..134eeb8b713c 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -42,6 +42,7 @@ #include #include #include +#include #if defined(FEATURE_TSO) #include @@ -210,11 +211,17 @@ struct sk_buff *__qdf_nbuf_alloc(qdf_device_t osdev, size_t size, int reserve, realloc: skb = dev_alloc_skb(size); + if (skb) + goto skb_alloc; + + skb = pld_nbuf_pre_alloc(size); + if (!skb) { pr_info("ERROR:NBUF alloc failed\n"); return NULL; } +skb_alloc: /* Hawkeye M2M emulation cannot handle memory addresses below 0x50000040 * Though we are trying to reserve low memory upfront to prevent this, * we sometimes see SKBs allocated from low memory. @@ -271,9 +278,15 @@ struct sk_buff *__qdf_nbuf_alloc(qdf_device_t osdev, size_t size, int reserve, skb = dev_alloc_skb(size); + if (skb) + goto skb_alloc; + + skb = pld_nbuf_pre_alloc(size); + if (!skb) return NULL; +skb_alloc: memset(skb->cb, 0x0, sizeof(skb->cb)); /* @@ -315,6 +328,9 @@ EXPORT_SYMBOL(__qdf_nbuf_alloc); #ifdef CONFIG_MCL void __qdf_nbuf_free(struct sk_buff *skb) { + if (pld_nbuf_pre_alloc_free(skb)) + return; + if (nbuf_free_cb) nbuf_free_cb(skb); else @@ -323,6 +339,9 @@ void __qdf_nbuf_free(struct sk_buff *skb) #else void __qdf_nbuf_free(struct sk_buff *skb) { + if (pld_nbuf_pre_alloc_free(skb)) + return; + dev_kfree_skb_any(skb); } #endif