This patch enables the fail-over mode in scheduler PMD.

Signed-off-by: Fan Zhang <roy.fan.zh...@intel.com>
---
 drivers/crypto/scheduler/Makefile                  | 1 +
 drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 7 +++++++
 drivers/crypto/scheduler/rte_cryptodev_scheduler.h | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/drivers/crypto/scheduler/Makefile 
b/drivers/crypto/scheduler/Makefile
index 0cce6f2..cb61c4f 100644
--- a/drivers/crypto/scheduler/Makefile
+++ b/drivers/crypto/scheduler/Makefile
@@ -54,6 +54,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += 
scheduler_pmd.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_pmd_ops.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += rte_cryptodev_scheduler.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_roundrobin.c
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += scheduler_failover.c
 
 # library dependencies
 DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_CRYPTO_SCHEDULER) += lib/librte_cryptodev
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c 
b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
index 11e8143..934d3b7 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c
@@ -336,6 +336,13 @@ rte_crpytodev_scheduler_mode_set(uint8_t scheduler_id,
                        return -1;
                }
                break;
+       case CDEV_SCHED_MODE_FAILOVER:
+               if (rte_cryptodev_scheduler_load_user_scheduler(scheduler_id,
+                               failover_scheduler) < 0) {
+                       CS_LOG_ERR("Failed to load scheduler");
+                       return -1;
+               }
+               break;
        default:
                CS_LOG_ERR("Not yet supported");
                return -ENOTSUP;
diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h 
b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
index 7ef44e7..124d32f 100644
--- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
+++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.h
@@ -47,6 +47,8 @@ enum rte_cryptodev_scheduler_mode {
        CDEV_SCHED_MODE_NOT_SET = 0,
        CDEV_SCHED_MODE_USERDEFINED,
        CDEV_SCHED_MODE_ROUNDROBIN,
+       /** fail-over mode */
+       CDEV_SCHED_MODE_FAILOVER,
 
        CDEV_SCHED_MODE_COUNT /* number of modes */
 };
@@ -158,6 +160,7 @@ struct rte_cryptodev_scheduler {
 };
 
 extern struct rte_cryptodev_scheduler *roundrobin_scheduler;
+extern struct rte_cryptodev_scheduler *failover_scheduler;
 
 #ifdef __cplusplus
 }
-- 
2.7.4

Reply via email to