From aa434cb67950e530460ecb6dce98feebc3c9153e Mon Sep 17 00:00:00 2001 From: Nisha Menon Date: Tue, 1 Sep 2020 16:33:09 -0700 Subject: [PATCH] qcacmn: Add qdf api to return nbuf size from data to end ptr Add api to qdf abstraction framework to return size of nbuf from nbuf data pointer to end pointer. Change-Id: I8a450306ddcaa7c6a85607425bc1c1fd26c4e1e4 CRs-Fixed: 2767763 --- qdf/inc/qdf_nbuf.h | 13 +++++++++++++ qdf/linux/src/i_qdf_nbuf.h | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/qdf/inc/qdf_nbuf.h b/qdf/inc/qdf_nbuf.h index d5cac604a2..4ab58f08f2 100644 --- a/qdf/inc/qdf_nbuf.h +++ b/qdf/inc/qdf_nbuf.h @@ -3809,6 +3809,19 @@ static inline uint32_t qdf_nbuf_get_mark(qdf_nbuf_t nbuf) return __qdf_nbuf_get_mark(nbuf); } +/** + * qdf_nbuf_get_data_len() - Return the size of the nbuf from + * data pointer to end pointer + * @nbuf: qdf_nbuf_t + * + * Return: size of network buffer from data pointer to end + * pointer + */ +static inline qdf_size_t qdf_nbuf_get_data_len(qdf_nbuf_t nbuf) +{ + return __qdf_nbuf_get_data_len(nbuf); +} + #ifdef NBUF_FRAG_MEMORY_DEBUG #define qdf_nbuf_move_frag_page_offset(f, i, o) \ diff --git a/qdf/linux/src/i_qdf_nbuf.h b/qdf/linux/src/i_qdf_nbuf.h index 8e881bd5da..6225e342ba 100644 --- a/qdf/linux/src/i_qdf_nbuf.h +++ b/qdf/linux/src/i_qdf_nbuf.h @@ -2465,6 +2465,18 @@ static inline uint32_t __qdf_nbuf_get_mark(__qdf_nbuf_t buf) return buf->mark; } +/** + * __qdf_nbuf_get_data_len() - Return the size of the nbuf from + * the data pointer to the end pointer + * @nbuf: qdf_nbuf_t + * + * Return: size of skb from data pointer to end pointer + */ +static inline qdf_size_t __qdf_nbuf_get_data_len(__qdf_nbuf_t nbuf) +{ + return (skb_end_pointer(nbuf) - nbuf->data); +} + #ifdef CONFIG_NBUF_AP_PLATFORM #include #else