Procházet zdrojové kódy

qcacmn: Add missing nbuf_count updates in qdf APIs

Add missing nbuf_count updates in qdf APIs which are used
for keeping track of nbufs in debug mode.

Change-Id: If031ec8860513dddb1704a75e4761ce14aa26f21
CRs-Fixed: 4728458
Pavankumar Nandeshwar před 2 roky
rodič
revize
9f16b44a9b
1 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. 11 1
      qdf/linux/src/i_qdf_nbuf.h

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

@@ -1337,6 +1337,7 @@ static inline uint8_t *__qdf_nbuf_put_tail(struct sk_buff *skb, size_t size)
 	if (skb_tailroom(skb) < size) {
 		if (unlikely(pskb_expand_head(skb, 0,
 			size - skb_tailroom(skb), GFP_ATOMIC))) {
+			__qdf_nbuf_count_dec(skb);
 			dev_kfree_skb_any(skb);
 			return NULL;
 		}
@@ -1839,6 +1840,7 @@ static inline void __qdf_nbuf_set_pktlen(struct sk_buff *skb, uint32_t len)
 				   "SKB tailroom is lessthan requested length."
 				   " tail-room: %u, len: %u, skb->len: %u",
 				   skb_tailroom(skb), len, skb->len);
+				__qdf_nbuf_count_dec(skb);
 				dev_kfree_skb_any(skb);
 			}
 		}
@@ -2269,6 +2271,7 @@ static inline struct sk_buff *
 __qdf_nbuf_realloc_headroom(struct sk_buff *skb, uint32_t headroom)
 {
 	if (pskb_expand_head(skb, headroom, 0, GFP_ATOMIC)) {
+		__qdf_nbuf_count_dec(skb);
 		dev_kfree_skb_any(skb);
 		skb = NULL;
 	}
@@ -2292,6 +2295,7 @@ __qdf_nbuf_realloc_tailroom(struct sk_buff *skb, uint32_t tailroom)
 	/**
 	 * unlikely path
 	 */
+	__qdf_nbuf_count_dec(skb);
 	dev_kfree_skb_any(skb);
 	return NULL;
 }
@@ -2382,6 +2386,7 @@ __qdf_nbuf_expand(struct sk_buff *skb, uint32_t headroom, uint32_t tailroom)
 	if (likely(!pskb_expand_head(skb, headroom, tailroom, GFP_ATOMIC)))
 		return skb;
 
+	__qdf_nbuf_count_dec(skb);
 	dev_kfree_skb_any(skb);
 	return NULL;
 }
@@ -2398,7 +2403,12 @@ __qdf_nbuf_expand(struct sk_buff *skb, uint32_t headroom, uint32_t tailroom)
 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);
+	struct sk_buff *copy;
+	copy = skb_copy_expand(buf, headroom, tailroom, GFP_ATOMIC);
+	if (copy)
+		__qdf_nbuf_count_inc(copy);
+
+	return copy;
 }
 
 /**