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 9F976A2EFC for ; Tue, 15 Oct 2019 10:23:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 604321E550; Tue, 15 Oct 2019 10:23:07 +0200 (CEST) Received: from mail.ntop.org (mail-digitalocean.ntop.org [167.99.215.164]) by dpdk.org (Postfix) with ESMTP id 978E71DFE6 for ; Tue, 15 Oct 2019 10:22:46 +0200 (CEST) Received: from devele.ntop.org (net-93-145-196-230.cust.vodafonedsl.it [93.145.196.230]) by mail.ntop.org (Postfix) with ESMTPSA id 5669341C18; Tue, 15 Oct 2019 10:22:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntop.org; s=mail; t=1571127766; bh=tDytpbiRIvnOlHflOP4pLmFJxGyKT25+eQdCjjhhmmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rw/aLcXNe4x9H6KgPdWll4vtrOfsgjH61d4BTWwuSV1WDL73snEo5Mv/MUW+cR/um g/s2ZrUrFYx0JZC71W5zom88LkwRbwGKVkGEoqzmXbr/t0h3NNp8Oy0t7FvmeNeZXG ge/G9N8qLZpdm8Z/diJ6OO74i9a7visJtNRKzpts= From: Alfredo Cardigliano To: Alfredo Cardigliano Cc: dev@dpdk.org Date: Tue, 15 Oct 2019 10:22:25 +0200 Message-Id: <20191015082235.28639-8-cardigliano@ntop.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191015082235.28639-1-cardigliano@ntop.org> References: <20191015082235.28639-1-cardigliano@ntop.org> Subject: [dpdk-dev] [PATCH v2 07/17] net/ionic: add doorbells 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" 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 Reviewed-by: Shannon Nelson --- 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 9d25c5e15..d0a4d5268 100644 --- a/drivers/net/ionic/ionic_dev.c +++ b/drivers/net/ionic/ionic_dev.c @@ -5,6 +5,7 @@ #include #include "ionic_dev.h" +#include "ionic_lif.h" #include "ionic.h" int @@ -291,3 +292,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 9ab482c8a..812d800d9 100644 --- a/drivers/net/ionic/ionic_dev.h +++ b/drivers/net/ionic/ionic_dev.h @@ -132,6 +132,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); @@ -161,4 +178,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 c67619d85..c36bb6bc3 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_init_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_init_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 374cebd05..6b912efa0 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