From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 720E3A00BE; Fri, 12 Jun 2020 23:28:40 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50DDA1C07E; Fri, 12 Jun 2020 23:26:40 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 7AB511BFA1 for ; Fri, 12 Jun 2020 23:26:27 +0200 (CEST) IronPort-SDR: wXEfwTodJA6FDeJ10yowP/vmcu8hXyydP9hVhA05OYLlgOdcAviCzIySHnrG3uIZ6zhc5c7O4d O3wCnEh3dD6Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 14:26:27 -0700 IronPort-SDR: 79pNL8Brq8dsjlnat1PU/D1oZ8XxzZyJ7CJMnoDWsPZk9VmZO2LVgbsV9lVSlQl7pZpI8tXz7c pXjTe6XWy+8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,504,1583222400"; d="scan'208";a="272035829" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga003.jf.intel.com with ESMTP; 12 Jun 2020 14:26:26 -0700 From: "McDaniel, Timothy" To: jerinj@marvell.com Cc: dev@dpdk.org, gage.eads@intel.com, harry.van.haaren@intel.com Date: Fri, 12 Jun 2020 16:24:19 -0500 Message-Id: <20200612212434.6852-13-timothy.mcdaniel@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200612212434.6852-1-timothy.mcdaniel@intel.com> References: <20200612212434.6852-1-timothy.mcdaniel@intel.com> Subject: [dpdk-dev] [PATCH 12/27] event/dlb: add the PMD's public interfaces X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Change-Id: I0237d00b8d27d84962be467c48de7c4d5137cc4c Signed-off-by: McDaniel, Timothy --- 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 + +/** + * 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