All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas.monjalon@6wind.com, bruce.richardson@intel.com,
	harry.van.haaren@intel.com, hemant.agrawal@nxp.com,
	gage.eads@intel.com, nipun.gupta@nxp.com,
	santosh.shukla@caviumnetworks.com,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [PATCH v2 06/38] event/octeontx: add octeontx eventdev driver
Date: Sat,  1 Apr 2017 01:04:33 +0530	[thread overview]
Message-ID: <1490988905-12584-7-git-send-email-jerin.jacob@caviumnetworks.com> (raw)
In-Reply-To: <1490988905-12584-1-git-send-email-jerin.jacob@caviumnetworks.com>

This adds the minimal changes to allow a octeontx eventdev
implementation to be compiled, linked and created at run time.
The eventdev does nothing, but can be created via vdev
on command line, e.g.

sudo ./build/app/test -c 0xff00 --vdev=event_octeontx
...
Initializing event_octeontx domain=4 max_queues=64 max_ports=32
RTE>>

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Gage Eads <gage.eads@intel.com>
---
 drivers/event/octeontx/Makefile      |   1 +
 drivers/event/octeontx/ssovf_evdev.c | 148 +++++++++++++++++++++++++++++++++++
 drivers/event/octeontx/ssovf_evdev.h |  23 ++++++
 3 files changed, 172 insertions(+)
 create mode 100644 drivers/event/octeontx/ssovf_evdev.c

diff --git a/drivers/event/octeontx/Makefile b/drivers/event/octeontx/Makefile
index 3076b85..6e8227b 100644
--- a/drivers/event/octeontx/Makefile
+++ b/drivers/event/octeontx/Makefile
@@ -46,6 +46,7 @@ LIBABIVER := 1
 #
 # all source are stored in SRCS-y
 #
+SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_evdev.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_probe.c
 SRCS-$(CONFIG_RTE_LIBRTE_PMD_OCTEONTX_SSOVF) += ssovf_mbox.c
 
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
new file mode 100644
index 0000000..b349adc
--- /dev/null
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -0,0 +1,148 @@
+/*
+ *   BSD LICENSE
+ *
+ *   Copyright (C) Cavium networks Ltd. 2017.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following conditions
+ *   are met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in
+ *       the documentation and/or other materials provided with the
+ *       distribution.
+ *     * Neither the name of Cavium networks nor the names of its
+ *       contributors may be used to endorse or promote products derived
+ *       from this software without specific prior written permission.
+ *
+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rte_common.h>
+#include <rte_debug.h>
+#include <rte_dev.h>
+#include <rte_eal.h>
+#include <rte_lcore.h>
+#include <rte_log.h>
+#include <rte_malloc.h>
+#include <rte_memory.h>
+#include <rte_memzone.h>
+#include <rte_vdev.h>
+
+#include "ssovf_evdev.h"
+
+/* SSOPF Mailbox messages */
+
+struct ssovf_mbox_dev_info {
+	uint64_t min_deq_timeout_ns;
+	uint64_t max_deq_timeout_ns;
+	uint32_t max_num_events;
+};
+
+static int
+ssovf_mbox_dev_info(struct ssovf_mbox_dev_info *info)
+{
+	struct octeontx_mbox_hdr hdr = {0};
+	uint16_t len = sizeof(struct ssovf_mbox_dev_info);
+
+	hdr.coproc = SSO_COPROC;
+	hdr.msg = SSO_GET_DEV_INFO;
+	hdr.vfid = 0;
+
+	memset(info, 0, len);
+	return octeontx_ssovf_mbox_send(&hdr, NULL, 0, info, len);
+}
+
+static int
+ssovf_vdev_probe(const char *name, const char *params)
+{
+	struct octeontx_ssovf_info oinfo;
+	struct ssovf_mbox_dev_info info;
+	struct ssovf_evdev *edev;
+	struct rte_eventdev *eventdev;
+	static int ssovf_init_once;
+	int ret;
+
+	RTE_SET_USED(params);
+
+	/* More than one instance is not supported */
+	if (ssovf_init_once) {
+		ssovf_log_err("Request to create >1 %s instance", name);
+		return -EINVAL;
+	}
+
+	eventdev = rte_event_pmd_vdev_init(name, sizeof(struct ssovf_evdev),
+				rte_socket_id());
+	if (eventdev == NULL) {
+		ssovf_log_err("Failed to create eventdev vdev %s", name);
+		return -ENOMEM;
+	}
+	eventdev->dev_ops = NULL;
+
+	/* For secondary processes, the primary has done all the work */
+	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+		return 0;
+
+	ret = octeontx_ssovf_info(&oinfo);
+	if (ret) {
+		ssovf_log_err("Failed to probe and validate ssovfs %d", ret);
+		return ret;
+	}
+
+	edev = ssovf_pmd_priv(eventdev);
+	edev->max_event_ports = oinfo.total_ssowvfs;
+	edev->max_event_queues = oinfo.total_ssovfs;
+	edev->is_timeout_deq = 0;
+
+	ret = ssovf_mbox_dev_info(&info);
+	if (ret < 0 || ret != sizeof(struct ssovf_mbox_dev_info)) {
+		ssovf_log_err("Failed to get mbox devinfo %d", ret);
+		return ret;
+	}
+
+	edev->min_deq_timeout_ns = info.min_deq_timeout_ns;
+	edev->max_deq_timeout_ns = info.max_deq_timeout_ns;
+	edev->max_num_events =  info.max_num_events;
+	ssovf_log_dbg("min_deq_tmo=%"PRId64" max_deq_tmo=%"PRId64" max_evts=%d",
+			info.min_deq_timeout_ns, info.max_deq_timeout_ns,
+			info.max_num_events);
+
+	if (!edev->max_event_ports || !edev->max_event_queues) {
+		ssovf_log_err("Not enough eventdev resource queues=%d ports=%d",
+			edev->max_event_queues, edev->max_event_ports);
+		return -ENODEV;
+	}
+
+	ssovf_log_info("Initializing %s domain=%d max_queues=%d max_ports=%d\n",
+			name, oinfo.domain, edev->max_event_queues,
+			edev->max_event_ports);
+
+	ssovf_init_once = 1;
+	return 0;
+}
+
+static int
+ssovf_vdev_remove(const char *name)
+{
+	ssovf_log_info("Closing %s\n", name);
+	return rte_event_pmd_vdev_uninit(name);
+}
+
+static struct rte_vdev_driver vdev_ssovf_pmd = {
+	.probe = ssovf_vdev_probe,
+	.remove = ssovf_vdev_remove
+};
+
+RTE_PMD_REGISTER_VDEV(EVENTDEV_NAME_OCTEONTX_PMD, vdev_ssovf_pmd);
diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h
index c2b8187..b8b89a7 100644
--- a/drivers/event/octeontx/ssovf_evdev.h
+++ b/drivers/event/octeontx/ssovf_evdev.h
@@ -34,6 +34,7 @@
 #define __SSOVF_EVDEV_H__
 
 #include <rte_config.h>
+#include <rte_eventdev_pmd.h>
 #include <rte_io.h>
 
 #include "rte_pmd_octeontx_ssovf.h"
@@ -108,4 +109,26 @@
 
 #define SSOW_BAR4_LEN                     (64 * 1024)
 
+/* Mailbox message constants */
+#define SSO_COPROC                        0x2
+
+#define SSO_GETDOMAINCFG                  0x1
+#define SSO_IDENTIFY                      0x2
+#define SSO_GET_DEV_INFO                  0x3
+
+struct ssovf_evdev {
+	uint8_t max_event_queues;
+	uint8_t max_event_ports;
+	uint8_t is_timeout_deq;
+	uint32_t min_deq_timeout_ns;
+	uint32_t max_deq_timeout_ns;
+	int32_t max_num_events;
+} __rte_cache_aligned;
+
+static inline struct ssovf_evdev *
+ssovf_pmd_priv(const struct rte_eventdev *eventdev)
+{
+	return eventdev->data->dev_private;
+}
+
 #endif /* __SSOVF_EVDEV_H__ */
