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 0AA2545509; Thu, 27 Jun 2024 09:42:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9338D410E4; Thu, 27 Jun 2024 09:40:00 +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 09E2240E68 for ; Thu, 27 Jun 2024 09:39:52 +0200 (CEST) Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02lp2105.outbound.protection.outlook.com [104.47.11.105]) 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:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DJYrLg/hqoDXjzGBL5UG4OSkyBUQYCn6FYI5rwFM0WBweE/7ipRJgyvmdGtywPR09WxaXKclylwEpxnAcOUafPBiQbVZpQyyaHjUgo47JDobO4GbivuT0Mq9VNZuEcdDqict/aMb53P1Y7KXo6l42MXFpYc5ogxdwM/9WJ00Ky8TlhidKKTDbknjggF/TI0vMHblmoJhpftC5rYa47R6bGeFtNB99m3Cpzpa61YURPrlmQMU/FW4vxd8S8FjSpeJ8whg/fPzZuwdIhZd88d9SgLL5wp9yQwjWly7rsBM9c0nK2y+coO3/HrEmxd2p5dVv9OmcT6tbzCZyyOIM2+rJA== 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=1p1eB3yy3oIMS1FSDEztjbwFmrXixLuJ8VmwaTvwbME=; b=DmPykVU992URXTyA+PvLG9eTUzhIJaSps3leexki88Yyf8wYxrbT/89dJUSgrFEwPv82VyKpnIifIzwWsFjzD5K22YTGTbqyvzKDip7RbhApbqpuric7Qpjq5+8dAu+DFGpcpXreQpLLb6rL4bHEOUPrjjaf8L94iFZfwZCBaswH00FyUluLVk2EV/rarUM/sQ2nvghIkFasUUCl1dZpzl/bOL0dcdBk3SGskBTOqmoU5HehRFYKvJ4FhOz/u2fpbF2fiqr8/DHTc5g45iL+kfkeDmCc4XZ3FCENLdU3A64qWxTnCptRkhOVTdwq3M1jM5lyqQAXQMdC9XPWG6OhUg== 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=1p1eB3yy3oIMS1FSDEztjbwFmrXixLuJ8VmwaTvwbME=; b=XUm+ef2LbbacTsS4DrLTF+4EI+xw4DFyQg7Tpyumbo/B0LdhpiNVGGg6OVtaR29WCQfpsN5SXgDuMkvlPo//9a7RJ9zKbmKcFHm/EG3L/N25l7p1wAA+ZOnaqvIUVLdV1V46JkSbFydzGoe5sqXt3hNrIDxDkAy5UR84r/ft99s= Received: from DUZPR01CA0336.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b8::21) by PA4P190MB1040.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:101::11) 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:48 +0000 Received: from DB1PEPF000509E2.eurprd03.prod.outlook.com (2603:10a6:10:4b8:cafe::76) by DUZPR01CA0336.outlook.office365.com (2603:10a6:10:4b8::21) 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:48 +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:48 +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 23/23] net/ntnic: add GMF (Generic MAC Feeder) module Date: Thu, 27 Jun 2024 09:39:04 +0200 Message-ID: <20240627073918.2039719-23-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_|PA4P190MB1040:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 58f3416d-326c-4e33-28fe-08dc967c527d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|376014|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?YJLz/cGJsOlmhVqkDmv0sw9s5yiwSeLxPiyDS5gqvcyD9g1/2y/syPyC07jm?= =?us-ascii?Q?G5vX/ApkglHjKcYgtw9qZtskNiFyEu/mwRRrjYF9yY51WdRBDN3Yz/A9tx6G?= =?us-ascii?Q?/av2SUxEE/xQsk/DUPySp5079QP0rzZgdhhABqMv732sn4dXTiWZXqRPeOh3?= =?us-ascii?Q?bZ2UJNQVaivOK2yLtQBRNENm0XfBmLwBRUkzSKjUOoEoYfdQ7TWbotzi7Hrl?= =?us-ascii?Q?cK8C1UijEwaEN5TmvzGGgiSQoRn81sfMno2GuVaCOkKp6NZ/bwq0149IIsJ/?= =?us-ascii?Q?dajTh+YxEk/mNytg8tRciJVIHxckBCt0uWOOPU7Ed8yDEE0oqARrxpzOqRtO?= =?us-ascii?Q?o+DVKHpHoPXzAtHo4htDjBucPLE2TbJU5dXVWvKg9MMUi98gAXn+9hE5mUZn?= =?us-ascii?Q?uAyoNJmoAXonvmr3BZk9PRxFtUIiKqzPA5ODMJRy/jpt+6sbtrIXCQLGiFQJ?= =?us-ascii?Q?WJZC3fQCZgd3uh2uvhPW45EFmUoqfrRvdTkp5V0bmZzHDgjm/+GRamoD2jZd?= =?us-ascii?Q?VCeGWjn+OnxORrIVxwoaQW6u8GSa0aaOkqEkoOZehvq3HtOiwcL9MUUlms4C?= =?us-ascii?Q?5Q/1aM3SFZ7wY3DKyOwXAQxggZkDWVSN6I0LfwCenWTpbU/+MdX6x2sGzRIx?= =?us-ascii?Q?4ADzJsf9n7RXhMQgZ0NiYoG1rdFn0Q0UTXTxIzuOZJWQTr9ME6XtCkMvqDUO?= =?us-ascii?Q?o2BsMpnRSwW5nKaodjTu81qTPC01EA9LkigpDUvkQbYaMIsk3VlblSTzQFQd?= =?us-ascii?Q?tfjBglMWDfr4jAzoix0kcTfs+qcor3Q691AT9ffiLv8uZmUnpW2j/hbWFQgn?= =?us-ascii?Q?fGzjPi2bgcO/esIaN0ElKGu+CZOcA1zdSn5JQ9jfqkyZYKbzb/ybLzvByDUI?= =?us-ascii?Q?pyYkHXBph+dIL+JEBKf6Q3cnV91ZMEkykSQe0uKo3H1tIUkJSk2j9m2kc4Xw?= =?us-ascii?Q?nWLqheRRYKZdZEK7C4S1Ea1NdOU5mzOYhOWbir44Z6CR8IICZIV8QewMRBn0?= =?us-ascii?Q?TappRqkSIaAAQ3wL9i/fFjCFFX9z7AXfFlkwcm3p0AgiKMmeKN8c1Lh2x+Id?= =?us-ascii?Q?QWdP4Gu5/f3SgzY+tKJt/lXvyxpz8tfOOkzrjkkDjG/iarfWdkvud+DbOOoY?= =?us-ascii?Q?u1c8YhlBQ4VtTHkHcvKu5e34EXvDVLjyz6/tZtRwweGgKL7SMrS9nBDgK65U?= =?us-ascii?Q?szUSsvgdE6c6AmmNBAO9f8z0S0AsCovwOx61DbcTlTtAi5k/3TUh+eO7OypH?= =?us-ascii?Q?INlhy2pxq83pRqxaFAz6gj76tQV3qCxda7PG0mJVUVg2+TvF+6NlDNK3mNZB?= =?us-ascii?Q?rEQxqbJe1IbuqI/hN+pFfTVGC7td4TrOAfXiXrJoDCavxyeVTmy3SlUuZ57I?= =?us-ascii?Q?eEB7nDcVaXuuZGvvqXXIGCrHC/S4Jn4jLOePOQApTEL5duEjCdCxKXs2s5az?= =?us-ascii?Q?5jaBl4QQ5rH4BgXSI07/3YSVYJb+Tt3s?= 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)(1800799024)(82310400026)(376014)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 2lbwrcXiW1nGnXgCwz9VRMUBY3Hi7OBh2NG0Fbf3SOLbNunQJxq0Yhc+7yMg1AbdO8FfmJgyd44lGanf8wzPORcO1zd5gisl3V08XQtpl1QHhA4VHQ16aifhUWNp5/aSmjEiMvUT3dEHOE8vz1QDCDfvO7vlpThm4Sq0pdTMm7/hGOBQiewc1cLDri6YQKhJX/qGLAaR46ZKKxGs9zYjMGRzwfmmP6KVGBJNUUosXNOoyJVfRxzKcyBOOOOWSwfw79L9CbI3L+zZiAx3XA2GkZtthBKA64zEFttlNCaHVEQ2w7lyS4CqWPNAbzwcWhts3Vxb8KpROfW+d0Wi9xwaKE12aM5ZFiN7/yFF1W/i3hdyQh6tD1ypR86+hTrbYvRsrB/HtnCJ/+VPCVR7F/Wcg6djF41qgSOhUM6+ExGCR3iXh8bPgBQDYQUlk9srXnYsvvps649+uDAxRBGVKDBAdtVH/HEJlF8838DjeheT+DZfYRPKL+8eLNbkwUS9dghlzYT2tWCQZhkFP1rE5+5UOYrnzggIOOnyuaEmuJvbGO0miiELEwiKSDvhymM23yZZ0jsUyHPdKHib0AENBDldF1z+EYASSsF18ZQM7tjN3lwsKvnteE7sUHx9RGqcnEabpVtY1g359H5Tqo9Ug5ufzA== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2024 07:39:48.1000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58f3416d-326c-4e33-28fe-08dc967c527d 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: PA4P190MB1040 X-BESS-ID: 1719473990-305740-12659-2641-1 X-BESS-VER: 2019.1_20240620.2317 X-BESS-Apparent-Source-IP: 104.47.11.105 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVhYWJqZAVgZQ0NTEyMjQ1DQlKT nZNMXM0iIp0cgsJc3Y0sDcLNXMNMVIqTYWAMAQeTxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.257231 [from cloudscan14-6.eu-central-1a.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 Generic MAC Feeder Signed-off-by: Serhii Iliushyk --- .../link_mgmt/link_100g/nt4ga_link_100g.c | 8 ++ drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../net/ntnic/nthw/core/include/nthw_gmf.h | 64 +++++++++ drivers/net/ntnic/nthw/core/nthw_gmf.c | 133 ++++++++++++++++++ 5 files changed, 207 insertions(+) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c diff --git a/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c b/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c index 9d55733ddc..da570256f1 100644 --- a/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +++ b/drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c @@ -404,6 +404,14 @@ static int _port_init(adapter_info_t *drv, nthw_fpga_t *fpga, int port) _enable_tx(drv, mac_pcs); _reset_rx(drv, mac_pcs); + /* 2.2) Nt4gaPort::setup() */ + if (nthw_gmf_init(NULL, fpga, port) == 0) { + nthw_gmf_t gmf; + + if (nthw_gmf_init(&gmf, fpga, port) == 0) + nthw_gmf_set_enable(&gmf, true); + } + /* Phase 3. Link state machine steps */ /* 3.1) Create NIM, ::createNim() */ diff --git a/drivers/net/ntnic/meson.build b/drivers/net/ntnic/meson.build index 77f87ffa8e..4ae9358073 100644 --- a/drivers/net/ntnic/meson.build +++ b/drivers/net/ntnic/meson.build @@ -39,6 +39,7 @@ sources = files( 'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', + 'nthw/core/nthw_gmf.c', 'nthw/core/nthw_gpio_phy.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_i2cm.c', diff --git a/drivers/net/ntnic/nthw/core/include/nthw_core.h b/drivers/net/ntnic/nthw/core/include/nthw_core.h index fe32891712..4073f9632c 100644 --- a/drivers/net/ntnic/nthw/core/include/nthw_core.h +++ b/drivers/net/ntnic/nthw/core/include/nthw_core.h @@ -17,6 +17,7 @@ #include "nthw_iic.h" #include "nthw_i2cm.h" +#include "nthw_gmf.h" #include "nthw_gpio_phy.h" #include "nthw_mac_pcs.h" #include "nthw_sdc.h" diff --git a/drivers/net/ntnic/nthw/core/include/nthw_gmf.h b/drivers/net/ntnic/nthw/core/include/nthw_gmf.h new file mode 100644 index 0000000000..cc5be85154 --- /dev/null +++ b/drivers/net/ntnic/nthw/core/include/nthw_gmf.h @@ -0,0 +1,64 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#ifndef __NTHW_GMF_H__ +#define __NTHW_GMF_H__ + +struct nthw_gmf { + nthw_fpga_t *mp_fpga; + nthw_module_t *mp_mod_gmf; + int mn_instance; + + nthw_register_t *mp_ctrl; + nthw_field_t *mp_ctrl_enable; + nthw_field_t *mp_ctrl_ifg_enable; + nthw_field_t *mp_ctrl_ifg_tx_now_always; + nthw_field_t *mp_ctrl_ifg_tx_on_ts_always; + nthw_field_t *mp_ctrl_ifg_tx_on_ts_adjust_on_set_clock; + nthw_field_t *mp_ctrl_ifg_auto_adjust_enable; + nthw_field_t *mp_ctrl_ts_inject_always; + nthw_field_t *mp_ctrl_fcs_always; + + nthw_register_t *mp_speed; + nthw_field_t *mp_speed_ifg_speed; + + nthw_register_t *mp_ifg_clock_delta; + nthw_field_t *mp_ifg_clock_delta_delta; + + nthw_register_t *mp_ifg_clock_delta_adjust; + nthw_field_t *mp_ifg_clock_delta_adjust_delta; + + nthw_register_t *mp_ifg_max_adjust_slack; + nthw_field_t *mp_ifg_max_adjust_slack_slack; + + nthw_register_t *mp_debug_lane_marker; + nthw_field_t *mp_debug_lane_marker_compensation; + + nthw_register_t *mp_stat_sticky; + nthw_field_t *mp_stat_sticky_data_underflowed; + nthw_field_t *mp_stat_sticky_ifg_adjusted; + + nthw_register_t *mp_stat_next_pkt; + nthw_field_t *mp_stat_next_pkt_ns; + + nthw_register_t *mp_stat_max_delayed_pkt; + nthw_field_t *mp_stat_max_delayed_pkt_ns; + + nthw_register_t *mp_ts_inject; + nthw_field_t *mp_ts_inject_offset; + nthw_field_t *mp_ts_inject_pos; + int mn_param_gmf_ifg_speed_mul; + int mn_param_gmf_ifg_speed_div; + + bool m_administrative_block; /* Used to enforce license expiry */ +}; + +typedef struct nthw_gmf nthw_gmf_t; + +int nthw_gmf_init(nthw_gmf_t *p, nthw_fpga_t *p_fpga, int n_instance); + +void nthw_gmf_set_enable(nthw_gmf_t *p, bool enable); + +#endif /* __NTHW_GMF_H__ */ diff --git a/drivers/net/ntnic/nthw/core/nthw_gmf.c b/drivers/net/ntnic/nthw/core/nthw_gmf.c new file mode 100644 index 0000000000..a56fb80d3a --- /dev/null +++ b/drivers/net/ntnic/nthw/core/nthw_gmf.c @@ -0,0 +1,133 @@ +/* + * SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2023 Napatech A/S + */ + +#include +#include +#include "ntlog.h" + +#include "nthw_drv.h" +#include "nthw_register.h" + +#include "nthw_gmf.h" + +int nthw_gmf_init(nthw_gmf_t *p, nthw_fpga_t *p_fpga, int n_instance) +{ + nthw_module_t *mod = nthw_fpga_query_module(p_fpga, MOD_GMF, n_instance); + + if (p == NULL) + return mod == NULL ? -1 : 0; + + if (mod == NULL) { + NT_LOG(ERR, NTHW, "%s: GMF %d: no such instance\n", + p_fpga->p_fpga_info->mp_adapter_id_str, n_instance); + return -1; + } + + p->mp_fpga = p_fpga; + p->mn_instance = n_instance; + p->mp_mod_gmf = mod; + + p->mp_ctrl = nthw_module_get_register(p->mp_mod_gmf, GMF_CTRL); + p->mp_ctrl_enable = nthw_register_get_field(p->mp_ctrl, GMF_CTRL_ENABLE); + p->mp_ctrl_ifg_enable = nthw_register_get_field(p->mp_ctrl, GMF_CTRL_IFG_ENABLE); + p->mp_ctrl_ifg_auto_adjust_enable = + nthw_register_get_field(p->mp_ctrl, GMF_CTRL_IFG_AUTO_ADJUST_ENABLE); + p->mp_ctrl_ts_inject_always = + nthw_register_query_field(p->mp_ctrl, GMF_CTRL_TS_INJECT_ALWAYS); + p->mp_ctrl_fcs_always = nthw_register_query_field(p->mp_ctrl, GMF_CTRL_FCS_ALWAYS); + + p->mp_speed = nthw_module_get_register(p->mp_mod_gmf, GMF_SPEED); + p->mp_speed_ifg_speed = nthw_register_get_field(p->mp_speed, GMF_SPEED_IFG_SPEED); + + p->mp_ifg_clock_delta = nthw_module_get_register(p->mp_mod_gmf, GMF_IFG_SET_CLOCK_DELTA); + p->mp_ifg_clock_delta_delta = + nthw_register_get_field(p->mp_ifg_clock_delta, GMF_IFG_SET_CLOCK_DELTA_DELTA); + + p->mp_ifg_max_adjust_slack = + nthw_module_get_register(p->mp_mod_gmf, GMF_IFG_MAX_ADJUST_SLACK); + p->mp_ifg_max_adjust_slack_slack = nthw_register_get_field(p->mp_ifg_max_adjust_slack, + GMF_IFG_MAX_ADJUST_SLACK_SLACK); + + p->mp_debug_lane_marker = nthw_module_get_register(p->mp_mod_gmf, GMF_DEBUG_LANE_MARKER); + p->mp_debug_lane_marker_compensation = + nthw_register_get_field(p->mp_debug_lane_marker, + GMF_DEBUG_LANE_MARKER_COMPENSATION); + + p->mp_stat_sticky = nthw_module_get_register(p->mp_mod_gmf, GMF_STAT_STICKY); + p->mp_stat_sticky_data_underflowed = + nthw_register_get_field(p->mp_stat_sticky, GMF_STAT_STICKY_DATA_UNDERFLOWED); + p->mp_stat_sticky_ifg_adjusted = + nthw_register_get_field(p->mp_stat_sticky, GMF_STAT_STICKY_IFG_ADJUSTED); + + p->mn_param_gmf_ifg_speed_mul = + nthw_fpga_get_product_param(p_fpga, NT_GMF_IFG_SPEED_MUL, 1); + p->mn_param_gmf_ifg_speed_div = + nthw_fpga_get_product_param(p_fpga, NT_GMF_IFG_SPEED_DIV, 1); + + p->m_administrative_block = false; + + p->mp_stat_next_pkt = nthw_module_query_register(p->mp_mod_gmf, GMF_STAT_NEXT_PKT); + + if (p->mp_stat_next_pkt) { + p->mp_stat_next_pkt_ns = + nthw_register_query_field(p->mp_stat_next_pkt, GMF_STAT_NEXT_PKT_NS); + + } else { + p->mp_stat_next_pkt_ns = NULL; + } + + p->mp_stat_max_delayed_pkt = + nthw_module_query_register(p->mp_mod_gmf, GMF_STAT_MAX_DELAYED_PKT); + + if (p->mp_stat_max_delayed_pkt) { + p->mp_stat_max_delayed_pkt_ns = + nthw_register_query_field(p->mp_stat_max_delayed_pkt, + GMF_STAT_MAX_DELAYED_PKT_NS); + + } else { + p->mp_stat_max_delayed_pkt_ns = NULL; + } + + p->mp_ctrl_ifg_tx_now_always = + nthw_register_query_field(p->mp_ctrl, GMF_CTRL_IFG_TX_NOW_ALWAYS); + p->mp_ctrl_ifg_tx_on_ts_always = + nthw_register_query_field(p->mp_ctrl, GMF_CTRL_IFG_TX_ON_TS_ALWAYS); + + p->mp_ctrl_ifg_tx_on_ts_adjust_on_set_clock = + nthw_register_query_field(p->mp_ctrl, GMF_CTRL_IFG_TX_ON_TS_ADJUST_ON_SET_CLOCK); + + p->mp_ifg_clock_delta_adjust = + nthw_module_query_register(p->mp_mod_gmf, GMF_IFG_SET_CLOCK_DELTA_ADJUST); + + if (p->mp_ifg_clock_delta_adjust) { + p->mp_ifg_clock_delta_adjust_delta = + nthw_register_query_field(p->mp_ifg_clock_delta_adjust, + GMF_IFG_SET_CLOCK_DELTA_ADJUST_DELTA); + + } else { + p->mp_ifg_clock_delta_adjust_delta = NULL; + } + + p->mp_ts_inject = nthw_module_query_register(p->mp_mod_gmf, GMF_TS_INJECT); + + if (p->mp_ts_inject) { + p->mp_ts_inject_offset = + nthw_register_query_field(p->mp_ts_inject, GMF_TS_INJECT_OFFSET); + p->mp_ts_inject_pos = + nthw_register_query_field(p->mp_ts_inject, GMF_TS_INJECT_POS); + + } else { + p->mp_ts_inject_offset = NULL; + p->mp_ts_inject_pos = NULL; + } + + return 0; +} + +void nthw_gmf_set_enable(nthw_gmf_t *p, bool enable) +{ + if (!p->m_administrative_block) + nthw_field_set_val_flush32(p->mp_ctrl_enable, enable ? 1 : 0); +} -- 2.45.0