From: Aakash Sasidharan <asasidha...@marvell.com>

Rx inject is supported only with CPT05 microcode version.
sg_ver2 indicates if CPT05 is loaded. Fail the rx inject
configuration with ENOTSUP error if sg_ver2 is not supported.

Signed-off-by: Aakash Sasidharan <asasidha...@marvell.com>
---
 drivers/crypto/cnxk/cn10k_cryptodev_ops.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c 
b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
index 851e6f0a88..947f50b4c8 100644
--- a/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
+++ b/drivers/crypto/cnxk/cn10k_cryptodev_ops.c
@@ -1981,6 +1981,7 @@ cn10k_cryptodev_sec_rx_inject_configure(void *device, 
uint16_t port_id, bool ena
 {
        struct rte_cryptodev *crypto_dev = device;
        struct rte_eth_dev *eth_dev;
+       struct cnxk_cpt_vf *vf;
        int ret;
 
        if (!rte_eth_dev_is_valid_port(port_id))
@@ -1989,6 +1990,11 @@ cn10k_cryptodev_sec_rx_inject_configure(void *device, 
uint16_t port_id, bool ena
        if (!(crypto_dev->feature_flags & RTE_CRYPTODEV_FF_SECURITY_RX_INJECT))
                return -ENOTSUP;
 
+       /* Rx Inject is supported only with CPT05. sg_ver2 indicates that CPT05 
is loaded */
+       vf = crypto_dev->data->dev_private;
+       if (!(vf->cpt.hw_caps[CPT_ENG_TYPE_SE].sg_ver2 && 
vf->cpt.hw_caps[CPT_ENG_TYPE_IE].sg_ver2))
+               return -ENOTSUP;
+
        eth_dev = &rte_eth_devices[port_id];
 
        ret = strncmp(eth_dev->device->driver->name, "net_cn10k", 8);
-- 
2.25.1

Reply via email to