浏览代码

qcacmn: Add a flag in skb->cb for packet tracking

When a packet is generated internally, host adds a debug
node entry to the table and deletes the entry once received
tx completion for that packet by calling qdf_nbuf_free.
But when a packet is coming from network stack, host doesn’t
add any debug entry to the table and on receiving tx completion,
it calls qdf_nbuf_tx_free which will simply free the skb.

In case of P2P GO mode where packets are forwarded internally,
host creates a private copy of skb and add debug node entry in
the table. But when receiving a tx completion for the same packet
host calls qdf_nbuf_tx_free which will free the skb but will not
remove this node entry from the table. Currently, this api is common
for all data tx completion packets.

Add an extra flag in control block to differentiate whether skb is
generated by driver or come from network stack. If flag is true,
that means generated internally and need to remove the entry from
debug node table.

Change-Id: I61a76fdfedf0429e1b972824dc4513065d53033f
CRs-Fixed: 2020947
Poddar, Siddarth 8 年之前
父节点
当前提交
01c4031969
共有 3 个文件被更改,包括 13 次插入9 次删除
  1. 0 1
      qdf/inc/qdf_nbuf.h
  2. 12 1
      qdf/linux/src/i_qdf_nbuf.h
  3. 1 7
      qdf/linux/src/qdf_nbuf.c

+ 0 - 1
qdf/inc/qdf_nbuf.h

@@ -638,7 +638,6 @@ void qdf_net_buf_debug_exit(void);
 void qdf_net_buf_debug_clean(void);
 void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
 			uint8_t *file_name, uint32_t line_num);
-void qdf_net_buf_debug_delete_node(qdf_nbuf_t net_buf);
 void qdf_net_buf_debug_release_skb(qdf_nbuf_t net_buf);
 
 /* nbuf allocation rouines */

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

@@ -116,6 +116,7 @@ typedef union {
  * @tx.trace       : combined structure for DP and protocol trace
  * @tx.trace.packet_state: {NBUF_TX_PKT_[(HDD)|(TXRX_ENQUEUE)|(TXRX_DEQUEUE)|
  *                       +               (TXRX)|(HTT)|(HTC)|(HIF)|(CE)|(FREE)]
+ * @tx.trace.is_packet_priv: flag, pkt generated internally or come from NS
  * @tx.trace.packet_track: {NBUF_TX_PKT_[(DATA)|(MGMT)]_TRACK}
  * @tx.trace.proto_type  : bitmap of NBUF_PKT_TRAC_TYPE[(EAPOL)|(DHCP)|
  *                       +                              (MGMT_ACTION)] - 4 bits
@@ -183,7 +184,8 @@ struct qdf_nbuf_cb {
 				struct {
 					uint32_t data_attr; /* 4 bytes */
 					struct{
-						uint8_t packet_state;
+						uint8_t packet_state:7,
+							is_packet_priv:1;
 						uint8_t packet_track:4,
 							proto_type:4;
 						uint8_t dp_trace:1,
@@ -278,6 +280,9 @@ struct qdf_nbuf_cb {
 #define QDF_NBUF_CB_TX_PACKET_STATE(skb) \
 	(((struct qdf_nbuf_cb *) \
 		((skb)->cb))->u.tx.dev.mcl.trace.packet_state)
+#define QDF_NBUF_CB_TX_IS_PACKET_PRIV(skb) \
+	(((struct qdf_nbuf_cb *) \
+		((skb)->cb))->u.tx.dev.mcl.trace.is_packet_priv)
 #define QDF_NBUF_CB_TX_PACKET_TRACK(skb) \
 	(((struct qdf_nbuf_cb *) \
 		((skb)->cb))->u.tx.dev.mcl.trace.packet_track)
@@ -527,6 +532,7 @@ void __qdf_nbuf_unmap_nbytes_single(
 void __qdf_nbuf_dma_map_info(__qdf_dma_map_t bmap, qdf_dmamap_info_t *sg);
 uint32_t __qdf_nbuf_get_frag_size(__qdf_nbuf_t nbuf, uint32_t cur_frag);
 void __qdf_nbuf_frag_info(struct sk_buff *skb, qdf_sglist_t  *sg);
+void qdf_net_buf_debug_delete_node(struct sk_buff *net_buf);
 QDF_STATUS __qdf_nbuf_frag_map(
 	qdf_device_t osdev, __qdf_nbuf_t nbuf,
 	int offset, qdf_dma_dir_t dir, int cur_frag);
@@ -963,6 +969,11 @@ static inline void __qdf_nbuf_tx_free(struct sk_buff *bufs, int tx_err)
 {
 	while (bufs) {
 		struct sk_buff *next = __qdf_nbuf_next(bufs);
+
+		if (QDF_NBUF_CB_TX_IS_PACKET_PRIV(bufs)) {
+			if (qdf_likely(bufs))
+				qdf_net_buf_debug_delete_node(bufs);
+		}
 		__qdf_nbuf_free(bufs);
 		bufs = next;
 	}

+ 1 - 7
qdf/linux/src/qdf_nbuf.c

@@ -1456,9 +1456,7 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
 		qdf_print("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);
 		qdf_nbuf_track_free(new_node);
-		goto done;
 	} else {
 		p_node = new_node;
 		if (p_node) {
@@ -1468,15 +1466,11 @@ void qdf_net_buf_debug_add_node(qdf_nbuf_t net_buf, size_t size,
 			p_node->size = size;
 			p_node->p_next = gp_qdf_net_buf_track_tbl[i];
 			gp_qdf_net_buf_track_tbl[i] = p_node;
-		} else {
+		} else
 			qdf_print(
 				  "Mem alloc failed ! Could not track skb from %s %d of size %zu",
 				  file_name, line_num, size);
-			QDF_ASSERT(0);
-		}
 	}
-
-done:
 	spin_unlock_irqrestore(&g_qdf_net_buf_track_lock[i], irq_flag);
 
 	return;