Эх сурвалжийг харах

qcacmn: Takecare of extended nbufs memory leak tracking

Update nbuf memory leak tracking logic to handle extended nbufs.

Change-Id: I172f9de0b3dd99d634cfe70dfab964749b9d49a7
CRs-Fixed: 963060
Manjunathappa Prakash 9 жил өмнө
parent
commit
dff1f975d9

+ 14 - 0
qdf/inc/qdf_nbuf.h

@@ -849,6 +849,20 @@ qdf_nbuf_append_ext_list(qdf_nbuf_t head_buf, qdf_nbuf_t ext_list,
 	__qdf_nbuf_append_ext_list(head_buf, ext_list, ext_len);
 }
 
+/**
+ * qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
+ * @head_buf: Network buf holding head segment (single)
+ *
+ * This ext_list is populated when we have Jumbo packet, for example in case of
+ * monitor mode amsdu packet reception, and are stiched using frags_list.
+ *
+ * Return: Network buf list holding linked extensions from head buf.
+ */
+static inline qdf_nbuf_t qdf_nbuf_get_ext_list(qdf_nbuf_t head_buf)
+{
+	return (qdf_nbuf_t)__qdf_nbuf_get_ext_list(head_buf);
+}
+
 /**
  * qdf_nbuf_get_tx_cksum() - gets the tx checksum offload demand
  * @buf: Network buffer

+ 14 - 0
qdf/linux/src/i_qdf_nbuf.h

@@ -860,6 +860,20 @@ __qdf_nbuf_append_ext_list(struct sk_buff *skb_head,
 	skb_head->len += skb_head->data_len;
 }
 
+/**
+ * __qdf_nbuf_get_ext_list() - Get the link to extended nbuf list.
+ * @head_buf: Network buf holding head segment (single)
+ *
+ * This ext_list is populated when we have Jumbo packet, for example in case of
+ * monitor mode amsdu packet reception, and are stiched using frags_list.
+ *
+ * Return: Network buf list holding linked extensions from head buf.
+ */
+static inline struct sk_buff *__qdf_nbuf_get_ext_list(struct sk_buff *head_buf)
+{
+	return (skb_shinfo(head_buf)->frag_list);
+}
+
 /**
  * __qdf_nbuf_tx_free() - free skb list
  * @skb: Pointer to network buffer

+ 17 - 2
qdf/linux/src/qdf_nbuf.c

@@ -682,8 +682,9 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
 
 	if (p_node) {
 		qdf_print(
-			  "Double allocation of skb ! Already allocated from %s %d",
-			  p_node->file_name, p_node->line_num);
+			  "Double allocation of skb ! Already allocated from %p %s %d current alloc from %p %s %d",
+			  p_node->net_buf, p_node->file_name, p_node->line_num,
+			  net_buf, file_name, line_num);
 		QDF_ASSERT(0);
 		goto done;
 	} else {
@@ -771,6 +772,7 @@ EXPORT_SYMBOL(qdf_net_buf_debug_delete_node);
 
 /**
  * qdf_net_buf_debug_release_skb() - release skb to avoid memory leak
+ * @net_buf: Network buf holding head segment (single)
  *
  * WLAN driver module whose allocated SKB is freed by network stack are
  * suppose to call this API before returning SKB to network stack such
@@ -780,6 +782,19 @@ EXPORT_SYMBOL(qdf_net_buf_debug_delete_node);
  */
 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf)
 {
+	qdf_nbuf_t ext_list = qdf_nbuf_get_ext_list(net_buf);
+
+	while (ext_list) {
+		/*
+		 * Take care to free if it is Jumbo packet connected using
+		 * frag_list
+		 */
+		qdf_nbuf_t next;
+
+		next = qdf_nbuf_queue_next(ext_list);
+		qdf_net_buf_debug_delete_node(ext_list);
+		ext_list = next;
+	}
 	qdf_net_buf_debug_delete_node(net_buf);
 }
 EXPORT_SYMBOL(qdf_net_buf_debug_release_skb);