MCPcopy Create free account
hub / github.com/F-Stack/f-stack / enqueue_cop_bulk

Function enqueue_cop_bulk

dpdk/examples/ipsec-secgw/ipsec_process.c:29–73  ·  view source on GitHub ↗

helper routine to enqueue bulk of crypto ops */

Source from the content-addressed store, hash-verified

27
28/* helper routine to enqueue bulk of crypto ops */
29static inline void
30enqueue_cop_bulk(struct cdev_qp *cqp, struct rte_crypto_op *cop[], uint32_t num)
31{
32 uint32_t i, k, len, n;
33
34 len = cqp->len;
35
36 /*
37 * if cqp is empty and we have enough ops,
38 * then queue them to the PMD straightway.
39 */
40 if (num >= RTE_DIM(cqp->buf) * 3 / 4 && len == 0) {
41 n = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp, cop, num);
42 cqp->in_flight += n;
43 free_cops(cop + n, num - n);
44 return;
45 }
46
47 k = 0;
48
49 do {
50 n = RTE_DIM(cqp->buf) - len;
51 n = RTE_MIN(num - k, n);
52
53 /* put packets into cqp */
54 for (i = 0; i != n; i++)
55 cqp->buf[len + i] = cop[k + i];
56
57 len += n;
58 k += n;
59
60 /* if cqp is full then, enqueue crypto-ops to PMD */
61 if (len == RTE_DIM(cqp->buf)) {
62 n = rte_cryptodev_enqueue_burst(cqp->id, cqp->qp,
63 cqp->buf, len);
64 cqp->in_flight += n;
65 free_cops(cqp->buf + n, len - n);
66 len = 0;
67 }
68
69
70 } while (k != num);
71
72 cqp->len = len;
73}
74
75static inline int
76check_ipsec_session(const struct rte_ipsec_session *ss)

Callers 1

Calls 2

free_copsFunction · 0.85

Tested by

no test coverage detected