All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Duszynski <tduszynski@marvell.com>
To: <dev@dpdk.org>
Cc: <jerinj@marvell.com>, <stephen@networkplumber.org>,
	Tomasz Duszynski <tduszynski@marvell.com>
Subject: [PATCH v3 06/10] raw/cnxk_gpio: support enqueuing buffers
Date: Mon, 13 Dec 2021 09:17:28 +0100	[thread overview]
Message-ID: <20211213081732.2096334-7-tduszynski@marvell.com> (raw)
In-Reply-To: <20211213081732.2096334-1-tduszynski@marvell.com>

Add dummy support for enqueuing buffers.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
---
 drivers/raw/cnxk_gpio/cnxk_gpio.c         | 46 +++++++++++++++++++++++
 drivers/raw/cnxk_gpio/cnxk_gpio.h         |  1 +
 drivers/raw/cnxk_gpio/meson.build         |  1 +
 drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h | 38 +++++++++++++++++++
 4 files changed, 86 insertions(+)
 create mode 100644 drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h

diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index 8ac3c5e1be..9477e7293a 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -14,6 +14,7 @@
 #include <roc_api.h>
 
 #include "cnxk_gpio.h"
+#include "rte_pmd_cnxk_gpio.h"
 
 #define CNXK_GPIO_BUFSZ 128
 #define CNXK_GPIO_CLASS_PATH "/sys/class/gpio"
@@ -262,7 +263,52 @@ cnxk_gpio_queue_count(struct rte_rawdev *dev)
 	return gpiochip->num_gpios;
 }
 
