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 5E90D45509; Thu, 27 Jun 2024 09:40:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C8DD40DD2; Thu, 27 Jun 2024 09:39:38 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id B29F640B91 for ; Thu, 27 Jun 2024 09:39:32 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2041.outbound.protection.outlook.com [104.47.11.41]) by mx-outbound22-108.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Jun 2024 07:39:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UOXZxXP/5Vrpup4W/fyFNjYSP5Nlk+4zYvv4JDZAjGJ/VktsvPkXZsBPeUwMutloGu3yA7W+dN3zQ/hXC7fvhBL484zJzMOw69P0rJ3W6NhMElnMay4pSM6ox1shjravn/wQ+nwTEV0fk+Me5NbL7ROWYvhEjP8JAos0TlyHEygG8PHAQfBdFlOOjfI4b28VDXdTyhswbwpZ7eQotPAz9KTpOIONYU4hD0YaotUxslwSbZTJwC6C28kzFtm9UKdlPtwExl980NzNKpKA+uYFKuUzul+FIKHnyjoq0cWZjgkQ+Ab5yybTzue/YsLujKK//1hkf75G8lNiDT5scuo0Pg== 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=cJUPgD4qRMKS2VRVIxnia74nGORnaB+tZJae09rex2P8D3UiY/e/+drIzuK/jJ8lCOXkIzupPyGYHSYIqV6elbmIMo+txqNLsWSo7RPm2XgcmmZF+IZ/m/CNClqzQ19+kpgkHSY90RmZHkEHuqWPyWmnW+tFGiVxcO3/GC6U4otKhJHI+H6N46gfRL+6Qqz6S/CtoPUn6B23rE34TcA6dUQR+C+duFbBVv9o2YOpQ04nnrhqlCK8G1MdYHV7JWQ2aKhwnhYR2V53e3XJVgUjyUxB+1siQjE4ye/ZlONaKM79BGpYvDBp7+pHSOU2sPbARThh5sfXH8ta3+mP6bW/5g== 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=npUsleEGEAXAk5K6ts6xSEMRviNpf/0OIcEwNmpz6cT+QUA7LD0vHUFGcCBMY2nMqcUySoxH8gS8MqONJ+EuEDfBi9dt3La0QKdk+tGUrbfKjWhPv8uiudK7bYXgidv+6fGOcIYYQDjoPxUNuWn9LwO1ArrCK/Zj20yLUjiF6NQ= Received: from DUZPR01CA0341.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::11) by AM0P190MB0611.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:19d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.35; Thu, 27 Jun 2024 07:39:28 +0000 Received: from DB1PEPF000509E2.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::b6) by DUZPR01CA0341.outlook.office365.com (2603:10a6:10:4b8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7719.25 via Frontend Transport; Thu, 27 Jun 2024 07:39:27 +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 DB1PEPF000509E2.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server id 15.20.7677.15 via Frontend Transport; Thu, 27 Jun 2024 07:39:27 +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 v5 07/23] net/ntnic: add core platform functionality Date: Thu, 27 Jun 2024 09:38:48 +0200 Message-ID: <20240627073918.2039719-7-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240627073918.2039719-1-sil-plv@napatech.com> References: <20240530144929.4127931-1-sil-plv@napatech.com> <20240627073918.2039719-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB1PEPF000509E2:EE_|AM0P190MB0611:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 8b2f946b-b851-4d72-86fb-08dc967c463b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Ant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XehhpuDLoVb+smSSHI7stUhKAYFgaPT7Ku16knQctMOGf1/DA?= =?us-ascii?Q?zr/Rnk7gP/nHV+l7gIayCRa83ZBBL6zEoSpVkkzKVu2lN/8eAggEqz//xWAz?= =?us-ascii?Q?ALxdGRPftR76OElAy14iDoTubhI681hx0Z87u+ASzwTCY0/nKJ3dbxAiNwVR?= =?us-ascii?Q?Xv5BQKDOrDRrSWWeWNu4SyOrjBVuNLhaOKxL8l5GtnlSScxYaZghyMOZQ5po?= =?us-ascii?Q?o3X11eIK9pxk2VZKX+l0bcr6AZHizglsTSzcI11n26UZ35XU0MXrma2PGFOX?= =?us-ascii?Q?t131IIxqtYi0Tp64pdtggTw7T9fHT+IoVzv97vS2l88pObhDBqJDXxZnb5tt?= =?us-ascii?Q?hsQDchY/fh0U6ALw6xd1Gdj0F5ANZsMIXrfWLeQXIapBWNSGTf9m4sRUvfvj?= =?us-ascii?Q?L/uxFr7CQ24UWVhZbHhPFXFbaBJUA0MdnyuJQONLAcCPaC9BKeHO4VUnC9Br?= =?us-ascii?Q?yNcW+hUZnGEtxBxDhosm/EJxuKtm9b4oSHd7a77EFLrzXiWunMkXC3r1b3v4?= =?us-ascii?Q?OIP8sgq5YnLU6z9SiXoEi0RElT7E3bzHpoevde5mH2i5N+VsGSb2ZZROzxlv?= =?us-ascii?Q?iGGXm3ZdAhIGurZdRi2ncbHs7qzm4Jj8?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VrFqS7Hydn5gobYgXYdmJQRpt0ScZcXokAcd6O0Pr1O8sJ8f/gCDVtZslMfV1lffQL99N7dYzqhtPsYRLo/JQLvv1QjhjeCwduviuldNZvkui6JpM1wqEHlkx3RhxNiqxjUaZIyp3bHhlt0UqWUR+7LPvs4Yk0m1wjBnvO0whRSJWCBQlzAUNBm4pWsRP4F32y7AINcwQOFPoRzKiK/pgvWHu5I2iRXwh8vbt8+W7QWkFgw080cjscUNHm5CvMDkJI1wj3WHY13DfWIWTw97xO2l5ohM7KrwKJhosGvTaSzSfpysbvk02dPk/DAkZf56vrUJMxAj0gwgskYkGqUy+C03hXTyq0/SbMv2oeC86f8nF0g7BvEln0b1jL2rRV25pcLX3DcwKD3oPZAzuLGW/a5W4FZj+K4g7MZ3r4YdkJsmR5SSdPLUJlcY26eRRMgy9aWjyYI6R8TRglR2FQfHnBK7nxIQkYzGEMi/eXBF2d81Mb46N0iPQX3n1/Kilm54hJ1Vd8s92eKA80JEpb0f8qxrcHVX0BXsYIs/gTHb/mW/1gU/4lCvoTBk31g0RJYoxfXC/0+p+g8V1/vD0hmhy2tlUnsXOJkEuD1BbL5C47De2U4PVEiplBiG/3TwjKOm4ndmcNwuJgkB+yap9XEk+Q== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 07:39:27.5372 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b2f946b-b851-4d72-86fb-08dc967c463b 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: DB1PEPF000509E2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P190MB0611 X-BESS-ID: 1719473970-305740-12659-2605-2 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.11.41 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.257231 [from cloudscan20-36.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