MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_capabilities

Function check_capabilities

dpdk/examples/l2fwd-crypto/main.c:2010–2305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2008}
2009
2010static int
2011check_capabilities(struct l2fwd_crypto_options *options, uint8_t cdev_id)
2012{
2013 struct rte_cryptodev_info dev_info;
2014 const struct rte_cryptodev_capabilities *cap;
2015
2016 rte_cryptodev_info_get(cdev_id, &dev_info);
2017
2018 /* Set AEAD parameters */
2019 if (options->xform_chain == L2FWD_CRYPTO_AEAD) {
2020 /* Check if device supports AEAD algo */
2021 cap = check_device_support_aead_algo(options, &dev_info,
2022 cdev_id);
2023 if (cap == NULL)
2024 return -1;
2025
2026 if (check_iv_param(&cap->sym.aead.iv_size,
2027 options->aead_iv_param,
2028 options->aead_iv_random_size,
2029 options->aead_iv.length) != 0) {
2030 RTE_LOG(DEBUG, USER1,
2031 "Device %u does not support IV length\n",
2032 cdev_id);
2033 return -1;
2034 }
2035
2036 /*
2037 * Check if length of provided AEAD key is supported
2038 * by the algorithm chosen.
2039 */
2040 if (options->aead_key_param) {
2041 if (check_supported_size(
2042 options->aead_xform.aead.key.length,
2043 cap->sym.aead.key_size.min,
2044 cap->sym.aead.key_size.max,
2045 cap->sym.aead.key_size.increment)
2046 != 0) {
2047 RTE_LOG(DEBUG, USER1,
2048 "Device %u does not support "
2049 "AEAD key length\n",
2050 cdev_id);
2051 return -1;
2052 }
2053 /*
2054 * Check if length of the aead key to be randomly generated
2055 * is supported by the algorithm chosen.
2056 */
2057 } else if (options->aead_key_random_size != -1) {
2058 if (check_supported_size(options->aead_key_random_size,
2059 cap->sym.aead.key_size.min,
2060 cap->sym.aead.key_size.max,
2061 cap->sym.aead.key_size.increment)
2062 != 0) {
2063 RTE_LOG(DEBUG, USER1,
2064 "Device %u does not support "
2065 "AEAD key length\n",
2066 cdev_id);
2067 return -1;

Callers 1

initialize_cryptodevsFunction · 0.85

Calls 6

rte_cryptodev_info_getFunction · 0.85
check_iv_paramFunction · 0.85
check_supported_sizeFunction · 0.85

Tested by

no test coverage detected