+static int
+cnxk_gpio_process_buf(struct cnxk_gpio *gpio, struct rte_rawdev_buf *rbuf)
+{
+	struct cnxk_gpio_msg *msg = rbuf->buf_addr;
+	void *rsp = NULL;
+
+	switch (msg->type) {
+	default:
+		return -EINVAL;
+	}
+
+	/* get rid of last response if any */
+	if (gpio->rsp) {
+		RTE_LOG(WARNING, PMD, "previous response got overwritten\n");
+		rte_free(gpio->rsp);
+	}
+	gpio->rsp = rsp;
+
+	return ret;
+}
+
+static int
+cnxk_gpio_enqueue_bufs(struct rte_rawdev *dev, struct rte_rawdev_buf **buffers,
+		       unsigned int count, rte_rawdev_obj_t context)
+{
+	struct cnxk_gpiochip *gpiochip = dev->dev_private;
+	unsigned int queue = (size_t)context;
+	struct cnxk_gpio *gpio;
+	int ret;
+
+	if (count == 0)
+		return 0;
+
+	gpio = cnxk_gpio_lookup(gpiochip, queue);
+	if (!gpio)
+		return -ENODEV;
+
+	ret = cnxk_gpio_process_buf(gpio, buffers[0]);
+	if (ret)
+		return ret;
+
+	return 1;
+}
+
 static const struct rte_rawdev_ops cnxk_gpio_rawdev_ops = {
+	.enqueue_bufs = cnxk_gpio_enqueue_bufs,
 	.queue_def_conf = cnxk_gpio_queue_def_conf,
 	.queue_count = cnxk_gpio_queue_count,
 	.queue_setup = cnxk_gpio_queue_setup,
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.h b/drivers/raw/cnxk_gpio/cnxk_gpio.h
index 4dae8316ba..6b54ebe6e6 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.h
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.h
@@ -9,6 +9,7 @@ struct cnxk_gpiochip;
 
 struct cnxk_gpio {
 	struct cnxk_gpiochip *gpiochip;
+	void *rsp;
 	int num;
 };
 
diff --git a/drivers/raw/cnxk_gpio/meson.build b/drivers/raw/cnxk_gpio/meson.build
index 9a7e716c1e..3fbfdd838c 100644
--- a/drivers/raw/cnxk_gpio/meson.build
+++ b/drivers/raw/cnxk_gpio/meson.build
@@ -6,3 +6,4 @@ deps += ['bus_vdev', 'common_cnxk', 'rawdev', 'kvargs']
 sources = files(
         'cnxk_gpio.c',
 )
+headers = files('rte_pmd_cnxk_gpio.h')
diff --git a/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h b/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h
new file mode 100644
index 0000000000..c71065e10c
--- /dev/null
+++ b/drivers/raw/cnxk_gpio/rte_pmd_cnxk_gpio.h
@@ -0,0 +1,38 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(C) 2021 Marvell.
+ */
+
+#ifndef _RTE_PMD_CNXK_GPIO_H_
+#define _RTE_PMD_CNXK_GPIO_H_
+
+/**
+ * @file rte_pmd_cnxk_gpio.h
+ *
+ * Marvell GPIO PMD specific structures and interface
+ *
+ * This API allows applications to manage GPIOs in user space along with
+ * installing interrupt handlers for low latency signal processing.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/** Available message types */
+enum cnxk_gpio_msg_type {
+	/** Invalid message type */
+	CNXK_GPIO_MSG_TYPE_INVALID,
+};
+
+struct cnxk_gpio_msg {
+	/** Message type */
+	enum cnxk_gpio_msg_type type;
+	/** Message data passed to PMD or received from PMD */
+	void *data;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_PMD_CNXK_GPIO_H_ */
-- 
2.25.1


  parent reply	other threads:[~2021-12-13  8:19 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17  0:21 [DPDK 22.02 PATCH 00/10] Add cnxk_gpio PMD Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 01/10] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 02/10] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 03/10] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 04/10] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 05/10] raw/cnxk_gpio: support queue release Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 06/10] raw/cnxk_gpio: support enqueuing buffers Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 07/10] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 08/10] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 09/10] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2021-11-17  0:21 ` [PATCH 10/10] raw/cnxk_gpio: support selftest Tomasz Duszynski
2021-11-17  1:17   ` Stephen Hemminger
2021-11-28 15:44 ` [DPDK 22.02 PATCH v2 00/10] Add cnxk_gpio PMD Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 01/10] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 02/10] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 03/10] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 04/10] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 05/10] raw/cnxk_gpio: support queue release Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 06/10] raw/cnxk_gpio: support enqueuing buffers Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 07/10] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 08/10] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 09/10] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2021-11-28 15:44   ` [PATCH v2 10/10] raw/cnxk_gpio: support selftest Tomasz Duszynski
2021-12-13  8:17   ` [PATCH v3 00/10] Add cnxk_gpio PMD Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 01/10] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 02/10] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 03/10] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 04/10] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 05/10] raw/cnxk_gpio: support queue release Tomasz Duszynski
2021-12-13  8:17     ` Tomasz Duszynski [this message]
2021-12-13  8:17     ` [PATCH v3 07/10] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 08/10] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 09/10] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2021-12-13  8:17     ` [PATCH v3 10/10] raw/cnxk_gpio: support selftest Tomasz Duszynski
2022-01-05 14:00     ` [PATCH v4 00/11] Add cnxk_gpio Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 01/11] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 02/11] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 03/11] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 04/11] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 05/11] raw/cnxk_gpio: support queue release Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 06/11] raw/cnxk_gpio: support enqueuing buffers Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 07/11] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 08/11] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 09/11] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 10/11] raw/cnxk_gpio: support selftest Tomasz Duszynski
2022-01-05 14:00       ` [PATCH v4 11/11] raw/cnxk_gpio: add option to allow using subset of GPIOs Tomasz Duszynski
2022-01-06  9:43       ` [PATCH v4 00/11] Add cnxk_gpio Jerin Jacob
2022-01-18 13:24       ` [PATCH v5 " Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 01/11] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 02/11] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 03/11] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 04/11] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 05/11] raw/cnxk_gpio: support queue release Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 06/11] raw/cnxk_gpio: support enqueuing buffers Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 07/11] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 08/11] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 09/11] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 10/11] raw/cnxk_gpio: support selftest Tomasz Duszynski
2022-01-18 13:24         ` [PATCH v5 11/11] raw/cnxk_gpio: add option to allow using subset of GPIOs Tomasz Duszynski
2022-02-09 13:24         ` [PATCH v5 00/11] Add cnxk_gpio Thomas Monjalon
2022-02-17 11:09         ` [PATCH v6 " Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 01/11] raw/cnxk_gpio: add GPIO driver skeleton Tomasz Duszynski
2022-02-18 11:47             ` Thomas Monjalon
2022-02-22 14:18             ` Ferruh Yigit
2022-02-17 11:09           ` [PATCH v6 02/11] raw/cnxk_gpio: support reading default queue conf Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 03/11] raw/cnxk_gpio: support reading queue count Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 04/11] raw/cnxk_gpio: support queue setup Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 05/11] raw/cnxk_gpio: support queue release Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 06/11] raw/cnxk_gpio: support enqueuing buffers Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 07/11] raw/cnxk_gpio: support dequeuing buffers Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 08/11] raw/cnxk_gpio: support standard GPIO operations Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 09/11] raw/cnxk_gpio: support custom irq handlers Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 10/11] raw/cnxk_gpio: support selftest Tomasz Duszynski
2022-02-17 11:09           ` [PATCH v6 11/11] raw/cnxk_gpio: add option to allow using subset of GPIOs Tomasz Duszynski
2022-02-18 17:19           ` [PATCH v6 00/11] Add cnxk_gpio Thomas Monjalon

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=20211213081732.2096334-7-tduszynski@marvell.com \
    --to=tduszynski@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=stephen@networkplumber.org \
    /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.