Эх сурвалжийг харах

qcacld-3.0: Handle error condition when dma map fail

Change the return type to QDF_STATUS of htt_tx_desc_init function
to handle dma map and other error condition.
Free the tx descriptor if this function returns error.

CRs-Fixed: 2021634
Change-Id: Ib9154de308154c43c202ad8a88ecdfff04be47a2
Poddar, Siddarth 8 жил өмнө
parent
commit
28014e9769

+ 7 - 27
core/dp/htt/htt_tx.c

@@ -1628,28 +1628,7 @@ void htt_push_ext_header(qdf_nbuf_t msdu,
 	}
 }
 
-/**
- * htt_tx_desc_init() - Initialize the per packet HTT Tx descriptor
- * @pdev:		  The handle of the physical device sending the
- *			  tx data
- * @htt_tx_desc:	  Abstract handle to the tx descriptor
- * @htt_tx_desc_paddr_lo: Physical address of the HTT tx descriptor
- * @msdu_id:		  ID to tag the descriptor with.
- *			  The FW sends this ID back to host as a cookie
- *			  during Tx completion, which the host uses to
- *			  identify the MSDU.
- *			  This ID is an index into the OL Tx desc. array.
- * @msdu:		  The MSDU that is being prepared for transmission
- * @msdu_info:		  Tx MSDU meta-data
- * @tso_info:		  Storage for TSO meta-data
- * @ext_header_data:      extension header data
- * @type:                 extension header type
- *
- * This function initializes the HTT tx descriptor.
- * HTT Tx descriptor is a host-f/w interface structure, and meta-data
- * accompanying every packet downloaded to f/w via the HTT interface.
- */
-void
+QDF_STATUS
 htt_tx_desc_init(htt_pdev_handle pdev,
 		 void *htt_tx_desc,
 		 qdf_dma_addr_t htt_tx_desc_paddr,
@@ -1679,17 +1658,17 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 	if (qdf_unlikely(!qdf_ctx)) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			"%s: qdf_ctx is NULL", __func__);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 	if (qdf_unlikely(!msdu_info)) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			"%s: bad arg: msdu_info is NULL", __func__);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 	if (qdf_unlikely(!tso_info)) {
 		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 			"%s: bad arg: tso_info is NULL", __func__);
-		return;
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	word0 = (uint32_t *) htt_tx_desc;
@@ -1716,7 +1695,7 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 		if (0xffffffff == ce_pkt_type) {
 			QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
 			"Invalid HTT pkt type %d\n", pkt_type);
-			return;
+			return QDF_STATUS_E_INVAL;
 		}
 	}
 
@@ -1803,7 +1782,7 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 		if (qdf_unlikely(status != QDF_STATUS_SUCCESS)) {
 			QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
 				"%s: nbuf map failed", __func__);
-			return;
+			return QDF_STATUS_E_NOMEM;
 		}
 	}
 
@@ -1832,6 +1811,7 @@ htt_tx_desc_init(htt_pdev_handle pdev,
 	}
 
 	qdf_nbuf_data_attr_set(msdu, data_attr);
+	return QDF_STATUS_SUCCESS;
 }
 
 #ifdef FEATURE_HL_GROUP_CREDIT_FLOW_CONTROL

+ 24 - 1
core/dp/ol/inc/ol_htt_tx_api.h

@@ -533,7 +533,30 @@ extern const uint32_t htt_to_ce_pkt_type[];
  */
 #define HTT_TX_DESC_VADDR_OFFSET 8
 