-- 
2.5.5

  parent reply	other threads:[~2017-03-31 19:36 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 17:27 Cavium OCTEONTX ssovf eventdev PMD Jerin Jacob
2017-03-03 17:27 ` [PATCH 01/39] eventdev: update PMD dequeue timeout conversion callback Jerin Jacob
2017-03-15 17:27   ` Van Haaren, Harry
2017-03-16  8:30     ` Jerin Jacob
2017-03-23 10:11     ` Jerin Jacob
2017-03-03 17:27 ` [PATCH 02/39] app/test: fix eventdev reconfigure test Jerin Jacob
2017-03-15 17:28   ` Van Haaren, Harry
2017-03-23 10:11     ` Jerin Jacob
2017-03-03 17:27 ` [PATCH 03/39] mk: handle intra drivers dependencies for shared build Jerin Jacob
2017-03-03 17:27 ` [PATCH 04/39] event/octeontx: add build and log infrastructure Jerin Jacob
2017-03-23 15:14   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 05/39] event/octeontx: probe ssovf pcie devices Jerin Jacob
2017-03-23 15:39   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 06/39] event/octeontx: probe ssowvf " Jerin Jacob
2017-03-23 15:44   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 07/39] event/octeontx: add vdev interface functions Jerin Jacob
2017-03-23 16:07   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 08/39] event/octeontx: add mailbox support Jerin Jacob
2017-03-23 16:46   ` Eads, Gage
2017-03-24  9:57     ` Jerin Jacob
2017-03-03 17:27 ` [PATCH 09/39] event/octeontx: add octeontx eventdev driver Jerin Jacob
2017-03-23 17:07   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 10/39] event/octeontx: add device capabilities function Jerin Jacob
2017-03-23 17:08   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 11/39] event/octeontx: add configure function Jerin Jacob
2017-03-23 18:09   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 12/39] event/octeontx: add support for event queues Jerin Jacob
2017-03-23 18:10   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 13/39] event/octeontx: add support for event ports Jerin Jacob
2017-03-23 18:14   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 14/39] event/octeontx: add support for linking queues to ports Jerin Jacob
2017-03-23 18:16   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 15/39] event/octeontx: add support dequeue timeout tick conversion Jerin Jacob
2017-03-23 18:17   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 16/39] event/octeontx: add dump function for easier debugging Jerin Jacob
2017-03-23 18:20   ` Eads, Gage
2017-03-03 17:27 ` [PATCH 17/39] event/octeontx: add SSO HW device operations Jerin Jacob
2017-03-22 15:29   ` Eads, Gage
2017-03-23 18:24     ` Eads, Gage
2017-03-03 17:28 ` [PATCH 18/39] event/octeontx: add support worker enqueue function Jerin Jacob
2017-03-23 18:27   ` Eads, Gage
2017-03-03 17:28 ` [PATCH 19/39] event/octeontx: add support worker dequeue function Jerin Jacob
2017-03-20 21:11   ` Eads, Gage
2017-03-21  3:21     ` Jerin Jacob
2017-03-23 18:51   ` Eads, Gage
2017-03-24 11:16     ` Jerin Jacob
2017-03-03 17:28 ` [PATCH 20/39] event/octeontx: add start function Jerin Jacob
2017-03-23 18:59   ` Eads, Gage
2017-03-03 17:28 ` [PATCH 21/39] event/octeontx: add stop and close function Jerin Jacob
2017-03-23 19:02   ` Eads, Gage
2017-03-03 17:28 ` [PATCH 22/39] app/test: octeontx eventdev unit test infrastructure Jerin Jacob
2017-03-23 11:55   ` Van Haaren, Harry
2017-03-24 13:40     ` Jerin Jacob
2017-03-24 13:47       ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 23/39] app/test: octeontx unit test case setup and teardown Jerin Jacob
2017-03-23 11:56   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 24/39] app/test: octeontx unit test case helper functions Jerin Jacob
2017-03-23 12:00   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 25/39] app/test: octeontx simple event enqueue and dequeue test Jerin Jacob
2017-03-23 12:01   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 26/39] app/test: octeontx multi queue " Jerin Jacob
2017-03-23 12:02   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 27/39] app/test: octeontx eventdev priority test Jerin Jacob
2017-03-23 12:03   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 28/39] app/test: add infrastructure for multicore octeontx tests Jerin Jacob
2017-03-23 12:03   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 29/39] app/test: octeontx multi queue and multi core/port tests Jerin Jacob
2017-03-23 12:04   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 30/39] app/test: octeontx single link establishment test Jerin Jacob
2017-03-23 12:05   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 31/39] app/test: octeontx multi " Jerin Jacob
2017-03-23 12:06   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 32/39] app/test: octeontx flow based two stage sched type test Jerin Jacob
2017-03-23 12:07   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 33/39] app/test: octeontx queue " Jerin Jacob
2017-03-23 12:08   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 34/39] app/test: octeontx flow based maximum stage pipeline Jerin Jacob
2017-03-23 12:08   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 35/39] app/test: octeontx queue " Jerin Jacob
2017-03-23 12:09   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 36/39] app/test: octeontx queue and flow based max " Jerin Jacob
2017-03-23 12:09   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 37/39] app/test: octeontx producer-consumer based order test Jerin Jacob
2017-03-23 12:10   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 38/39] app/test: add remaining tests based on existing helpers Jerin Jacob
2017-03-23 12:11   ` Van Haaren, Harry
2017-03-03 17:28 ` [PATCH 39/39] doc: add OCTEONTX ssovf details Jerin Jacob
2017-03-20 20:20   ` Eads, Gage
2017-03-20 21:38   ` Eads, Gage
2017-03-21  3:18     ` Jerin Jacob
2017-03-23 12:47   ` Van Haaren, Harry
2017-03-31 19:34 ` [PATCH v2 00/38] Cavium OCTEONTX ssovf eventdev PMD Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 01/38] event/octeontx: add build and log infrastructure Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 02/38] event/octeontx: probe ssovf pcie devices Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 03/38] event/octeontx: probe ssowvf " Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 04/38] event/octeontx: add vdev interface functions Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 05/38] event/octeontx: add mailbox support Jerin Jacob
2017-03-31 19:34   ` Jerin Jacob [this message]
2017-03-31 19:34   ` [PATCH v2 07/38] event/octeontx: add device capabilities function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 08/38] event/octeontx: add configure function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 09/38] event/octeontx: add support for event queues Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 10/38] event/octeontx: add support for event ports Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 11/38] event/octeontx: add support for linking queues to ports Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 12/38] event/octeontx: add support dequeue timeout tick conversion Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 13/38] event/octeontx: add dump function for easier debugging Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 14/38] event/octeontx: add SSO HW device operations Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 15/38] event/octeontx: add support worker enqueue function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 16/38] event/octeontx: add support worker dequeue function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 17/38] event/octeontx: add start function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 18/38] event/octeontx: add stop and close function Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 19/38] test/test: octeontx eventdev unit test infrastructure Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 20/38] test/test: octeontx unit test case setup and teardown Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 21/38] test/test: octeontx unit test case helper functions Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 22/38] test/test: octeontx simple event enqueue and dequeue test Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 23/38] test/test: octeontx multi queue " Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 24/38] test/test: octeontx eventdev priority test Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 25/38] test/test: add infrastructure for multicore octeontx tests Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 26/38] test/test: octeontx multi queue and multi core/port tests Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 27/38] test/test: octeontx single link establishment test Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 28/38] test/test: octeontx multi " Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 29/38] test/test: octeontx flow based two stage sched type test Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 30/38] test/test: octeontx queue " Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 31/38] test/test: octeontx flow based maximum stage pipeline Jerin Jacob
2017-03-31 19:34   ` [PATCH v2 32/38] test/test: octeontx queue " Jerin Jacob
2017-03-31 19:35   ` [PATCH v2 33/38] test/test: octeontx queue and flow based max " Jerin Jacob
2017-03-31 19:35   ` [PATCH v2 34/38] test/test: octeontx producer-consumer based order test Jerin Jacob
2017-03-31 19:35   ` [PATCH v2 35/38] test/test: add remaining tests based on existing helpers Jerin Jacob
2017-03-31 19:35   ` [PATCH v2 36/38] doc: add OCTEONTX ssovf details Jerin Jacob
2017-04-02 12:29     ` Mcnamara, John
2017-04-03  4:49       ` Jerin Jacob
2017-04-02 15:20     ` Mcnamara, John
2017-03-31 19:35   ` [PATCH v2 37/38] maintainers: claim OCTEONTX eventdev PMD maintainership Jerin Jacob
2017-03-31 19:35   ` [PATCH v2 38/38] doc: add Cavium OCTEONTX eventdev PMD to 17.05 release notes Jerin Jacob
2017-04-02 12:18     ` Mcnamara, John
2017-04-03 11:29   ` [PATCH v2 00/38] Cavium OCTEONTX ssovf eventdev PMD Jerin Jacob

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490988905-12584-7-git-send-email-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=gage.eads@intel.com \
    --cc=harry.van.haaren@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=nipun.gupta@nxp.com \
    --cc=santosh.shukla@caviumnetworks.com \
    --cc=thomas.monjalon@6wind.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.