From patchwork Thu Sep 19 10:52:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 11152157 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6D6C16B1 for ; Thu, 19 Sep 2019 10:54:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A0C1C217D6 for ; Thu, 19 Sep 2019 10:54:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=silabs.onmicrosoft.com header.i=@silabs.onmicrosoft.com header.b="dEVBsl4U" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389526AbfISKwz (ORCPT ); Thu, 19 Sep 2019 06:52:55 -0400 Received: from mail-eopbgr700049.outbound.protection.outlook.com ([40.107.70.49]:8577 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389472AbfISKwy (ORCPT ); Thu, 19 Sep 2019 06:52:54 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WIDSGBGMRukhk57nRlL+G+Abnf2v5SGWfBK0kjSLIEx7SG42JPF59MJjppVbkZp3yQiCzlHlFAC2pKwg3z32DYvAQTdgvzv2lgkZEqvRuRZ+yRyjtH88gxmG/ioWTLtFOdBFZdlJDWziDwMpnzGUgBb524N+Lzt2yk/g3MWx8qz7kx6I9YnPFZjWr9sQ9h57ZqGj/EKa3toMQDPUs51Lnhlw7CGpuzajCK+rFvQyiQ4V0Lk+UapEjmo2LzsGr4sNf5oTZuzeRKJAc0J3cxp0FE87put68AU6v7nISaBueGG0IRzbAH/zRP4X10hO1UGIQH0Rbs98+gBSXlLN1lzT3A== 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=5Bm1KHIPwDvk1kpyacIlCp6b2DmOV1eFPZMvv3Tcnb0=; b=CkeUwayihPYeVUaWhfsMyYymeEZKaCr4tFS7AEYpk2kYHNHT/9qQjR+ORU77Mp0XK/oWBpHfh/9z6AuZvnAPVWccTSZs3yeh8D0I0vhaNiBQLlEh383Qm71N5OfU9FDa731MPp42cx/+wkR7ytczhhf6gzgf/hNmAdaw5kSVAyp6dK96/PJxUlOTMxPg68Rqe89eZZdCZgdr7FILbgd6OZtTvtVZFR7NFDL+G6fVoJzHmZKMv8vwUgrseR7I1kEGbircgn4c1/TOHARC1m7I64w29B+ZQuHEtFZc32CaUGWyHnRW+QqWjrEZXDHbJSgfEGTws2Qel4YU/pLwnwAnAQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Bm1KHIPwDvk1kpyacIlCp6b2DmOV1eFPZMvv3Tcnb0=; b=dEVBsl4UpgZRK910Tj0tigvx3ByiP90rcTYvO0iD7S9iZU3knW8GS6rA+QgO6VfhyFb8yl7KWccT5/wWYhe1enq7ZfVvxSTXe18YVZrX/wIqqZy/pc4Ik9u2PkHxtv+fdsxadnrEG6hd8uP74JuMVn+MLThI0baEULAD7WCTnwk= Received: from MN2PR11MB4063.namprd11.prod.outlook.com (20.179.149.217) by MN2PR11MB3775.namprd11.prod.outlook.com (20.178.253.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2263.17; Thu, 19 Sep 2019 10:52:39 +0000 Received: from MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::45dc:e073:4446:4bf8]) by MN2PR11MB4063.namprd11.prod.outlook.com ([fe80::45dc:e073:4446:4bf8%3]) with mapi id 15.20.2263.023; Thu, 19 Sep 2019 10:52:39 +0000 From: Jerome Pouiller To: "devel@driverdev.osuosl.org" , "linux-wireless@vger.kernel.org" CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , David Le Goff , Jerome Pouiller Subject: [PATCH 08/20] staging: wfx: add tracepoints for HIF Thread-Topic: [PATCH 08/20] staging: wfx: add tracepoints for HIF Thread-Index: AQHVbthaINJ+7f1/okOvkfYfWNwjcg== Date: Thu, 19 Sep 2019 10:52:38 +0000 Message-ID: <20190919105153.15285-9-Jerome.Pouiller@silabs.com> References: <20190919105153.15285-1-Jerome.Pouiller@silabs.com> In-Reply-To: <20190919105153.15285-1-Jerome.Pouiller@silabs.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Jerome.Pouiller@silabs.com; x-originating-ip: [37.71.187.125] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: b6494417-d63f-4c3b-294e-08d73cef7d3f x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600167)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:MN2PR11MB3775; x-ms-traffictypediagnostic: MN2PR11MB3775: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:13; x-forefront-prvs: 016572D96D x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(1496009)(366004)(376002)(346002)(39850400004)(136003)(396003)(199004)(189003)(86362001)(256004)(14444005)(8936002)(4326008)(66066001)(36756003)(14454004)(305945005)(64756008)(5660300002)(66476007)(66556008)(66446008)(316002)(476003)(446003)(11346002)(110136005)(2616005)(66946007)(478600001)(91956017)(25786009)(76116006)(7736002)(71190400001)(81166006)(1076003)(2501003)(6506007)(186003)(6436002)(486006)(81156014)(3846002)(6116002)(8676002)(102836004)(107886003)(54906003)(76176011)(2906002)(26005)(66574012)(99286004)(6486002)(71200400001)(6512007);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR11MB3775;H:MN2PR11MB4063.namprd11.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: silabs.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: BJNd2Siof3WRKmlTF0jvaOOXOzS7uRJIsvBCcxQLOZZdTOU4VXnQWi4AZbN6jbgKV6j/UsbNlbq+Ylx9QuhUbMKm/pQB2l+E6sjKjYO85jwRph9QA0sA/bowzhdPoBmMbtKac3AY7HVPDKJt2X55Tog9u5X3x+OX79g1B/6ya9JLtZxcb0LA+I4X9B09Ov6z6cd+U1oKzEkcJF/4N+8fwrDh1SXm6Rk2HmQYUIY9uFDcq6mkQI4oF/sZi0YwN1m8oIElPffFi/+9BGoKAlzo6Lob2SpGBySshfSMiMnaBr72AihNIAyLOPgRAk9YbXhup3MIPHuhm4FNeOVCe6MN3DV6v59kRJChwviHUadUXKwdk7eqmzxPW23DAIuqnudxwPvCjL1U5wQSrR5y1lQ6UminkRxUIizLae/VO+SOER4= Content-ID: <26031517EDDCA249A2979838F817F7D6@namprd11.prod.outlook.com> MIME-Version: 1.0 X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: b6494417-d63f-4c3b-294e-08d73cef7d3f X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Sep 2019 10:52:38.2321 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0Y/pPhbv8nguNJmQwilukjVd0lYDH3wXjJ8PIPTKTCWmJ6LtECiK1qOwbh3fIU6C9iD+22+mNieNRDJGZZbRlQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3775 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller These tracepoints decode HIF headers and provide more human readable results. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/bh.c | 5 + drivers/staging/wfx/traces.h | 211 +++++++++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) diff --git a/drivers/staging/wfx/bh.c b/drivers/staging/wfx/bh.c index 02a42e5c1e10..76afecdf579d 100644 --- a/drivers/staging/wfx/bh.c +++ b/drivers/staging/wfx/bh.c @@ -11,6 +11,7 @@ #include "bh.h" #include "wfx.h" #include "hwio.h" +#include "traces.h" #include "hif_api_cmd.h" static void device_wakeup(struct wfx_dev *wdev) @@ -67,6 +68,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) goto err; piggyback = le16_to_cpup((u16 *) (skb->data + alloc_len - 2)); + _trace_piggyback(piggyback, false); hif = (struct hif_msg *) skb->data; WARN(hif->encrypted & 0x1, "unsupported encryption type"); @@ -95,6 +97,7 @@ static int rx_helper(struct wfx_dev *wdev, size_t read_len, int *is_cnf) if (!wdev->hif.tx_buffers_used) wake_up(&wdev->hif.tx_buffers_empty); } + _trace_hif_recv(hif, wdev->hif.tx_buffers_used); if (hif->id != HIF_IND_ID_EXCEPTION && hif->id != HIF_IND_ID_ERROR) { if (hif->seqnum != wdev->hif.rx_seqnum) @@ -171,6 +174,7 @@ static void tx_helper(struct wfx_dev *wdev, struct hif_msg *hif) goto end; wdev->hif.tx_buffers_used++; + _trace_hif_send(hif, wdev->hif.tx_buffers_used); end: if (is_encrypted) kfree(data); @@ -234,6 +238,7 @@ static void bh_work(struct work_struct *work) device_release(wdev); release_chip = true; } + _trace_bh_stats(stats_ind, stats_req, stats_cnf, wdev->hif.tx_buffers_used, release_chip); } /* diff --git a/drivers/staging/wfx/traces.h b/drivers/staging/wfx/traces.h index ba97df821f1b..fd75c4c7e9c7 100644 --- a/drivers/staging/wfx/traces.h +++ b/drivers/staging/wfx/traces.h @@ -15,6 +15,8 @@ #include #include "bus.h" +#include "hif_api_cmd.h" +#include "hif_api_mib.h" #if (KERNEL_VERSION(4, 1, 0) > LINUX_VERSION_CODE) #define TRACE_DEFINE_ENUM(a) @@ -50,6 +52,167 @@ * #define list_for_print_symbolic list_names { -1, NULL } */ +#define _hif_msg_list \ + hif_cnf_name(ADD_KEY) \ + hif_cnf_name(BEACON_TRANSMIT) \ + hif_cnf_name(EDCA_QUEUE_PARAMS) \ + hif_cnf_name(JOIN) \ + hif_cnf_name(MAP_LINK) \ + hif_cnf_name(READ_MIB) \ + hif_cnf_name(REMOVE_KEY) \ + hif_cnf_name(RESET) \ + hif_cnf_name(SET_BSS_PARAMS) \ + hif_cnf_name(SET_PM_MODE) \ + hif_cnf_name(START) \ + hif_cnf_name(START_SCAN) \ + hif_cnf_name(STOP_SCAN) \ + hif_cnf_name(TX) \ + hif_cnf_name(MULTI_TRANSMIT) \ + hif_cnf_name(UPDATE_IE) \ + hif_cnf_name(WRITE_MIB) \ + hif_cnf_name(CONFIGURATION) \ + hif_cnf_name(CONTROL_GPIO) \ + hif_cnf_name(PREVENT_ROLLBACK) \ + hif_cnf_name(SET_SL_MAC_KEY) \ + hif_cnf_name(SL_CONFIGURE) \ + hif_cnf_name(SL_EXCHANGE_PUB_KEYS) \ + hif_cnf_name(SHUT_DOWN) \ + hif_ind_name(EVENT) \ + hif_ind_name(JOIN_COMPLETE) \ + hif_ind_name(RX) \ + hif_ind_name(SCAN_CMPL) \ + hif_ind_name(SET_PM_MODE_CMPL) \ + hif_ind_name(SUSPEND_RESUME_TX) \ + hif_ind_name(SL_EXCHANGE_PUB_KEYS) \ + hif_ind_name(ERROR) \ + hif_ind_name(EXCEPTION) \ + hif_ind_name(GENERIC) \ + hif_ind_name(WAKEUP) \ + hif_ind_name(STARTUP) + +#define hif_msg_list_enum _hif_msg_list + +#undef hif_cnf_name +#undef hif_ind_name +#define hif_cnf_name(msg) TRACE_DEFINE_ENUM(HIF_CNF_ID_##msg); +#define hif_ind_name(msg) TRACE_DEFINE_ENUM(HIF_IND_ID_##msg); +hif_msg_list_enum +#undef hif_cnf_name +#undef hif_ind_name +#define hif_cnf_name(msg) { HIF_CNF_ID_##msg, #msg }, +#define hif_ind_name(msg) { HIF_IND_ID_##msg, #msg }, +#define hif_msg_list hif_msg_list_enum { -1, NULL } + +#define _hif_mib_list \ + hif_mib_name(ARP_IP_ADDRESSES_TABLE) \ + hif_mib_name(ARP_KEEP_ALIVE_PERIOD) \ + hif_mib_name(BEACON_FILTER_ENABLE) \ + hif_mib_name(BEACON_FILTER_TABLE) \ + hif_mib_name(BEACON_WAKEUP_PERIOD) \ + hif_mib_name(BLOCK_ACK_POLICY) \ + hif_mib_name(CONFIG_DATA_FILTER) \ + hif_mib_name(COUNTERS_TABLE) \ + hif_mib_name(CURRENT_TX_POWER_LEVEL) \ + hif_mib_name(DOT11_MAC_ADDRESS) \ + hif_mib_name(DOT11_MAX_RECEIVE_LIFETIME) \ + hif_mib_name(DOT11_MAX_TRANSMIT_MSDU_LIFETIME) \ + hif_mib_name(DOT11_RTS_THRESHOLD) \ + hif_mib_name(DOT11_WEP_DEFAULT_KEY_ID) \ + hif_mib_name(GL_BLOCK_ACK_INFO) \ + hif_mib_name(GL_OPERATIONAL_POWER_MODE) \ + hif_mib_name(GL_SET_MULTI_MSG) \ + hif_mib_name(INACTIVITY_TIMER) \ + hif_mib_name(INTERFACE_PROTECTION) \ + hif_mib_name(IPV4_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(IPV6_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(KEEP_ALIVE_PERIOD) \ + hif_mib_name(MAC_ADDR_DATAFRAME_CONDITION) \ + hif_mib_name(NON_ERP_PROTECTION) \ + hif_mib_name(NS_IP_ADDRESSES_TABLE) \ + hif_mib_name(OVERRIDE_INTERNAL_TX_RATE) \ + hif_mib_name(PROTECTED_MGMT_POLICY) \ + hif_mib_name(RX_FILTER) \ + hif_mib_name(RCPI_RSSI_THRESHOLD) \ + hif_mib_name(SET_ASSOCIATION_MODE) \ + hif_mib_name(SET_DATA_FILTERING) \ + hif_mib_name(ETHERTYPE_DATAFRAME_CONDITION) \ + hif_mib_name(SET_HT_PROTECTION) \ + hif_mib_name(MAGIC_DATAFRAME_CONDITION) \ + hif_mib_name(SET_TX_RATE_RETRY_POLICY) \ + hif_mib_name(SET_UAPSD_INFORMATION) \ + hif_mib_name(PORT_DATAFRAME_CONDITION) \ + hif_mib_name(SLOT_TIME) \ + hif_mib_name(STATISTICS_TABLE) \ + hif_mib_name(TEMPLATE_FRAME) \ + hif_mib_name(TSF_COUNTER) \ + hif_mib_name(UC_MC_BC_DATAFRAME_CONDITION) + +#define hif_mib_list_enum _hif_mib_list + +#undef hif_mib_name +#define hif_mib_name(mib) TRACE_DEFINE_ENUM(HIF_MIB_ID_##mib); +hif_mib_list_enum +#undef hif_mib_name +#define hif_mib_name(mib) { HIF_MIB_ID_##mib, #mib }, +#define hif_mib_list hif_mib_list_enum { -1, NULL } + +DECLARE_EVENT_CLASS(hif_data, + TP_PROTO(struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv), + TP_STRUCT__entry( + __field(int, tx_fill_level) + __field(int, msg_id) + __field(const char *, msg_type) + __field(int, msg_len) + __field(int, buf_len) + __field(int, if_id) + __field(int, mib) + __array(u8, buf, 128) + ), + TP_fast_assign( + int header_len; + + __entry->tx_fill_level = tx_fill_level; + __entry->msg_len = hif->len; + __entry->msg_id = hif->id; + __entry->if_id = hif->interface; + if (is_recv) + __entry->msg_type = __entry->msg_id & 0x80 ? "IND" : "CNF"; + else + __entry->msg_type = "REQ"; + if (!is_recv && + (__entry->msg_id == HIF_REQ_ID_READ_MIB || __entry->msg_id == HIF_REQ_ID_WRITE_MIB)) { + __entry->mib = le16_to_cpup((u16 *) hif->body); + header_len = 4; + } else { + __entry->mib = -1; + header_len = 0; + } + __entry->buf_len = min_t(int, __entry->msg_len, sizeof(__entry->buf)) + - sizeof(struct hif_msg) - header_len; + memcpy(__entry->buf, hif->body + header_len, __entry->buf_len); + ), + TP_printk("%d:%d:%s_%s%s%s: %s%s (%d bytes)", + __entry->tx_fill_level, + __entry->if_id, + __print_symbolic(__entry->msg_id, hif_msg_list), + __entry->msg_type, + __entry->mib != -1 ? "/" : "", + __entry->mib != -1 ? __print_symbolic(__entry->mib, hif_mib_list) : "", + __print_hex(__entry->buf, __entry->buf_len), + __entry->msg_len > sizeof(__entry->buf) ? " ..." : "", + __entry->msg_len + ) +); +DEFINE_EVENT(hif_data, hif_send, + TP_PROTO(struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv)); +#define _trace_hif_send(hif, tx_fill_level) trace_hif_send(hif, tx_fill_level, false) +DEFINE_EVENT(hif_data, hif_recv, + TP_PROTO(struct hif_msg *hif, int tx_fill_level, bool is_recv), + TP_ARGS(hif, tx_fill_level, is_recv)); +#define _trace_hif_recv(hif, tx_fill_level) trace_hif_recv(hif, tx_fill_level, true) + #define wfx_reg_list_enum \ wfx_reg_name(WFX_REG_CONFIG, "CONFIG") \ wfx_reg_name(WFX_REG_CONTROL, "CONTROL") \ @@ -143,6 +306,54 @@ DEFINE_EVENT(io_data32, io_read32, #define _trace_io_ind_read32(reg, addr, val) trace_io_read32(reg, addr, val) #define _trace_io_read32(reg, val) trace_io_read32(reg, -1, val) +DECLARE_EVENT_CLASS(piggyback, + TP_PROTO(u32 val, bool ignored), + TP_ARGS(val, ignored), + TP_STRUCT__entry( + __field(int, val) + __field(bool, ignored) + ), + TP_fast_assign( + __entry->val = val; + __entry->ignored = ignored; + ), + TP_printk("CONTROL: %08x%s", + __entry->val, + __entry->ignored ? " (ignored)" : "" + ) +); +DEFINE_EVENT(piggyback, piggyback, + TP_PROTO(u32 val, bool ignored), + TP_ARGS(val, ignored)); +#define _trace_piggyback(val, ignored) trace_piggyback(val, ignored) + +TRACE_EVENT(bh_stats, + TP_PROTO(int ind, int req, int cnf, int busy, bool release), + TP_ARGS(ind, req, cnf, busy, release), + TP_STRUCT__entry( + __field(int, ind) + __field(int, req) + __field(int, cnf) + __field(int, busy) + __field(bool, release) + ), + TP_fast_assign( + __entry->ind = ind; + __entry->req = req; + __entry->cnf = cnf; + __entry->busy = busy; + __entry->release = release; + ), + TP_printk("IND/REQ/CNF:%3d/%3d/%3d, REQ in progress:%3d, WUP: %s", + __entry->ind, + __entry->req, + __entry->cnf, + __entry->busy, + __entry->release ? "release" : "keep" + ) +); +#define _trace_bh_stats(ind, req, cnf, busy, release) trace_bh_stats(ind, req, cnf, busy, release) + #endif /* This part must be outside protection */