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 449364414A; Mon, 3 Jun 2024 18:19:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BB2C642E83; Mon, 3 Jun 2024 18:18:44 +0200 (CEST) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 2100D42E64 for ; Mon, 3 Jun 2024 18:18:40 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2168.outbound.protection.outlook.com [104.47.17.168]) by mx-outbound43-249.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 03 Jun 2024 16:18:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fHoVXFkbHcr2SR3LwAeiwzvXb6exzgfUdWtFXFmpLqi4dbPkowQJj2Ra746jGW1tuFRxFv9wcbm5uvQIsNmopOXpilww5FOdqgnpa7QqA9z0RtS5mkVYTY9uWoblOmeShYnitxArda21ABEmjgdImSzT/NxZrawJ/iBwP8vgGZ4T35FHtymwROKZuLh/5pZy5odWqIyQk5hjp87N3vEisvdjpnBO3fyT2WX24BmMYbigcr4ybOMrHtPe9VqH+lexObfJEPhW/Q8FLUE7rQ2kzsly8iqLoGY6x7dBc5L3Gizy9sej0LWLh4Wnqxfp66jf65kOkAHyUDRs2FFc0m0abA== 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=s1NuTVUtkMNhV8l8Ooo+ZrIB78ustqp3UAalWNhZgRE=; b=kA2mcSZqjjcu2vzNjN40wezDehOChn+3c5ze/4kAz31W37OQ+K7wC0MSJ0l/iCWQZfvu4yslHB35w8gBy2es0vp785Fb2FuQVTHHiyWZw19dkmCMZtCGRwaY3jSwvNzu8GzUaoLvFUK6W7KJ2kG2g1jW8emFJhPiM37Ll00iH4kW7RlotfcxgDoD1UJ0s9eCkZp8CialgC+Fmgd2jn8LGxipyOW1O1FOLKzsgKv/bgVy8ZoAbeziZR2ON+ZE5O9ESWCQE/81bqC3VW3OSw5xhb61p+0MxTkZemZbyrkFKpjBKKu/d+sH5VO0ya1ZUu6nff4rI0PLBGxHOPtJc7i1Ng== 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=s1NuTVUtkMNhV8l8Ooo+ZrIB78ustqp3UAalWNhZgRE=; b=lN9dLQ4yhZisfhNvLjUDV0rg/4ce8PINtNs+3hySY801w2IX4h6e70bRp8WCi1r7aXt5NPErivs8VxIV6J5giRt85VDwVXkjhtgB9oSLoTaHAie6YXaG1Rc/Oa+u7J1F8L1mmhcRIfbEPxu5eUxcIYk9H5KEa1EPqWNaH01u2ZM= Received: from AM6P191CA0080.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8a::21) by AS8P190MB1144.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2e4::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.25; Mon, 3 Jun 2024 16:18:36 +0000 Received: from AMS0EPF00000196.eurprd05.prod.outlook.com (2603:10a6:209:8a:cafe::6d) by AM6P191CA0080.outlook.office365.com (2603:10a6:209:8a::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.29 via Frontend Transport; Mon, 3 Jun 2024 16:18:36 +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 AMS0EPF00000196.mail.protection.outlook.com (10.167.16.217) with Microsoft SMTP Server id 15.20.7633.15 via Frontend Transport; Mon, 3 Jun 2024 16:18:36 +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 v3 07/17] net/ntnic: add API for PMD driver modules Date: Mon, 3 Jun 2024 18:18:04 +0200 Message-ID: <20240603161822.59552-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240603161822.59552-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240603161822.59552-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF00000196:EE_|AS8P190MB1144:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: b76e5aa6-bfff-49b6-12f4-08dc83e8d24e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|36860700004|376005|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BalULtb8IyAfKL3EiwC3nMyjNN1FJip7BDO5KSUniDnrl7n+3oFUaB0UqvZ7?= =?us-ascii?Q?8zfWYf08bTPKged6dep5ezmY1lwFXx41ZFZbWpa59zRdr1BrRhap1hH9TMCi?= =?us-ascii?Q?rsumog/ssV+a38Yktu/AJrI0kbAusO1s8UVR6oCcH3w09wUNwVo7IZ+7oqlK?= =?us-ascii?Q?/lerG1E52cWpaAbEGRb4LhdkEhoYdCBaRu+f7ZTFILVZfKtu1ied3V+B1yCA?= =?us-ascii?Q?1spA80+BHevYjZ9oWCRTImMWUaWEJzJYW0PT0R/T8Hfkf3dlkdAN7Y3I5GSM?= =?us-ascii?Q?bC8C99rInJbiTOSpbzbS4VSM7q+gzRS8wnC8uHmvcrzqYLeenXSquiiIjxQa?= =?us-ascii?Q?8hhckGl7SAPOK/X5FDlzg7Om2SQFZRs9/S/iatUC64EZBp9FdTcB415HEGqn?= =?us-ascii?Q?uUbd1KUXtWTkBNGQkaskjKXdwJQMsaNWB7XzDkp5ryJ9muptBJDTL+U+9W2A?= =?us-ascii?Q?6TJZWnsrYq/+ttQ33ipKcSS4e1MYxJX/nDwYa4cEEaZHSFjsxhPa9h6Ke92D?= =?us-ascii?Q?EC0ylOTfZInQeRDzv23PJinha6ECwA64u3UpGY5fiABmdj//zQEaFlRIuuAo?= =?us-ascii?Q?2kJxS9luJIAP4L8Pd5OtYmGC25mMHXYwiLrgtEo+uHRV8t9mUUUBQWOJqb4G?= =?us-ascii?Q?DhN2tNCIZtBsfX7FNTW94/2jTdtrtqiUPSR1knw6kUHQgtAEnYIMjO7L4d6U?= =?us-ascii?Q?4fRBxoZvk2fTDgXBZCrvrWpnsiCpjIO+XOurghAm4P6f1OD6ynbYiBr8rPCP?= =?us-ascii?Q?eOM7PppgxZmjDZGIe7JyD6hf9KLVBKRY1th9r+IFlGyQsucfZJEmXL1Vztux?= =?us-ascii?Q?lo+h7WuFttgi7g6PBLpGnayKfu+UB3eSphHOSFJ4VaN5+fGlcWB0S3AQW7f3?= =?us-ascii?Q?OUYIFr8QcsOGoJy6VuBSrcZgzR2NPSOqMkcm324RvOJ+HbF9llEjiqeoHPzl?= =?us-ascii?Q?QeaOIkdM5wWAXyVZQ+ucPvt6UDU9lOVBHdlDQ4nmuAen0oV4mjYDsgHEG5o3?= =?us-ascii?Q?GOyiccHyp3vdsghtS1zVqjSDj4QoSGcQ7qASuPHg8lDzy98bNYQMEhyQPwdU?= =?us-ascii?Q?vtbTrQOxecGgW0RFfWItgt1SuqQ1VbAuyOwUc5wIAOTL4dO6fo5vGOoeXQ6E?= =?us-ascii?Q?bRTcTszRCeZC89KapQydvs+9gcTyXqA6LoZyX2H2SUlTQw/Fz5AMVS4eScz7?= =?us-ascii?Q?Hi05gwWCZlT8WcHh+UnuiSt/PCsy8xQhRNm1b64zq2I502VlRdu5++blGNTt?= =?us-ascii?Q?D+sdSc9gqLboEQ/GsSwBJRRxpZGjNm7Pq5hebP6yFMlyl0Gp0UgN5a/cM95m?= =?us-ascii?Q?/r7PXwzBhQ+wVLShN6xbhipSTuUIUVPJeLNLtCIGq2qCYpNXloVzPef1w6bw?= =?us-ascii?Q?6CKzvpE=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)(1800799015)(36860700004)(376005)(82310400017); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: yUR0iCvQoOB1loIR3eJFhPg9JoCCbtJp66fRaQql2sC6NvH71nEphMiyOBCtHQYrqjt2Qb/qDRkrILLNHhtn390tavI/zrms1LJGfjbV/OT6RMzxo4ULefXgn6vkIsPnochYzxXbPzUjBc6+rTW40BYuP6Nb8DNxFBuarz3RieB/N4OLE4htY/5/HJbBoywDYOIUp/Da9th/L/EdByTytLkpDcWW3d285+D8E1GPWUJQQAFQ9Wjh6ZhsZ/mfEGyhZVsgvE2QOrR5g4Lg3WQjSFkLM6sl6Cn/g+p6ip2si3/QAGsmKjcpnmYtIhqY0Fm92m5IJu9jKpMlWPvujUI48R090d45UwW4bXCWI+alFghbjTLul0sOBwuAODnCUd+DzHeJ1cgBNN9hST5JjayZ/pfi+VuT/1XRVRNT0ShMUZAW7QgXAx8iinqK5qKF2vEIkw9LBPSREFoXCNoYxn9MVdcQPWTmdPIQ/nsaOWGfoqhVea5xDFBf5K3rU0nWLr5AcSfTzTGrWNNAc/OXp2RLPzkA6kuHggse9+ezpW5NY9OxuUF8FT3xFg2xzHMtjPU0h0K3B3qyAH/nKo47P6oulF7oYyw7fQkhC6zkyMo/4dzuGCjH2KWQux2tJduuImDOOduDlRO3dzHYT9s68A+P6w== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jun 2024 16:18:36.2501 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b76e5aa6-bfff-49b6-12f4-08dc83e8d24e 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: AMS0EPF00000196.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1144 X-BESS-ID: 1717431518-311257-12793-8275-1 X-BESS-VER: 2019.1_20240530.1612 X-BESS-Apparent-Source-IP: 104.47.17.168 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsaGBkYmQGYGUNQ4JSUl1dzQMN HQxCzRIM0i2dLYwtTY3CLFzCjR0sIkSak2FgBNRsdqQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.256698 [from cloudscan17-209.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.45.0