Skip to contentSkip to conversation

crypto/dpaa2_sec: fix to check queue pair array for null

PATCH Applied Hemant Agrawal 2 participants 3 messages Sep 3, 2020 – Oct 9, 2020 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 crypto/dpaa2_sec: fix to check queue pair array for null

dpdk-procinfo calls the crypto stats API, which results segmentation fault on DPAA2_SEC.
The queue pair array will be NULL, when it is used without configuring the SEC device.

Fixes 02f35eee264b ("crypto/dpaa2_sec: support statistics")
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +1 -1
index 109e61ae1..f480aafd0 100644
@@ -3501,7 +3501,7 @@ void dpaa2_sec_stats_get(struct rte_cryptodev *dev,
 		return;
 	}
 	for (i = 0; i < dev->data->nb_queue_pairs; i++) {
-		if (qp[i] == NULL) {
+		if (qp == NULL || qp[i] == NULL) {
 			DPAA2_SEC_DEBUG("Uninitialised queue pair");
 			continue;
 		}
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 crypto/dpaa2_sec: support stats for secondary process

DPAA2 crypto object access need availability of MCP object pointer. In case of secondary process, we need to use local MCP pointer instead of primary process.

---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +7 -2
index f480aafd0..14158a22d 100644
@@ -3489,7 +3489,7 @@ void dpaa2_sec_stats_get(struct rte_cryptodev *dev,
 			 struct rte_cryptodev_stats *stats)
 {
 	struct dpaa2_sec_dev_private *priv = dev->data->dev_private;
-	struct fsl_mc_io *dpseci = (struct fsl_mc_io *)priv->hw;
+	struct fsl_mc_io dpseci;
 	struct dpseci_sec_counters counters = {0};
 	struct dpaa2_sec_qp **qp = (struct dpaa2_sec_qp **)
 					dev->data->queue_pairs;
@@ -3512,7 +3512,12 @@ void dpaa2_sec_stats_get(struct rte_cryptodev *dev,
 		stats->dequeue_err_count += qp[i]->rx_vq.err_pkts;
 	}
 
-	ret = dpseci_get_sec_counters(dpseci, CMD_PRI_LOW, priv->token,
+	/* In case as secondary process access stats, MCP portal in priv-hw
+	 * may have primary process address. Need the secondary process
+	 * based MCP portal address for this object.
+	 */
+	dpseci.regs = dpaa2_get_mcp_ptr(MC_PORTAL_INDEX);
+	ret = dpseci_get_sec_counters(&dpseci, CMD_PRI_LOW, priv->token,
 				      &counters);
 	if (ret) {
 		DPAA2_SEC_ERR("SEC counters failed");
Signature · 1 line
2.17.1