I'm trying out VPP native crypto in async mode and ran into a few issues. I am using 20.09, but the parts below haven't changed in master.
Have I misunderstood the code? I hope someone could comment: 1. The first issue was that processed operations were not being dequeued. In crypto_sw_scheduler/main.c crypto_sw_scheduler_dequeue_aead() there is (some parts omitted for clarity): vec_foreach_index (i, cm->per_thread_data) { ptd = cm->per_thread_data + i; q = ptd->queues[async_op_id]; f = crypto_sw_scheduler_get_pending_frame (q); if (f) break; } ptd = cm->per_thread_data + vm->thread_index; if (f) { while (n_elts--) { crypto_sw_scheduler_convert_aead (vm, ptd, fe, fe - f->elts, bi[0], sync_op_id, aad_len, tag_len); bi++; fe++; } process_ops (vm, f, ptd->crypto_ops, &state); f->state = state; *enqueue_thread_idx = f->enqueue_thread_index; } return crypto_sw_scheduler_get_completed_frame (ptd->queues[async_op_id]); } It seems to me that the last line should be: return crypto_sw_scheduler_get_completed_frame (q); because we want to dequeue from the queue of the originating thread. 2. I made the above change locally, which led to the second issue: vnet/crypto/node.c crypto_dequeue_frame() calls vnet_crypto_async_free_frame() in the context of the worker thread (not the original enqueueing thread) and tries to free the spent frame (returned by crypto_sw_scheduler_dequeue_aead() above) back to the wrong per-thread pool. It looks to me as if enqueue_thread_idx is ignored by crypto_dequeue_frame() when instead it should be used somehow to free the frame back to the correct pool. 3. While looking at all the above, I noticed that all of the loops involving crypto_sw_scheduler_queue_t * q look like this: u32 tail = q->tail; u32 head = q->head; for (i = tail; i < head; i++) { f = q->jobs[i & CRYPTO_SW_SCHEDULER_QUEUE_MASK]; [... do stuff ...] } It seems to me that these loops will not work correctly when head wraps. Thanks for your comments. -- G. Paul Ziemba FreeBSD unix: 6:26AM up 43 days, 35 mins, 16 users, load averages: 1.13, 1.18, 1.16
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#18909): https://lists.fd.io/g/vpp-dev/message/18909 Mute This Topic: https://lists.fd.io/mt/81279833/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-