- if (rte_crypto_op_bulk_alloc(task->crypto_op_pool,
- RTE_CRYPTO_OP_TYPE_SYMMETRIC,
- ops_burst, n_pkts) != n_pkts) {
- plog_info("Failed to allocate crypto operations, discarding \
- %d packets\n", n_pkts);
- for (j = 0; j < n_pkts; j++) {
- out[j] = OUT_DISCARD;
- }
- nbr_tx_pkt += task->base.tx_pkt(&task->base, mbufs, n_pkts,
- out);
- }
- else {
- for (j = 0; j < n_pkts; j++) {
- result = task->handle_esp_ah(task, mbufs[j],
- ops_burst[j]);
- if (result == 0) {
- task->ops_burst[task->len] = ops_burst[j];
- task->len++;
- /* enough ops to be sent */
- if (task->len == MAX_PKT_BURST) {
- nbr_tx_pkt += crypto_send_burst(task,
- (uint16_t) MAX_PKT_BURST);
- task->len = 0;
+ if (likely(n_pkts != 0)) {
+ if (rte_crypto_op_bulk_alloc(task->crypto_op_pool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ ops_burst, n_pkts) != n_pkts) {
+ plog_info("Failed to allocate crypto operations, discarding \
+ %d packets\n", n_pkts);
+ for (j = 0; j < n_pkts; j++) {
+ out[j] = OUT_DISCARD;
+ }
+ nbr_tx_pkt += task->base.tx_pkt(&task->base, mbufs, n_pkts,
+ out);
+ }
+ else {
+ for (j = 0; j < n_pkts; j++) {
+ result = task->handle_esp_ah(task, mbufs[j],
+ ops_burst[j]);
+ if (result == 0) {
+ task->ops_burst[task->len] = ops_burst[j];
+ task->len++;
+ /* enough ops to be sent */
+ if (task->len == MAX_PKT_BURST) {
+ nbr_tx_pkt += crypto_send_burst(task,
+ (uint16_t) MAX_PKT_BURST);
+ task->len = 0;
+ }
+ }
+ else {
+ drop_mbufs[idx] = mbufs[j];
+ out[idx] = result;
+ idx++;
+ rte_crypto_op_free(ops_burst[j]);
+ plog_info("Failed handle_esp_ah for 1 \
+ packet\n");