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 8A14845ACC; Sun, 6 Oct 2024 22:42:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8BAFC40E5A; Sun, 6 Oct 2024 22:38:48 +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 3660E40B98 for ; Sun, 6 Oct 2024 22:38:06 +0200 (CEST) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2170.outbound.protection.outlook.com [104.47.51.170]) by mx-outbound44-124.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 06 Oct 2024 20:38:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yZLZc2UjsCa0KtysPBbGWBcDTBMZcdn4nmdAmR6yYHk8vf8d4ZdPNbqWWr9OUlbz3f60B4k2O14zn/5Qs8Nk6o/RvXgpqxCEEzm3r87eXZ5xx9uDQeWqTSr2SXBj7sTtYh9hSYzewm/ukohB9IdNVHh1Hsq1Z2lzUnbnlNThkbh91wUdNparR71AWUtwrItIlnIT1U1GVrMrAqrQwSgfmwKP+DaHm6Ye3wISQRPN009k8GeUHiXRXxeG9c5fnfpNi+ePPAXTEedFFnb2YxvDqDe20tuy3XL2SAd8Gxi2PxW+MaaXCe8x+QJ3ynbyIeOLsZU2xms6Y1pYCPSgBB8/Bw== 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=wh5CFsUC9wWgNIt3EDTmIXaKnJOrM+FinRU5PRac6wbjt0Fv+XZoOjPdJUp1STJuQlTNXrXCNQF/My/B4CPYbzxnIMlgubDNhSuB+mqqn2mH+ksXJvuFJ+0f9x296n0maZO3z8wv2C3CboAXa6G1PTBlHz6nGO2eRo47P/JLrHHRkM7JruF68AqgH2CpZ8QwXAYbg0rr4DFcpAw5DiBSX6u6yDge39xRWXOdWqba2pIinuuXbRWxBfQaVp9nhIr+AVJlwRwVi8nMI34/uWTiq1ucBs6QbxbunpFtT02+rOAIwV3r10dwG1rn5jV5jTJikeffmUzAvp7td7eiZ4128w== 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=mitajgpb2urbPxOnb3+l/C6zFY9CGbw+cHr6SoYcHgig60S30hdFjsTJ96L2mVNrYmGVZVqZEmH9Gho0L7ihCp9wpyNMU6NkqwQcTDSeTC2vgshEZVNNzQP+HTYCGlyDrG1sIScndzOLZYB5KeacpiV+34kLrFxpzf9/30oct3Q= Received: from AM6PR04CA0008.eurprd04.prod.outlook.com (2603:10a6:20b:92::21) by VE1P190MB0832.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1b0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Sun, 6 Oct 2024 20:38:01 +0000 Received: from AMS0EPF00000190.eurprd05.prod.outlook.com (2603:10a6:20b:92:cafe::7e) by AM6PR04CA0008.outlook.office365.com (2603:10a6:20b:92::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.20 via Frontend Transport; Sun, 6 Oct 2024 20:38:01 +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 AMS0EPF00000190.mail.protection.outlook.com (10.167.16.213) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Sun, 6 Oct 2024 20:38:01 +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 38/50] net/ntnic: enhance Ethernet device configuration Date: Sun, 6 Oct 2024 22:37:05 +0200 Message-ID: <20241006203728.330792-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241006203728.330792-1-sil-plv@napatech.com> References: <20241006203728.330792-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000190:EE_|VE1P190MB0832:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: a1aad965-541d-4046-79b3-08dce646c5a0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3j5Hwr8S3j4jaFf/EzJqQQo3IMBtMfQOIfQroxn8Yf285vkIl5Q2lW6feOyY?= =?us-ascii?Q?zeSD256EARkOrYKJJVvXByn2ukCRvM+QyVwkM5XvTpDlgBkJOsoYyLCa5ctZ?= =?us-ascii?Q?khogMb3nVmN79VzzE4xALmeJH8ZfDxkbC+Ao0cx41h0lV2ecQy86UoEwvIny?= =?us-ascii?Q?HeEa90EZ4Rn5N+SQKMLksGEGghQ364du1Jp/LeIdgt/GtEj/Z2VmL+cLF0SO?= =?us-ascii?Q?yX+SyVV8kUepvBq32+dClY80LpEh/F1HjqfJDoXoPCC0v2khIjPyHosj8cwc?= =?us-ascii?Q?RX+xODG9ySzcAE3K5q1rr3HpLW0ORhLkTJsiK73JxFoxIWoaUBg3swv+p1xt?= =?us-ascii?Q?AQ78+zPcAmqElPYxtjB8Ex24MrTRbzpDN5RWLo/no6w1sh0Rw8K96DSY4Lib?= =?us-ascii?Q?ddo0xPGeWit6VAODD7zYaioZG+JU2TUiKHKRYQjicetxu2ZnIaD0VBkt5ui8?= =?us-ascii?Q?0SReXymJvsSDKfncpDMMtLzVBq+GOrlhKKgLxKf/eBFNbi9yh5+q8Mu91J7l?= =?us-ascii?Q?GGbmrQkoa6SYyrcSYezmSv9BRTGYvJ/UcAwJfccEix/jqPLgD1lsE/Zo+b9O?= =?us-ascii?Q?bBeAvqcDj74oNS69yKX0iE/Jspgg4FjO7ffImoBZsHsvvmwn7wxhmrHzJ7F6?= =?us-ascii?Q?yTfvNCvEEk0VsWRdz7SLt4N6F4OTyRP/LBQ1xYP8x3a4Tlpk3WxNEVT/TUSX?= =?us-ascii?Q?7/9fPpmp3dEbSXxOQ7l8AFeUqzj2BGKNyt+YT0OjiT31wQqqnULRk8Nhkak+?= =?us-ascii?Q?KelqC1Mn+YV0qyr+8o+RCoh5g31LUrPRcyCJp/+YfpkOhCVisBvngOYeuUs5?= =?us-ascii?Q?nTRmYBOspxKE9hWE84b/KozMG/PZKkPMjZEeoaQX4NwyVUg4RjegsAqqA/nN?= =?us-ascii?Q?cCr7Tpg1dPEGohfNpIzDtcsEqTzbseqxZZAIHXVgp/O6MQHUsnZAyQ8NvCvB?= =?us-ascii?Q?hijm+FllvvuQJZ1AbnRJMV/5GR4TaKWlMontYYMxA6HWTM0o+TDFtcZgZH9v?= =?us-ascii?Q?l9/S1gtGNac1nnnFzBCMKoMeY9ggCoc+/Pf+gHt3NSzZ5QZBSXUc8tBOy/ZV?= =?us-ascii?Q?m3/SonckDtFZoh5WDv82MNqgkxLZI8dPYwFf5Y0mUk44MD+8FD5AY9P3ZJzn?= =?us-ascii?Q?W1tWzZRH2xJdbE4cdyDwV/b0VW/zgfhG21boSxZIaSA0RZcTtTd7jQnzMtHA?= =?us-ascii?Q?QY5KihbM50tsXozslV8std9abWaB/811Anm8JicggZ5DSV+YIW4uUcaPL6lB?= =?us-ascii?Q?+UkwYTbqYCPLozC/wtrFvLOGhNl8tJBqOprubkmIEdzySeJIcDFrw6ZcHjSt?= =?us-ascii?Q?oIXffnpHZHIkFSYiq/GPe0gRzP53R6FifdnY5GLo4TshHFXaBKIIwsnesy48?= =?us-ascii?Q?ewNFmPfUK3MC4m1ZDG4uEJnKabU4?= 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)(1800799024)(82310400026)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: hUas6tby6g3CkvO9dOCLX2klrRHz5YaAnfAvniOOOsRUJR/u/+8Dw8KUapBE6DObt+LTP4YwhY2695cq7VWKYZjlwXuYPYrZttTR5a4azvnupdCBpUBghVJpK7vmFgTv6ZRAvTle5CIKa+6loAHv+vADy1XZ0AG1lU4ADkteOU7ttGfc8/LgEUiwFA3Pi7p/hUCB66SkqDSMFNLnkCoHdoOgGL8CRXH1osLyMOiCVXuLicbmvNoTvyNpIrhcv4OR9xVYfbuvTsDacwGteSeB+KVMwdqnmXnhNwTSA6HiAQcv41/fPxyAT2wml5kTQnYjVyUc+7b0cYgF5bANu1VlE9weKKS/NgN8NyU/7twXlMuTGDgh8gxjfL8QV3lwTvgoz/f6jPrC6ShWAN5Z7Xz3Ez+AJcSvcCf+cWGmKbkH+NQBpPxHugA5MoENyEgs50ZZn6zwvFoPuzQpwas9JWt2IGpYxB0IH88wB9d15SnjlsMCkO2+pj5Ro1WtZdEZXa0A8W3OAFKKGNiEiM4JaNtQQGl0q4DwrMVQVPlZGwapY6bBqkuEp6V2eZfyP7pVeP/m/p6VLSYemFNLBeY84Oa/WZK55bMuGV7Ru+0XhCGyj5Pomvujx9VrO8xiDEBbiCNhDcWVCPFeK8dTjN0/vXEYyQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2024 20:38:01.6089 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1aad965-541d-4046-79b3-08dce646c5a0 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: AMS0EPF00000190.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P190MB0832 X-BESS-ID: 1728247085-311388-12690-123476-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.51.170 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.259547 [from cloudscan23-175.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