1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright 2021-2024 Advanced Micro Devices, Inc. 3 */ 4 5 #include <rte_cryptodev.h> 6 #include <cryptodev_pmd.h> 7 #include <rte_errno.h> 8 #include <rte_malloc.h> 9 #include <rte_mempool.h> 10 11 #include "ionic_crypto.h" 12 13 static int 14 iocpt_op_config(struct rte_cryptodev *cdev, 15 struct rte_cryptodev_config *config __rte_unused) 16 { 17 struct iocpt_dev *dev = cdev->data->dev_private; 18 19 iocpt_configure(dev); 20 21 return 0; 22 } 23 24 static int 25 iocpt_op_close(struct rte_cryptodev *cdev) 26 { 27 struct iocpt_dev *dev = cdev->data->dev_private; 28 29 iocpt_deinit(dev); 30 31 return 0; 32 } 33 34 static void 35 iocpt_op_info_get(struct rte_cryptodev *cdev, struct rte_cryptodev_info *info) 36 { 37 struct iocpt_dev *dev = cdev->data->dev_private; 38 39 if (info == NULL) 40 return; 41 42 info->max_nb_queue_pairs = dev->max_qps; 43 info->feature_flags = dev->features; 44 info->capabilities = iocpt_get_caps(info->feature_flags); 45 info->sym.max_nb_sessions = dev->max_sessions; 46 info->driver_id = dev->driver_id; 47 info->min_mbuf_headroom_req = 0; 48 info->min_mbuf_tailroom_req = 0; 49 } 50 51 static struct rte_cryptodev_ops iocpt_ops = { 52 .dev_configure = iocpt_op_config, 53 .dev_close = iocpt_op_close, 54 .dev_infos_get = iocpt_op_info_get, 55 }; 56 57 int 58 iocpt_assign_ops(struct rte_cryptodev *cdev) 59 { 60 struct iocpt_dev *dev = cdev->data->dev_private; 61 62 cdev->dev_ops = &iocpt_ops; 63 cdev->feature_flags = dev->features; 64 65 return 0; 66 } 67