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 8866745AD9; Mon, 7 Oct 2024 21:40:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 03E34427A1; Mon, 7 Oct 2024 21:36:09 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 4E00A40E3E for ; Mon, 7 Oct 2024 21:35:41 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound43-193.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 07 Oct 2024 19:35:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dujgHy3V2VLXRUR0e1IbZWxI4cnxOg+LMmgfwrWH3rDpbQ2V64+ySXokLAx1VCpxjz2zvgeEnB970npMVmoGsJJZ2d1ALZsyTC269D1lDHZQ6EJ5+aJgyPbyTZyMwv0YA8AJAbyqjYOk61Ak6g6z6Ret8qo/soqlHmbQVbm65R+tjVQIEi+BhMgHfE9H/M7sDNcTdi83n2M6oOvrS/0kE5sKMRxU1lXao0O++ZEU/vg8yDhPBXcDWYHdsEU8GTAVi4JD6yKeuh5/m6yKWpzYbTA7C6Tkjh4+PxCjEdIeimD6empXAHYvTcr8LsFLfXcUlgIKMhFd0stkrPBAGYtu/Q== 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=rxuNLE465JdOqGoVOry2Sl/QPkbAoMj3Uiuw/hnc+sDqR55VGNrBmqH00rOyJv3N8LGR25z0fHWUXcLY+s0VFuckpDDS+LkIgZTOikPmC8WvGkQuopWa74B2Fil2Fr7E8mB2pTSeEAw4wsWhm/JHeLfrAesA22mHi4KrmZqKA3Nego6q2pZ5JxR7NbKK8PXxFjLUeS6kQtb7/ZREvoCylRDufxOoMoTDgiUfpoK7Axaf72s1wVWIhpf9MPO2Eh50jF/U0MNGcCq/R+LBkgtpyb9ph3Wm9+jLpayi5v0ZKUUaKWbWzDBHypHKq0frHGXwEsEgKa80ghPODKR2LQ3fDA== 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=ZgQX24wp5SjhMHo1uisFCrkQxDvH14IkKdrfg8KLqqu8rW9mENInB5aCTMwQGIpVTVfNqbYLV6orZ0r2+smc/0wIhK/Y+s7OLbXE2ZyXzMkQzDH9Is1UeSqp8p7byN9mcEaBaKa+m2RaYtMgEEkavgm/lfhS1ETXcBOJ29cF7os= Received: from DB9PR05CA0002.eurprd05.prod.outlook.com (2603:10a6:10:1da::7) by AM0P190MB0610.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:197::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Mon, 7 Oct 2024 19:35:34 +0000 Received: from DB1PEPF000509EC.eurprd03.prod.outlook.com (2603:10a6:10:1da:cafe::d5) by DB9PR05CA0002.outlook.office365.com (2603:10a6:10:1da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.34 via Frontend Transport; Mon, 7 Oct 2024 19:35: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 DB1PEPF000509EC.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server id 15.20.8048.13 via Frontend Transport; Mon, 7 Oct 2024 19:35: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 v2 38/50] net/ntnic: enhance Ethernet device configuration Date: Mon, 7 Oct 2024 21:34:14 +0200 Message-ID: <20241007193436.675785-39-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241007193436.675785-1-sil-plv@napatech.com> References: <20241006203728.330792-2-sil-plv@napatech.com> <20241007193436.675785-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509EC:EE_|AM0P190MB0610:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 74a7ee08-6100-4ebd-4d03-08dce7073625 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+tqxL0wcQsIJv0DxQeG+Oe+jjtbJnU7tHfgSjBlqwk89wbXc6rkRL4jj++x+?= =?us-ascii?Q?q7yfZgJ+FhUeWnCj7oRmvT/53p72vr97D5s4fbUIQuZRP8r6KwaWX/L+8Fpa?= =?us-ascii?Q?KmJ6KVeUawH84L+W6cX9Weqy2bL4bH34nrFgbvwnsOvGTi8UVxo0RDEGb+4/?= =?us-ascii?Q?u1IQEGUJwkBXsO5qfTbqk+T9uI1cRUkYOAgLpMhLnGPiQzC3SKA83cDyOapX?= =?us-ascii?Q?T1uekcHX/NgQimhnZg9uouGfA0jS1Kl6HzLtLdO4f3t7MkxKMYP4ME/5h/0k?= =?us-ascii?Q?r8IENvMUdsLWShiq7KHcTMHAEkRiFRIU+kuXM+v3TqfTQSmEZAHKtIp+2Cah?= =?us-ascii?Q?BkImwkJz5S75jZDkja55b72QQfh2uW+8kxqlK6qtITalmwuj8Iond85pk11v?= =?us-ascii?Q?MnjVdMXGd0/bHYxS+wnp7BT2JH5V2jO1DITI+ZYMdKaNK629PpbAG5EqS2Yj?= =?us-ascii?Q?moKZK5yADKiSZBYkXRnvMI7cWi9iArWSF0JELPNsDiFT5Yk5GwRnVuBVNSSh?= =?us-ascii?Q?t1PeJdTSS1SnKDnjBPcJYJziXob/VvDALlZrHfdHMaN4bej80cvpybrXRg0G?= =?us-ascii?Q?iEjK21eQlwaFWLVZydhmr+hhhkqmF0d5qbenxd8kmoKQPxTNys/ojJr9kDYa?= =?us-ascii?Q?f99+uQE00727HcoXcqWxHMPVcBBmYc428eZd/rS74G/x7BwAroIS5jc7I06+?= =?us-ascii?Q?eqykwuxrtXbU3NbCWo0dy0RB850/BLFIVTpW05dBA+wR4ehpxNO6N64uJ+fJ?= =?us-ascii?Q?hSENvyim5KL7t9+Ewz+4fUq6S3xg7ngiPIqkElhpgmFK0r4hNZ0tkijxuLyq?= =?us-ascii?Q?UmNAIMLVeP5wpzYVc5CCUJvQM9QtSJR+VwRB4NOYTi25Hys4NfUuErTwORTl?= =?us-ascii?Q?qunpVnID033MjZd/KED+qSUmYMyvW04epNokQp8SfqXljtsw7wJckJEyIhsN?= =?us-ascii?Q?4OWTWFRwaStrfbrVj1Dw+6WuqxARodkmJY0+kKyasqpkIeN4n5Z0wNvDuaO0?= =?us-ascii?Q?186efg0GQLCIC/eWnNu7YkEt5t99PEisxzTFa9j8hRhr06YoPPMXZMZAeeJq?= =?us-ascii?Q?8Xr03/bN32qONhwAf6i+C+fypI8qdNy7rubssyl1HwHVybSAp05oxiTpN8AL?= =?us-ascii?Q?vs3YGdO3QjfOamBu+xg4bxe28S13t9VCLRx/3o6c6+bYEd/WV/YRZld/Iy2O?= =?us-ascii?Q?SgJPVKDBjvaaf7lpS+t6UMGVEARnM12ERjnljbIJaannsHCiJ018Z6GFS06t?= =?us-ascii?Q?5lf6ROO/Huh5pr1kYWGQ9bYliGSNnAWqDKT2AZS3nvhH/CGeo/55KL+Ccaoy?= =?us-ascii?Q?z1Y0UDkF6tRPPB3Wu+V0Fzspw4No0ANAvDdg0CL8D28As36zJv9fChrfPTYn?= =?us-ascii?Q?76ycvlz/Z9+3NRXO8IHiOT+levbA?= 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)(1800799024)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VBUHnma1MfwcKWooElTLCtIDq87CXOBjXhtFAIaPS3alpDf/1fsmsWjzVtaJ8VsGVDWwylN7PcmbjFiB8UasrAHCwYeCqxTORL/BcW0/FCYewKX6/QAti4mEOHLkbJogyYVHpyCnIqEWkaRjHoz7D+0uzm/22QF9K0z+TSs16ggoRxwJv/Jjdx7xZ20qOt5K+KZITbF0g6i9Ir0m+ccjrxtmv1HrMNUfpO3xujJ0u6jRaW1Zj/eOYcp4btTWpbn0MpnAC3rDcoJ632aUDIjxHRi6dbCcMQsbIUFjZMtePUYUeYyorHYx5nC7wM4ttpge6Jc2sD4nrS7b9nuaGEGBUP/kgwQV7OkA9cck1faULs9i+6LkH1F2Q+Vvk0tzSkSNK6j/2/9qUyW7DtgLBTdieXQcFbgS+XjyNW6qLNwwC2bEZ3Q1Ccp/BWEPbCf2dK5i3PrwMBtFBnhkzTaua0Djv2WnVTlfst3NbZyBpSogcAEp1id4L4Slinrjivh3/cHmV1eQ+VGAdbXjMBijjJ1K+1ezKndNLKKa8h4V/xh3UxMWQfQdfbf5+duvRqKw75sZcP0+ak2PYBmcK7HCU/OCA0jvDrScewyv/uD/GQEjAqMTKHM+SmGvya7GDkVTMx16AxBgg5zfr3ThJzxZQv0SJg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2024 19:35:33.6156 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74a7ee08-6100-4ebd-4d03-08dce7073625 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: DB1PEPF000509EC.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0610 X-BESS-ID: 1728329735-311201-2746-3528-2 X-BESS-VER: 2019.1_20241004.2057 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.259566 [from cloudscan9-218.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 --- 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