DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alfredo Cardigliano <cardigliano@ntop.org>
To: Alfredo Cardigliano <cardigliano@ntop.org>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3 07/17] net/ionic: add doorbells
Date: Mon,  9 Dec 2019 22:46:46 +0100	[thread overview]
Message-ID: <20191209214656.27347-8-cardigliano@ntop.org> (raw)
In-Reply-To: <20191209214656.27347-1-cardigliano@ntop.org>

Doorbell registers are used by the driver to signal to the NIC
that requests are waiting on the message queues.

Signed-off-by: Alfredo Cardigliano <cardigliano@ntop.org>
Reviewed-by: Shannon Nelson <snelson@pensando.io>
---
 drivers/net/ionic/ionic_dev.c | 15 +++++++++++++++
 drivers/net/ionic/ionic_dev.h | 19 +++++++++++++++++++
 drivers/net/ionic/ionic_lif.c | 24 ++++++++++++++++++++++++
 drivers/net/ionic/ionic_lif.h |  4 +++-
 4 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c
index 841e0837f..29f2720ae 100644
--- a/drivers/net/ionic/ionic_dev.c
+++ b/drivers/net/ionic/ionic_dev.c
@@ -5,6 +5,7 @@
 #include <rte_malloc.h>
 
 #include "ionic_dev.h"
+#include "ionic_lif.h"
 #include "ionic.h"
 
 int
@@ -297,3 +298,17 @@ ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index)
 
 	ionic_dev_cmd_go(idev, &cmd);
 }
+
+int
+ionic_db_page_num(struct ionic_lif *lif, int pid)
+{
+	return (lif->index * 0) + pid;
+}
+
+void
+ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
+		unsigned long index)
+{
+	ionic_intr_clean(idev->intr_ctrl, index);
+	intr->index = index;
+}
diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h
index afcfcbf56..ca9807a9b 100644
--- a/drivers/net/ionic/ionic_dev.h
+++ b/drivers/net/ionic/ionic_dev.h
@@ -121,6 +121,23 @@ struct ionic_dev {
 	uint32_t port_info_sz;
 };
 
+#define IONIC_INTR_INDEX_NOT_ASSIGNED	(-1)
+#define IONIC_INTR_NAME_MAX_SZ		(32)
+
+struct ionic_intr_info {
+	char name[IONIC_INTR_NAME_MAX_SZ];
+	int index;
+	uint32_t vector;
+	struct ionic_intr __iomem *ctrl;
+	uint64_t rearm_count;
+};
+
+struct ionic_lif;
+struct ionic_adapter;
+
+void ionic_intr_init(struct ionic_dev *idev, struct ionic_intr_info *intr,
+	unsigned long index);
+
 int ionic_dev_setup(struct ionic_adapter *adapter);
 
 void ionic_dev_cmd_go(struct ionic_dev *idev, union ionic_dev_cmd *cmd);
@@ -150,4 +167,6 @@ void ionic_dev_cmd_lif_init(struct ionic_dev *idev, uint16_t lif_index,
 	rte_iova_t addr);
 void ionic_dev_cmd_lif_reset(struct ionic_dev *idev, uint16_t lif_index);
 
+int ionic_db_page_num(struct ionic_lif *lif, int pid);
+
 #endif /* _IONIC_DEV_H_ */
diff --git a/drivers/net/ionic/ionic_lif.c b/drivers/net/ionic/ionic_lif.c
index d02dc05c9..1cc130322 100644
--- a/drivers/net/ionic/ionic_lif.c
+++ b/drivers/net/ionic/ionic_lif.c
@@ -10,15 +10,39 @@
 #include "ionic_lif.h"
 #include "ionic_ethdev.h"
 
