Browse Source

qcacmn: Add QDF API for nbuf truesize

Added API to return size of nbuf including header and
data and variable data area

Change-Id: Ie707a18adab7f2e4407f4aa8c481cd86012011a3
Manoj Ekbote 3 years ago
parent
commit
8f94e32594
2 changed files with 26 additions and 2 deletions
  1. 13 1
      qdf/inc/qdf_nbuf.h
  2. 13 1
      qdf/linux/src/i_qdf_nbuf.h

+ 13 - 1
qdf/inc/qdf_nbuf.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -3961,6 +3961,18 @@ static inline qdf_size_t qdf_nbuf_get_end_offset(qdf_nbuf_t nbuf)
 	return __qdf_nbuf_get_end_offset(nbuf);
 }
 
+/**
+ * qdf_nbuf_get_truesize() - Return the true size of the nbuf
+ * including the header and variable data area
+ * @nbuf: qdf_nbuf_t
+ *
+ * Return: size of network buffer
+ */
+static inline qdf_size_t qdf_nbuf_get_truesize(qdf_nbuf_t nbuf)
+{
+	return __qdf_nbuf_get_truesize(nbuf);
+}
+
 #ifdef NBUF_FRAG_MEMORY_DEBUG
 
 #define qdf_nbuf_move_frag_page_offset(f, i, o) \

+ 13 - 1
qdf/linux/src/i_qdf_nbuf.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -2277,6 +2277,18 @@ static inline unsigned int __qdf_nbuf_get_end_offset(__qdf_nbuf_t nbuf)
 	return skb_end_offset(nbuf);
 }
 
+/**
+ * __qdf_nbuf_get_truesize() - Return the true size of the nbuf
+ * including the header and variable data area
+ * @skb: sk buff
+ *
+ * Return: size of network buffer
+ */
+static inline unsigned int __qdf_nbuf_get_truesize(struct sk_buff *skb)
+{
+	return skb->truesize;
+}
+
 #ifdef CONFIG_WLAN_SYSFS_MEM_STATS
 /**
  * __qdf_record_nbuf_nbytes() - add or subtract the size of the nbuf