From patchwork Thu Jun 17 15:59:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viktor Barna X-Patchwork-Id: 462763 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28876C2B9F4 for ; Thu, 17 Jun 2021 16:04:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 12C2161249 for ; Thu, 17 Jun 2021 16:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233679AbhFQQGa (ORCPT ); Thu, 17 Jun 2021 12:06:30 -0400 Received: from mail-eopbgr140040.outbound.protection.outlook.com ([40.107.14.40]:17172 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233658AbhFQQGJ (ORCPT ); Thu, 17 Jun 2021 12:06:09 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kdSthIEx294OzRDIjifh34UP/Li1boadt8BmTlxPtG3yc7ZcdhiGdzKEkkkn08laz3v2D2jaxWinWDWwZ3LAUP0HQVafoiOCZUGQdg9Qndpl2rgsBRP8HeDJzycBqqQrXnQTnaEFH+XNjUKmFRoZmO/AOsNdxc5GEdkC2L8tAK814XjEntXe5OfTfjw3hr7vnlA+cAJqzCaXIspQZeGw4ve6kT26pO+lUD3Jx/Apsh2/hKd+iZ6iyB3h988R9bgEpf6trgnyooX5LOgB35Hr6x5POgh1V3JIIRKgGZE+0kdfXeMWxwqe6JWTdwedhHE/KbHGlAG3q8bDXwL1TC9p3A== 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-SenderADCheck; bh=qwuvoILTbpbwnCbWZuxd6YdxG2AJSdCL72/oaNg9a/E=; b=oZEpSdqlvPm6JgMMi7lKHztGRxjoFrblISvCbPCvXLwvpGp8e/7CmSxHDWwmFVUP0fKsP8YSbOWxod1uQB3F132geVcJxMPnLS0nRILaDBv4nRks5m4RFeV/nbWkug6HaBZ4aN674DaEgVRFfI0Y5/hwapJgjJtls7A3qkyPnT8ePGEaxSBPsn1CxK2qdgnOWZAvMigm4IBxREraGcFnLiQzx5QOQL/GEIznhxlD5RVTvs76TuTZSGCeE3Gvpr1d4isiQ3knAjOyGyMyB9XBz3PBpcN8LJsa3QxTLNGx5DRZULEN7ehIwopwLdv3RLycIUzISjeVeUihpNHrvhuLHw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=celeno.com; dmarc=pass action=none header.from=celeno.com; dkim=pass header.d=celeno.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=celeno.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qwuvoILTbpbwnCbWZuxd6YdxG2AJSdCL72/oaNg9a/E=; b=p/RHpLbwFSeWiWhpYhSGya1YJ0ywHLOSoF6Dhi7oIpWOQKmfQH0ft8gTBcXxeDgNmAmqfcLQRmcKpuG3AR8wzzyYzKJux0U4WjtJC73hOw9iWlqLzaIJybLAWFYV3l5eWYIhXY803xn7wxRiYavxYaSXmdEKfiziA/ECuj2MPtY= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=celeno.com; Received: from AM9P192MB1412.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:38b::16) by AM9P192MB1234.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:388::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16; Thu, 17 Jun 2021 16:03:46 +0000 Received: from AM9P192MB1412.EURP192.PROD.OUTLOOK.COM ([fe80::1847:5583:4db7:102f]) by AM9P192MB1412.EURP192.PROD.OUTLOOK.COM ([fe80::1847:5583:4db7:102f%4]) with mapi id 15.20.4242.021; Thu, 17 Jun 2021 16:03:46 +0000 From: viktor.barna@celeno.com To: linux-wireless@vger.kernel.org Cc: Kalle Valo , "David S . Miller" , Jakub Kicinski , Aviad Brikman , Eliav Farber , Oleksandr Savchenko , Shay Bar , Viktor Barna Subject: [RFC v1 054/256] cl8k: add debug.h Date: Thu, 17 Jun 2021 15:59:01 +0000 Message-Id: <20210617160223.160998-55-viktor.barna@celeno.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210617160223.160998-1-viktor.barna@celeno.com> References: <20210617160223.160998-1-viktor.barna@celeno.com> X-Originating-IP: [62.216.42.54] X-ClientProxiedBy: PR3PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:102:b7::23) To AM9P192MB1412.EURP192.PROD.OUTLOOK.COM (2603:10a6:20b:38b::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (62.216.42.54) by PR3PR09CA0018.eurprd09.prod.outlook.com (2603:10a6:102:b7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18 via Frontend Transport; Thu, 17 Jun 2021 16:03:32 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 307a1a64-d557-4a01-a484-08d931a974d2 X-MS-TrafficTypeDiagnostic: AM9P192MB1234: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1148; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hoKoPKdmJy+4OgE7/I7g3ATuhjICCYIPRYp38Er/gVqpzUykOwL45iCAs0Ojlo3aDAibBRtfRo8QAol/OJaXtokVtVqKpSwc73UX8cOjQf9tpRu7W7D7yrtUTgIDBOg003WKcfqwOVGyyW608oC4fw4aPa2O+EsxMIFGXlaaaOy6S4MOIMjRDeuYGKSCQ46V/ElNznd2ivaDC+8Q39AVx8kEhuWEu+rvtpoTKoCUTKUtN61Hyud28+7z0wLX78y5AUrGE6hAHnYVjs1McCBhVvW5qI12wdoM/DUNegnO11cgQdm66qPWJ9DMVp4sErPYe0HatOx08QtYnOpGCP/X4/A8oK+hfpkJi+ACva+kFC6tbbr2VeJxNrpk0RidB1Vt1hCdX/YeUhz5RXkcuHdymf43knDGJyRmXDcuMaIocJfIU0iyx7Zskk71g60hG45SNtcwQKGgYgCOHR59I+3vEtFDZfMNWIhmwiEQDwSctTNQOtxtOBK0NJmwk4XnIFbSICYQm1ZowpdEtoAAwEnO6/EUJnxliOoCDvPqwnfgCBSMmviRlUcml49xLL07qkeQXqSXN3kEUARPCOEbXXdzeymg3kRQCE9DQXrsXDx3qCv1IwKM39tV3KImQzbdLLMZiHfmxOgf+GVTnz+sKmUe8HIYQ5ZVy/AwZlXkOxncE7j2Qp4ZMyJnV0A+lz22ca4NADbiwDD9o59qEGTEc9q6DQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9P192MB1412.EURP192.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(376002)(366004)(136003)(346002)(396003)(39850400004)(6666004)(107886003)(36756003)(956004)(66476007)(66556008)(2616005)(66946007)(6916009)(2906002)(26005)(9686003)(1076003)(6512007)(6486002)(16526019)(6506007)(38100700002)(52116002)(86362001)(8936002)(316002)(38350700002)(186003)(55236004)(54906003)(8676002)(5660300002)(508600001)(83380400001)(4326008)(69590400013)(32563001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J2glHhleHdaxWKrZmXqTXUT6fOr7avDSZwtMkp4B0g5FwgkKH+glZF8bnA3YaHFEq5Hw5jvmiPxrfzw8ZwXM8dngEktLCu8JobMNCImeic3Paz1iqhIoMtB9rGaTtxKqdwPnny+9sXfqr70ZC/jfDoXd5pUVtTYQ8WeYUVpS7+yimU//kxwAqnb9iZ6Uj2rmMlsEMasoSesthGGGznbupyjFtPJGsa+NMOYbbBynora/s/8gRDypyRydGASYHe/9sl6vu1FUbSoJd4y7xTWub0gAs/rRyjLJknA0NJMTIkWaF/A2WcakpiaVjiAopITTpG32xLfnTPIsGuZ4LfQWzpUYv79xKOvXba5GwYVzxkMOG2qrppPlxf0MlZrQJP/+wSbVi4mjPdP1uQ8PpiSV8TwiwU8qsTpt7LQUSFtN7b3qC+kzQZkisZrIpSiAlfEDf0AdggaVKi2UreyFrOFAOtb7o5TVoj6MzZjKsdl9VWvjZZQThZK7XyqAZH2a43GuTDFtS0s7MtpNPrRTM56T4azuNQwZ/b6V9O135gG4vv+5/zBanEmbmNaK5LfdlhRxA3Rm7zm6RiCPeoEqRImuGI8JfgfABJ1i0aK4jPVGdrnYow/s3b0IJuWF6AovVWphT7bhUEPlL3zCXBGqZTtxIfFmzHuG+TrIeLLwCvL5vJP8KCZ/aWDJyCCaORSGftRlLLuIabANz+x1eIX2qhcPd1u1E7RqS6+TJUpT1Uy9+NjBoN25dUQb7BGYjg4uPBwDSYLRrsBFiCXcGBD5TQcIDX5Xep0LtHQZ2RsF9nqL27SNiPbRbrpUXPUjY1BtyNPNyL1IBJi6aDThPGI8GijLmNRAbQqOmYsDKI0tbQ8A5nzkTU992ciEeSPp6omYK4nGZUIsAJ75ebBZEcJj1G6Lvz9fw7vLJTn6UfNcXh0aao46UpBGCH28EdR/7odC8lto5Xf57nLlnbMQbKttCpl0doO5D9DBwze5/FB8m2uXh5yzzz35YIZmM07Ad92eKpGQXDABHa0JLihNOOpzAH/mjSKoGeEPP36a0HB28PctmSFV57j4yXBkTrrIHb0Np1zkxjzqt60G/FyyxchOeOhZustrFgtxc9ZQwrG1ED1cPT6/jVKwL7A3G+l7tekiSXw5LLMXJiisNlXveIZCBqfn9mP8cbz/ZFZVYKy1vIcylH9d0DYGngP5yZGZZX445fGQg3Lng777F+rRdJ1EX9vMTOrb9VGAYjrgfq1+AuEeuwA9tdqKRinxmukWvy7mUv/8zmc2QoHTve4Nrf4EAOF4ywmjhZmb6aUUtKgHJzjn5FNcywZm0GhP7Yk28pXL04J3 X-OriginatorOrg: celeno.com X-MS-Exchange-CrossTenant-Network-Message-Id: 307a1a64-d557-4a01-a484-08d931a974d2 X-MS-Exchange-CrossTenant-AuthSource: AM9P192MB1412.EURP192.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 16:03:33.0155 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f313103b-4c9f-4fd3-b5cf-b97f91c4afa8 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aSpTqisevZgoZxlMjfwQw1pTFxjDrR0HFHVcLYY0CHNhcC/rltMs43etGW+7OMwarfI8Ngjz/qMo8LSYawWEZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9P192MB1234 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Viktor Barna (Part of the split. Please, take a look at the cover letter for more details). Signed-off-by: Viktor Barna --- drivers/net/wireless/celeno/cl8k/debug.h | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 drivers/net/wireless/celeno/cl8k/debug.h -- 2.30.0 diff --git a/drivers/net/wireless/celeno/cl8k/debug.h b/drivers/net/wireless/celeno/cl8k/debug.h new file mode 100644 index 000000000000..f51591755051 --- /dev/null +++ b/drivers/net/wireless/celeno/cl8k/debug.h @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: MIT */ +/* Copyright(c) 2019-2021, Celeno Communications Ltd. */ + +#ifndef CL_DEBUG_H +#define CL_DEBUG_H + +#include + +enum cl_dbg_level { + DBG_LVL_VERBOSE, + DBG_LVL_ERROR, + DBG_LVL_WARNING, + DBG_LVL_TRACE, + DBG_LVL_INFO, + + DBG_LVL_MAX, +}; + +#define CL_DBG(cl_hw, lvl, fmt, ...) \ +do { \ + if ((lvl) <= (cl_hw)->conf->ce_debug_level) \ + pr_debug("[tcv%u][%s][%d] " fmt, (cl_hw)->idx, __func__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#define CL_DBG_CHIP(chip, lvl, fmt, ...) \ +do { \ + if ((lvl) <= (chip)->conf->ce_debug_level) \ + pr_debug("[chip%u][%s][%d] " fmt, (chip)->idx, __func__, __LINE__, ##__VA_ARGS__); \ +} while (0) + +#define cl_dbg_verbose(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_VERBOSE, ##__VA_ARGS__) +#define cl_dbg_err(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_ERROR, ##__VA_ARGS__) +#define cl_dbg_warn(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_WARNING, ##__VA_ARGS__) +#define cl_dbg_trace(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_TRACE, ##__VA_ARGS__) +#define cl_dbg_info(cl_hw, ...) CL_DBG((cl_hw), DBG_LVL_INFO, ##__VA_ARGS__) + +#define cl_dbg_chip_verbose(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_VERBOSE, ##__VA_ARGS__) +#define cl_dbg_chip_err(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_ERROR, ##__VA_ARGS__) +#define cl_dbg_chip_warn(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_WARNING, ##__VA_ARGS__) +#define cl_dbg_chip_trace(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_TRACE, ##__VA_ARGS__) +#define cl_dbg_chip_info(chip, ...) CL_DBG_CHIP((chip), DBG_LVL_INFO, ##__VA_ARGS__) + +static inline char *basename(const char *filename) +{ + char *p = strrchr(filename, '/'); + + return p ? p + 1 : (char *)filename; +} + +#define TXT_ERROR \ + do { \ + pr_debug("\n"); \ + pr_debug("####### ##### ##### ##### #####\n"); \ + pr_debug("# # # # # # # # #\n"); \ + pr_debug("# # # # # # # # #\n"); \ + pr_debug("####### ##### ##### # # #####\n"); \ + pr_debug("# # # # # # # # #\n"); \ + pr_debug("# # # # # # # # #\n"); \ + pr_debug("####### # # # # ##### # #\n"); \ + } while (0) + +#define TXT_WARNING \ + do { \ + pr_debug("\n"); \ + pr_debug("# # ##### ##### # # ### # # #####\n"); \ + pr_debug("# # # # # # ## # # ## # # #\n"); \ + pr_debug("# # # # # # # # # # # # # #\n"); \ + pr_debug("# # # ####### ##### # # # # # # # # ###\n"); \ + pr_debug("# # # # # # # # # # # # # # # # #\n"); \ + pr_debug("# # # # # # # # # ## # # ## # #\n"); \ + pr_debug(" # # # # # # # # ### # # #####\n"); \ + } while (0) + +#define INFO_CL_HW(cl_hw, ...) \ + do { \ + pr_debug("\n"); \ + pr_debug("CHIP: %u\n", (cl_hw)->chip->idx); \ + pr_debug("TCV: %u\n", (cl_hw)->idx); \ + pr_debug("FILE: %s\n", basename(__FILE__)); \ + pr_debug("FUNCTION: %s\n", __func__); \ + pr_debug("LINE: %u\n", __LINE__); \ + pr_debug("DESCRIPTION: " __VA_ARGS__); \ + pr_debug("\n"); \ + } while (0) + +#define INFO_CHIP(chip, ...) \ + do { \ + pr_debug("\n"); \ + pr_debug("CHIP: %u\n", (chip)->idx); \ + pr_debug("FILE: %s\n", basename(__FILE__)); \ + pr_debug("FUNCTION: %s\n", __func__); \ + pr_debug("LINE: %u\n", __LINE__); \ + pr_debug("DESCRIPTION: " __VA_ARGS__); \ + pr_debug("\n"); \ + } while (0) + +#define CL_DBG_ERROR(cl_hw, ...) \ + do { \ + TXT_ERROR; \ + INFO_CL_HW(cl_hw, __VA_ARGS__); \ + } while (0) + +#define CL_DBG_ERROR_CHIP(chip, ...) \ + do { \ + TXT_ERROR; \ + INFO_CHIP(chip, __VA_ARGS__); \ + } while (0) + +#define CL_DBG_WARNING(cl_hw, ...) \ + do { \ + TXT_WARNING; \ + INFO_CL_HW(cl_hw, __VA_ARGS__); \ + } while (0) + +#define CL_DBG_WARNING_CHIP(chip, ...) \ + do { \ + TXT_WARNING; \ + INFO_CHIP(chip, __VA_ARGS__); \ + } while (0) + +#endif /* CL_DEBUG_H */