Change-Id: I0237d00b8d27d84962be467c48de7c4d5137cc4c
Signed-off-by: McDaniel, Timothy <timothy.mcdan...@intel.com>
---
 drivers/event/dlb/rte_pmd_dlb.c                 | 39 ++++++++++++++
 drivers/event/dlb/rte_pmd_dlb.h                 | 69 +++++++++++++++++++++++++
 drivers/event/dlb/rte_pmd_dlb_event_version.map |  6 +++
 3 files changed, 114 insertions(+)
 create mode 100644 drivers/event/dlb/rte_pmd_dlb.c
 create mode 100644 drivers/event/dlb/rte_pmd_dlb.h
 create mode 100644 drivers/event/dlb/rte_pmd_dlb_event_version.map

diff --git a/drivers/event/dlb/rte_pmd_dlb.c b/drivers/event/dlb/rte_pmd_dlb.c
new file mode 100644
index 000000000..11f0d66cd
--- /dev/null
+++ b/drivers/event/dlb/rte_pmd_dlb.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation
+ */
+
+#include "rte_eventdev.h"
+#include "rte_eventdev_pmd.h"
+
+#include "rte_pmd_dlb.h"
+#include "dlb_priv.h"
+#include "dlb_inline_fns.h"
+
+int
+rte_pmd_dlb_set_token_pop_mode(uint8_t dev_id,
+                               uint8_t port_id,
+                               enum dlb_token_pop_mode mode)
+{
+       struct dlb_eventdev *dlb;
+       struct rte_eventdev *dev;
+
+       RTE_EVENTDEV_VALID_DEVID_OR_ERR_RET(dev_id, -EINVAL);
+       dev = &rte_eventdevs[dev_id];
+
+       dlb = dlb_pmd_priv(dev);
+
+       if (mode >= NUM_TOKEN_POP_MODES)
+               return -EINVAL;
+
+       /* The event device must be configured, but not yet started */
+       if (!dlb->configured || dlb->run_state != DLB_RUN_STATE_STOPPED)
+               return -EINVAL;
+
+       /* The token pop mode must be set before configuring the port */
+       if (port_id >= dlb->num_ports || dlb->ev_ports[port_id].setup_done)
+               return -EINVAL;
+
+       dlb->ev_ports[port_id].qm_port.token_pop_mode = mode;
+
+       return 0;
+}
diff --git a/drivers/event/dlb/rte_pmd_dlb.h b/drivers/event/dlb/rte_pmd_dlb.h
new file mode 100644
index 000000000..1b637def6
--- /dev/null
+++ b/drivers/event/dlb/rte_pmd_dlb.h
@@ -0,0 +1,69 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2019-2020 Intel Corporation
+ */
+
+/*!
+ *  @file      rte_pmd_dlb.h
+ *
+ *  @brief     DLB PMD-specific functions
+ */
+
+#ifndef _RTE_PMD_DLB_H_
+#define _RTE_PMD_DLB_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/**
+ * Selects the token pop mode for an DLB port.
+ */
+enum dlb_token_pop_mode {
+       /* Pop the CQ tokens immediately after dequeueing. */
+       AUTO_POP,
+       /* Pop CQ tokens after (dequeue_depth - 1) events are released.
+        * Supported on load-balanced ports only.
+        */
+       DELAYED_POP,
+       /* Pop the CQ tokens during next dequeue operation. */
+       DEFERRED_POP,
+
+       /* NUM_TOKEN_POP_MODES must be last */
+       NUM_TOKEN_POP_MODES
+};
+
+/*!
+ * Configure the token pop mode for an DLB port. By default, all ports use
+ * AUTO_POP. This function must be called before calling rte_event_port_setup()
+ * for the port, but after calling rte_event_dev_configure().
+ *
+ * @note
+ *    The defer_sched vdev arg, which configures all load-balanced ports with
+ *    dequeue_depth == 1 for DEFERRED_POP mode, takes precedence over this
+ *    function.
+ *
+ * @param dev_id
+ *    The identifier of the event device.
+ * @param port_id
+ *    The identifier of the event port.
+ * @param mode
+ *    The token pop mode.
+ *
+ * @return
+ * - 0: Success
+ * - EINVAL: Invalid dev_id, port_id, or mode
+ * - EINVAL: The DLB is not configured, is already running, or the port is
+ *   already setup
+ */
+
+int
+rte_pmd_dlb_set_token_pop_mode(uint8_t dev_id,
+                               uint8_t port_id,
+                               enum dlb_token_pop_mode mode);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_DLB_H_ */
diff --git a/drivers/event/dlb/rte_pmd_dlb_event_version.map 
b/drivers/event/dlb/rte_pmd_dlb_event_version.map
new file mode 100644
index 000000000..8b1c796de
--- /dev/null
+++ b/drivers/event/dlb/rte_pmd_dlb_event_version.map
@@ -0,0 +1,6 @@
+DPDK_20.08 {
+       global:
+
+       rte_pmd_dlb_set_token_pop_mode;
+       local: *;
+};
-- 
2.13.6

Reply via email to