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 8829E45AAF; Fri, 4 Oct 2024 17:08:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9533D4279F; Fri, 4 Oct 2024 17:08:11 +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 72A2E41157 for ; Fri, 4 Oct 2024 17:08:05 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2109.outbound.protection.outlook.com [104.47.18.109]) by mx-outbound8-201.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 04 Oct 2024 15:08:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MjwcLn+KuQf5HAbaU/mdny8UfBo87VptxxZPIKv/avuA1go4MtMJ8wGwYjL9TdwjHP2RA1c4VdbVj5l/n7X9SFg+Dq3sQ7R/8JXHtyIcHx+ut9WtBxhi6QdqrQb4eDgWwbSqUHPGWiVY9lEIGju2nxer/QdyfKxuq1iedvHQLhPnsqk/b/CA8o7abCIL1MfiCwK7+WReD311aUCiARbCIhqfL4B8m/PjJqSqmr1uqzWyVc299BYdNc23olslV9U4uYUyXfMCwLWV2jBJWnp+/ikD+f9DRS5jSMWvdkQsdE3tY54fPNS+5IRDYDA2aZwAbmv/JY0wuCALQGWSWv/p0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=nlrFz0M/tjcUNIfI9/JMJ4wj2kmfkvw3yHIC15Ewjfg=; b=h2kY6UM1aJY7Km0xVxtKaQukrNAVz1JZIIDxGd9tppACVkvXlg5ZfInMgAMOVUnxCvoNQ+dV95FjpQJWpK3xUe2U/XG9wVYBlcftfJnOebbn6Ljt7uyWtshbnHdHsggLI3sqB/uofxfzRzpMWOQBMsE1XbKUvDtRcnJdF8pZmJ+n5d5RWM984z5BbbABc63g5cePUDHfKab1z2q/fX4z/jCqzJLX9OjcwlIRarQ4C887BwwaqZvLjdEOvPMr7KRBoOTp7Ast+vk4W/XLL9td9+LAx5H4P1K6QZUrSto2W/10nEg4xTc274+baN+/syRa4uuUkg1WUP8Y5pvbfbFiXA== 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=nlrFz0M/tjcUNIfI9/JMJ4wj2kmfkvw3yHIC15Ewjfg=; b=oQgzZD6dygPsbqmrRneaEetrH9pDtLF/p1XShnl2jG0lhVrRiyZ2gWjlQUOwsy1hKa2Z4RecS7nCW5EeMHxB3X6zGNQfsWWtNdegsikhJblNSEU3DW2fcVCFGhQTaDAzJByI1VILWq0MhBvreq5rgaAB6nnA8wA7+hP6QuuUXqc= Received: from AM0PR02CA0010.eurprd02.prod.outlook.com (2603:10a6:208:3e::23) by PA4P190MB1069.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:bf::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.18; Fri, 4 Oct 2024 15:08:01 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:208:3e:cafe::8b) by AM0PR02CA0010.outlook.office365.com (2603:10a6:208:3e::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16 via Frontend Transport; Fri, 4 Oct 2024 15:08:01 +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.7918.13 via Frontend Transport; Fri, 4 Oct 2024 15:08:01 +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, Danylo Vodopianov , Oleksandr Kolomeiets Subject: [PATCH v1 5/5] net/ntnic: extend and fix logging implementation Date: Fri, 4 Oct 2024 17:06:52 +0200 Message-ID: <20241004150749.261020-6-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241004150749.261020-1-sil-plv@napatech.com> References: <20241004150749.261020-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_|PA4P190MB1069:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 390d9c3b-cae4-44d3-f67d-08dce4865701 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ahjqUXjsJDpw0YFO88yZICOXDOzzS2upfY55g/bzKjM+h43akayjK3i6aTYl?= =?us-ascii?Q?gFRqQ50i0EFXht+7PP+do4U7YK0KNgcMpNC3h42J8fHT+PcT6zlW8tK51mni?= =?us-ascii?Q?spzQczOA76z6zAbeJikVnJJ14xKjfa8Mwzp/A1J2RGWnZfIivPqFa5Pyxp/I?= =?us-ascii?Q?ae4hfy+miDMInP9wwBB2Dmwx95yflwt1O+uKW57o1rIJeZReBMQeuNSwRsfU?= =?us-ascii?Q?SVypQ0wYUSIpOfLTg0GAJ0jzPLTQYoF+KrKrWr6kxZrfxIU2jNcEiaPpyKlE?= =?us-ascii?Q?pyaI0sfOeTwEx0WRvdrDq692YMgGqqVEnmTkfXkU8ege6bZLufObl+bqXdjd?= =?us-ascii?Q?bb+FQxOaaPexhC7ZWd4eLF314V6RJIyRLqBsMYvorFC4w2BdXIbnHqlE0SbO?= =?us-ascii?Q?4dp1nvR4r3J++KbijChSG6hJ+U9Ux1uWtXRKz21NysxDX85p55YaB2cED5cA?= =?us-ascii?Q?9z4ZpxsmjvFf+8TtbFfAAZmKjU0cGI6XadDwgnzGQVImvO1olmZigMSp8go0?= =?us-ascii?Q?BDYyKdQtfr1nn5LezBbWpUI7HvxTL9eJgMYP4RTfSac/xJHMFzhcu7aYCd90?= =?us-ascii?Q?NJOOq4Hh4bIA6J9DPLsLvH+328cEYGvbSy9ffs70RWdSbsV69siUvmxT1kqI?= =?us-ascii?Q?0recJiYKg6zPn1nyq/eeZJnuwTqH4FPQBNAWA9Jes2as0YA3SNMMqZk71n7d?= =?us-ascii?Q?zCcoLU74/ceuDEFU+vd2LBPEOeoEk7bMoXf5hfwJ/4PJCrBW9LAuwXi0/Xcy?= =?us-ascii?Q?bh+HRuPftK2a1dyRA01ymHM94faxG0g66XxHFCK2kafgjv6K/zFbGz3EYYAQ?= =?us-ascii?Q?jWDvs7eLWwJR0erjUWOhgiBKK2ENd/eIvnDrbMYaTs1aB4NR3BR74J3LnLUR?= =?us-ascii?Q?Eq7rTvqiokQ8D4wD+3wF7CXtJZffWZskeztkvz9G8cah/fk6zBY4pr2HZGJQ?= =?us-ascii?Q?xyUA/yyw8gttMFxdOsYhnV3ftun0Ayu1ummdtpZy25zBpQYcQh7zXGqQo/Mx?= =?us-ascii?Q?N6gdO8JxG+sqx2Vq3FwRsMUHx1pHZIbUz59jwQpUnzcRMTEg3U3V7ZUCwjfC?= =?us-ascii?Q?TFbvr86AamBvF1EpRWiF5IOhqLQQnakDA9gQMFM3yqKsR08pGeZ+w2XqbpxL?= =?us-ascii?Q?ajKhLmSOVV6O4PkxvZ/JY14zYyrDPtvgUe7zP8w256hrBs/wrhP8JjfWR506?= =?us-ascii?Q?0Su9/mzyubPcGslg4ww+fNXXdJJkCkYgOgYzEFrzGVDCOsAgStJgxq+Wnohg?= =?us-ascii?Q?b9T2qwPPVPnbIrlULKd2BZxMe0vB9PbzsquiaxyhA1sR2LTKb5KJetb9+xb5?= =?us-ascii?Q?nvEa18aMM1BnCIWjnP9W5KB7LRZgJuQlWFdi6eQ6Jovkvi1waU+aLad+HDgT?= =?us-ascii?Q?kt3Afb056fIXOCyQzqG1VNIl8Ezl?= 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)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: K3g1qXeNskySbY8JNhu4CEk2aOXN3kveXqETsQBx7Ca+AN2xqsWE0t3t4A6s/nMm7rkPB1h3g9kGDAQC+JFUdkr/eb3y1HydrWCL7hOYAtxs4pjOwN+bUjUhG2UlfQUlpOJSP4aDBghnQvQk/Rz3bgeqrLqD1g25FQ9+zP6gLa4tNNOgRadSytZdXhHls4DG93wxzLFDhxhUkzJZiRUxPMaCNv2tDYYv3mYtj4kBxmlsJu5xgDTFaoZ+c0oshpLvcgf2RNAq6bmNIsleZOEh5oiNOQ1LCqU15EEOS56oQ2CIUBFE4QtP6MIKdnTINzDzR4cqQE9kUw6JSqBmFx5SgQYWjeWEKyZU/BFfhR72p7qxre4U6kgd8SjIBZfX7Tr/QMvzejQZuurMtSnuR4k0txUvwbRSE5kUG+a1tOW7jtcQIGB313VUUsBUomS8uaqccj2cRlAczhQCb1kpkg5TF92M2tUzt6P9qoc95qoupult2qP91SdUOCzNioKEU6Nwq+zQfuCEApYG/vRdskKPLaHg2SNDT8wgds11oYxsOkPWlr1hqdOHcu95/AYsGgmhm7glDSwaha05oCzYCmnB82l5j/iaWte8Zp6bkGCtMnJNCdzSEqalQrbp6TaigcoqxLdE1Samm6DvMGpQrYcFpQ== X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2024 15:08:01.4389 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 390d9c3b-cae4-44d3-f67d-08dce4865701 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: PA4P190MB1069 X-BESS-ID: 1728054483-302249-12646-31656-1 X-BESS-VER: 2019.1_20240924.1654 X-BESS-Apparent-Source-IP: 104.47.18.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVkbG5uaGQGYGUNTSINHAxMTCIC 3VxCItKcXINNkwzdg8JdXQyNTU2CzVQqk2FgA5xvG8QgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259494 [from cloudscan12-63.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 From: Danylo Vodopianov Add suffixes logging Fix the issue with the configuration log level for a specific module Fix extended debug logging 3-letter abbreviation for log type Update documentation new log modules were added Log level in functions that initialize feature operations was updated from INFO to DEBUG to avoid noisy traces during driver startup. log level for ops init was changed nim and PMD modules was replaced with NTNIC NIM module was replaced with NTNIC according to the ntnic log convention. Signed-off-by: Oleksandr Kolomeiets Signed-off-by: Danylo Vodopianov --- doc/guides/nics/ntnic.rst | 29 +++++++++ drivers/net/ntnic/nim/i2c_nim.c | 16 ++--- .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.c | 2 +- .../core/nt200a0x/reset/nthw_fpga_rst9563.c | 12 ++-- .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.c | 10 +-- drivers/net/ntnic/nthw/core/nthw_iic.c | 6 +- drivers/net/ntnic/nthw/core/nthw_pcie3.c | 2 +- .../net/ntnic/nthw/model/nthw_fpga_model.c | 6 +- drivers/net/ntnic/ntlog/ntlog.c | 2 - drivers/net/ntnic/ntlog/ntlog.h | 63 +++++++++++++------ drivers/net/ntnic/ntnic_ethdev.c | 41 ++++++------ 11 files changed, 123 insertions(+), 66 deletions(-) diff --git a/doc/guides/nics/ntnic.rst b/doc/guides/nics/ntnic.rst index 88d95832e5..7ac92c891c 100644 --- a/doc/guides/nics/ntnic.rst +++ b/doc/guides/nics/ntnic.rst @@ -49,3 +49,32 @@ which is required for the PMD to use vfio-pci on the PF. This support has been back-ported to older Linux distributions and they are also supported. If vfio-pci is not required, kernel version 4.18 is supported. + + +Logging and Debugging +--------------------- + +NTNIC supports several groups of logging that can be enabled with ``--log-level`` +parameter: + +- NTNIC. + + Logging info from the main PMD code. i.e. code that is related to DPDK:: + + --log-level=pmd.net.ntnic.ntnic,8 + +- NTHW. + + Logging info from NTHW. i.e. code that is related to the FPGA and the Adapter:: + + --log-level=pmd.net.ntnic.nthw,8 + +- FILTER. + + Logging info from filter. i.e. code that is related to the binary filter:: + + --log-level=pmd.net.ntnic.filter,8 + +To enable logging on all levels use wildcard in the following way:: + + --log-level=pmd.net.ntnic.*,8 diff --git a/drivers/net/ntnic/nim/i2c_nim.c b/drivers/net/ntnic/nim/i2c_nim.c index e6e256b062..310d5d2598 100644 --- a/drivers/net/ntnic/nim/i2c_nim.c +++ b/drivers/net/ntnic/nim/i2c_nim.c @@ -219,7 +219,7 @@ static int i2c_nim_common_construct(nim_i2c_ctx_p ctx) res = -1; if (res) { - NT_LOG(ERR, PMD, "Can't read NIM id."); + NT_LOG(ERR, NTNIC, "Can't read NIM id."); return res; } @@ -308,7 +308,7 @@ static int qsfp_nim_state_build(nim_i2c_ctx_t *ctx, sfp_nim_state_t *state) break; default: - NT_LOG(INF, NIM, "nim_id = %u is not an QSFP/QSFP+/QSFP28 module\n", ctx->nim_id); + NT_LOG(INF, NTNIC, "nim_id = %u is not an QSFP/QSFP+/QSFP28 module\n", ctx->nim_id); res = -1; } @@ -419,7 +419,7 @@ static int qsfpplus_read_basic_data(nim_i2c_ctx_t *ctx) yes_no[ctx->avg_pwr]); qsfp_read_vendor_info(ctx); - NT_LOG(DBG, PMD, + NT_LOG(DBG, NTNIC, "Instance %d: NIM info: (Vendor: %s, PN: %s, SN: %s, Date: %s, Rev: %s)\n", ctx->instance, ctx->vendor_name, ctx->prod_no, ctx->serial_no, ctx->date, ctx->rev); @@ -540,7 +540,7 @@ static bool qsfp28_is_rate_selection_enabled(nim_i2c_ctx_p ctx) (read_byte(ctx, enh_options_reg_addr) >> 2) & 0x03; /* bit 3..2 */ if (rate_select_type != 2) { - NT_LOG(DBG, PMD, "NIM has unhandled rate select type (%d)", rate_select_type); + NT_LOG(DBG, NTNIC, "NIM has unhandled rate select type (%d)", rate_select_type); return false; } @@ -548,7 +548,7 @@ static bool qsfp28_is_rate_selection_enabled(nim_i2c_ctx_p ctx) read_byte(ctx, ext_rate_select_compl_reg_addr) & 0x03; /* bit 1..0 */ if (ext_rate_select_ver != 0x02) { - NT_LOG(DBG, PMD, "NIM has unhandled extended rate select version (%d)", + NT_LOG(DBG, NTNIC, "NIM has unhandled extended rate select version (%d)", ext_rate_select_ver); return false; } @@ -669,7 +669,7 @@ static void qsfp28_wait_for_ready_after_reset(nim_i2c_ctx_p ctx) */ read_data_lin(ctx, 1, sizeof(ctx->specific_u.qsfp.specific_u.qsfp28.rev_compliance), &ctx->specific_u.qsfp.specific_u.qsfp28.rev_compliance); - NT_LOG(DBG, NTHW, "NIM RevCompliance = %d", + NT_LOG(DBG, NTHW, "NIM RevCompliance = %d\n", ctx->specific_u.qsfp.specific_u.qsfp28.rev_compliance); /* Wait if lane_idx == -1 (all lanes are used) or lane_idx == 0 (the first lane) */ @@ -682,7 +682,7 @@ static void qsfp28_wait_for_ready_after_reset(nim_i2c_ctx_p ctx) init_complete_flag_present = (data & (1 << 4)) != 0; } - NT_LOG(DBG, NTHW, "NIM InitCompleteFlagPresent = %d", init_complete_flag_present); + NT_LOG(DBG, NTHW, "NIM InitCompleteFlagPresent = %d\n", init_complete_flag_present); /* * If the init complete flag is not present then wait 500ms that together with 500ms @@ -708,7 +708,7 @@ static void qsfp28_wait_for_ready_after_reset(nim_i2c_ctx_p ctx) read_data_lin(ctx, 6, sizeof(data), &data); if (data & 0x01) { - NT_LOG(DBG, NTHW, "Module ready after %dms", count * 100); + NT_LOG(DBG, NTHW, "Module ready after %dms\n", count * 100); break; } diff --git a/drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c b/drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c index 3009e30670..e5e9bb9025 100644 --- a/drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c +++ b/drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c @@ -71,6 +71,6 @@ static struct nt200a0x_ops nt200a0x_ops = { .nthw_fpga_nt200a0x_init = nthw_fpga void nt200a0x_ops_init(void) { - NT_LOG(INF, NTHW, "NT200A0X OPS INIT\n"); + NT_LOG(DBG, NTHW, "NT200A0X OPS INIT\n"); register_nt200a0x_ops(&nt200a0x_ops); } diff --git a/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c b/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c index 380f877096..da70379dcb 100644 --- a/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c +++ b/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c @@ -26,7 +26,7 @@ static int nthw_fpga_rst9563_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt2 p->mn_fpga_version = n_fpga_version; p->mn_fpga_revision = n_fpga_revision; - NT_LOG_DBGX(DEBUG, NTHW, "%s: FPGA reset setup: FPGA %04d-%02d-%02d\n", p_adapter_id_str, + NT_LOG_DBGX(DBG, NTHW, "%s: FPGA reset setup: FPGA %04d-%02d-%02d\n", p_adapter_id_str, n_fpga_product_id, n_fpga_version, n_fpga_revision); p_mod_rst = nthw_fpga_query_module(p_fpga, MOD_RST9563, 0); @@ -212,7 +212,7 @@ static int nthw_fpga_rst9563_init(struct fpga_info_s *p_fpga_info, res = nthw_fpga_rst9563_periph_reset(p_fpga); if (res) { - NT_LOG_DBGX(DEBUG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); + NT_LOG_DBGX(DBG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); return res; } @@ -220,14 +220,14 @@ static int nthw_fpga_rst9563_init(struct fpga_info_s *p_fpga_info, n_si_labs_clock_synth_i2c_addr); if (res) { - NT_LOG_DBGX(DEBUG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); + NT_LOG_DBGX(DBG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); return res; } res = nthw_fpga_rst9563_setup(p_fpga, p_rst); if (res) { - NT_LOG_DBGX(DEBUG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); + NT_LOG_DBGX(DBG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); return res; } @@ -235,7 +235,7 @@ static int nthw_fpga_rst9563_init(struct fpga_info_s *p_fpga_info, res = rst_ops != NULL ? rst_ops->nthw_fpga_rst_nt200a0x_reset(p_fpga, p_rst) : -1; if (res) { - NT_LOG_DBGX(DEBUG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); + NT_LOG_DBGX(DBG, NTHW, "%s: ERROR: res=%d\n", p_adapter_id_str, res); return res; } @@ -246,6 +246,6 @@ static struct rst9563_ops rst9563_ops = { .nthw_fpga_rst9563_init = nthw_fpga_rs void rst9563_ops_init(void) { - NT_LOG(INF, NTHW, "RST9563 OPS INIT\n"); + NT_LOG(DBG, NTHW, "RST9563 OPS INIT\n"); register_rst9563_ops(&rst9563_ops); } diff --git a/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c b/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c index aa0d97dafd..e930d0a09d 100644 --- a/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c +++ b/drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c @@ -221,7 +221,7 @@ static int nthw_fpga_rst_nt200a0x_reset(nthw_fpga_t *p_fpga, int locked; int res = -1; - NT_LOG_DBGX(DEBUG, NTHW, "%s: FPGA reset sequence: FPGA %04d-%02d-%02d @ HWId%d\n", + NT_LOG_DBGX(DBG, NTHW, "%s: FPGA reset sequence: FPGA %04d-%02d-%02d @ HWId%d\n", p_adapter_id_str, n_fpga_product_id, n_fpga_version, n_fpga_revision, n_hw_id); assert(n_fpga_product_id == p_fpga->mn_product_id); @@ -505,7 +505,7 @@ static int nthw_fpga_rst_nt200a0x_reset(nthw_fpga_t *p_fpga, nthw_field_clr_flush(p->mp_fld_power_pu_nseb); /* NSEB power down */ } - NT_LOG_DBGX(DEBUG, NTHW, "%s END\n", p_adapter_id_str); + NT_LOG_DBGX(DBG, NTHW, "%s END\n", p_adapter_id_str); return 0; } @@ -523,7 +523,7 @@ static int nthw_fpga_rst_nt200a0x_init(struct fpga_info_s *p_fpga_info, p_fpga = p_fpga_info->mp_fpga; - NT_LOG_DBGX(DEBUG, NTHW, "%s: RAB init/reset\n", p_adapter_id_str); + NT_LOG_DBGX(DBG, NTHW, "%s: RAB init/reset\n", p_adapter_id_str); nthw_rac_rab_reset(p_fpga_info->mp_nthw_rac); nthw_rac_rab_setup(p_fpga_info->mp_nthw_rac); @@ -554,7 +554,7 @@ static int nthw_fpga_rst_nt200a0x_init(struct fpga_info_s *p_fpga_info, p_rst->mn_si_labs_clock_synth_model = n_si_labs_clock_synth_model; p_rst->mn_si_labs_clock_synth_i2c_addr = n_si_labs_clock_synth_i2c_addr; p_rst->mn_hw_id = p_fpga_info->nthw_hw_info.hw_id; - NT_LOG_DBGX(DEBUG, NTHW, "%s: Si%04d @ 0x%02x\n", p_adapter_id_str, + NT_LOG_DBGX(DBG, NTHW, "%s: Si%04d @ 0x%02x\n", p_adapter_id_str, p_rst->mn_si_labs_clock_synth_model, p_rst->mn_si_labs_clock_synth_i2c_addr); return res; @@ -568,6 +568,6 @@ static struct rst_nt200a0x_ops rst_nt200a0x_ops = { .nthw_fpga_rst_nt200a0x_init void rst_nt200a0x_ops_init(void) { - NT_LOG(INF, NTHW, "RST NT200A0X OPS INIT\n"); + NT_LOG(DBG, NTHW, "RST NT200A0X OPS INIT\n"); register_rst_nt200a0x_ops(&rst_nt200a0x_ops); } diff --git a/drivers/net/ntnic/nthw/core/nthw_iic.c b/drivers/net/ntnic/nthw/core/nthw_iic.c index 7f324dec78..a08f8d90f6 100644 --- a/drivers/net/ntnic/nthw/core/nthw_iic.c +++ b/drivers/net/ntnic/nthw/core/nthw_iic.c @@ -422,11 +422,11 @@ int nthw_iic_writebyte(nthw_iic_t *p, uint8_t dev_addr, uint8_t a_reg_addr, uint nthw_iic_reg_tx_fifo_write(p, *p_byte, 0, 1); if (!nthw_iic_bus_ready(p)) { - NT_LOG_DBGX(WARNING, NTHW, "%s: warn: !busReady\n", p_adapter_id_str); + NT_LOG_DBGX(WRN, NTHW, "%s: warn: !busReady\n", p_adapter_id_str); while (true) if (nthw_iic_bus_ready(p)) { - NT_LOG_DBGX(DEBUG, NTHW, "%s: info: busReady\n", + NT_LOG_DBGX(DBG, NTHW, "%s: info: busReady\n", p_adapter_id_str); break; } @@ -435,7 +435,7 @@ int nthw_iic_writebyte(nthw_iic_t *p, uint8_t dev_addr, uint8_t a_reg_addr, uint return 0; } else { - NT_LOG_DBGX(WARNING, NTHW, "%s\n", p_adapter_id_str); + NT_LOG_DBGX(WRN, NTHW, "%s\n", p_adapter_id_str); return -1; } } diff --git a/drivers/net/ntnic/nthw/core/nthw_pcie3.c b/drivers/net/ntnic/nthw/core/nthw_pcie3.c index c6cb3ce8de..16c2a816e2 100644 --- a/drivers/net/ntnic/nthw/core/nthw_pcie3.c +++ b/drivers/net/ntnic/nthw/core/nthw_pcie3.c @@ -250,7 +250,7 @@ int nthw_pcie3_get_stat_rate(nthw_pcie3_t *p, uint64_t *p_pci_rx_rate, uint64_t int nthw_pcie3_end_point_counters_sample_post(nthw_pcie3_t *p, struct nthw_hif_end_point_counters *epc) { - NT_LOG_DBGX(DEBUG, NTHW); + NT_LOG_DBGX(DBG, NTHW); assert(epc); nthw_pcie3_get_stat_rate(p, &epc->cur_tx, &epc->cur_rx, &epc->n_ref_clk_cnt, &epc->n_tags_in_use, &epc->cur_pci_nt_util, diff --git a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c index 14d1ebf5fa..37a0b10c93 100644 --- a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c +++ b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c @@ -250,12 +250,12 @@ void nthw_fpga_mgr_log_dump(nthw_fpga_mgr_t *p) { int i; - NT_LOG_DBGX(DEBUG, NTHW, "fpgas=%d\n", p->mn_fpgas); + NT_LOG_DBGX(DBG, NTHW, "fpgas=%d\n", p->mn_fpgas); for (i = 0; i < p->mn_fpgas; i++) { nthw_fpga_prod_init_s *p_init = p->mpa_fpga_prod_init[i]; (void)p_init; - NT_LOG_DBGX(DEBUG, NTHW, "fpga=%d/%d: %04d-%02d-%02d\n", i, p->mn_fpgas, + NT_LOG_DBGX(DBG, NTHW, "fpga=%d/%d: %04d-%02d-%02d\n", i, p->mn_fpgas, p_init->fpga_product_id, p_init->fpga_version, p_init->fpga_revision); } } @@ -903,7 +903,7 @@ void nthw_field_init(nthw_field_t *p, nthw_register_t *p_reg, const nthw_fpga_fi p->mn_tail_mask = (1 << bits_remaining) - 1; if (p->mn_debug_mode >= 0x100) { - NT_LOG_DBGX(DEBUG, NTHW, + NT_LOG_DBGX(DBG, NTHW, "fldid=%08d: [%08d:%08d] %08d/%08d: (%08d,%08d) (0x%08X,%08d,0x%08X)\n", p_init->id, p_init->low, (p_init->low + p_init->bw), p_init->bw, ((p_init->bw + 31) / 32), p->mn_first_word, diff --git a/drivers/net/ntnic/ntlog/ntlog.c b/drivers/net/ntnic/ntlog/ntlog.c index 2e4fba799d..7b7f583364 100644 --- a/drivers/net/ntnic/ntlog/ntlog.c +++ b/drivers/net/ntnic/ntlog/ntlog.c @@ -16,8 +16,6 @@ #define NTLOG_HELPER_STR_SIZE_MAX (1024) -RTE_LOG_REGISTER_DEFAULT(nt_logtype, NOTICE) - char *ntlog_helper_str_alloc(const char *sinit) { char *s = malloc(NTLOG_HELPER_STR_SIZE_MAX); diff --git a/drivers/net/ntnic/ntlog/ntlog.h b/drivers/net/ntnic/ntlog/ntlog.h index 58dcce0580..1d0fc2329f 100644 --- a/drivers/net/ntnic/ntlog/ntlog.h +++ b/drivers/net/ntnic/ntlog/ntlog.h @@ -10,30 +10,57 @@ #include #include -extern int nt_logtype; +extern int nt_log_general; +extern int nt_log_nthw; +extern int nt_log_filter; +extern int nt_log_ntnic; #define NT_DRIVER_NAME "ntnic" -#define NT_PMD_DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, nt_logtype, \ - RTE_FMT(NT_DRIVER_NAME ": " \ - RTE_FMT_HEAD(__VA_ARGS__, ""), \ - RTE_FMT_TAIL(__VA_ARGS__, ""))) +/* Common log format */ +#define NT_LOG_TEMPLATE_COM(level, module, ...) \ + RTE_FMT(NT_DRIVER_NAME " " module ": " level ": " RTE_FMT_HEAD(__VA_ARGS__, ""), \ + RTE_FMT_TAIL(__VA_ARGS__, "")) +/* Extended log format */ +#define NT_LOG_TEMPLATE_EXT(level, module, ...) \ + RTE_FMT(NT_DRIVER_NAME " " module ": " level ": [%s: %u] " RTE_FMT_HEAD(__VA_ARGS__, ""), \ + __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, "")) -#define NT_LOG_ERR(...) NT_PMD_DRV_LOG(ERR, __VA_ARGS__) -#define NT_LOG_WRN(...) NT_PMD_DRV_LOG(WARNING, __VA_ARGS__) -#define NT_LOG_INF(...) NT_PMD_DRV_LOG(INFO, __VA_ARGS__) -#define NT_LOG_DBG(...) NT_PMD_DRV_LOG(DEBUG, __VA_ARGS__) +#define NT_PMD_DRV_GENERAL_LOG(level, module, format, ...) \ + rte_log(RTE_LOG_##level, nt_log_general, \ + NT_LOG_TEMPLATE_##format(#level, #module, __VA_ARGS__)) -#define NT_LOG(level, module, ...) \ - NT_LOG_##level(#module ": " #level ":" __VA_ARGS__) +#define NT_PMD_DRV_NTHW_LOG(level, module, format, ...) \ + rte_log(RTE_LOG_##level, nt_log_nthw, \ + NT_LOG_TEMPLATE_##format(#level, #module, __VA_ARGS__)) + +#define NT_PMD_DRV_FILTER_LOG(level, module, format, ...) \ + rte_log(RTE_LOG_##level, nt_log_filter, \ + NT_LOG_TEMPLATE_##format(#level, #module, __VA_ARGS__)) + +#define NT_PMD_DRV_NTNIC_LOG(level, module, format, ...) \ + rte_log(RTE_LOG_##level, nt_log_ntnic, \ + NT_LOG_TEMPLATE_##format(#level, #module, __VA_ARGS__)) + +#define NT_LOG_ERR(level, module, ...) NT_PMD_DRV_##module##_LOG(ERR, module, COM, __VA_ARGS__) +#define NT_LOG_WRN(level, module, ...) NT_PMD_DRV_##module##_LOG(WARNING, module, COM, __VA_ARGS__) +#define NT_LOG_INF(level, module, ...) NT_PMD_DRV_##module##_LOG(INFO, module, COM, __VA_ARGS__) +#define NT_LOG_DBG(level, module, ...) NT_PMD_DRV_##module##_LOG(DEBUG, module, COM, __VA_ARGS__) + +#define NT_LOG_DBGX_ERR(level, module, ...) \ + NT_PMD_DRV_##module##_LOG(ERR, module, EXT, __VA_ARGS__) +#define NT_LOG_DBGX_WRN(level, module, ...) \ + NT_PMD_DRV_##module##_LOG(WARNING, module, EXT, __VA_ARGS__) +#define NT_LOG_DBGX_INF(level, module, ...) \ + NT_PMD_DRV_##module##_LOG(INFO, module, EXT, __VA_ARGS__) +#define NT_LOG_DBGX_DBG(level, module, ...) \ + NT_PMD_DRV_##module##_LOG(DEBUG, module, EXT, __VA_ARGS__) + +#define NT_LOG(level, module, ...) NT_LOG_##level(level, module, __VA_ARGS__) + +#define NT_LOG_DBGX(level, module, ...) NT_LOG_DBGX_##level(level, module, __VA_ARGS__) -#define NT_LOG_DBGX(level, module, ...) \ - rte_log(RTE_LOG_ ##level, nt_logtype, \ - RTE_FMT(NT_DRIVER_NAME #module ": [%s:%u]" \ - RTE_FMT_HEAD(__VA_ARGS__, ""), __func__, __LINE__, \ - RTE_FMT_TAIL(__VA_ARGS__, ""))) /* * nt log helper functions * to create a string for NT_LOG usage to output a one-liner log @@ -41,9 +68,7 @@ extern int nt_logtype; * you do not know the number of parameters at programming time or it is variable */ char *ntlog_helper_str_alloc(const char *sinit); - void ntlog_helper_str_add(char *s, const char *format, ...); - void ntlog_helper_str_free(char *s); #endif /* NTOSS_SYSTEM_NTLOG_H */ diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c index 52ca8f2844..5af18a3b27 100644 --- a/drivers/net/ntnic/ntnic_ethdev.c +++ b/drivers/net/ntnic/ntnic_ethdev.c @@ -174,7 +174,7 @@ eth_mac_addr_add(struct rte_eth_dev *eth_dev, if (index >= NUM_MAC_ADDRS_PER_PORT) { const struct pmd_internals *const internals = (struct pmd_internals *)eth_dev->data->dev_private; - NT_LOG_DBGX(DEBUG, NTNIC, "Port %i: illegal index %u (>= %u)\n", + NT_LOG_DBGX(DBG, NTNIC, "Port %i: illegal index %u (>= %u)\n", internals->n_intf_no, index, NUM_MAC_ADDRS_PER_PORT); return -1; } @@ -204,7 +204,7 @@ eth_set_mc_addr_list(struct rte_eth_dev *eth_dev, size_t i; if (nb_mc_addr >= NUM_MULTICAST_ADDRS_PER_PORT) { - NT_LOG_DBGX(DEBUG, NTNIC, + NT_LOG_DBGX(DBG, NTNIC, "Port %i: too many multicast addresses %u (>= %u)\n", internals->n_intf_no, nb_mc_addr, NUM_MULTICAST_ADDRS_PER_PORT); return -1; @@ -223,7 +223,7 @@ eth_set_mc_addr_list(struct rte_eth_dev *eth_dev, static int eth_dev_configure(struct rte_eth_dev *eth_dev) { - NT_LOG_DBGX(DEBUG, NTNIC, "Called for eth_dev %p\n", eth_dev); + NT_LOG_DBGX(DBG, NTNIC, "Called for eth_dev %p\n", eth_dev); /* The device is ALWAYS running promiscuous mode. */ eth_dev->data->promiscuous ^= ~eth_dev->data->promiscuous; @@ -245,7 +245,7 @@ eth_dev_start(struct rte_eth_dev *eth_dev) const int n_intf_no = internals->n_intf_no; struct adapter_info_s *p_adapter_info = &internals->p_drv->ntdrv.adapter_info; - NT_LOG_DBGX(DEBUG, NTNIC, "Port %u\n", internals->n_intf_no); + NT_LOG_DBGX(DBG, NTNIC, "Port %u\n", internals->n_intf_no); if (internals->type == PORT_TYPE_VIRTUAL || internals->type == PORT_TYPE_OVERRIDE) { eth_dev->data->dev_link.link_status = RTE_ETH_LINK_UP; @@ -264,7 +264,7 @@ eth_dev_start(struct rte_eth_dev *eth_dev) while (port_ops->get_link_status(p_adapter_info, n_intf_no) == RTE_ETH_LINK_DOWN) { /* break out after 5 sec */ if (++loop >= 50) { - NT_LOG_DBGX(DEBUG, NTNIC, + NT_LOG_DBGX(DBG, NTNIC, "TIMEOUT No link on port %i (5sec timeout)\n", internals->n_intf_no); break; @@ -294,7 +294,7 @@ eth_dev_stop(struct rte_eth_dev *eth_dev) { struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private; - NT_LOG_DBGX(DEBUG, NTNIC, "Port %u\n", internals->n_intf_no); + NT_LOG_DBGX(DBG, NTNIC, "Port %u\n", internals->n_intf_no); eth_dev->data->dev_link.link_status = RTE_ETH_LINK_DOWN; return 0; @@ -424,7 +424,7 @@ eth_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size static int promiscuous_enable(struct rte_eth_dev __rte_unused(*dev)) { - NT_LOG(DBG, NTHW, "The device always run promiscuous mode."); + NT_LOG(DBG, NTHW, "The device always run promiscuous mode\n"); return 0; } @@ -472,7 +472,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) int n_phy_ports; struct port_link_speed pls_mbps[NUM_ADAPTER_PORTS_MAX] = { 0 }; int num_port_speeds = 0; - NT_LOG_DBGX(DEBUG, NTNIC, "Dev %s PF #%i Init : %02x:%02x:%i\n", pci_dev->name, + NT_LOG_DBGX(DBG, NTNIC, "Dev %s PF #%i Init : %02x:%02x:%i\n", pci_dev->name, pci_dev->addr.function, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); @@ -491,7 +491,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) int vfio = nt_vfio_setup(pci_dev); if (vfio < 0) { - NT_LOG_DBGX(ERR, TNIC, "%s: vfio_setup error %d\n", + NT_LOG_DBGX(ERR, NTNIC, "%s: vfio_setup error %d\n", (pci_dev->name[0] ? pci_dev->name : "NA"), -1); rte_free(p_drv); return -1; @@ -583,14 +583,14 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) char name[32]; if ((1 << n_intf_no) & ~n_port_mask) { - NT_LOG_DBGX(DEBUG, NTNIC, + NT_LOG_DBGX(DBG, NTNIC, "%s: interface #%d: skipping due to portmask 0x%02X\n", p_port_id_str, n_intf_no, n_port_mask); continue; } snprintf(name, sizeof(name), "ntnic%d", n_intf_no); - NT_LOG_DBGX(DEBUG, NTNIC, "%s: interface #%d: %s: '%s'\n", p_port_id_str, + NT_LOG_DBGX(DBG, NTNIC, "%s: interface #%d: %s: '%s'\n", p_port_id_str, n_intf_no, (pci_dev->name[0] ? pci_dev->name : "NA"), name); internals = rte_zmalloc_socket(name, sizeof(struct pmd_internals), @@ -674,7 +674,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev) static int nthw_pci_dev_deinit(struct rte_eth_dev *eth_dev __rte_unused) { - NT_LOG_DBGX(DEBUG, NTNIC, "PCI device deinitialization\n"); + NT_LOG_DBGX(DBG, NTNIC, "PCI device deinitialization\n"); int i; char name[32]; @@ -701,13 +701,13 @@ nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, { int ret; - NT_LOG_DBGX(DEBUG, NTNIC, "pcidev: name: '%s'\n", pci_dev->name); - NT_LOG_DBGX(DEBUG, NTNIC, "devargs: name: '%s'\n", pci_dev->device.name); + NT_LOG_DBGX(DBG, NTNIC, "pcidev: name: '%s'\n", pci_dev->name); + NT_LOG_DBGX(DBG, NTNIC, "devargs: name: '%s'\n", pci_dev->device.name); if (pci_dev->device.devargs) { - NT_LOG_DBGX(DEBUG, NTNIC, "devargs: args: '%s'\n", + NT_LOG_DBGX(DBG, NTNIC, "devargs: args: '%s'\n", (pci_dev->device.devargs->args ? pci_dev->device.devargs->args : "NULL")); - NT_LOG_DBGX(DEBUG, NTNIC, "devargs: data: '%s'\n", + NT_LOG_DBGX(DBG, NTNIC, "devargs: data: '%s'\n", (pci_dev->device.devargs->data ? pci_dev->device.devargs->data : "NULL")); } @@ -737,14 +737,14 @@ nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, ret = nthw_pci_dev_init(pci_dev); - NT_LOG_DBGX(DEBUG, NTNIC, "leave: ret=%d\n", ret); + NT_LOG_DBGX(DBG, NTNIC, "leave: ret=%d\n", ret); return ret; } static int nthw_pci_remove(struct rte_pci_device *pci_dev) { - NT_LOG_DBGX(DEBUG, NTNIC); + NT_LOG_DBGX(DBG, NTNIC); struct drv_s *p_drv = get_pdrv_from_pci(pci_dev->addr); drv_deinit(p_drv); @@ -762,3 +762,8 @@ static struct rte_pci_driver rte_nthw_pmd = { RTE_PMD_REGISTER_PCI(net_ntnic, rte_nthw_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ntnic, nthw_pci_id_map); RTE_PMD_REGISTER_KMOD_DEP(net_ntnic, "* vfio-pci"); + +RTE_LOG_REGISTER_SUFFIX(nt_log_general, general, INFO); +RTE_LOG_REGISTER_SUFFIX(nt_log_nthw, nthw, INFO); +RTE_LOG_REGISTER_SUFFIX(nt_log_filter, filter, INFO); +RTE_LOG_REGISTER_SUFFIX(nt_log_ntnic, ntnic, INFO); -- 2.45.0