浏览代码

qcacmn: Set in_use bit of last allocated descriptor as 0

With current implementation in_use bit for last descriptor is not
getting set as 0. Removing redundant code and setting in_use bit
for last descriptor as 0.

Change-Id: Ia1945fcb814136128d18a8aec473ed1b4786dd9e
Varsha Mishra 5 年之前
父节点
当前提交
10b86d636a
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      dp/wifi3.0/dp_rx_desc.c

+ 6 - 5
dp/wifi3.0/dp_rx_desc.c

@@ -192,16 +192,17 @@ QDF_STATUS dp_rx_desc_pool_alloc(struct dp_soc *soc, uint32_t pool_id,
 
 	/* link SW rx descs into a freelist */
 	rx_desc_pool->freelist = &rx_desc_pool->array[0];
-	for (i = 0; i < rx_desc_pool->pool_size-1; i++) {
-		rx_desc_pool->array[i].next = &rx_desc_pool->array[i+1];
+	for (i = 0; i <= rx_desc_pool->pool_size - 1; i++) {
+		if (i == rx_desc_pool->pool_size - 1)
+			rx_desc_pool->array[i].next = NULL;
+		else
+			rx_desc_pool->array[i].next =
+				&rx_desc_pool->array[i + 1];
 		rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
 		rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
 		rx_desc_pool->array[i].rx_desc.in_use = 0;
 	}
 
-	rx_desc_pool->array[i].next = NULL;
-	rx_desc_pool->array[i].rx_desc.cookie = i | (pool_id << 18);
-	rx_desc_pool->array[i].rx_desc.pool_id = pool_id;
 	qdf_spin_unlock_bh(&rx_desc_pool->lock);
 	return QDF_STATUS_SUCCESS;
 }