qcacmn: Account for fragmented list in qdf_nbuf_count_dec

When a jumbo packet connected using fragmented list is freed or given to
the network stack, currently we decrement WLAN skb count by only 1,
instead, decrement the skb count for all fragments in the fragmented list.

Change-Id: I36a9aa9f3f5537718d476c368b3b110786494d5b
CRs-Fixed: 2498313
diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c
index 30553f9..8e83783 100644
--- a/qdf/linux/src/qdf_nbuf.c
+++ b/qdf/linux/src/qdf_nbuf.c
@@ -347,7 +347,23 @@
  */
 void __qdf_nbuf_count_dec(__qdf_nbuf_t nbuf)
 {
-	qdf_atomic_dec(&nbuf_count);
+	qdf_nbuf_t ext_list;
+	int num_nbuf;
+
+	if (qdf_nbuf_get_users(nbuf) > 1)
+		return;
+
+	num_nbuf = 1;
+
+	/* Take care to account for frag_list */
+	ext_list = qdf_nbuf_get_ext_list(nbuf);
+	while (ext_list) {
+		if (qdf_nbuf_get_users(ext_list) == 1)
+			++num_nbuf;
+		ext_list = qdf_nbuf_queue_next(ext_list);
+	}
+
+	qdf_atomic_sub(num_nbuf, &nbuf_count);
 }
 qdf_export_symbol(__qdf_nbuf_count_dec);
 #endif