-void
+/**
+ * htt_tx_desc_init() - Initialize the per packet HTT Tx descriptor
+ * @pdev:		  The handle of the physical device sending the
+ *			  tx data
+ * @htt_tx_desc:	  Abstract handle to the tx descriptor
+ * @htt_tx_desc_paddr_lo: Physical address of the HTT tx descriptor
+ * @msdu_id:		  ID to tag the descriptor with.
+ *			  The FW sends this ID back to host as a cookie
+ *			  during Tx completion, which the host uses to
+ *			  identify the MSDU.
+ *			  This ID is an index into the OL Tx desc. array.
+ * @msdu:		  The MSDU that is being prepared for transmission
+ * @msdu_info:		  Tx MSDU meta-data
+ * @tso_info:		  Storage for TSO meta-data
+ * @ext_header_data:      extension header data
+ * @type:                 extension header type
+ *
+ * This function initializes the HTT tx descriptor.
+ * HTT Tx descriptor is a host-f/w interface structure, and meta-data
+ * accompanying every packet downloaded to f/w via the HTT interface.
+ *
+ * Return QDF_STATUS_SUCCESS for success, otherwise error.
+ */
+QDF_STATUS
 htt_tx_desc_init(htt_pdev_handle pdev,
 		 void *htt_tx_desc,
 		 qdf_dma_addr_t htt_tx_desc_paddr,

+ 12 - 4
core/dp/txrx/ol_tx.c

@@ -485,10 +485,17 @@ ol_tx_prepare_ll_fast(struct ol_txrx_pdev_t *pdev,
 	/* TODO: Precompute and store paddr in ol_tx_desc_t */
 	/* Virtual address of the HTT/HTC header, added by driver */
 	htc_hdr_vaddr = (char *)htt_tx_desc - HTC_HEADER_LEN;
-	htt_tx_desc_init(pdev->htt_pdev, htt_tx_desc,
+	if (qdf_unlikely(htt_tx_desc_init(pdev->htt_pdev, htt_tx_desc,
 			 tx_desc->htt_tx_desc_paddr, tx_desc->id, msdu,
 			 &msdu_info->htt, &msdu_info->tso_info,
-			 NULL, type);
+			 NULL, type))) {
+		/*
+		 * HTT Tx descriptor initialization failed.
+		 * therefore, free the tx desc
+		 */
+		ol_tx_desc_free(pdev, tx_desc);
+		return NULL;
+	}
 
 	num_frags = qdf_nbuf_get_num_frags(msdu);
 	/* num_frags are expected to be 2 max */
@@ -1385,12 +1392,13 @@ int ol_txrx_mgmt_send_frame(
 	 * an added L2 header.
 	 */
 	htt_tx_desc_mpdu_header(tx_desc->htt_tx_desc, 0);
-	htt_tx_desc_init(
+	if (qdf_unlikely(htt_tx_desc_init(
 			pdev->htt_pdev, tx_desc->htt_tx_desc,
 			tx_desc->htt_tx_desc_paddr,
 			ol_tx_desc_id(pdev, tx_desc),
 			tx_mgmt_frm,
-			&tx_msdu_info->htt, &tx_msdu_info->tso_info, NULL, 0);
+			&tx_msdu_info->htt, &tx_msdu_info->tso_info, NULL, 0)))
+		return 1;
 	htt_tx_desc_display(tx_desc->htt_tx_desc);
 	htt_tx_desc_set_chanfreq(tx_desc->htt_tx_desc, chanfreq);
 

+ 9 - 2
core/dp/txrx/ol_tx_desc.c

@@ -537,10 +537,17 @@ struct ol_tx_desc_t *ol_tx_desc_ll(struct ol_txrx_pdev_t *pdev,
 	type = ol_tx_get_ext_header_type(vdev, netbuf);
 
 	/* initialize the HW tx descriptor */
-	htt_tx_desc_init(pdev->htt_pdev, tx_desc->htt_tx_desc,
+	if (qdf_unlikely(htt_tx_desc_init(pdev->htt_pdev, tx_desc->htt_tx_desc,
 			 tx_desc->htt_tx_desc_paddr,
 			 ol_tx_desc_id(pdev, tx_desc), netbuf, &msdu_info->htt,
-			 &msdu_info->tso_info, NULL, type);
+			 &msdu_info->tso_info, NULL, type))) {
+		/*
+		 * HTT Tx descriptor initialization failed.
+		 * therefore, free the tx desc
+		 */
+		ol_tx_desc_free(pdev, tx_desc);
+		return NULL;
+	}
 
 	/*
 	 * Initialize the fragmentation descriptor.