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 7948C45AAF; Fri, 4 Oct 2024 17:51:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4602942DC7; Fri, 4 Oct 2024 17:50:53 +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 10A83427DC for ; Fri, 4 Oct 2024 17:50:48 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2233.outbound.protection.outlook.com [104.47.11.233]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:50:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kEDazPojMFNh9OTOBQrKe0xlbzPcajyysGJpprZPZoRWRkDGGhNNI0CPBj8DLMdJeNYwwAyimENavNPFR7umdYg8nwWOLNTmD6kdcc6s6xXlimbyykfp26gxRn3rnSrWpBcUO/8ZFBpJzz/9bD0PUqJtK4GLDUHaB3u2L5KcCVP8iNSBRqcy4pbjXcic3m5IpnpmRc6oKKMysol/Cr+f2vRIUar83sIRcqHqdzvItRSWP/lzCLB5ddVCS4/6/o41oqsEClzvifE8Az/6ZTx503eV1AWZsbO92z3Ifi1nbEizsXbOTO1eeTSCjcSL2qKIM41Qu4p7OLRbFl2vozs/nw== 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=Km3MJ0ivD7e2wMllWaqaSmWaiFu46zmRBAushnn+WPU=; b=qLBJ7OxulIzI+ptj1idJkuWbyIuDKdzPi6JU8Bi8SrQlXsk71ZFIJ85rWQQ5z7PZlH5zNgzfq4pNMUkevbjd0fyLoUiHa1WPPFyz7q5hkcDo3ixTkIfrgwZQRlezQiuF6Bgx8Jk2gpWlkkfFuBKMoUkI7k6VHlf8HJHtb2Wy0oCev/5WE6265U1+2uHtx/Thw7Y8l7QAEaLg+sKDvb2wRcpsKlzVItis0KLnlKlgKv31AERn5EHeS2e3qSCQiEz0F7j+ustT/9DKu8SzPjFG49Q/gzM3VqurF9vkb6hw1pJQTJO9ai0ofeAvhpqw9LxmLe3PcoTlik9nKCCe8yit6w== 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=Km3MJ0ivD7e2wMllWaqaSmWaiFu46zmRBAushnn+WPU=; b=pUFgebIHwex1VyX78uG41b2yfxT0x4/dN7ygxuC0496VvzZy7VA1pNjkB2ygOKNJKmBMRyx0kLZEYpbRzI4RnR3/xLUWqKbFfdVu3PW42wj+qjDEWf0EPxS3C+/HY2aGtAGVciLlTl1qV0ybyeONM+ZtrStPBgMsGiHiGMoyxMQ= Received: from AM0PR10CA0132.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:e6::49) by AM9P190MB1107.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:271::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Fri, 4 Oct 2024 15:36:31 +0000 Received: from AM2PEPF0001C715.eurprd05.prod.outlook.com (2603:10a6:208:e6:cafe::6b) by AM0PR10CA0132.outlook.office365.com (2603:10a6:208:e6::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18 via Frontend Transport; Fri, 4 Oct 2024 15:36:31 +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 AM2PEPF0001C715.mail.protection.outlook.com (10.167.16.185) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:36:31 +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 v1 02/14] net/ntnic: enhance Ethernet device configuration Date: Fri, 4 Oct 2024 17:34:56 +0200 Message-ID: <20241004153551.267935-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004153551.267935-1-sil-plv@napatech.com> References: <20241004153551.267935-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM2PEPF0001C715:EE_|AM9P190MB1107:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e9dbf493-3289-42bb-1041-08dce48a5250 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?xRFBmJp5kAZ8Jk8bHUmYss9DnYtUxWcF8EtnjOFxzZrAi9LzmJWD5SdLiKLo?= =?us-ascii?Q?Qua1XggUhY5wkYMheDRDMxUH5YlAN4G16E+Vs0TQpA6/ktsp8RSnd8PXySt2?= =?us-ascii?Q?Wv5r01Hsm67j80rbF27ozYIGH/2CIrnBVVzszF4X9mKLmfsJq5BfUOnxJalc?= =?us-ascii?Q?y8Nl4Cs2MN9C5QA9FnL4uaD8b7atMKNW9egHFmEB1jIRdp2qVy6K2d/tHUEG?= =?us-ascii?Q?T8BhP05wfKHoS0KKo2bNfWyrldFTPdUkbXkyW0zSnC1LX393hB46JwjcJ6Zf?= =?us-ascii?Q?ooaztyzKJjO+4yiWsZmdD5nc7lTcmQlm6GiIl3MMLORRZZX3p100BsV+gybq?= =?us-ascii?Q?rKLR9QhhOQH73VZ5fLgM4O2EPSjzjrNuOOKYZeQMXFFaqbf/jMvAIVrw/6Iw?= =?us-ascii?Q?ncYmBgP/Tj7rq/G1jAvP1QMBAeP9RuBuxZQ2HF2LxH5G71j39nahyrPMoJaL?= =?us-ascii?Q?vu2gH8zOu7Md4nXvl+T/mh4NeKZlApVC8dWedDjl/MfwIK7SY19CTxN6riGb?= =?us-ascii?Q?iuCljLkv9iKIRx0Ce42XKog6u+pAw0wkQ3F9rYzSKWT/u4CtUYkafngnQSub?= =?us-ascii?Q?7tT9M+VAnf6sHL8yNtt3iTMTlnYKONQU0KDLnNW5Uvwe5G2Hhs8UM8fyqHxU?= =?us-ascii?Q?y68laYmWYwSn1uviM0gOu7nfACjPRr0MNiWKezjC6C3+OfEW4uLy42KAsJND?= =?us-ascii?Q?XPm8//XSAoNTvgGZGFzzau2ZzVJ0Ip/TF/w6HUnHi36eU1vu/of6I3U76vKG?= =?us-ascii?Q?wdRqGfVoIbjCjPENTJy/fegWlcZI7317ZCwvhDoWxKTanZepfWRmjCnRLQS9?= =?us-ascii?Q?ZBI0bTHkqvTpPMgn5jymkUBTpmRP8+A8FBgrAtAw1ASsVytYSc6C0K9skm50?= =?us-ascii?Q?hzLtAo+Suj8R0uTITaS9vW8csKGMRkI7BGCbDssdT0uoAQmX9SbVliXOdrqf?= =?us-ascii?Q?UGNoS9ylt5GF9CeENVQEz8lhKjw0hEhOjHmoHVFWtd/OoA9Bb9krYUBNDHay?= =?us-ascii?Q?dhPjvgh/4eqYcLf9szII7dFkThpNEp2ojcmNPQZKr6tX8IXORgWu027A6Rj6?= =?us-ascii?Q?6PdCZ0lvhcV0fAZprifXWJCPAtzLE4VZYqcAvNYT1RvzIMsl0SfmrTJHfpVs?= =?us-ascii?Q?PZSG7QlSxUlRVB9hVk1eCsnGsZs+Gwy9Kr5DWEhNG0dCXSHJdr8ElxDKe601?= =?us-ascii?Q?xHySldwnkdroQ/9ntSpsu0wM8RXkRT6+aXy30Rysf7POV2N6DdZEKahJNA1y?= =?us-ascii?Q?IahJWptkCVdcDlRIGXMI5Bnxd7WNPZP93/z7bz7iE2AB0G5MErLuDBWWJ6lV?= =?us-ascii?Q?vRaXUdSn+jQcVmuHIYBX0Nd6PmBT8ItL8XdQbGt4G1OTsW163pArYh6+nnlA?= =?us-ascii?Q?+IyeRfspLubTYXftwC+IGVHzbK9y?= 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)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jHgceese/PMy/xDMGjnBuM0TUs//fLLbVB65qtwSnKVXMX8T7o7KZFyYDiKuvCZbH6wNPD+bQ1eadPdWmG7T5XVjVDNIsE3t9WQYj0jmp+rVYQlntTpTA6kwb19TjH3IyQxqr7zVe8Z4f+JcSAMHrMuK+0S4DtlKAtoWZwiA9c/X71Mz4op6YMc6xc3gqp/JmkaxRZq++H+OTU12Z5NWyfxn4uRsRZImaqHiSIRDHizGvJM01wopzKCl4sMQBpOLSFtAOjZygEsoqIfe4RP3o5xijfIuUf0GZdP4Q6+WSHIHSf2i01eRyHWW/owzp2GPAdvX1e2X47uJvx5YrOZdWkkgwKonEOOX8UNthPWynIBoQZAlvXlFwdw+lJPtnVTrCm174bu06mAxvnd+mw+5m0upr+9ckagvNU2tRtMMLVHJM5qg+fHq4ki1DhA9Ef+tRQwNeinGjQP/1379dlHZNDFzPWorWSwMHa2Jogxz6tDp2Apy9IGdqyChkToxjlDkVqICU73qRL/QA5315m4H8yLTIs7mRp0BCrHB5RSKf6t7CG8Dg6o7rB5yFgmXXQD3hrRNiFpJ6NpZYNGEgpbLsKTHL1x1j6k+a17dTpI0B33NYKtQUaVLY3g+UqHs0mdgAnm0v2MraMr1VDRvK0ZCyA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:36:31.5491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9dbf493-3289-42bb-1041-08dce48a5250 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: AM2PEPF0001C715.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P190MB1107 X-OriginatorOrg: napatech.com X-BESS-ID: 1728057047-311388-12692-32508-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.11.233 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoYGpuYmQGYGUNQsxdjIICnZ0t I40dwoxcIUyLRITk60TDM3MzM3MjJRqo0FAKisg95CAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan20-43.eu-central-1b.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 --- 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 967e989575..79b5ae4d60 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\n", + p_nt_drv->adapter_info.mp_adapter_id_str); + + } else { + NT_LOG(DBG, NTNIC, "%s: Initialized scatter-gather queues\n", + p_nt_drv->adapter_info.mp_adapter_id_str); + } + + } else { + NT_LOG_DBGX(DBG, NTNIC, "SG module is not initialized\n"); + } + } + /* 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