Selaa lähdekoodia

qcacmn: QDF API for skb_clone_fraglist along with copy expand

Add API wrapper function for skb_clone_fraglist along
with skb_copy_expand.

Change-Id: Ib03e16566368d75a7a547fea6fd863e6411f98ef
nobelj 5 vuotta sitten
vanhempi
sitoutus
7b76263659
2 muutettua tiedostoa jossa 39 lisäystä ja 0 poistoa
  1. 24 0
      qdf/inc/qdf_nbuf.h
  2. 15 0
      qdf/linux/src/i_qdf_nbuf.h

+ 24 - 0
qdf/inc/qdf_nbuf.h

@@ -1697,8 +1697,32 @@ static inline qdf_nbuf_t qdf_nbuf_copy_expand(qdf_nbuf_t buf, int headroom,
 {
 	return __qdf_nbuf_copy_expand(buf, headroom, tailroom);
 }
+
 #endif /* NBUF_MEMORY_DEBUG */
 
+/**
+ * qdf_nbuf_copy_expand_fraglist() - copy and expand nbuf and
+ * get reference of the fraglist.
+ * @buf: Network buf instance
+ * @headroom: Additional headroom to be added
+ * @tailroom: Additional tailroom to be added
+ *
+ * Return: New nbuf that is a copy of buf, with additional head and tailroom
+ *	or NULL if there is no memory
+ */
+static inline qdf_nbuf_t
+qdf_nbuf_copy_expand_fraglist(qdf_nbuf_t buf, int headroom,
+			      int tailroom)
+{
+	buf = qdf_nbuf_copy_expand(buf, headroom, tailroom);
+
+	/* get fraglist reference */
+	if (buf)
+		__qdf_nbuf_get_ref_fraglist(buf);
+
+	return buf;
+}
+
 #ifdef WLAN_FEATURE_FASTPATH
 /**
  * qdf_nbuf_init_fast() - before put buf into pool,turn it to init state

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

@@ -1927,6 +1927,21 @@ __qdf_nbuf_copy_expand(struct sk_buff *buf, int headroom, int tailroom)
 	return skb_copy_expand(buf, headroom, tailroom, GFP_ATOMIC);
 }
 
+/**
+ * __qdf_nbuf_get_ref_fraglist() - get reference to fragments
+ * @buf: Network buf instance
+ *
+ * Return: void
+ */
+static inline void
+__qdf_nbuf_get_ref_fraglist(struct sk_buff *buf)
+{
+	struct sk_buff *list;
+
+	skb_walk_frags(buf, list)
+		skb_get(list);
+}
+
 /**
  * __qdf_nbuf_tx_cksum_info() - tx checksum info
  *