| 261 | } |
| 262 | |
| 263 | static int |
| 264 | packet_prepare(struct rte_mbuf **buf, struct ipsec_sa *sa, |
| 265 | uint16_t num_pkts) |
| 266 | { |
| 267 | uint64_t time_stamp; |
| 268 | uint16_t k = 0, i; |
| 269 | |
| 270 | for (i = 0; i < num_pkts; i++) { |
| 271 | |
| 272 | sa->cop[i] = rte_crypto_op_alloc(cop_pool, |
| 273 | RTE_CRYPTO_OP_TYPE_SYMMETRIC); |
| 274 | |
| 275 | if (sa->cop[i] == NULL) { |
| 276 | |
| 277 | RTE_LOG(ERR, USER1, |
| 278 | "Failed to allocate symmetric crypto op\n"); |
| 279 | |
| 280 | return k; |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | time_stamp = rte_rdtsc_precise(); |
| 285 | |
| 286 | k = rte_ipsec_pkt_crypto_prepare(&sa->ss[0], buf, |
| 287 | sa->cop, num_pkts); |
| 288 | |
| 289 | time_stamp = rte_rdtsc_precise() - time_stamp; |
| 290 | |
| 291 | if (k != num_pkts) { |
| 292 | RTE_LOG(ERR, USER1, "rte_ipsec_pkt_crypto_prepare fail\n"); |
| 293 | return k; |
| 294 | } |
| 295 | |
| 296 | sa->cnt.prepare_ticks_elapsed += time_stamp; |
| 297 | sa->cnt.nb_prepare_call++; |
| 298 | sa->cnt.nb_prepare_pkt += k; |
| 299 | |
| 300 | for (i = 0; i < num_pkts; i++) |
| 301 | rte_crypto_op_free(sa->cop[i]); |
| 302 | |
| 303 | return k; |
| 304 | } |
| 305 | |
| 306 | static int |
| 307 | packet_process(struct rte_mbuf **buf, struct ipsec_sa *sa, |
no test coverage detected