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 F0E0D45AAF; Fri, 4 Oct 2024 17:15:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4DD3442EA0; Fri, 4 Oct 2024 17:09:11 +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 3EBE742DE3 for ; Fri, 4 Oct 2024 17:08:40 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:08:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zAzAB/5KuBMgCS2e72eLaz+3pOHR7khLfnNZfq18axtM/G9eKMvVblrOr/rHWtlTjoircAPFKqx1BHJ12sy5eTq7nHVRKa7lUz00InU9g4RztDKDvku+1uO5hSVOWjWSBL0vqgqaLmZUh2jGQiGwj+mj9z8EzKVM72i5Ikv0pJFytCAOnYwZ/o4FjgfDSvpSFiDSUjsHDP3d9Ds8LHiBuNOYOPKYw0KHZKbN0wwAWc4b89dwzntmzilCOqdbzxxd5ckaHXO1lXoEbVCA6DZJp3JoqbWbnko+M95oWNFoPWkZGxS9NsjhythP5mQeLI3MQqKoqAPlCmSB02FTsmK7Sg== 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=CNDgLuxMQuICl0IQncqowrf7u23oUujF49O5mwOfE3e10hu7RvFtz64k2c48Pbu145dj0sWWtcR0nPVs6tkG4SUOfQOOXIh2znLaKuhkdXjweBcTjqFykfbtPpJhqD1DjNC56vm1okqrgxsihrd9Eh/i5sjyJC7Q2KV6yBmDey86/uJvwX2CnJ4obP388eHB6LgdPO+12bvFq2wHyOOVvnu2zoqYamc4fBSAWag87TVEKKdo1ki669NmJRz+UMkLOmQY86JJBEtbn7PCMG+MF/Q31Aoz9KBC/qCIkSSAWqNJ7a05ljG6ENCfSIf73E1k3q8g4WuJssmhQ8itYGPa5w== 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=SpQDa0qP9BM8GH9zHmaJOHKGn9Yfrisd51tAMwpinTlREdrIqdA1yBsMvSzLKxD+bcEhoZlIbAT3WllvvolkZcncecQEpGlJIzwebijxJZ5+Fn+eokGfF9rBzsboKs98s76CKUrr9y4TbHg/eFqoDAQUFjUHINSPXW1Tonl6Pd0= Received: from AM0PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:208:3e::39) by DB9P190MB1770.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:324::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Fri, 4 Oct 2024 15:08:33 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::2a) by AM0PR02CA0026.outlook.office365.com (2603:10a6:208:3e::39) 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:08:33 +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 AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft SMTP Server id 15.20.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:08:33 +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:07:27 +0200 Message-ID: <20241004150749.261020-41-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004150749.261020-1-sil-plv@napatech.com> References: <20241004150749.261020-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|DB9P190MB1770:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 85ef1902-105d-4aa3-839b-08dce48669e7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?bZyHK2keWvjWW/1SXQeGBnn+bm+BcAVEY9tBQ+HgCT00kzL6BdxghTXP/E+G?= =?us-ascii?Q?K4ttJdft32F+CQHN7mkEQwcbHG3ocQlsF+ICDYyB2TeFFzjtW5vx4bXHmgE7?= =?us-ascii?Q?gg+tZ6XXlW4AR8TARllmINszY9lR9odwVa0hMMj+fOLPonGh+hyv0d1ey2ej?= =?us-ascii?Q?0Zb2CpGoD63xJ4olkK0IwlNebco1EQNxCKIQ655cbHKxtsggrCXAnIiekmSM?= =?us-ascii?Q?xYmOWw/Y2XVWOwoPoZv/Op3TkOEPfikYUX6GuQ4GJwaCoHA55VZUHWg6Th8Q?= =?us-ascii?Q?kMyNToV/hrXDmMOIEj5ym78aM37aBFjqJOzj1hnmqv9bzQrOMbEolISUIUyA?= =?us-ascii?Q?Mn1wLndvTmf7RW5jSDToUg7VK6eCVX8ZIgSZe63EAFhSBXy/h1a5J883Kdkt?= =?us-ascii?Q?2zZ+WYQk1Ai7JgPFCLZZVu0d8P/XxwCFJiva67cP4vito9bIFRzmhe5FFy7T?= =?us-ascii?Q?lEPaOnkdORrd4oPSvbwp9YH457ybZugfQZ++TfY3B4bGtcpzwgQXlNlWqsRH?= =?us-ascii?Q?kEsAGeffisAZiRo50nfbAGRvYd2u06Hn+rtOH6YbxDHdCIVtE63HDtnR2Oe9?= =?us-ascii?Q?+hOwGYpZ5n3co4kqwXlgQhzofJT1COrhcjcOW5VZhC+O9k2dUYgJIO7kN4u2?= =?us-ascii?Q?JgB5KdZcXYKZ7zV20R/bXhqUEaZ/PgQiE78tsKrC5b/pfB+LhtFjn28psMSD?= =?us-ascii?Q?+UtwUWCiyOqp71yq7n+JZ1Jz0ZLIsHtUNGliEX0Vu+iSJ/Xw8Z8JVFXQfI0b?= =?us-ascii?Q?TeU8zNP79GDW9AcCGDkA30hw1udSX1NLgRRu8rG+YSqdQwpZEotYmtGPZMQE?= =?us-ascii?Q?9/ZfMSAN8NFOJweTy9FNL/gZtyl9sLqN6d6Sgk8gf4QsYDevO6N/Tsxtk7OC?= =?us-ascii?Q?/OQ/KNWmFiNaLzOZUhWPW0pEff118B0DeOlsZqEGdPtRCTbXmqHfH5dmBw9m?= =?us-ascii?Q?4C3SJWWDMdnj5XKa7WN3Nx0j/SNBnqcELovR1ixF4VPA72qrJge6F/t91vow?= =?us-ascii?Q?Zb7hU3xoIP4dJHJJ4CS/mLOoDjBAxBpzupFWGWrDTTDnLLmt+Nz4ubMB2stS?= =?us-ascii?Q?1oUxaO3eO7BJMUrlzpy7sHq2Z7WXlIEWX/IUy1rhP1+UwCD2mWBAUXV7OJ9C?= =?us-ascii?Q?/vkCXuIoxyBf6XgSiYjSlD7XajhTMWXf1tTiLKPfNo5BGNkcJTBbZRzO48ZL?= =?us-ascii?Q?3tcVewuW3xqMqWNUCa8uDaw1EKa315+rcfAuWYyEayO6het2lJtQudDpgiL0?= =?us-ascii?Q?E3Fm2o8FPOJinEIoCe6J/Msg8opF41cOGgSzgXmFY9SjT553akixigMgqTD6?= =?us-ascii?Q?fd/lB9SenFeUXoHu1YCEZIO/UgpuZh9Yp/VyefYwkY/IJ3VTxMBC1WaPEHNu?= =?us-ascii?Q?Jqgplv0Ch8XelVu2XJRmTuVNT3vo?= 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)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ydqBbwBG0Q+c9miYrl/J2rops/SYOzVzmdr+XjJV/9iM+KyoLeQhQWywW0XO3MqTLPjRqj7dfpr0zTzZpalA+64kHozxOtPfOrBbVLjUbQH1c8IibrUMXlr3NDn4B9SbZXZ+1mH0E7pgR4v8eMccgiQu7S6r0Z2/t+Ryg1CnM4ReL70wvOgrIFKFUwl370f/T6x5yane53YqbeF/7zFOByZS4Ls+qrePhLh9EH2edcDJ3/qYxX2LJTd+Q8LW3M4ZUQczdouWqeSACaBVYrESdVEv10hsbCCoZ2RcHuB0Iudj4pTrazNNteZKyK3BL5WLJezJvxSxXG7jjVLmAnC/k0QCEW2xFR4Un7sTLQ3GGkDnOn0Wce53D/Llwcecs2eSlmvHfNesCyks+mgeibYbt6nFpNe3esUIkUEfIuoAS/+2imxDj9YfAmCcX2/RL1HgY345/JLTC7Bx1MnQ1MsxqfhQA9h6nwd1uVDl0zBhPEZUvVt3odYONCO/aCmcpEV9hFOlWMfziopFud1cpQsbg8YiukLx1BQyA/1+P/W8MkAx76ZQd4WGs85X9BQzCz7Z5PJul2k/tuFFrYuN77/4TOscyvaJYUC1/KZw0Vqi87eOF55y4laBVNdz+4LAfzOEW3Zzu69wEEgsjOH31NOCNg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:33.1579 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85ef1902-105d-4aa3-839b-08dce48669e7 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: AMS0EPF000001AC.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1770 X-BESS-ID: 1728054515-302249-12641-31688-2 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.17.168 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-7.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