+static void *
+ionic_bus_map_dbpage(struct ionic_adapter *adapter, int page_num)
+{
+	char *vaddr = adapter->bars[IONIC_PCI_BAR_DBELL].vaddr;
+
+	if (adapter->num_bars <= IONIC_PCI_BAR_DBELL)
+		return NULL;
+
+	return (void *)&vaddr[page_num << PAGE_SHIFT];
+}
+
 int
 ionic_lif_alloc(struct ionic_lif *lif)
 {
+	struct ionic_adapter *adapter = lif->adapter;
 	uint32_t socket_id = rte_socket_id();
+	int dbpage_num;
 
 	snprintf(lif->name, sizeof(lif->name), "lif%u", lif->index);
 
 	IONIC_PRINT(DEBUG, "Allocating Lif Info");
 
+	lif->kern_pid = 0;
+
+	dbpage_num = ionic_db_page_num(lif, 0);
+
+	lif->kern_dbpage = ionic_bus_map_dbpage(adapter, dbpage_num);
+
+	if (!lif->kern_dbpage) {
+		IONIC_PRINT(ERR, "Cannot map dbpage, aborting");
+		return -ENOMEM;
+	}
+
 	lif->info_sz = RTE_ALIGN(sizeof(*lif->info), PAGE_SIZE);
 
 	lif->info_z = rte_eth_dma_zone_reserve(lif->eth_dev,
diff --git a/drivers/net/ionic/ionic_lif.h b/drivers/net/ionic/ionic_lif.h
index 49bceaccf..6e3233d1d 100644
--- a/drivers/net/ionic/ionic_lif.h
+++ b/drivers/net/ionic/ionic_lif.h
@@ -23,8 +23,10 @@ struct ionic_lif {
 	uint16_t port_id;  /**< Device port identifier */
 	uint32_t index;
 	uint32_t hw_index;
-	char name[IONIC_LIF_NAME_MAX_SZ];
 	uint32_t state;
+	uint32_t kern_pid;
+	struct ionic_doorbell __iomem *kern_dbpage;
+	char name[IONIC_LIF_NAME_MAX_SZ];
 	uint32_t info_sz;
 	struct ionic_lif_info *info;
 	rte_iova_t info_pa;
-- 
2.17.1


  parent reply	other threads:[~2019-12-09 21:49 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 21:46 [dpdk-dev] [PATCH v3 00/17] Introduces net/ionic PMD Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 01/17] net/ionic: add skeleton Alfredo Cardigliano
2019-12-10 18:48   ` Ferruh Yigit
2019-12-12 12:01     ` Alfredo Cardigliano
2019-12-12 12:39       ` Ferruh Yigit
2019-12-12 14:09         ` Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 02/17] net/ionic: add hardware structures definitions Alfredo Cardigliano
2019-12-10 18:48   ` Ferruh Yigit
2019-12-13 10:25     ` Hemant Agrawal
2019-12-17 19:46       ` Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 03/17] net/ionic: add log Alfredo Cardigliano
2019-12-10 18:49   ` Ferruh Yigit
2019-12-13 10:22     ` Hemant Agrawal
2019-12-10 18:49   ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 04/17] net/ionic: register and initialize the adapter Alfredo Cardigliano
2019-12-10 18:50   ` Ferruh Yigit
2019-12-12 12:04     ` Alfredo Cardigliano
2019-12-12 12:42       ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 05/17] net/ionic: add port management commands Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 06/17] net/ionic: add basic lif support Alfredo Cardigliano
2019-12-09 21:46 ` Alfredo Cardigliano [this message]
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 08/17] net/ionic: add adminq support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 09/17] net/ionic: add notifyq support Alfredo Cardigliano
2019-12-10 18:53   ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 10/17] net/ionic: add basic port operations Alfredo Cardigliano
2019-12-10 18:50   ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 11/17] net/ionic: add RX filters support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 12/17] net/ionic: add Flow Control support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 13/17] net/ionic: add RX and TX handling Alfredo Cardigliano
2019-12-10 18:51   ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 14/17] net/ionic: add RSS support Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 15/17] net/ionic: add stats Alfredo Cardigliano
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 16/17] net/ionic: add TX checksum support Alfredo Cardigliano
2019-12-10 18:52   ` Ferruh Yigit
2019-12-09 21:46 ` [dpdk-dev] [PATCH v3 17/17] net/ionic: read fw version Alfredo Cardigliano
2019-12-10 18:57 ` [dpdk-dev] [PATCH v3 00/17] Introduces net/ionic PMD Ferruh Yigit

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=20191209214656.27347-8-cardigliano@ntop.org \
    --to=cardigliano@ntop.org \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).