From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id B133FA046B for ; Sat, 1 Jun 2019 20:20:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E48D04F91; Sat, 1 Jun 2019 20:20:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id E2CF31C0B for ; Sat, 1 Jun 2019 20:20:26 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x51IKQiZ003606 for ; Sat, 1 Jun 2019 11:20:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Ul+Uv8k5AB9KKJQhrw1XJlPjU1ZP5Bidwpd5jt1De90=; b=WOcGPMKEMrlbSXcpATZEC6fPnZhUcGn8q3KmJMUuQLb7HhDo1Jhc1eNS9T38kRADsyEW 6ThdJTvV5qW/b65/GkyMYECGA/jQf8ZwtPFsjF2S/duJ2v3M5Bt5NpnF5PIMvnHj6pNa 3P6unN4i3THjPP6/ocmL2GodbExjDPz+lmeTqfaFiwV87IataVMX1QwJTi9+/J2s05mT V4X2NQBnYOj2ZSI66OFUqS2rhcWOU+ihlw1gnk5eSIL/QisoIoIvuwadfWYM+EgBwOGD 1hGcQAB7TboQk2EIGeF/HKNVYJ+5amlkL8e5y9HD9XvvYn7K55ur01PyusDp/AVsSive 0g== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2survk1016-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Sat, 01 Jun 2019 11:20:26 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Sat, 1 Jun 2019 11:20:25 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Sat, 1 Jun 2019 11:20:25 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 1CB353F703F; Sat, 1 Jun 2019 11:20:23 -0700 (PDT) From: To: CC: , Vamsi Attunuru Date: Sat, 1 Jun 2019 23:50:23 +0530 Message-ID: <20190601182030.8282-3-jerinj@marvell.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190601182030.8282-1-jerinj@marvell.com> References: <20190601182030.8282-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-06-01_13:, , signatures=0 Subject: [dpdk-dev] [PATCH v1 2/9] raw/octeontx2_dma: update probe function 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: Satha Rao Probe function enhanced to allocate and initialise PMD private data. Signed-off-by: Satha Rao Signed-off-by: Vamsi Attunuru --- drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c | 25 +++++++-- drivers/raw/octeontx2_dma/otx2_dpi_rawdev.h | 59 +++++++++++++++++++++ 2 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 drivers/raw/octeontx2_dma/otx2_dpi_rawdev.h diff --git a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c index 01422c299..f9560abcc 100644 --- a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c +++ b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.c @@ -17,7 +17,7 @@ #include #include -#include +#include "otx2_dpi_rawdev.h" static const struct rte_pci_id pci_dma_map[] = { { @@ -34,11 +34,13 @@ otx2_dpi_rawdev_probe(struct rte_pci_driver *pci_drv __rte_unused, struct rte_pci_device *pci_dev) { char name[RTE_RAWDEV_NAME_MAX_LEN]; + struct dpi_vf_s *dpivf = NULL; struct rte_rawdev *rawdev; + uint16_t vf_id; /* For secondary processes, the primary has done all the work */ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; + return DPI_DMA_QUEUE_SUCCESS; if (pci_dev->mem_resource[0].addr == NULL) { otx2_dpi_dbg("Empty bars %p %p", pci_dev->mem_resource[0].addr, @@ -52,7 +54,8 @@ otx2_dpi_rawdev_probe(struct rte_pci_driver *pci_drv __rte_unused, pci_dev->addr.function); /* Allocate device structure */ - rawdev = rte_rawdev_pmd_allocate(name, 0, rte_socket_id()); + rawdev = rte_rawdev_pmd_allocate(name, sizeof(struct dpi_vf_s), + rte_socket_id()); if (rawdev == NULL) { otx2_err("Rawdev allocation failed"); return -EINVAL; @@ -61,7 +64,21 @@ otx2_dpi_rawdev_probe(struct rte_pci_driver *pci_drv __rte_unused, rawdev->device = &pci_dev->device; rawdev->driver_name = pci_dev->driver->driver.name; - return 0; + dpivf = rawdev->dev_private; + if (dpivf->state != DPI_QUEUE_STOP) { + otx2_dpi_dbg("Device already started!!!"); + return -ENODEV; + } + + vf_id = ((pci_dev->addr.devid & 0x1F) << 3) | + (pci_dev->addr.function & 0x7); + vf_id -= 1; + dpivf->state = DPI_QUEUE_START; + dpivf->vf_id = vf_id; + dpivf->vf_bar0 = (uintptr_t)pci_dev->mem_resource[0].addr; + dpivf->vf_bar2 = (uintptr_t)pci_dev->mem_resource[2].addr; + + return DPI_DMA_QUEUE_SUCCESS; } static int diff --git a/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.h b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.h new file mode 100644 index 000000000..33fd95c33 --- /dev/null +++ b/drivers/raw/octeontx2_dma/otx2_dpi_rawdev.h @@ -0,0 +1,59 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#ifndef _DPI_RAWDEV_H_ +#define _DPI_RAWDEV_H_ + +#include "otx2_common.h" +#include "otx2_mempool.h" + +#define DPI_QUEUE_OPEN 0x1 +#define DPI_QUEUE_CLOSE 0x2 + +/* DPI VF register offsets from VF_BAR0 */ +#define DPI_VDMA_EN (0x0) +#define DPI_VDMA_REQQ_CTL (0x8) +#define DPI_VDMA_DBELL (0x10) +#define DPI_VDMA_SADDR (0x18) +#define DPI_VDMA_COUNTS (0x20) +#define DPI_VDMA_NADDR (0x28) +#define DPI_VDMA_IWBUSY (0x30) +#define DPI_VDMA_CNT (0x38) +#define DPI_VF_INT (0x100) +#define DPI_VF_INT_W1S (0x108) +#define DPI_VF_INT_ENA_W1C (0x110) +#define DPI_VF_INT_ENA_W1S (0x118) + +#define DPI_MAX_VFS 8 +#define DPI_DMA_CMD_SIZE 64 +#define DPI_CHUNK_SIZE 1024 +#define DPI_QUEUE_STOP 0x0 +#define DPI_QUEUE_START 0x1 + +struct dpi_vf_s { + struct rte_pci_device *dev; + uint8_t state; + uint16_t vf_id; + uint8_t domain; + uintptr_t vf_bar0; + uintptr_t vf_bar2; + + uint16_t pool_size_m1; + uint16_t index; + uint64_t *base_ptr; + void *chunk_pool; + struct otx2_mbox *mbox; +}; + +struct dpi_rawdev_conf_s { + void *chunk_pool; +}; + +enum dpi_dma_queue_result_e { + DPI_DMA_QUEUE_SUCCESS = 0, + DPI_DMA_QUEUE_NO_MEMORY = -1, + DPI_DMA_QUEUE_INVALID_PARAM = -2, +}; + +#endif /* _DPI_RAWDEV_H_ */ -- 2.21.0