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 0FADEA052B; Thu, 30 Jul 2020 21:55:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B95DD1C10C; Thu, 30 Jul 2020 21:53:28 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A6E151C0AE for ; Thu, 30 Jul 2020 21:53:14 +0200 (CEST) IronPort-SDR: /m3NySrtmtTXtH5RN1O8tn7S1pIbKkxNHAUpTEDThaX0inRW/jv/vQpFnRf0OZhqjhbeZ6GTPB WxqReN/8X3lQ== X-IronPort-AV: E=McAfee;i="6000,8403,9698"; a="139672311" X-IronPort-AV: E=Sophos;i="5.75,415,1589266800"; d="scan'208";a="139672311" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jul 2020 12:53:13 -0700 IronPort-SDR: Q6cPvOnt4Apt0lHW/CgA5Jl8CVYihaByUixx1m8HYrD8iG4Vt7nvnTc7Bg+EHpTyZR3T1d6eUG QX6pIyPGIRIg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,415,1589266800"; d="scan'208";a="465378111" Received: from txasoft-yocto.an.intel.com ([10.123.72.192]) by orsmga005.jf.intel.com with ESMTP; 30 Jul 2020 12:53:12 -0700 From: "McDaniel, Timothy" To: jerinj@marvell.com Cc: mattias.ronnblom@ericsson.com, dev@dpdk.org, gage.eads@intel.com, harry.van.haaren@intel.com, "McDaniel, Timothy" Date: Thu, 30 Jul 2020 14:49:59 -0500 Message-Id: <1596138614-17409-13-git-send-email-timothy.mcdaniel@intel.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1596138614-17409-1-git-send-email-timothy.mcdaniel@intel.com> References: <1593232671-5690-0-git-send-email-timothy.mcdaniel@intel.com> <1596138614-17409-1-git-send-email-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" From: "McDaniel, Timothy" Signed-off-by: McDaniel, Timothy --- drivers/event/dlb/Makefile | 2 + drivers/event/dlb/meson.build | 4 +- drivers/event/dlb/rte_pmd_dlb.c | 38 +++++++++++++ drivers/event/dlb/rte_pmd_dlb.h | 69 +++++++++++++++++++++++ drivers/event/dlb/rte_pmd_dlb_event_version.map | 6 ++ 5 files changed, 118 insertions(+), 1 deletion(-) 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/Makefile b/drivers/event/dlb/Makefile index b506e75..9bcb8ef 100644 --- a/drivers/event/dlb/Makefile +++ b/drivers/event/dlb/Makefile @@ -20,11 +20,13 @@ LIBABIVER := 1 EXPORT_MAP := rte_pmd_dlb_event_version.map # library source files +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DLB_EVENTDEV) += rte_pmd_dlb.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_DLB_EVENTDEV) += dlb_iface.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_DLB_EVENTDEV) += pf/dlb_pf.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_DLB_EVENTDEV) += pf/dlb_main.c SRCS-$(CONFIG_RTE_LIBRTE_PMD_DLB_EVENTDEV) += pf/base/dlb_resource.c # export include files +SYMLINK-y-include += rte_pmd_dlb.h include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/event/dlb/meson.build b/drivers/event/dlb/meson.build index 1471a43..06285c5 100644 --- a/drivers/event/dlb/meson.build +++ b/drivers/event/dlb/meson.build @@ -1,10 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2019-2020 Intel Corporation -sources = files('dlb_iface.c', +sources = files('rte_pmd_dlb.c', + 'dlb_iface.c', 'pf/dlb_pf.c', 'pf/dlb_main.c', 'pf/base/dlb_resource.c' ) deps += ['mbuf', 'mempool', 'ring', 'pci', 'bus_pci'] +install_headers('rte_pmd_dlb.h') diff --git a/drivers/event/dlb/rte_pmd_dlb.c b/drivers/event/dlb/rte_pmd_dlb.c new file mode 100644 index 0000000..bc802d3 --- /dev/null +++ b/drivers/event/dlb/rte_pmd_dlb.c @@ -0,0 +1,38 @@ +/* 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 0000000..1b637de --- /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 0000000..8b1c796 --- /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: *; +}; -- 1.7.10