Bug 934

Summary: crypto_aesni_mb PMD found crash in access mb_mgr on primary process after secondary process launch scan/probe
Product: DPDK Reporter: changchun zhang (changchun.zhang)
Component: cryptodevAssignee: dev
Status: UNCONFIRMED ---    
Severity: normal CC: changchun.zhang
Priority: Normal    
Version: 20.11   
Target Milestone: ---   
Hardware: x86   
OS: Linux   

Description changchun zhang 2022-02-07 01:35:57 CET
This is a bug for AESNI_MB PMD in DPDK 20.11. The issue may have been resolved in latest DPDK, but wondering if a patch can be applied for 20.11.

The AESNI_MB PMD in DPDK 20.11 does not work well in supporting multi-process.
The crash can be seen by this sequence:
1. The crypto_aesni_mb is started successfuly on primary process by rte_vdev_init. 
2. The secondary process launches the scanning/prob procedure and the primary process received the sync req and replied the secondary process. The crypto_aesni_mb is also started by the probe on receiving the reply of the vdev_scan.
3. On primary process, the packet process tries to create the crypto session and it crashes on accessing the mb_mgr of dev->data->dev_private, in aesni_mb_set_session_auth_parameters()

It is found in cryptodev_aesni_mb_create(), 
mb_mgr = alloc_init_mb_mgr(vector_mode);
can be triggered on both primary process and second process. Thus after the device is started on primary, the dev->data->dev_private->mb_mgr can be updated when second process started the device again. This is incorrect. 

The mb_mgr allocation should be limited to primary process. The same should be applied to the qp->mb_mgr when setup the queue pair.