qcacmn: QDF API for skb_copy_expand

Add QDF wrappers for skb_copy_expand

Change-Id: I401241259c87a067ed4773bee9fdfc7ee3cdcc23
This commit is contained in:
Karunakar Dasineni
2019-10-15 18:33:32 -07:00
committed by nshrivas
parent 8e626ee720
commit 91da9dce36
3 changed files with 67 additions and 0 deletions

View File

@@ -1581,6 +1581,24 @@ qdf_nbuf_t qdf_nbuf_clone_debug(qdf_nbuf_t buf, const char *func,
*/
qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line);
#define qdf_nbuf_copy_expand(buf, headroom, tailroom) \
qdf_nbuf_copy_expand_debug(buf, headroom, tailroom, __func__, __LINE__)
/**
* qdf_nbuf_copy_expand_debug() - copy and expand nbuf
* @buf: Network buf instance
* @headroom: Additional headroom to be added
* @tailroom: Additional tailroom to be added
* @func: name of the calling function
* @line: line number of the callsite
*
* Return: New nbuf that is a copy of buf, with additional head and tailroom
* or NULL if there is no memory
*/
qdf_nbuf_t
qdf_nbuf_copy_expand_debug(qdf_nbuf_t buf, int headroom, int tailroom,
const char *func, uint32_t line);
#else /* NBUF_MEMORY_DEBUG */
static inline void qdf_net_buf_debug_init(void) {}
@@ -1648,6 +1666,20 @@ static inline qdf_nbuf_t qdf_nbuf_copy(qdf_nbuf_t buf)
return __qdf_nbuf_copy(buf);
}
/**
* qdf_nbuf_copy_expand() - copy and expand nbuf
* @buf: Network buf instance
* @headroom: Additional headroom to be added
* @tailroom: Additional tailroom to be added
*
* Return: New nbuf that is a copy of buf, with additional head and tailroom
* or NULL if there is no memory
*/
static inline qdf_nbuf_t qdf_nbuf_copy_expand(qdf_nbuf_t buf, int headroom,
int tailroom)
{
return __qdf_nbuf_copy_expand(buf, headroom, tailroom);
}
#endif /* NBUF_MEMORY_DEBUG */
#ifdef WLAN_FEATURE_FASTPATH

View File

@@ -1915,6 +1915,21 @@ __qdf_nbuf_expand(struct sk_buff *skb, uint32_t headroom, uint32_t tailroom)
return NULL;
}
/**
* __qdf_nbuf_copy_expand() - copy and expand nbuf
* @buf: Network buf instance
* @headroom: Additional headroom to be added
* @tailroom: Additional tailroom to be added
*
* Return: New nbuf that is a copy of buf, with additional head and tailroom
* or NULL if there is no memory
*/
static inline struct sk_buff *
__qdf_nbuf_copy_expand(struct sk_buff *buf, int headroom, int tailroom)
{
return skb_copy_expand(buf, headroom, tailroom, GFP_ATOMIC);
}
/**
* __qdf_nbuf_tx_cksum_info() - tx checksum info
*

View File

@@ -555,6 +555,7 @@ enum qdf_nbuf_event_type {
QDF_NBUF_FREE,
QDF_NBUF_MAP,
QDF_NBUF_UNMAP,
QDF_NBUF_ALLOC_COPY_EXPAND,
};
struct qdf_nbuf_event {
@@ -2681,6 +2682,25 @@ qdf_nbuf_t qdf_nbuf_copy_debug(qdf_nbuf_t buf, const char *func, uint32_t line)
}
qdf_export_symbol(qdf_nbuf_copy_debug);
qdf_nbuf_t
qdf_nbuf_copy_expand_debug(qdf_nbuf_t buf, int headroom, int tailroom,
const char *func, uint32_t line)
{
qdf_nbuf_t copied_buf = __qdf_nbuf_copy_expand(buf, headroom, tailroom);
if (qdf_unlikely(!copied_buf))
return NULL;
/* Store SKB in internal QDF tracking table */
qdf_net_buf_debug_add_node(copied_buf, 0, func, line);
qdf_nbuf_history_add(copied_buf, func, line,
QDF_NBUF_ALLOC_COPY_EXPAND);
return copied_buf;
}
qdf_export_symbol(qdf_nbuf_copy_expand_debug);
#endif /* NBUF_MEMORY_DEBUG */
#if defined(FEATURE_TSO)