crypto/dpaa2_sec: add enqueue retry timeout

This patch adds retry in the DPAA2 SEC packet enqueue API

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
This commit is contained in:
Nipun Gupta 2019-11-06 12:48:27 +05:30 committed by Akhil Goyal
parent a37ce227a8
commit 3ffce51a1f

View File

@ -1433,7 +1433,7 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
uint32_t loop; uint32_t loop;
int32_t ret; int32_t ret;
struct qbman_fd fd_arr[MAX_TX_RING_SLOTS]; struct qbman_fd fd_arr[MAX_TX_RING_SLOTS];
uint32_t frames_to_send; uint32_t frames_to_send, retry_count;
struct qbman_eq_desc eqdesc; struct qbman_eq_desc eqdesc;
struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp; struct dpaa2_sec_qp *dpaa2_qp = (struct dpaa2_sec_qp *)qp;
struct qbman_swp *swp; struct qbman_swp *swp;
@ -1491,16 +1491,29 @@ dpaa2_sec_enqueue_burst(void *qp, struct rte_crypto_op **ops,
} }
ops++; ops++;
} }
loop = 0; loop = 0;
retry_count = 0;
while (loop < frames_to_send) { while (loop < frames_to_send) {
loop += qbman_swp_enqueue_multiple(swp, &eqdesc, ret = qbman_swp_enqueue_multiple(swp, &eqdesc,
&fd_arr[loop], &fd_arr[loop],
&flags[loop], &flags[loop],
frames_to_send - loop); frames_to_send - loop);
if (unlikely(ret < 0)) {
retry_count++;
if (retry_count > DPAA2_MAX_TX_RETRY_COUNT) {
num_tx += loop;
nb_ops -= loop;
goto skip_tx;
}
} else {
loop += ret;
retry_count = 0;
}
} }
num_tx += frames_to_send; num_tx += loop;
nb_ops -= frames_to_send; nb_ops -= loop;
} }
skip_tx: skip_tx:
dpaa2_qp->tx_vq.tx_pkts += num_tx; dpaa2_qp->tx_vq.tx_pkts += num_tx;