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 CBA9D45501; Wed, 26 Jun 2024 21:56:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CB82940669; Wed, 26 Jun 2024 21:56:12 +0200 (CEST) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id ACA0940664 for ; Wed, 26 Jun 2024 21:56:08 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2104.outbound.protection.outlook.com [104.47.17.104]) by mx-outbound14-103.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 26 Jun 2024 19:56:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MLk6Sqbn6blzKhn/Ra2mgvJlLuugL7T6EZLLFDCSxK5gEJYRrVruC9mmE1ZMrpomf+NQAm6e3jxjKQ7+iZUoYb4rARNE/+I8gBgPdL0gq0NucP5Eu9f4+WOVm8877E0hItWGQ7z1v4gFZHNteBQi/+rUSXxTgxGDvb5y4oSCqP0mV6J+5HgmjoSdpq9NHX//+B44/FN0wJ0esNeEb1oWgilNNUH++W5Isw5ARrpdYU4XKMfdtGaag1kFU180ae613vQRJULeliVbVjh6nya1CiiMSUj2cvGto7iEOW7QszUAPR0qpcnBmi5QX/k9T9dnDrvKMXZ4DdiMRkvDXxw5gg== 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=WbcOaqLdKGsL88FnDDwSPf6RWa+cLQx8yKgVEMGgFlk=; b=d1uxu6xzyRafnLtENMs+Hxq+fJTGCgBi76oH/0jI6oJJoLs2gbDuACt2wElY4KqX0ZVxc04qnxBKVub4Pe/33pDUeX+URt8pP1UnLe5Q03D6wmBVC+rG4UhjGWwMbil74fvQy/R+7HM3ObW9Ud+zvOBP2b5VOiRAG9iEwmQxH1Dfdp48VZNvaXL86dUDg7uqRrIfWMkDR8vWt0EGxQXygzp80vL/iXp+sCB7yzWmueTSmoZag2uxoAn4o8Aw+KbZZOMwSDDMq7Z8NcFj2h32SCE3Qx26uuUECw4ATczL8LS89j58oollgC15JPA9Ooin40LonmuXYx4Mzyal5TQoIA== 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=WbcOaqLdKGsL88FnDDwSPf6RWa+cLQx8yKgVEMGgFlk=; b=caVSyiLJQBSuCvj0XJvb5XI2WuP03WUsIjq7W34Yfvv3Rby3Wxh18TutaErrU2bJ4n+RctpQv4DC166H/7QgK1QIiu3XLrquj+2sN/WfmjJB+7s5Yhkhdn0A6NDrbfJQl11uGUUeK7FKhqkCBEL2eosUpHtEMQ097tdt59O2odM= Received: from AS4P250CA0019.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:5e3::10) by AM7P190MB0630.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:115::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.32; Wed, 26 Jun 2024 19:56:02 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:20b:5e3:cafe::23) by AS4P250CA0019.outlook.office365.com (2603:10a6:20b:5e3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.22 via Frontend Transport; Wed, 26 Jun 2024 19:56:02 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft SMTP Server id 15.20.7677.15 via Frontend Transport; Wed, 26 Jun 2024 19:56:02 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com Subject: [PATCH v4 07/23] net/ntnic: add core platform functionality Date: Wed, 26 Jun 2024 21:55:17 +0200 Message-ID: <20240626195545.1793419-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240626195545.1793419-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240626195545.1793419-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|AM7P190MB0630:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8808bc20-66a1-434f-e3bc-08dc961a020d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230038|1800799022|36860700011|82310400024|376012; X-Microsoft-Antispam-Message-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wlrGplvoeo1nxXxCfamyRAGnGoidCfdyiB3PZ7olx4ITpo6gC1SiI?= =?us-ascii?Q?bfXzQZJA2y5OgLrd4aYkEfyklDkrWc0mpoaByJk9Rqu/pVDLtVGyqRVCQHVd?= =?us-ascii?Q?ob/UVQ21ytJhm1n68AD+YtkbINdyvhEOnTs1VYMrGbC6auSPzJ4rJaJRzANT?= =?us-ascii?Q?F+9wPakR9wrjbDrV/PG9jUyErmrGT7Dt0EbcDylCXxxVfOWNuROZClxZGMeH?= =?us-ascii?Q?Gkt2dP0Nmp+aw5ZgrWQeDFeDhZGqchE/rxD+avmN7sWY9q2o8LvIATlS2M4q?= =?us-ascii?Q?qxB8v95yKuV/qs7gDKec5GUVnUKoALHcVm6qBYmpt1aA+2lErdIGTwjAtVOH?= =?us-ascii?Q?ozzOGsKr6gbTm4YCF/Fw0iZ7pI08ZavWPoXo667nQnncQcqqzW0giXwX6gVj?= =?us-ascii?Q?IbrrVdEnGTzj92UMhDBKCiW0P+1YF1djGUDTs61S1idl1B4Ib6cGixlA5fLi?= =?us-ascii?Q?VfICowr06bJnhdTTUDBykfHeoK+DxQQDnQPXzSi4JqZV56P/ncBgx8iq7XUO?= =?us-ascii?Q?QvAng6WXZt4h77z1XXcWQvJelSE9egxM+T9owu4igY17xdG7Rg=3D=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:(13230038)(1800799022)(36860700011)(82310400024)(376012); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5RTeKALMVqle++i8cUmUZgWZ9QujSVcFKRwGnZwTnvaMQww8bFrCVDoteoAwdcgXSyqR8SP0+TajRufJ/ENuFnvyM0o127JOaTe8j5RsLe6VSHRvKCN+OY/pvi3L9Zi1BWXqqs9BPA3DbdlgoI4C1RXXfJnK0r2ZB261yju3aHWBJdr30pbMhrBrgZQ0lbfWJwhOb+5AXtrQ4jRdbyJWLnu5T0jxcayAgndi7GG/GOdvYF9pmH2s/LdZs5DFvXICBVfa9rRNfT882UF9fmNaEKKRZH3Bx03uprP0gi9/BWtlm43VLo6mAvorffCVXGkMHGkpXUxTlyhvV3X9gRrMnYBVaYXMEKL1aUXgZDHHgy5iuYhdwy0TgUUYLo407AsNK3fTFHu+lPpFJcV6GWpN4aau76eK+KxizdDPsTj38kyrhSXHQ5w23ibWLSoXJMPB2UwpmxRXAUUrcqCO+kToyXybLkmWbvNs/U8tLsWK2O2u4RAq9NYeTNMBRcWCktMCm6n3bIR2zHm8DQQ/bvvtgFu19lAeFL+VILaUaQCvzJzeFaGH8UG5HZ29w2UyEMirwnVHRDhJza585z1T36dgR1SPETdoJ2Fj9HDqViuY9Ee/nJxInbdSyDALyCOYkbVIkncwvsjV7G2m1ucrJhsK3A== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 19:56:02.5986 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8808bc20-66a1-434f-e3bc-08dc961a020d X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AC.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7P190MB0630 X-BESS-ID: 1719431766-303687-15939-41601-2 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.17.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmJkZAVgZQ0NDAzDgpKTkxNT Ut1Sgl1cLMyNjCyMTIwNzMwCTFzMxCqTYWAIYtg1ZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257218 [from cloudscan17-43.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 ntnic basic platform interfaces Signed-off-by: Serhii Iliushyk --- drivers/net/ntnic/include/ntos_drv.h | 2 + drivers/net/ntnic/meson.build | 2 + drivers/net/ntnic/nthw/nthw_drv.h | 88 ++++++++++++++++++++++ drivers/net/ntnic/nthw/nthw_platform.c | 14 ++++ drivers/net/ntnic/nthw/nthw_platform_drv.h | 21 ++++++ 5 files changed, 127 insertions(+) create mode 100644 drivers/net/ntnic/nthw/nthw_drv.h create mode 100644 drivers/net/ntnic/nthw/nthw_platform.c create mode 100644 drivers/net/ntnic/nthw/nthw_platform_drv.h diff --git a/drivers/net/ntnic/include/ntos_drv.h b/drivers/net/ntnic/include/ntos_drv.h index aed9e83c8d..0014e267ec 100644 --- a/drivers/net/ntnic/include/ntos_drv.h +++ b/drivers/net/ntnic/include/ntos_drv.h @@ -13,6 +13,8 @@ #include +#include "nthw_drv.h" + #define NUM_MAC_ADDRS_PER_PORT (16U) #define NUM_MULTICAST_ADDRS_PER_PORT (16U) diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index ff5dd81a37..3ded7fd8a9 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -18,10 +18,12 @@ includes = [ include_directories('include'), include_directories('ntlog/include'), include_directories('ntutil/include'), + include_directories('nthw'), ] # all sources sources = files( + 'nthw/nthw_platform.c', 'ntlog/ntlog.c', 'ntutil/nt_util.c', 'ntnic_vfio.c', diff --git a/drivers/net/ntnic/nthw/nthw_drv.h b/drivers/net/ntnic/nthw/nthw_drv.h new file mode 100644 index 0000000000..0b89a5c5a0 --- /dev/null +++ b/drivers/net/ntnic/nthw/nthw_drv.h @@ -0,0 +1,88 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __NTHW_DRV_H__ +#define __NTHW_DRV_H__ + +#include +#include "nthw_platform_drv.h" + +typedef enum nt_meta_port_type_e { + PORT_TYPE_PHYSICAL, + PORT_TYPE_VIRTUAL, + PORT_TYPE_OVERRIDE, +} nt_meta_port_type_t; + +enum fpga_info_profile { + FPGA_INFO_PROFILE_UNKNOWN = 0, + FPGA_INFO_PROFILE_VSWITCH = 1, + FPGA_INFO_PROFILE_INLINE = 2, + FPGA_INFO_PROFILE_CAPTURE = 3, +}; + +typedef struct mcu_info_s { + int mn_mcu_type; + int mn_mcu_dram_size; +} mcu_info_t; + +typedef struct nthw_hw_info_s { + /* From FW */ + int hw_id; + int hw_id_emulated; + char hw_plat_id_str[32]; + + struct vpd_info_s { + int mn_mac_addr_count; + uint64_t mn_mac_addr_value; + uint8_t ma_mac_addr_octets[6]; + } vpd_info; +} nthw_hw_info_t; + +typedef struct fpga_info_s { + uint64_t n_fpga_ident; + + int n_fpga_type_id; + int n_fpga_prod_id; + int n_fpga_ver_id; + int n_fpga_rev_id; + + int n_fpga_build_time; + + int n_fpga_debug_mode; + + int n_phy_ports; + int n_phy_quads; + int n_rx_ports; + int n_tx_ports; + int n_vf_offset; + + enum fpga_info_profile profile; + + struct nthw_fpga_s *mp_fpga; + + struct nthw_rac *mp_nthw_rac; + struct nthw_hif *mp_nthw_hif; + struct nthw_pcie3 *mp_nthw_pcie3; + struct nthw_tsm *mp_nthw_tsm; + + uint8_t *bar0_addr; /* Needed for register read/write */ + size_t bar0_size; + + int adapter_no; /* Needed for nthw_rac DMA array indexing */ + uint32_t pciident; /* Needed for nthw_rac DMA memzone_reserve */ + int numa_node; /* Needed for nthw_rac DMA memzone_reserve */ + + char *mp_adapter_id_str;/* Pointer to string literal used in nthw log messages */ + + struct mcu_info_s mcu_info; + + struct nthw_hw_info_s nthw_hw_info; + + nthw_adapter_id_t n_nthw_adapter_id; + +} fpga_info_t; + + +#endif /* __NTHW_DRV_H__ */ diff --git a/drivers/net/ntnic/nthw/nthw_platform.c b/drivers/net/ntnic/nthw/nthw_platform.c new file mode 100644 index 0000000000..181330dd37 --- /dev/null +++ b/drivers/net/ntnic/nthw/nthw_platform.c @@ -0,0 +1,14 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include "nthw_platform_drv.h" + +nthw_adapter_id_t nthw_platform_get_nthw_adapter_id(const uint16_t n_pci_device_id) +{ + switch (n_pci_device_id) { + default: + return NT_HW_ADAPTER_ID_UNKNOWN; + } +} diff --git a/drivers/net/ntnic/nthw/nthw_platform_drv.h b/drivers/net/ntnic/nthw/nthw_platform_drv.h new file mode 100644 index 0000000000..ab26d8149a --- /dev/null +++ b/drivers/net/ntnic/nthw/nthw_platform_drv.h @@ -0,0 +1,21 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __NTHW_PLATFORM_DRV_H__ +#define __NTHW_PLATFORM_DRV_H__ + +#include + +#define NT_HW_PCI_VENDOR_ID (0x18f4) + +enum nthw_adapter_id_e { + NT_HW_ADAPTER_ID_UNKNOWN = 0, +}; + +typedef enum nthw_adapter_id_e nthw_adapter_id_t; + +nthw_adapter_id_t nthw_platform_get_nthw_adapter_id(const uint16_t n_pci_device_id); + +#endif /* __NTHW_PLATFORM_DRV_H__ */ -- 2.45.0