From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0C1D845B04; Thu, 10 Oct 2024 16:19:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D34940BA5; Thu, 10 Oct 2024 16:15:36 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id BFD8C40E1F for ; Thu, 10 Oct 2024 16:15:06 +0200 (CEST) Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03lp2238.outbound.protection.outlook.com [104.47.51.238]) by mx-outbound11-198.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 10 Oct 2024 14:15:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HN9tM+aq53uhNjeL2t9wFDkhfF2ZbEVbsmO+joCuLFR+RQMRB4ndG3OIeU3efgv/l/NUO59b+kFRJoksSt1CQFCUrjpTpAOimlwdg9ooTtRdSW4TwVm6tIvunHTjC7GR7A+mjOpHbsamb8vsFadgwXeUmB8XCnBn9FVjT7SsA51cs96WiSHjiAQRZDyena8AayyeE8ggzw+8sfvu8NPgA1PNYkZwIpnXHGOXBnF4xLx0cbhj/W+wS50IJv7wWUqKzwCMFRL2TMACBc17xXwuNnqrnnccFITrMH8RyvhL6GWfServ65F13SnxzBKEmydCXE1evt1O4jyUaUKdJk3law== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nzBhh99KyrntiXOXSU/iSmk6rTLYdLDtpe/totu1ynE=; b=hrYSLVH1anK6ZiOwJxMOiKQ0Cv4RPWYH43JjlSErdKDJmG5M/FjL1aPheJt8reNlSEG4HqnVMC5qV8iL7dqZRvV/rvdk9ktJQImkOWXJOswZLJtAJZdbNNMjF61Q4IJZOxQt7k8E7MOR3+SMURfEHpO6I0dHTSNi3oUt8Xpc5cL+O1UVT0GZio6MjJ1nZR+7dbUaoKXxY2grMcqy7j8KU/yX99dOzBFzLnnu4ouQp8E8q+ZuvaZbasgE2kbbrObo+iaAZIOgFF+1O98UAGo/EDP1c4f+vl2SM7pYRvtVA4QGXZorRFgc17/M53SoikT2rBdevtExz0CCp0IB7HB23A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nzBhh99KyrntiXOXSU/iSmk6rTLYdLDtpe/totu1ynE=; b=DDNittliHb6OBkRWS4UFcS487SI7+9OKEETMf7WHDFx2M/oCIYMy4kWivj/9X1dqBFr/yl0nJRc2Z68ZHUFy09S2T4rcrrZ3iCBfzPydgrWaSuxS4qcSiBXSUi/wHMstHXGOjBRQpI3LmwpL6O+hmmpxdVqq9ls/rc5Dm27X1XQ= Received: from DU2PR04CA0072.eurprd04.prod.outlook.com (2603:10a6:10:232::17) by DB9P190MB1724.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:326::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.16; Thu, 10 Oct 2024 14:15:00 +0000 Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com (2603:10a6:10:232:cafe::7f) by DU2PR04CA0072.outlook.office365.com (2603:10a6:10:232::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend Transport; Thu, 10 Oct 2024 14:15:00 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024 14:15:00 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, Danylo Vodopianov Subject: [PATCH v3 38/50] net/ntnic: enhance Ethernet device configuration Date: Thu, 10 Oct 2024 16:13:53 +0200 Message-ID: <20241010141416.4063591-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241010141416.4063591-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241010141416.4063591-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61B:EE_|DB9P190MB1724:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4116292a-ffdb-46f3-5630-08dce935ed97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rudKBkDRW2Gt5S/azKe2hspGugDD6E2lMKUeTMUSKv1w3v/5jDnWlaUjDST5?= =?us-ascii?Q?rZ5ZRfbnGyF9Ey60psH6eG79hG2JkEWKHXp7Tqb4qMiRY2RV4U963cqxsnCW?= =?us-ascii?Q?HoaEYoA/hU3IRWF0wrAOtFpgzviZawleVtZI1TQsJHIks88d+bb4Dx1uE22B?= =?us-ascii?Q?nBesmXa1rtIIOarzVexsYWaeOCciZPy9LFNsBwvrao+ejuBrvkHKNoHgiA9l?= =?us-ascii?Q?XYWtLgIwqkvCM5EZe23pVbLtWEbbd0mA8e8OhhrkTEyf4gIyTgw/GXtPOgNi?= =?us-ascii?Q?I5tNgoerOVHV/b6IBvQJAbaV7ZguisszLuDTCCT1Zq8yyG8OmnbPcNTlM/8R?= =?us-ascii?Q?QJWCV1K/eMF8cvbzsdds3RM8R9KEVoNE4AXB6RWmfWQy8t/69FR/eeQN1vF6?= =?us-ascii?Q?BDle3HdfxgGDy/s/T/fl2Q2QXmqlCpHnteflxNg+/WQUzF4TmGEcM6Zc3Thq?= =?us-ascii?Q?Sk2YycKoLCzit/p4HKN6F1vSIcyjppiSny2aTUJVhVaOAzbZ84bwuzPYgQNK?= =?us-ascii?Q?jp6ifK4o75YeGeQyugKD47hzYh1uvKR91bqXrTjfeH2rU48FstIdL5YpUHPU?= =?us-ascii?Q?2IAlSI9ZnV0/+y850rUUINhJmNwgDuZqTtVk9hkZwV4ti13FmzWXZ/3OhEKR?= =?us-ascii?Q?pNO0L3ibUvVbuk/pOY5XrMaYH1i7OUP+uWwOgbJOriivutCnULWOXzlND9/p?= =?us-ascii?Q?Y9rA4oM6JET1EfvdiIYB3BaLT4gWKfdxkHNGiyht8wjehH8MQUx8+qnsRgGd?= =?us-ascii?Q?WfXmOv4Q7OGIfnlyzuGkPZFu+iXg/eCTkvdDjlsv9wT1c99iCJuk/nev0TWC?= =?us-ascii?Q?cYogHA7sER1i6BCHT8UFIitkmUBJpMfLxnwg01pRADXFZOsfmI3GPQp0bVKm?= =?us-ascii?Q?Gu5usTTmXFfPJG7vHWtQbIlP4YXa7xIv/+PwTPBtNAQLA4N4rCiB6/Fc6Z4G?= =?us-ascii?Q?37tLoWDIO4KRnz9gFR+QWWanFZURRbX68WX/30CCnkxNXmZKhVQYmbqQDflz?= =?us-ascii?Q?Ad3pyf8ChrbiMUoiL3C2upVt1+N/RZMWP6YqUumSQCYBjsB5Dvm7KfjC04hD?= =?us-ascii?Q?t+6M2c2ch1GL9rSMCI9/976RQ6rfon0k771DxGr4bZpse5wDirO5VSen6N/c?= =?us-ascii?Q?vvaL8GxAuuziQlgZjnnHq2JqpWHgeKNkDZoZ3Y1inr7Eo7z2fQow6SaB90f5?= =?us-ascii?Q?97c6rqLqtIVyPepTb/qJmiGzLEqW4RQHsiy348CjdOX7LADAt6pHeHafaJ3f?= =?us-ascii?Q?7pIaf8yYfOKSJT0bFIrL32pa7/NydqzolAFAOoroDAiSLeTzd0M9WiGes5v9?= =?us-ascii?Q?orOlv8JAvZiHittjXqRWm2YnIIHbaaV+ty/sODLNPDwEPTNxbnCu+/9I5HMK?= =?us-ascii?Q?+DrhbHR4yS6pYGbeH33nb0SsBRBo?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: /UKDRZP9MQuGidZyaYJ+ejf9Dq9e6pxJoSMj5PeSh9R7ckPr5ECB7qqvO9aVsTDDFLTlLJ8ej5I2/l1Xa58mGo0pDjR0y1m5RcriR5U9XulGGgGXXdpgT92l0KGl/Oz6Sd+ivkPhgiaEJIDC6xBGN0UVxLERDdhTt9qLPC7PLCvmmB0FZqBiwirAGueQkgmWTnZB1QEmqTjY7tnIB9LEp7ltA62kqnNkFZEJcGp1TeqzbjTBe62Grggr701TofP9RvDu7sb3mP1fN45+aTMHoA+wkn/rVzCwN+wQrkPYeYWb1doF6jNdvtwbSlvK5lhlxiJRpESdyVaEYKq5b7A24+klq07lzt0bqT3f36QvnqXsMDCxL5H0HrcMqa5h8sU0QsI0HnskIExuHF+R9SkVo4QEicfkenJo0EiGt0eRyiGsVoBZpimVrPuNeQlSTBJ6EgZR7KRXIEozZngX36o5fLDsR1Q5Hv6G7q0Tf+zqkNrgQufHj6Z4Z3D1dPUZHdPLFg/pwYR4DldEL00x/J9tMyRlcBniwwX4M/roKXxacsivQxp5f0qdu1YDIzCbbkLrr5ws4Wbt4uR7dSL8KTgFZFLVx7XZ3TQpkrjC6xY3kP4wwitS09UFpA4bkZD8CMP1mwR1U6tKSP1YYymPyMB6qn1IBmuUvDU60LAQZsrsTx4= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:15:00.5611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4116292a-ffdb-46f3-5630-08dce935ed97 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000B61B.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1724 X-BESS-ID: 1728569702-303014-12782-25645-2 X-BESS-VER: 2019.1_20241004.2057 X-BESS-Apparent-Source-IP: 104.47.51.238 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGZoYmQGYGUNQyLS0lNcXUOD k1KSkt1dAiMcko1cI02dLI1NjQxMTCRKk2FgC87Q20QgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259630 [from cloudscan12-202.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Danylo Vodopianov Added eth_dev_close function to handle closing of Ethernet devices. It releases managed RX/TX virtual queues. Initialized scatter-gather queue system. Defined constants and macros for hardware RX/TX descriptors and packet buffer sizes. Defined structures for RX and TX packet headers including fields for packet length, descriptors, and color types. Signed-off-by: Danylo Vodopianov --- v3 * Remove newline characters from logs. --- drivers/net/ntnic/include/ntnic_dbs.h | 19 ++++ drivers/net/ntnic/include/ntnic_virt_queue.h | 22 +++++ drivers/net/ntnic/include/ntos_drv.h | 15 ++++ drivers/net/ntnic/nthw/nthw_drv.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 67 ++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 5 ++ drivers/net/ntnic/ntnic_mod_reg.h | 93 ++++++++++++++++++++ 7 files changed, 222 insertions(+) create mode 100644 drivers/net/ntnic/include/ntnic_dbs.h create mode 100644 drivers/net/ntnic/include/ntnic_virt_queue.h diff --git a/drivers/net/ntnic/include/ntnic_dbs.h b/drivers/net/ntnic/include/ntnic_dbs.h new file mode 100644 index 0000000000..551c6ade43 --- /dev/null +++ b/drivers/net/ntnic/include/ntnic_dbs.h @@ -0,0 +1,19 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef _NTNIC_DBS_H_ +#define _NTNIC_DBS_H_ + +#include "nthw_fpga_model.h" + +/* + * Struct for implementation of memory bank shadows + */ + +struct nthw_dbs_s; + +typedef struct nthw_dbs_s nthw_dbs_t; + +#endif /* _NTNIC_DBS_H_ */ diff --git a/drivers/net/ntnic/include/ntnic_virt_queue.h b/drivers/net/ntnic/include/ntnic_virt_queue.h new file mode 100644 index 0000000000..422ac3b950 --- /dev/null +++ b/drivers/net/ntnic/include/ntnic_virt_queue.h @@ -0,0 +1,22 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __NTOSS_VIRT_QUEUE_H__ +#define __NTOSS_VIRT_QUEUE_H__ + +#include +#include + +#include + +struct nthw_virt_queue; + +struct nthw_virtq_desc_buf; + +struct nthw_cvirtq_desc; + +struct nthw_received_packets; + +#endif /* __NTOSS_VIRT_QUEUE_H__ */ diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index a77e6a0247..191686a07a 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -27,12 +27,25 @@ #define MAX_QUEUES 125 /* Structs: */ +struct nthw_memory_descriptor { + void *virt_addr; + uint32_t len; +}; + +struct hwq_s { + int vf_num; + struct nthw_memory_descriptor virt_queues_ctrl; + struct nthw_memory_descriptor *pkt_buffers; +}; + struct __rte_cache_aligned ntnic_rx_queue { struct flow_queue_id_s queue; /* queue info - user id and hw queue index */ struct rte_mempool *mb_pool; /* mbuf memory pool */ uint16_t buf_size; /* Size of data area in mbuf */ int enabled; /* Enabling/disabling of this queue */ + struct hwq_s hwq; + struct nthw_virt_queue *vq; nt_meta_port_type_t type; uint32_t port; /* Rx port for this queue */ enum fpga_info_profile profile; /* Inline / Capture */ @@ -41,6 +54,8 @@ struct __rte_cache_aligned ntnic_rx_queue { struct __rte_cache_aligned ntnic_tx_queue { struct flow_queue_id_s queue; /* queue info - user id and hw queue index */ + struct hwq_s hwq; + struct nthw_virt_queue *vq; nt_meta_port_type_t type; uint32_t port; /* Tx port for this queue */ diff --git a/drivers/net/ntnic/nthw/nthw_drv.h b/drivers/net/ntnic/nthw/nthw_drv.h index 41500f49dd..eaa2b19015 100644 --- a/drivers/net/ntnic/nthw/nthw_drv.h +++ b/drivers/net/ntnic/nthw/nthw_drv.h @@ -7,6 +7,7 @@ #define __NTHW_DRV_H__ #include "nthw_core.h" +#include "ntnic_dbs.h" typedef enum nt_meta_port_type_e { PORT_TYPE_PHYSICAL, diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index b45e25844a..24c38c015e 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -53,6 +53,8 @@ static const struct rte_pci_id nthw_pci_id_map[] = { }, /* sentinel */ }; +static const struct sg_ops_s *sg_ops; + static rte_spinlock_t hwlock = RTE_SPINLOCK_INITIALIZER; /* @@ -183,6 +185,14 @@ eth_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *dev_info return 0; } +static void release_hw_virtio_queues(struct hwq_s *hwq) +{ + if (!hwq || hwq->vf_num == 0) + return; + + hwq->vf_num = 0; +} + static void eth_tx_queue_release(struct rte_eth_dev *eth_dev, uint16_t queue_id) { (void)eth_dev; @@ -474,6 +484,21 @@ eth_dev_close(struct rte_eth_dev *eth_dev) struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; struct drv_s *p_drv = internals->p_drv; + if (internals->type != PORT_TYPE_VIRTUAL) { + struct ntnic_rx_queue *rx_q = internals->rxq_scg; + struct ntnic_tx_queue *tx_q = internals->txq_scg; + + uint q; + + if (sg_ops != NULL) { + for (q = 0; q < internals->nb_rx_queues; q++) + sg_ops->nthw_release_mngd_rx_virt_queue(rx_q[q].vq); + + for (q = 0; q < internals->nb_tx_queues; q++) + sg_ops->nthw_release_mngd_tx_virt_queue(tx_q[q].vq); + } + } + internals->p_drv = NULL; if (p_drv) { @@ -728,6 +753,28 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) return -1; } + /* Initialize the queue system */ + if (err == 0) { + sg_ops = get_sg_ops(); + + if (sg_ops != NULL) { + err = sg_ops->nthw_virt_queue_init(fpga_info); + + if (err != 0) { + NT_LOG(ERR, NTNIC, + "%s: Cannot initialize scatter-gather queues", + p_nt_drv->adapter_info.mp_adapter_id_str); + + } else { + NT_LOG(DBG, NTNIC, "%s: Initialized scatter-gather queues", + p_nt_drv->adapter_info.mp_adapter_id_str); + } + + } else { + NT_LOG_DBGX(DBG, NTNIC, "SG module is not initialized"); + } + } + /* Start ctrl, monitor, stat thread only for primary process. */ if (err == 0) { /* mp_adapter_id_str is initialized after nt4ga_adapter_init(p_nt_drv) */ @@ -891,6 +938,26 @@ nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused) ntdrv_4ga_t *p_ntdrv = &internals->p_drv->ntdrv; fpga_info_t *fpga_info = &p_ntdrv->adapter_info.fpga_info; const int n_phy_ports = fpga_info->n_phy_ports; + + /* let running threads end Rx and Tx activity */ + if (sg_ops != NULL) { + nt_os_wait_usec(1 * 1000 * 1000); + + while (internals) { + for (i = internals->nb_tx_queues - 1; i >= 0; i--) { + sg_ops->nthw_release_mngd_tx_virt_queue(internals->txq_scg[i].vq); + release_hw_virtio_queues(&internals->txq_scg[i].hwq); + } + + for (i = internals->nb_rx_queues - 1; i >= 0; i--) { + sg_ops->nthw_release_mngd_rx_virt_queue(internals->rxq_scg[i].vq); + release_hw_virtio_queues(&internals->rxq_scg[i].hwq); + } + + internals = internals->next; + } + } + for (i = 0; i < n_phy_ports; i++) { sprintf(name, "ntnic%d", i); eth_dev = rte_eth_dev_allocated(name); diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c index ff9afbeb7c..8fe5193027 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.c +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -5,6 +5,11 @@ #include "ntnic_mod_reg.h" +const struct sg_ops_s *get_sg_ops(void) +{ + return NULL; +} + static struct link_ops_s *link_100g_ops; void register_100g_link_ops(struct link_ops_s *ops) diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h index 602f5de77d..e9dff51935 100644 --- a/drivers/net/ntnic/ntnic_mod_reg.h +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -13,6 +13,99 @@ #include "nthw_drv.h" #include "nt4ga_adapter.h" #include "ntnic_nthw_fpga_rst_nt200a0x.h" +#include "ntnic_virt_queue.h" + +/* sg ops section */ +struct sg_ops_s { + /* Setup a virtQueue for a VM */ + struct nthw_virt_queue *(*nthw_setup_rx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t header, + uint32_t vq_type, + int irq_vector); + struct nthw_virt_queue *(*nthw_setup_tx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint16_t start_idx, + uint16_t start_ptr, + void *avail_struct_phys_addr, + void *used_struct_phys_addr, + void *desc_struct_phys_addr, + uint16_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + uint32_t vq_type, + int irq_vector, + uint32_t in_order); + struct nthw_virt_queue *(*nthw_setup_mngd_rx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t header, + /* + * Memory that can be used + * for virtQueue structs + */ + struct nthw_memory_descriptor *p_virt_struct_area, + /* + * Memory that can be used for packet + * buffers - Array must have queue_size + * entries + */ + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector); + int (*nthw_release_mngd_rx_virt_queue)(struct nthw_virt_queue *rxvq); + struct nthw_virt_queue *(*nthw_setup_mngd_tx_virt_queue)(nthw_dbs_t *p_nthw_dbs, + uint32_t index, + uint32_t queue_size, + uint32_t host_id, + uint32_t port, + uint32_t virtual_port, + uint32_t header, + /* + * Memory that can be used + * for virtQueue structs + */ + struct nthw_memory_descriptor *p_virt_struct_area, + /* + * Memory that can be used for packet + * buffers - Array must have queue_size + * entries + */ + struct nthw_memory_descriptor *p_packet_buffers, + uint32_t vq_type, + int irq_vector, + uint32_t in_order); + int (*nthw_release_mngd_tx_virt_queue)(struct nthw_virt_queue *txvq); + /* + * These functions handles both Split and Packed including merged buffers (jumbo) + */ + uint16_t (*nthw_get_rx_packets)(struct nthw_virt_queue *rxvq, + uint16_t n, + struct nthw_received_packets *rp, + uint16_t *nb_pkts); + void (*nthw_release_rx_packets)(struct nthw_virt_queue *rxvq, uint16_t n); + uint16_t (*nthw_get_tx_packets)(struct nthw_virt_queue *txvq, + uint16_t n, + uint16_t *first_idx, + struct nthw_cvirtq_desc *cvq, + struct nthw_memory_descriptor **p_virt_addr); + void (*nthw_release_tx_packets)(struct nthw_virt_queue *txvq, + uint16_t n, + uint16_t n_segs[]); + int (*nthw_virt_queue_init)(struct fpga_info_s *p_fpga_info); +}; + +const struct sg_ops_s *get_sg_ops(void); struct link_ops_s { int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga); -- 2.45.0