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 F1B5A44111; Thu, 30 May 2024 16:50:18 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7B4ED41101; Thu, 30 May 2024 16:50:02 +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 A30FD40EE5 for ; Thu, 30 May 2024 16:49:59 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2104.outbound.protection.outlook.com [104.47.17.104]) by mx-outbound15-68.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 30 May 2024 14:49:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YpgjJpsnoKCZtbfwU1qKYYPCkLXLV9N8ri/1WvyYii2dx8m+mJsDXPzeKwzbYJrlIsVZwiHNebh4Behe7/Hfe3VYcwD1ZzyGOHmnPzQeAELd/n4aJrVR0Ofz5CPFJxJiCYDX6UefzJ0gSUFkSJ0FOK+kQn6c0YZewKMwC8xAmKkEu1kZp7bDb5DUUhML+nNp1kW6JH7tU3PnhnxEOXCokhAwmaiv8YgICK7EXwa7yLmal3fZj7t5rUpJRcqUp9rGVYh40VCRfuHsvhS1vJNZC0IsVJ8fXK6aFD2R8jaFDcmCFKdaIAWqgzDRPJ5xjgtbaslIGBdzjHFAzddIBoIixA== 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=oqoYti14RDVjvr2PX3N6VS4bQQsBRM7O+tHAIhA0JOs=; b=WCltDzy3Rlv1SelPcZrWFf4bpeeMOLvRwJS1eKoW6cmGNozlth4VoesMbmZUm3LF6uQfba+/dPvvO5t1bjoa6XPPijveOBN+x4djj3sWw1jBk2PcYmS+fVW6lobR0M6Wl8SyLxiSyQoc9qF/QEcOKjnEEpdtotQXMfETQdylDYzrKSdSWuJ+JN+FBlsx/Esf/mlkSAXr53DXA5SozF7ZaAlp5WK5zQG8O2OqzYNlz/36b6wskftcbKWGyUn2RqpTb7iRCR2gh48myqNWy47vggbdV80sYF+21lc2xLLnrrlDsMVtKgwa3YZ1J3tZs4DDBkPkPIrijP+7hGMM6B6S0Q== 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=oqoYti14RDVjvr2PX3N6VS4bQQsBRM7O+tHAIhA0JOs=; b=arMn63zRYWjL/1iyB09Uq1n11fPgPJLysft/CBUtOMOkc6cpnu1SJm33L7JrKhUzowURxyyZNIDhpycuhhTKsTlvL3fo+bP0ynRiOduC4VdaFdpgVDwLZfMdGa1p443J9OC+rvEG4PhXrYIycN+yySJ4zNdspMfR1LQdL0o1N3Q= Received: from DU6P191CA0044.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:53f::24) by VE1P190MB0880.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:1a6::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.22; Thu, 30 May 2024 14:49:55 +0000 Received: from DB1PEPF000509EB.eurprd03.prod.outlook.com (2603:10a6:10:53f:cafe::23) by DU6P191CA0044.outlook.office365.com (2603:10a6:10:53f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21 via Frontend Transport; Thu, 30 May 2024 14:49:54 +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 DB1PEPF000509EB.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server id 15.20.7633.15 via Frontend Transport; Thu, 30 May 2024 14:49:54 +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 v1 07/17] net/ntnic: add API for PMD driver modules Date: Thu, 30 May 2024 16:49:04 +0200 Message-ID: <20240530144929.4127931-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240530144929.4127931-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509EB:EE_|VE1P190MB0880:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1dc7f949-ae02-4a7a-12bc-08dc80b7c4bb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|82310400017|376005|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rffFb08soHnxiW7cMviR++qgAP6zZZyFJnVktDtlpPmJWnJe8QaKumUC9Jvx?= =?us-ascii?Q?vZ4LHL46/vvqYu3F23Zvgg35kdUZbIhohryszTfbDu0Cp7lADEPb3ilPfl2q?= =?us-ascii?Q?bLalEd0p59uLwiu8GCwuAW3kbzQo91A4HPfiWVsgYBWliQApeEAo/AkTRhHf?= =?us-ascii?Q?WyNjsl0INDeBTK6/IFkjOYVqdB6AKHEqZTMMW+fu4fbECaAtD9vHKeSUxeBt?= =?us-ascii?Q?3wZ7RzSgdGLdaHYThYKT9DDqSptQcU9+KAhQ4Ptg6B58pV/FHqkbg8G4vcXw?= =?us-ascii?Q?A3NkC776rHrmmwVqSP6IBdeIy2Rb5Ha4VcC+RfXv5wYfc39n12cynrBcXNpk?= =?us-ascii?Q?XKMwiBuqyE3at50ZyWaPZ3M1DE9b69mdCc+vHVlxku0LAPnTdqFT6KlDEcZG?= =?us-ascii?Q?lebf9W5OWh1UDUFdW2hSGh3/2DSjqOtHDgztbZ0gmtX+KnDt3xshCzGPQbSR?= =?us-ascii?Q?HCiiHaQCvChN0k2GQ6eRvgh//z1cx5wtI8c0gGxhLJpjSryqnTD+uRQ3puEa?= =?us-ascii?Q?qGsX0ofLbLvYB4jB3mF+zFR0ywfgPRGZL1n78JbYtNzdUaLp9rCZ6gb+wQvQ?= =?us-ascii?Q?Vy91hF2YOAExGmsZcc/0B23w7hS8dHpdX/6m5nQWeWOsuxp1elgvx5z4p0VJ?= =?us-ascii?Q?f5syDxZY2iUtDnR6fGHuAqrQXZpmOCYaytlV2CGxCxGmr4uqjv1zh4rhV8kN?= =?us-ascii?Q?dylVQVJS0UyyQhd/djWk77bTJBaUZ97bdP2A/v46lwtjJEBQ34BW5NgFa6SN?= =?us-ascii?Q?dZniW7pR6fQAKo08bfqynNCWzRzaWtk+B9DGJqwz+/9y4kvQgFCnbpQmGJ8f?= =?us-ascii?Q?oj6GjqZ5XSGZAZ12rF+h+66z06RTmNPMka64C0p605PbF1oOqTsXRzq3sqoc?= =?us-ascii?Q?24UZZnlWGn0R3wPA1arX21yJjAuVWxM0EZjcLwV6Y12IANntPR8u7WBzMG92?= =?us-ascii?Q?nqAZQyvPPGoCM2gLMRvzEyA4eX8hMlrXI7DjXjBB8T/FtoMuemyxrt8etxFc?= =?us-ascii?Q?PrLJEKJtt8icbIlMG2E5c3zz9MwlbyiL5K/MuUXC74lgMTmgwXqI8J2OM66l?= =?us-ascii?Q?z8c6nUlC6WHMXnZ1Yd4TMYnVH9pSYZdgYS8lLP/1VG1Ni6riSwm9aLCUaVTW?= =?us-ascii?Q?uRw6Tp9VOCOKqOyW7LAZ+UmGV0oGM4d34VBJDFWy3jkgAZJXw3kKgTHP7znh?= =?us-ascii?Q?hqw/TuS66VkurQRRV/7jU46AzxWs6nOE9aV17WXqhimSW1HB4DJdrlsYCRWO?= =?us-ascii?Q?+hjh5DoYMnNYp/hmlEcwH3FGFy2ICZAldW+YAWLNr/kUX3Ry8FOsMc3l1TIz?= =?us-ascii?Q?/VTeIIHyofDFX3T8L0fP9tr3nKNRmiRHsipxyjRqoGqwmn9S5p8wdGxJJRln?= =?us-ascii?Q?R28jHT0=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)(82310400017)(376005)(36860700004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: bUrZDB25XbzqT6oauU3tQb3hOMo+Vi1Nu3CqVMb9ZQcpJw8M/5+UgaDwO6Oeuzvo7P1DLJhQdPuiXc9rwgTEsBRCOSZDyK2kXMF7MubsktyLUfMLDcUKcBqTXBMhnJa6RNGYSmzGCgOkvaBWwliDQlxN68JB2wmAMEQyEOpw1JcYUGG8A2FS4XBR8U7KAhQKykglXz4+jlkr9zNWCkB1TvWRU5YQ028URXwmy3+PB4AS089+O7HlfMkFiOFumrtP2sMScmBwt0zNBZym60S3PqaQKBIix6uFVSgF/pidqOdM1o6paLjY0Bmbco48bEc0TSr1Cqvf64SDX0H2ZkeYWe09hLvJOcbHtyeBmSgtlk6CkjQO5/V+vgWRq5Y9im44vGtnSzsinxG6L+HCr/gaUeqrSt8iHWteQSCaX6HWUKCMVOAy8b8bHzY+r/L/ToJrdxImpJ1QE2Ny4/ZmnAetVN05oDSKWcZaqdXB+O8GrhgeNEWpChRztm26C73e2DzCkKVHEzGxEdJ8XeQ97qgjMoKcO0FHV5qI6O5TYQ6frUXyT2V5aEktYtPRYjCcn3WWwo0HhBYGZX7jp2bxdLzfGuLAG8cl2ZRTgiKYGUPCwTo/yge7P2rT4nrzJGP60zTOzuiGNBy6j38NEOXGDCplYg== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2024 14:49:54.5232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1dc7f949-ae02-4a7a-12bc-08dc80b7c4bb 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: DB1PEPF000509EB.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1P190MB0880 X-BESS-ID: 1717080596-303908-12708-38175-1 X-BESS-VER: 2019.1_20240429.2309 X-BESS-Apparent-Source-IP: 104.47.17.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVsYGlhZmQGYGUNTYyCwlJdXY0j gt1czELM0yKc0kzcjIIMncwDQtJdE8Sak2FgCdBysHQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.256603 [from cloudscan21-6.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 --- 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..acd8da40d5 --- /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_convertion_fun_ops *sensor_convertion_fun_ops; + +void register_sensor_convertion_fun_ops(struct sensor_convertion_fun_ops *ops) +{ + sensor_convertion_fun_ops = ops; +} + +struct sensor_convertion_fun_ops *get_sensor_convertion_fun_ops(void) +{ + return sensor_convertion_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..718f3245c0 --- /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_convertion_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_convertion_fun_ops(struct sensor_convertion_fun_ops *ops); +struct sensor_convertion_fun_ops *get_sensor_convertion_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