Skip to content

Commit 9c41b3b

Browse files
JannePeltonenMatiasElo
authored andcommitted
linux-dpdk: crypto: fix hw_ciphers and hw_auths capabilities
When a HW accelerated crypto device is found, not only the algorithms it supports but all algorithms supported by preceding devices are added to the hw_ciphers and hw_auths capability fields. Fix this by adding only the newly found HW accelerated algorithms. Signed-off-by: Janne Peltonen <[email protected]> Reviewed-by: Matias Elo <[email protected]>
1 parent 2a31de8 commit 9c41b3b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

platform/linux-dpdk/odp_crypto.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -710,18 +710,22 @@ int odp_crypto_capability(odp_crypto_capability_t *capability)
710710

711711
for (int n = 0; n < global->num_devs; n++) {
712712
struct rte_cryptodev_info dev_info;
713+
odp_crypto_cipher_algos_t ciphers = {.all_bits = 0};
714+
odp_crypto_auth_algos_t auths = {.all_bits = 0};
713715

714716
rte_cryptodev_info_get(global->devs[n].dev_id, &dev_info);
715-
capability_process(&dev_info, &capability->ciphers,
716-
&capability->auths);
717+
capability_process(&dev_info, &ciphers, &auths);
717718

718719
if (global->devs[n].disable_aes_cmac)
719-
capability->auths.bit.aes_cmac = 0;
720+
auths.bit.aes_cmac = 0;
721+
722+
capability->ciphers.all_bits |= ciphers.all_bits;
723+
capability->auths.all_bits |= auths.all_bits;
720724

721725
if ((dev_info.feature_flags &
722726
RTE_CRYPTODEV_FF_HW_ACCELERATED)) {
723-
capability->hw_ciphers = capability->ciphers;
724-
capability->hw_auths = capability->auths;
727+
capability->hw_ciphers.all_bits |= ciphers.all_bits;
728+
capability->hw_auths.all_bits |= auths.all_bits;
725729
}
726730

727731
/* Report the lowest max_nb_sessions of all devices */

0 commit comments

Comments
 (0)