| 951 | } |
| 952 | |
| 953 | static inline int |
| 954 | ipsec_dequeue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, |
| 955 | struct rte_mbuf *pkts[], uint16_t max_pkts) |
| 956 | { |
| 957 | int32_t nb_pkts = 0, ret = 0, i, j, nb_cops; |
| 958 | struct ipsec_mbuf_metadata *priv; |
| 959 | struct rte_crypto_op *cops[max_pkts]; |
| 960 | struct ipsec_sa *sa; |
| 961 | struct rte_mbuf *pkt; |
| 962 | |
| 963 | for (i = 0; i < ipsec_ctx->nb_qps && nb_pkts < max_pkts; i++) { |
| 964 | struct cdev_qp *cqp; |
| 965 | |
| 966 | cqp = &ipsec_ctx->tbl[ipsec_ctx->last_qp++]; |
| 967 | if (ipsec_ctx->last_qp == ipsec_ctx->nb_qps) |
| 968 | ipsec_ctx->last_qp %= ipsec_ctx->nb_qps; |
| 969 | |
| 970 | if (cqp->in_flight == 0) |
| 971 | continue; |
| 972 | |
| 973 | nb_cops = rte_cryptodev_dequeue_burst(cqp->id, cqp->qp, |
| 974 | cops, max_pkts - nb_pkts); |
| 975 | |
| 976 | cqp->in_flight -= nb_cops; |
| 977 | |
| 978 | for (j = 0; j < nb_cops; j++) { |
| 979 | pkt = cops[j]->sym->m_src; |
| 980 | rte_prefetch0(pkt); |
| 981 | |
| 982 | priv = get_priv(pkt); |
| 983 | sa = priv->sa; |
| 984 | |
| 985 | RTE_ASSERT(sa != NULL); |
| 986 | |
| 987 | if (ipsec_get_action_type(sa) == |
| 988 | RTE_SECURITY_ACTION_TYPE_NONE) { |
| 989 | ret = xform_func(pkt, sa, cops[j]); |
| 990 | if (unlikely(ret)) { |
| 991 | free_pkts(&pkt, 1); |
| 992 | continue; |
| 993 | } |
| 994 | } else if (ipsec_get_action_type(sa) == |
| 995 | RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL) { |
| 996 | if (cops[j]->status) { |
| 997 | free_pkts(&pkt, 1); |
| 998 | continue; |
| 999 | } |
| 1000 | } |
| 1001 | pkts[nb_pkts++] = pkt; |
| 1002 | } |
| 1003 | } |
| 1004 | |
| 1005 | /* return packets */ |
| 1006 | return nb_pkts; |
| 1007 | } |
| 1008 | |
| 1009 | uint16_t |
| 1010 | ipsec_inbound(struct ipsec_ctx *ctx, struct rte_mbuf *pkts[], |
no test coverage detected