DPDK  17.08.2
rte_cryptodev_scheduler.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2017 Intel Corporation. All rights reserved.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of Intel Corporation nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _RTE_CRYPTO_SCHEDULER_H
35 #define _RTE_CRYPTO_SCHEDULER_H
36 
49 #include <stdint.h>
50 #include "rte_cryptodev_scheduler_operations.h"
51 
52 #ifdef __cplusplus
53 extern "C" {
54 #endif
55 
57 #ifndef RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES
58 #define RTE_CRYPTODEV_SCHEDULER_MAX_NB_SLAVES (8)
59 #endif
60 
62 #define RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKER_CORES (64)
63 
65 #define SCHEDULER_MODE_NAME_ROUND_ROBIN round-robin
66 
67 #define SCHEDULER_MODE_NAME_PKT_SIZE_DISTR packet-size-distr
68 
69 #define SCHEDULER_MODE_NAME_FAIL_OVER fail-over
70 
71 #define SCHEDULER_MODE_NAME_MULTI_CORE multi-core
72 
77  CDEV_SCHED_MODE_NOT_SET = 0,
88 
90 };
91 
92 #define RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN (64)
93 #define RTE_CRYPTODEV_SCHEDULER_DESC_MAX_LEN (256)
94 
99  CDEV_SCHED_OPTION_NOT_SET = 0,
100  CDEV_SCHED_OPTION_THRESHOLD,
101 
102  CDEV_SCHED_OPTION_COUNT
103 };
104 
109  uint32_t threshold;
110 };
111 
113 
128 int
130  struct rte_cryptodev_scheduler *scheduler);
131 
146 int
147 rte_cryptodev_scheduler_slave_attach(uint8_t scheduler_id, uint8_t slave_id);
148 
162 int
163 rte_cryptodev_scheduler_slave_detach(uint8_t scheduler_id, uint8_t slave_id);
164 
165 
179 int
180 rte_cryptodev_scheduler_mode_set(uint8_t scheduler_id,
182 
194 rte_cryptodev_scheduler_mode_get(uint8_t scheduler_id);
195 
211 int
212 rte_cryptodev_scheduler_ordering_set(uint8_t scheduler_id,
213  uint32_t enable_reorder);
214 
226 int
227 rte_cryptodev_scheduler_ordering_get(uint8_t scheduler_id);
228 
243 int
244 rte_cryptodev_scheduler_slaves_get(uint8_t scheduler_id, uint8_t *slaves);
245 
260 int
261 rte_cryptodev_scheduler_option_set(uint8_t scheduler_id,
262  enum rte_cryptodev_schedule_option_type option_type,
263  void *option);
264 
279 int
280 rte_cryptodev_scheduler_option_get(uint8_t scheduler_id,
281  enum rte_cryptodev_schedule_option_type option_type,
282  void *option);
283 
284 typedef uint16_t (*rte_cryptodev_scheduler_burst_enqueue_t)(void *qp_ctx,
285  struct rte_crypto_op **ops, uint16_t nb_ops);
286 
287 typedef uint16_t (*rte_cryptodev_scheduler_burst_dequeue_t)(void *qp_ctx,
288  struct rte_crypto_op **ops, uint16_t nb_ops);
289 
292  const char *name;
293  const char *description;
297  struct rte_cryptodev_scheduler_ops *ops;
298 };
299 
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 #endif /* _RTE_CRYPTO_SCHEDULER_H */