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 E75FD4411D; Fri, 31 May 2024 17:48:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E587842D95; Fri, 31 May 2024 17:47:49 +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 630FA427D8 for ; Fri, 31 May 2024 17:47:45 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound41-244.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 May 2024 15:47:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l6dG+ZDLJVIqcrd3FM/UucTFqb7oe68qHkTfcgry9nXaltc6daxcypqiiFUGO64cFNdgRKGuz0j/fo/Kc7fJhAIk7AajTj9fLnkktCMGNDtPyBeQDdkVnVmmTQjAhdz2BL9a++oi0U2fzrtSyGQEp5penLBgF/f8iul/MSXkCSJzxv6BL83mzoaMeegZFgqptC69y8u/XuCIoLwHHsQfxGSdfFRk2rLWgoJzjTQqWRlVuTlBPAofBW89Mp7ttB5/Z/kMUAnWFXqnie2rwU2SulD0M/KPKiKdIPCN8DlrOarHZA4pqUBXDQz1P0LSVBgI4TX1aPdRukxHWpt1OY/ysw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DInrkYKeU7MmMScQ0GTPYRj81TovzlRdcg2SPT5Mfx0=; b=j+85yRgrXXEpYZ2KMGHmKtp0JRo5XGm/wfcBk16b6AeNZN32cx97Cu5Di5D3BjhFtYFd7fx1TQN67MMJ2R/zfE1xYwl57vTeqQDt+DjgkRYuPeFOaNuBc3YlbZZZa1G1kfmk7fASBBtp3+Uczr67NmmgZ6INqBEskA4tiOMPK4J/gLQ9Tcfdy1M0HJMe9TiOXGTBDWuS9nRe++ZZlzEI+cE7+SaEzJSyw8ECVFX2UEZQndblBHpqngKTPtHOqLwKvc1qyNhLKpx4JteKvvj0Wx7GLUt4Kyy+M3arYVlLgxOBAUr3AuE84HKbjIyphjRP9GQeaj8MUyavgJ/49C/pnQ== 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=DInrkYKeU7MmMScQ0GTPYRj81TovzlRdcg2SPT5Mfx0=; b=nKWrYxqgT/MbitF1GE0+Ut0rdYFmGgWxthq2Sk7pvdXofnLZ5ezxMaLE0UXBwYhVVpvT79drVZVRgJYKxjpLsZawFrSvY74J1FhU3ih3zGXU5S7m4caFHIaSWN7pBbLoZX258Sk6/mxtxbk4hwx/UREH1YxKFS33BM21D+uOqBw= Received: from AS4P251CA0028.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:5d3::17) by AM8P190MB0881.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:1da::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.23; Fri, 31 May 2024 15:47:41 +0000 Received: from AMS1EPF00000047.eurprd04.prod.outlook.com (2603:10a6:20b:5d3:cafe::7c) by AS4P251CA0028.outlook.office365.com (2603:10a6:20b:5d3::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7452.27 via Frontend Transport; Fri, 31 May 2024 15:47:41 +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 AMS1EPF00000047.mail.protection.outlook.com (10.167.16.135) with Microsoft SMTP Server id 15.20.7633.15 via Frontend Transport; Fri, 31 May 2024 15:47:41 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com Subject: [PATCH v2 07/17] net/ntnic: add API for PMD driver modules Date: Fri, 31 May 2024 17:47:11 +0200 Message-ID: <20240531154731.1856874-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240531154731.1856874-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240531154731.1856874-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS1EPF00000047:EE_|AM8P190MB0881:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 40f597ef-e857-40eb-857c-08dc8189018a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|36860700004|376005|82310400017|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?woJ9pml6xjbUidyYVFh3IcqLvgQseSSycHrCC3SwVbGyQtgxXHuqcqzMDZZt?= =?us-ascii?Q?zijBBFcsHwVfKbHmWGLT6XS8CPNXqPg0i1y59BBdj7ZdIhiHYqD6Il+eOL95?= =?us-ascii?Q?D3RBjYB7549oc8OmmQQ9Ls/W/xbRbXuSH5r6nsQOLwAcP/o3qplanXEr9C2j?= =?us-ascii?Q?z30K6lQRtp4wzIwiWslTVwQVfhVHWJEYR4EaS4Pejhvcg6X2cFpfR/JOAXUh?= =?us-ascii?Q?LhYs3RS+zGd/yusxQjXjQ237wG8sDWpqrtGTHYjpL7EQADC/mS2RZkJ2fr9x?= =?us-ascii?Q?+aroTyIkHAOE8udpoBDJeORk8s6vseA5CQNr/UIbrWQGIUPxa75vJnGr0VwO?= =?us-ascii?Q?qrjvowOH+Weorbwz8gs9QHSTOEK/B3UHFGIPWP1pgB86Z60ucs96fEknUsak?= =?us-ascii?Q?HCM7he4wpIrUWQ7b0Ft4lIr5Cz2/aoa7uq3w5/pZq1jf1jd6pKpuyEz7zYZW?= =?us-ascii?Q?nQNXVsHclKoS+c6916PTogEj71y3tO9ffaHt9wNtlZBpuXG+bQkNKJiCpHrM?= =?us-ascii?Q?BgzuvnVJmjOHohGz0ZwB1KQBvVKeF65YySmUnjjMAHYc0pTUUtrfM1GcjL9i?= =?us-ascii?Q?U1mvsYzS/z+sZl5lqjrPiDsmgggE8Fd/VM6oCov6Ul7839Mfo3mW5mmzdN/p?= =?us-ascii?Q?s/ub54kkOnyERY3W7rL5ruAqcgblzqswRuQCpkp2U9526sdTAXLZ4Y4pkM0d?= =?us-ascii?Q?wAXFUY9jlcw2PRzHkrN0kaJGGHVmUQ7ER501DVPb/HayA6XE5YvFxcxSxyu9?= =?us-ascii?Q?hig1ouYQ0nzI6SEUOf3yiFEWz2pLJ2xNJJZ9RsTkGCu0g1dVTTTbweRu2mgS?= =?us-ascii?Q?2angwPodZymx6uOJiAhS+t8Qe7sApgPptg18ii33aq7FUnGl2WRuNBGH+W7R?= =?us-ascii?Q?5Oi6IjZCr60AWybmMH8PceNUnUq9ut64T5RO6sKayd7DyW1xARo5hTIm0vFb?= =?us-ascii?Q?HQbIktmn3vvymoEm5BYEcIL4cBfDMbqryWPS5twHA2DxgEA2lxuFiKP7wAXf?= =?us-ascii?Q?G2W1k8hDZjRuOI7+QU0gfS6umW9kqZ+NfY6zE3//d+lntVSyKL1nZW9ADUpz?= =?us-ascii?Q?ahGX60ads5koY7vsEV3PbcBs7cIaZOCQoYgFm0ydw74BtwrKCkDLpOdHL2ST?= =?us-ascii?Q?jiT1m9r0r5OS3zJUKit9uTuoJ0nwJEnb8A3HWQSXItZOLd6tNCZ/kwOjH3W6?= =?us-ascii?Q?XVdVb14nkOuCEE9beE3hQl8mJF8Buqy9GznxwJyC133Vz3dNoSggigbjKCet?= =?us-ascii?Q?21iQZNgRwS+wC15x7OqyO7AiWn2J29S9s05Yjw7srPZN/iOJTgAeWnK866mi?= =?us-ascii?Q?wdMKqWkDd8umc2wFXeQa9aI3dgR10zWWBFd5DOlJL9B9QULzRDMip2P/qBEP?= =?us-ascii?Q?nIQNEdU=3D?= 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:(13230031)(36860700004)(376005)(82310400017)(1800799015); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Z8iY5eStQWkwL5Y+0EgddlQ0l9R4CthZjpQI1b9M3ExkvqVH1MH0lW3RDqlvI5EyctsQUsWOUAZf0hQUx7et4vEBMQZN7cvS/Ov8Jl06TELq/vDjfi8L+p4Smj1a62LzAC+vxB3rjqCEndhx1059o/tLwYH2AUGPbLhArMYlLLoWACMbRyHpvy0HoOUkaAosXW6XSnfmfEvFcxI/Mb2kbCk0+dx0HC9MVKvOdjXCyLwKpvWhYhllkC6Zhx0zYtyLPIzu4ltBmNb8CG0PHpjXrJ/4SfBgqHPLzemIvSvhCEOb9KmWZd2OZUtalWxRbdLz/IO8tKV2k9uJKRYjtJXyLoAPvdrltBRu00TAexYzycIJ1Q8X7g/HD4w/GNZyaa1DRVF1tLpv9/jwdwMA+uIzU0Agv5P5h0SmPK77OjQnZy/85WIqwpH4V/z90qVj+EtIbiAh7qYR/o116vorhuxgmHFcj9ohEKb6uAQRhqphY+M0kZJuABhDj4D6XmTXQUNQB7f10ZV7I+qvKfngNxqyDl4AiT8/FnUuTcZWtyzt4ULBCJ+GuT3DoMiojx2RLM9ay3GBUjtGHsbS9pSorUE4pF50qNP94XH/a965yk8qpWhjRkS0Aeq/UZMwZCZ+pTIgwrJJ7Y/+JHU7gypojINl/w== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 May 2024 15:47:41.5032 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 40f597ef-e857-40eb-857c-08dc8189018a 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: AMS1EPF00000047.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8P190MB0881 X-BESS-ID: 1717170463-310740-12727-27673-1 X-BESS-VER: 2019.1_20240530.1612 X-BESS-Apparent-Source-IP: 104.47.17.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsaGBkYmQGYGUNQyJdHcMNHc2C LRwszE0NzU2NTSzNTYINXQ3NIoyTQpUak2FgCFr1n+QgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.256627 [from cloudscan22-138.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 Add API for ntnic PMD driver modules, thus allow modules to be enabled/disabled. Signed-off-by: Serhii Iliushyk --- v2: * Fixed WARNING:TYPO_SPELLING --- drivers/net/ntnic/dpdk_mod_reg.c | 64 ++++ drivers/net/ntnic/dpdk_mod_reg.h | 167 ++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 382 ++++++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 512 ++++++++++++++++++++++++++++++ 4 files changed, 1125 insertions(+) create mode 100644 drivers/net/ntnic/dpdk_mod_reg.c create mode 100644 drivers/net/ntnic/dpdk_mod_reg.h create mode 100644 drivers/net/ntnic/ntnic_mod_reg.c create mode 100644 drivers/net/ntnic/ntnic_mod_reg.h diff --git a/drivers/net/ntnic/dpdk_mod_reg.c b/drivers/net/ntnic/dpdk_mod_reg.c new file mode 100644 index 0000000000..dec3e54dc0 --- /dev/null +++ b/drivers/net/ntnic/dpdk_mod_reg.c @@ -0,0 +1,64 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include "dpdk_mod_reg.h" + +static struct sg_ops_s *sg_ops; + +void register_sg_ops(struct sg_ops_s *ops) +{ + sg_ops = ops; +} + +const struct sg_ops_s *get_sg_ops(void) +{ + return sg_ops; +} + +/* + * + */ +static struct meter_ops_s *meter_ops; + +void register_meter_ops(struct meter_ops_s *ops) +{ + meter_ops = ops; +} + +const struct meter_ops_s *get_meter_ops(void) +{ + return meter_ops; +} + +/* + * + */ +static const struct ntnic_filter_ops *ntnic_filter_ops; + +void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops) +{ + ntnic_filter_ops = ops; +} + +const struct ntnic_filter_ops *get_ntnic_filter_ops(void) +{ + return ntnic_filter_ops; +} + +/* + * + */ +static struct ntnic_xstats_ops *ntnic_xstats_ops; + +void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops) +{ + ntnic_xstats_ops = ops; +} + +struct ntnic_xstats_ops *get_ntnic_xstats_ops(void) +{ + return ntnic_xstats_ops; +} diff --git a/drivers/net/ntnic/dpdk_mod_reg.h b/drivers/net/ntnic/dpdk_mod_reg.h new file mode 100644 index 0000000000..5cc866f98c --- /dev/null +++ b/drivers/net/ntnic/dpdk_mod_reg.h @@ -0,0 +1,167 @@ +#ifndef __DPDK_MOD_REG_H__ +#define __DPDK_MOD_REG_H__ + +#include +#include "ntnic_ethdev.h" +#include "ntoss_virt_queue.h" +#include "ntnic_stat.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); + int (*nthw_enable_rx_virt_queue)(struct nthw_virt_queue *rx_vq); + int (*nthw_disable_rx_virt_queue)(struct nthw_virt_queue *rx_vq); + int (*nthw_release_rx_virt_queue)(struct nthw_virt_queue *rxvq); + 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); + int (*nthw_enable_tx_virt_queue)(struct nthw_virt_queue *tx_vq); + int (*nthw_disable_tx_virt_queue)(struct nthw_virt_queue *tx_vq); + int (*nthw_release_tx_virt_queue)(struct nthw_virt_queue *txvq); + int (*nthw_enable_and_change_port_tx_virt_queue)(struct nthw_virt_queue *tx_vq, + uint32_t outport); + struct nthw_virt_queue *(*nthw_setup_managed_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_managed_rx_virt_queue)(struct nthw_virt_queue *rxvq); + struct nthw_virt_queue *(*nthw_setup_managed_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_managed_tx_virt_queue)(struct nthw_virt_queue *txvq); + int (*nthw_set_tx_qos_config)(nthw_dbs_t *p_nthw_dbs, uint32_t port, uint32_t enable, + uint32_t ir, uint32_t bs); + int (*nthw_set_tx_qos_rate_global)(nthw_dbs_t *p_nthw_dbs, + uint32_t multiplier, + uint32_t divider); + /* + * 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_buffers)(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_buffers)(struct nthw_virt_queue *txvq, + uint16_t n, + uint16_t n_segs[]); + int (*nthw_get_rx_queue_ptr)(struct nthw_virt_queue *rxvq, uint16_t *index); + int (*nthw_get_tx_queue_ptr)(struct nthw_virt_queue *txvq, uint16_t *index); + int (*nthw_virt_queue_init)(struct fpga_info_s *p_fpga_info); +}; + +void register_sg_ops(struct sg_ops_s *ops); +const struct sg_ops_s *get_sg_ops(void); + +/* Meter ops section */ +struct meter_ops_s { + int (*eth_mtr_ops_get)(struct rte_eth_dev *eth_dev, void *ops); +}; + +void register_meter_ops(struct meter_ops_s *ops); +const struct meter_ops_s *get_meter_ops(void); + +/* + * + */ +#ifdef __NTNIC_ETHDEV_H__ +struct ntnic_filter_ops { + int (*poll_statistics)(struct pmd_internals *internals); +}; + +void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops); +const struct ntnic_filter_ops *get_ntnic_filter_ops(void); +#endif + +/* + * + */ +struct ntnic_xstats_ops { + int (*nthw_xstats_get_names)(nt4ga_stat_t *p_nt4ga_stat, + struct rte_eth_xstat_name *xstats_names, + unsigned int size, + bool is_vswitch); + int (*nthw_xstats_get)(nt4ga_stat_t *p_nt4ga_stat, + struct rte_eth_xstat *stats, + unsigned int n, + bool is_vswitch, + uint8_t port); + void (*nthw_xstats_reset)(nt4ga_stat_t *p_nt4ga_stat, bool is_vswitch, uint8_t port); + int (*nthw_xstats_get_names_by_id)(nt4ga_stat_t *p_nt4ga_stat, + struct rte_eth_xstat_name *xstats_names, + const uint64_t *ids, + unsigned int size, + bool is_vswitch); + int (*nthw_xstats_get_by_id)(nt4ga_stat_t *p_nt4ga_stat, + const uint64_t *ids, + uint64_t *values, + unsigned int n, + bool is_vswitch, + uint8_t port); +}; + +void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops); +struct ntnic_xstats_ops *get_ntnic_xstats_ops(void); + +#endif /* __DPDK_MOD_REG_H__ */ diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c new file mode 100644 index 0000000000..7ed6573a76 --- /dev/null +++ b/drivers/net/ntnic/ntnic_mod_reg.c @@ -0,0 +1,382 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include "ntnic_mod_reg.h" + +/* + * + */ +static struct link_ops_s *link_100g_ops; + +void register_100g_link_ops(struct link_ops_s *ops) +{ + link_100g_ops = ops; +} + +const struct link_ops_s *get_100g_link_ops(void) +{ + return link_100g_ops; +} + +/* + * + */ +static struct link_ops_s *link_agx_100g_ops; + +void register_agx_100g_link_ops(struct link_ops_s *ops) +{ + link_agx_100g_ops = ops; +} + +const struct link_ops_s *get_agx_100g_link_ops(void) +{ + return link_agx_100g_ops; +} + +/* + * + */ +static struct link_ops_s *link_25g_ops; + +void register_25g_link_ops(struct link_ops_s *ops) +{ + link_25g_ops = ops; +} + +const struct link_ops_s *get_25g_link_ops(void) +{ + return link_25g_ops; +} + +/* + * + */ +static struct link_ops_s *link_40g_ops; + +void register_40g_link_ops(struct link_ops_s *ops) +{ + link_40g_ops = ops; +} + +const struct link_ops_s *get_40g_link_ops(void) +{ + return link_40g_ops; +} + +/* + * + */ +static struct link_ops_s *link_8x10g_ops; + +void register_8x10g_link_ops(struct link_ops_s *ops) +{ + link_8x10g_ops = ops; +} + +const struct link_ops_s *get_8x10g_link_ops(void) +{ + return link_8x10g_ops; +} + +/* + * + */ +static struct avr_sensors_ops *avr_sensors_ops; + +void register_avr_sensors_ops(struct avr_sensors_ops *ops) +{ + avr_sensors_ops = ops; +} + +struct avr_sensors_ops *get_avr_sensors_ops(void) +{ + return avr_sensors_ops; +} + +/* + * + */ +static struct board_sensors_ops *board_sensors_ops; + +void register_board_sensors_ops(struct board_sensors_ops *ops) +{ + board_sensors_ops = ops; +} + +struct board_sensors_ops *get_board_sensors_ops(void) +{ + return board_sensors_ops; +} + +/* + * + */ +static struct ntavr_ops *ntavr_ops; + +void register_ntavr_ops(struct ntavr_ops *ops) +{ + ntavr_ops = ops; +} + +struct ntavr_ops *get_ntavr_ops(void) +{ + return ntavr_ops; +} + +/* + * + */ +static struct sensor_conversion_fun_ops *sensor_conversion_fun_ops; + +void register_sensor_conversion_fun_ops(struct sensor_conversion_fun_ops *ops) +{ + sensor_conversion_fun_ops = ops; +} + +struct sensor_conversion_fun_ops *get_sensor_conversion_fun_ops(void) +{ + return sensor_conversion_fun_ops; +} + +/* + * + */ +static struct sensor_ops *sensor_ops; + +void register_sensor_ops(struct sensor_ops *ops) +{ + sensor_ops = ops; +} + +struct sensor_ops *get_sensor_ops(void) +{ + return sensor_ops; +} + +/* + * + */ +static struct nim_sensors_ops *nim_sensors_ops; + +void register_nim_sensors_ops(struct nim_sensors_ops *ops) +{ + nim_sensors_ops = ops; +} + +struct nim_sensors_ops *get_nim_sensors_ops(void) +{ + return nim_sensors_ops; +} + +/* + * + */ +static const struct port_ops *port_ops; + +void register_port_ops(const struct port_ops *ops) +{ + port_ops = ops; +} + +const struct port_ops *get_port_ops(void) +{ + return port_ops; +} + +/* + * + */ +static const struct nt4ga_stat_ops *nt4ga_stat_ops; + +void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops) +{ + nt4ga_stat_ops = ops; +} + +const struct nt4ga_stat_ops *get_nt4ga_stat_ops(void) +{ + return nt4ga_stat_ops; +} + +/* + * + */ +static const struct adapter_ops *adapter_ops; + +void register_adapter_ops(const struct adapter_ops *ops) +{ + adapter_ops = ops; +} + +const struct adapter_ops *get_adapter_ops(void) +{ + return adapter_ops; +} + +static struct clk9530_ops *clk9530_ops; + +void register_clk9530_ops(struct clk9530_ops *ops) +{ + clk9530_ops = ops; +} + +struct clk9530_ops *get_clk9530_ops(void) +{ + return clk9530_ops; +} + +static struct clk9544_ops *clk9544_ops; + +void register_clk9544_ops(struct clk9544_ops *ops) +{ + clk9544_ops = ops; +} + +struct clk9544_ops *get_clk9544_ops(void) +{ + return clk9544_ops; +} + +static struct clk9563_ops *clk9563_ops; + +void register_clk9563_ops(struct clk9563_ops *ops) +{ + clk9563_ops = ops; +} + +struct clk9563_ops *get_clk9563_ops(void) +{ + return clk9563_ops; +} + +static struct clk9572_ops *clk9572_ops; + +void register_clk9572_ops(struct clk9572_ops *ops) +{ + clk9572_ops = ops; +} + +struct clk9572_ops *get_clk9572_ops(void) +{ + return clk9572_ops; +} + +static struct rst_nt200a0x_ops *rst_nt200a0x_ops; + +void register_rst_nt200a0x_ops(struct rst_nt200a0x_ops *ops) +{ + rst_nt200a0x_ops = ops; +} + +struct rst_nt200a0x_ops *get_rst_nt200a0x_ops(void) +{ + return rst_nt200a0x_ops; +} + +static struct rst9530_ops *rst9530_ops; + +void register_rst9530_ops(struct rst9530_ops *ops) +{ + rst9530_ops = ops; +} + +struct rst9530_ops *get_rst9530_ops(void) +{ + return rst9530_ops; +} + +static struct rst9544_ops *rst9544_ops; + +void register_rst9544_ops(struct rst9544_ops *ops) +{ + rst9544_ops = ops; +} + +struct rst9544_ops *get_rst9544_ops(void) +{ + return rst9544_ops; +} + +static struct rst9563_ops *rst9563_ops; + +void register_rst9563_ops(struct rst9563_ops *ops) +{ + rst9563_ops = ops; +} + +struct rst9563_ops *get_rst9563_ops(void) +{ + return rst9563_ops; +} + +static struct rst9572_ops *rst9572_ops; + +void register_rst9572_ops(struct rst9572_ops *ops) +{ + rst9572_ops = ops; +} + +struct rst9572_ops *get_rst9572_ops(void) +{ + return rst9572_ops; +} + +static struct rst_nt400dxx_ops *rst_nt400dxx_ops; + +void register_rst_nt400dxx_ops(struct rst_nt400dxx_ops *ops) +{ + rst_nt400dxx_ops = ops; +} + +struct rst_nt400dxx_ops *get_rst_nt400dxx_ops(void) +{ + return rst_nt400dxx_ops; +} + +/* + * + */ +static const struct profile_inline_ops *profile_inline_ops; + +void register_profile_inline_ops(const struct profile_inline_ops *ops) +{ + profile_inline_ops = ops; +} + +const struct profile_inline_ops *get_profile_inline_ops(void) +{ + return profile_inline_ops; +} + +/* + * + */ +static const struct flow_filter_ops *flow_filter_ops; + +void register_flow_filter_ops(const struct flow_filter_ops *ops) +{ + flow_filter_ops = ops; +} + +const struct flow_filter_ops *get_flow_filter_ops(void) +{ + return flow_filter_ops; +} + +/* + * + */ +static const struct rte_flow_ops *dev_flow_ops; + +void register_dev_flow_ops(const struct rte_flow_ops *ops) +{ + dev_flow_ops = ops; +} + +const struct rte_flow_ops *get_dev_flow_ops(void) +{ + return dev_flow_ops; +} diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h new file mode 100644 index 0000000000..e36133d815 --- /dev/null +++ b/drivers/net/ntnic/ntnic_mod_reg.h @@ -0,0 +1,512 @@ +#ifndef __NTNIC_MOD_REG_H__ +#define __NTNIC_MOD_REG_H__ + +#include +#include "flow_api.h" +#include "stream_binary_flow_api.h" +#include "nthw_fpga_model.h" +#include "nthw_platform_drv.h" +#include "ntnic_stat.h" +#include "nthw_drv.h" +#include "nt4ga_adapter.h" + +/* + * + */ +struct link_ops_s { + int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga); +}; + +void register_100g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_100g_link_ops(void); + +void register_agx_100g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_agx_100g_link_ops(void); + +void register_25g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_25g_link_ops(void); + +void register_40g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_40g_link_ops(void); + +void register_8x10g_link_ops(struct link_ops_s *ops); +const struct link_ops_s *get_8x10g_link_ops(void); + +/* + * + */ +struct avr_sensors_ops { + struct nt_sensor_group *(*avr_sensor_init)(nthw_spi_v3_t *s_spi, uint8_t m_adapter_no, + const char *p_name, + enum nt_sensor_source_e ssrc, enum nt_sensor_type_e type, unsigned int index, + enum sensor_mon_device avr_dev, uint8_t avr_dev_reg, enum sensor_mon_endian end, + enum sensor_mon_sign si, int (*conv_func)(uint32_t), uint16_t mask); +}; + +void register_avr_sensors_ops(struct avr_sensors_ops *ops); +struct avr_sensors_ops *get_avr_sensors_ops(void); + +/* + * + */ +struct board_sensors_ops { + struct nt_sensor_group *(*fpga_temperature_sensor_init)(uint8_t adapter_no, + unsigned int sensor_idx, + nthw_fpga_t *p_fpga); +}; + +void register_board_sensors_ops(struct board_sensors_ops *ops); +struct board_sensors_ops *get_board_sensors_ops(void); + +/* + * + */ +struct ntavr_ops { + int (*nt_avr_sensor_mon_ctrl)(nthw_spi_v3_t *s_spi, enum sensor_mon_control ctrl); + int (*nt_avr_sensor_mon_setup)(struct sensor_mon_setup16 *p_setup, nthw_spi_v3_t *s_spi); + uint32_t (*sensor_read)(nthw_spis_t *t_spi, uint8_t fpga_idx, uint32_t *p_sensor_result); +}; + +void register_ntavr_ops(struct ntavr_ops *ops); +struct ntavr_ops *get_ntavr_ops(void); + +/* + * + */ +struct sensor_conversion_fun_ops { + int (*null_signed)(uint32_t p_sensor_result); + int (*exar7724_tj)(uint32_t p_sensor_result); + int (*ds1775_t)(uint32_t p_sensor_result); + int (*mp2886a_tj)(uint32_t p_sensor_result); + int (*fan)(uint32_t p_sensor_result); + int (*null_sign)(uint32_t sensor_result); + int (*tmp464p_t)(uint32_t p_sensor_result); + int (*fan_nt400)(uint32_t sensor_result); + int (*mp8645p_tj)(uint32_t sensor_result); + int (*mp2978_t)(uint32_t sensor_result); + int (*max6642_t)(uint32_t p_sensor_result); + int (*ltm4676_tj)(uint32_t p_sensor_result); + int (*exar7724_vin)(uint32_t p_sensor_result); + int (*exar7724_vch)(uint32_t p_sensor_result); + int (*null_unsigned)(uint32_t p_sensor_result); +}; + +void register_sensor_conversion_fun_ops(struct sensor_conversion_fun_ops *ops); +struct sensor_conversion_fun_ops *get_sensor_conversion_fun_ops(void); + +/* + * + */ +struct sensor_ops { + void (*update_sensor_value)(struct nt_adapter_sensor *sensor, int32_t value); + void (*sensor_deinit)(struct nt_sensor_group *sg); + struct nt_adapter_sensor *(*allocate_sensor_by_description)(uint8_t adapter_or_port_index, + enum nt_sensor_source_e ssrc, + struct nt_adapter_sensor_description *descr); + void (*dump_sensor)(struct nt_adapter_sensor *sensor); + struct nt_adapter_sensor *(*allocate_sensor)(uint8_t adapter_or_port_index, + const char *p_name, + enum nt_sensor_source_e ssrc, + enum nt_sensor_type_e type, + unsigned int index, + enum nt_sensor_event_alarm_e event_alarm, + enum sensor_mon_sign si); + void (*init_sensor_group)(struct nt_sensor_group *sg); + int32_t (*get_value)(struct nt_sensor_group *sg); + int32_t (*get_lowest)(struct nt_sensor_group *sg); + int32_t (*get_highest)(struct nt_sensor_group *sg); + char *(*get_name)(struct nt_sensor_group *sg); +}; + +void register_sensor_ops(struct sensor_ops *ops); +struct sensor_ops *get_sensor_ops(void); + +/* + * + */ +struct nim_sensors_ops { + struct nt_adapter_sensor_description *(*get_sfp_sensors_level0)(void); + struct nt_adapter_sensor_description *(*get_sfp_sensors_level1)(void); + struct nt_adapter_sensor_description *(*get_qsfp_sensor_level0)(void); + struct nt_adapter_sensor_description *(*get_qsfp_sensor_level1)(void); + struct nt_adapter_sensor *(*allocate_sensor_by_description)(uint8_t adapter_or_port_index, + enum nt_sensor_source_e src, + struct nt_adapter_sensor_description *descr); + void (*update_sensor_value)(struct nt_adapter_sensor *sensor, int32_t value); +}; + +void register_nim_sensors_ops(struct nim_sensors_ops *ops); +struct nim_sensors_ops *get_nim_sensors_ops(void); + +/* + * + */ +struct port_ops { + bool (*get_nim_present)(struct adapter_info_s *p, int port); + + /* + * port:s link mode + */ + void (*set_adm_state)(struct adapter_info_s *p, int port, bool adm_state); + bool (*get_adm_state)(struct adapter_info_s *p, int port); + + /* + * port:s link status + */ + void (*set_link_status)(struct adapter_info_s *p, int port, bool status); + bool (*get_link_status)(struct adapter_info_s *p, int port); + + /* + * port: link autoneg + */ + void (*set_link_autoneg)(struct adapter_info_s *p, int port, bool autoneg); + bool (*get_link_autoneg)(struct adapter_info_s *p, int port); + + /* + * port: link speed + */ + void (*set_link_speed)(struct adapter_info_s *p, int port, nt_link_speed_t speed); + nt_link_speed_t (*get_link_speed)(struct adapter_info_s *p, int port); + + /* + * port: link duplex + */ + void (*set_link_duplex)(struct adapter_info_s *p, int port, nt_link_duplex_t duplex); + nt_link_duplex_t (*get_link_duplex)(struct adapter_info_s *p, int port); + + /* + * port: loopback mode + */ + void (*set_loopback_mode)(struct adapter_info_s *p, int port, uint32_t mode); + uint32_t (*get_loopback_mode)(struct adapter_info_s *p, int port); + + uint32_t (*get_link_speed_capabilities)(struct adapter_info_s *p, int port); + + /* + * port: nim capabilities + */ + nim_i2c_ctx_t (*get_nim_capabilities)(struct adapter_info_s *p, int port); + + /* + * port: tx power + */ + int (*tx_power)(struct adapter_info_s *p, int port, bool disable); +}; + +void register_port_ops(const struct port_ops *ops); +const struct port_ops *get_port_ops(void); + +/* + * + */ +struct nt4ga_stat_ops { + int (*nt4ga_stat_init)(struct adapter_info_s *p_adapter_info); + int (*nt4ga_stat_setup)(struct adapter_info_s *p_adapter_info); + int (*nt4ga_stat_stop)(struct adapter_info_s *p_adapter_info); + int (*nt4ga_stat_dump)(struct adapter_info_s *p_adapter_info, FILE *pfh); + int (*nt4ga_stat_collect)(struct adapter_info_s *p_adapter_info, + nt4ga_stat_t *p_nt4ga_stat); +}; + +void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops); +const struct nt4ga_stat_ops *get_nt4ga_stat_ops(void); + +/* + * + */ +struct adapter_ops { + int (*init)(struct adapter_info_s *p_adapter_info); + int (*deinit)(struct adapter_info_s *p_adapter_info); + + int (*show_info)(struct adapter_info_s *p_adapter_info, FILE *pfh); +}; + +void register_adapter_ops(const struct adapter_ops *ops); +const struct adapter_ops *get_adapter_ops(void); + +struct clk9530_ops { + const int *(*get_n_data_9530_si5340_nt200a02_u23_v6)(void); + const clk_profile_data_fmt2_t *(*get_p_data_9530_si5340_nt200a02_u23_v6)(void); +}; + +void register_clk9530_ops(struct clk9530_ops *ops); +struct clk9530_ops *get_clk9530_ops(void); + +struct clk9544_ops { + const int *(*get_n_data_9544_si5340_nt200a02_u23_v6)(void); + const clk_profile_data_fmt2_t *(*get_p_data_9544_si5340_nt200a02_u23_v6)(void); +}; + +void register_clk9544_ops(struct clk9544_ops *ops); +struct clk9544_ops *get_clk9544_ops(void); + +struct clk9563_ops { + const int *(*get_n_data_9563_si5340_nt200a02_u23_v5)(void); + const clk_profile_data_fmt2_t *(*get_p_data_9563_si5340_nt200a02_u23_v5)(void); +}; + +void register_clk9563_ops(struct clk9563_ops *ops); +struct clk9563_ops *get_clk9563_ops(void); + +struct clk9572_ops { + const int *(*get_n_data_9572_si5340_nt200a02_u23_v12)(void); + const clk_profile_data_fmt2_t *(*get_p_data_9572_si5340_nt200a02_u23_v12)(void); +}; + +void register_clk9572_ops(struct clk9572_ops *ops); +struct clk9572_ops *get_clk9572_ops(void); + +struct rst_nt200a0x_ops { + int (*nthw_fpga_rst_nt200a0x_init)(struct fpga_info_s *p_fpga_info, + struct nthw_fpga_rst_nt200a0x *p_rst); + int (*nthw_fpga_rst_nt200a0x_reset)(nthw_fpga_t *p_fpga, + const struct nthw_fpga_rst_nt200a0x *p); +}; + +void register_rst_nt200a0x_ops(struct rst_nt200a0x_ops *ops); +struct rst_nt200a0x_ops *get_rst_nt200a0x_ops(void); + +struct rst9530_ops { + int (*nthw_fpga_rst9530_init)(struct fpga_info_s *p_fpga_info, + struct nthw_fpga_rst_nt200a0x *const p); +}; + +void register_rst9530_ops(struct rst9530_ops *ops); +struct rst9530_ops *get_rst9530_ops(void); + +struct rst9544_ops { + int (*nthw_fpga_rst9544_init)(struct fpga_info_s *p_fpga_info, + struct nthw_fpga_rst_nt200a0x *const p); +}; + +void register_rst9544_ops(struct rst9544_ops *ops); +struct rst9544_ops *get_rst9544_ops(void); + +struct rst9563_ops { + int (*nthw_fpga_rst9563_init)(struct fpga_info_s *p_fpga_info, + struct nthw_fpga_rst_nt200a0x *const p); +}; + +void register_rst9563_ops(struct rst9563_ops *ops); +struct rst9563_ops *get_rst9563_ops(void); + +struct rst9572_ops { + int (*nthw_fpga_rst9572_init)(struct fpga_info_s *p_fpga_info, + struct nthw_fpga_rst_nt200a0x *const p); +}; + +void register_rst9572_ops(struct rst9572_ops *ops); +struct rst9572_ops *get_rst9572_ops(void); + +struct rst_nt400dxx_ops { + int (*nthw_fpga_rst_nt400dxx_init)(struct fpga_info_s *p_fpga_info); + int (*nthw_fpga_rst_nt400dxx_reset)(struct fpga_info_s *p_fpga_info); +}; + +void register_rst_nt400dxx_ops(struct rst_nt400dxx_ops *ops); +struct rst_nt400dxx_ops *get_rst_nt400dxx_ops(void); + +/* + * + */ +struct profile_inline_ops { + /* + * NT Flow FLM Meter API + */ + int (*flow_mtr_supported)(struct flow_eth_dev *dev); + + uint64_t (*flow_mtr_meter_policy_n_max)(void); + + int (*flow_mtr_set_profile)(struct flow_eth_dev *dev, uint32_t profile_id, + uint64_t bucket_rate_a, uint64_t bucket_size_a, + uint64_t bucket_rate_b, uint64_t bucket_size_b); + + int (*flow_mtr_set_policy)(struct flow_eth_dev *dev, uint32_t policy_id, int drop); + + int (*flow_mtr_create_meter)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id, + uint32_t profile_id, uint32_t policy_id, uint64_t stats_mask); + + int (*flow_mtr_probe_meter)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id); + + int (*flow_mtr_destroy_meter)(struct flow_eth_dev *dev, uint8_t caller_id, + uint32_t mtr_id); + + int (*flm_mtr_adjust_stats)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id, + uint32_t adjust_value); + + uint32_t (*flow_mtr_meters_supported)(struct flow_eth_dev *dev, uint8_t caller_id); + + void (*flm_setup_queues)(void); + void (*flm_free_queues)(void); + uint32_t (*flm_lrn_update)(struct flow_eth_dev *dev, uint32_t *inf_cnt); + + uint32_t (*flm_mtr_update_stats)(struct flow_eth_dev *dev, uint32_t *inf_cnt); + void (*flm_mtr_read_stats)(struct flow_eth_dev *dev, + uint8_t caller_id, + uint32_t id, + uint64_t *stats_mask, + uint64_t *green_pkt, + uint64_t *green_bytes, + int clear); + + uint32_t (*flm_update)(struct flow_eth_dev *dev); + + /* + * Config API + */ + int (*flow_set_mtu_inline)(struct flow_eth_dev *dev, uint32_t port, uint16_t mtu); +}; + +void register_profile_inline_ops(const struct profile_inline_ops *ops); +const struct profile_inline_ops *get_profile_inline_ops(void); + +/* + * + */ +struct flow_filter_ops { + int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, + int adapter_no); + int (*flow_filter_done)(struct flow_nic_dev *dev); + + /* + * Device Management API + */ + int (*flow_reset_nic_dev)(uint8_t adapter_no); + + struct flow_eth_dev *(*flow_get_eth_dev)(uint8_t adapter_no, + uint8_t hw_port_no, + uint32_t port_id, + int alloc_rx_queues, + struct flow_queue_id_s queue_ids[], + int *rss_target_id, + enum flow_eth_dev_profile flow_profile, + uint32_t exception_path); + + int (*flow_eth_dev_add_queue)(struct flow_eth_dev *eth_dev, + struct flow_queue_id_s *queue_id); + + int (*flow_delete_eth_dev)(struct flow_eth_dev *eth_dev); + + int (*flow_get_tunnel_definition)(struct tunnel_cfg_s *tun, uint32_t flow_stat_id, + uint8_t vport); + + /* + * NT Flow API + */ + int (*flow_validate)(struct flow_eth_dev *dev, + const struct flow_elem item[], + const struct flow_action action[], + struct flow_error *error); + + struct flow_handle *(*flow_create)(struct flow_eth_dev *dev, + const struct flow_attr *attr, + const struct flow_elem item[], + const struct flow_action action[], + struct flow_error *error); + + int (*flow_destroy)(struct flow_eth_dev *dev, + struct flow_handle *flow, + struct flow_error *error); + + int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id, struct flow_error *error); + + int (*flow_actions_update)(struct flow_eth_dev *dev, + struct flow_handle *flow, + const struct flow_action action[], + struct flow_error *error); + + int (*flow_query)(struct flow_eth_dev *dev, + struct flow_handle *flow, + const struct flow_action *action, + void **data, + uint32_t *length, + struct flow_error *error); + + int (*flow_dev_dump)(struct flow_eth_dev *dev, + struct flow_handle *flow, + uint16_t caller_id, + FILE *file, + struct flow_error *error); + + /* + * NT Flow asynchronous operations API + */ + int (*flow_info_get)(struct flow_eth_dev *dev, struct flow_port_info *port_info, + struct flow_queue_info *queue_info, struct flow_error *error); + + int (*flow_configure)(struct flow_eth_dev *dev, uint8_t caller_id, + const struct flow_port_attr *port_attr, uint16_t nb_queue, + const struct flow_queue_attr *queue_attr[], + struct flow_error *error); + + struct flow_pattern_template *(*flow_pattern_template_create)(struct flow_eth_dev *dev, + const struct flow_pattern_template_attr *template_attr, + const struct flow_elem pattern[], struct flow_error *error); + + int (*flow_pattern_template_destroy)(struct flow_eth_dev *dev, + struct flow_pattern_template *pattern_template, + struct flow_error *error); + + struct flow_actions_template *(*flow_actions_template_create)(struct flow_eth_dev *dev, + const struct flow_actions_template_attr *template_attr, + const struct flow_action actions[], const struct flow_action masks[], + struct flow_error *error); + + int (*flow_actions_template_destroy)(struct flow_eth_dev *dev, + struct flow_actions_template *actions_template, + struct flow_error *error); + + struct flow_template_table *(*flow_template_table_create)(struct flow_eth_dev *dev, + const struct flow_template_table_attr *table_attr, + struct flow_pattern_template *pattern_templates[], uint8_t nb_pattern_templates, + struct flow_actions_template *actions_templates[], uint8_t nb_actions_templates, + struct flow_error *error); + + int (*flow_template_table_destroy)(struct flow_eth_dev *dev, + struct flow_template_table *template_table, + struct flow_error *error); + + struct flow_handle *(*flow_async_create)(struct flow_eth_dev *dev, uint32_t queue_id, + const struct flow_op_attr *op_attr, + struct flow_template_table *template_table, const struct flow_elem pattern[], + uint8_t pattern_template_index, const struct flow_action actions[], + uint8_t actions_template_index, void *user_data, struct flow_error *error); + + int (*flow_async_destroy)(struct flow_eth_dev *dev, uint32_t queue_id, + const struct flow_op_attr *op_attr, struct flow_handle *flow, + void *user_data, struct flow_error *error); + + int (*flow_push)(struct flow_eth_dev *dev, uint32_t queue_id, struct flow_error *error); + + int (*flow_pull)(struct flow_eth_dev *dev, uint32_t queue_id, struct flow_op_result res[], + uint16_t n_res, struct flow_error *error); + + /* + * Other + */ + struct flow_eth_dev *(*nic_and_port_to_eth_dev)(uint8_t adapter_no, uint8_t port); + struct flow_nic_dev *(*get_nic_dev_from_adapter_no)(uint8_t adapter_no); + + int (*flow_nic_set_hasher)(struct flow_nic_dev *ndev, int hsh_idx, + enum flow_nic_hash_e algorithm); + + int (*flow_get_num_queues)(uint8_t adapter_no, uint8_t port_no); + int (*flow_get_hw_id)(uint8_t adapter_no, uint8_t port_no, uint8_t queue_no); + + int (*flow_get_flm_stats)(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size); + + int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be, int start_idx, int count); +}; + +void register_flow_filter_ops(const struct flow_filter_ops *ops); +const struct flow_filter_ops *get_flow_filter_ops(void); + +/* + * + */ +#ifdef RTE_FLOW_DRIVER_H_ +void register_dev_flow_ops(const struct rte_flow_ops *ops); +const struct rte_flow_ops *get_dev_flow_ops(void); +#endif + +#endif /* __NTNIC_MOD_REG_H__ */ -- 2.44.0