Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2483945rdb; Wed, 4 Oct 2023 02:37:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrcD5zCLsQk+IR5twRSgud1ZVU5pssQ9qO9LgH7sZLvVcdT5QINkWshgfWQ+9pKKbNhx4A X-Received: by 2002:a05:6a20:7485:b0:15d:eb3:839 with SMTP id p5-20020a056a20748500b0015d0eb30839mr6745381pzd.31.1696412239180; Wed, 04 Oct 2023 02:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696412239; cv=none; d=google.com; s=arc-20160816; b=VAVrDrkqjAe+dfbO/HzHMJH09rMqCUqm5h+uskxFvbBngnah+jhU/33BssZJXYfcp1 gdCM5J/E9Kq3CFJ4zkezhkZ4Gi5LbOLsDJ+rHH1yMBgcFuahkX9FwsEP0WzlyBnJwzlC 0+W6RcLyH+8hw/0MLh/Fj83t7GE6Kda0Tx5EthRyON6lazZrxHXz+1rlKqnXcXR+Y4AJ PaoamxL/4fGfdscM+l4ol/sr4epy9LDsCZTUwt84xqGVIw44vXurVLc+abv72uA++5TW 25a0Kp8rkpHt4u1tFMZTbYKDqSO5en6g2HSeVg9cCJNzIFW465FQDrBowkToi1Dsbd4B AHug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5xUPyqJ13f9NaQeXoUGE1qSNRF58mkQMajaPi+LhBj8=; fh=JKZqm9djF4cQ8/5xs/hzAvyr09qLpqcWfsVsCJHYbeE=; b=f0N+6mOS+ogOfHl4G4PEhP+hJ3J5RAtQCi0Z1OkpM65nwDwzeTcMR84pCE2qgN6PXT UGGVPveOnTJHrAsmtz+bHJCnLq0YZLW3+r7XJlGrCwBbsiWD3ad4t3PJsywXT975ex6p XDekD0NkGLfsPHCx43BJGs72I4BtLm0VIa8jrkR+0581vd1OUynwj02/PWHhy212zrJH No9dVGM+uKOgkNRx873O291ByMkmTh8vUI76ityHHTq96pDzxkHqB+h5OM3eIZNW4t9B K0l0XYAC8xRPkXxcaBubjnTqjEDKBDmd0gPCTXCJKqXPX8zXLu6CNqvkpjWtpLkYn0PS E5NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I59HpyBs; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m1-20020a656a01000000b0055379a7131csi3655924pgu.721.2023.10.04.02.37.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 02:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I59HpyBs; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 46D508206D65; Wed, 4 Oct 2023 02:37:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242051AbjJDJhQ (ORCPT + 53 others); Wed, 4 Oct 2023 05:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242043AbjJDJhL (ORCPT ); Wed, 4 Oct 2023 05:37:11 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F57C6 for ; Wed, 4 Oct 2023 02:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696412228; x=1727948228; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DZdTY93OEOk8wFMSO8IRFK1mVyw77RyMySaUVFNglYA=; b=I59HpyBseYJgMkBRJSeGDauTrMZ9+zgzQ7ibEKmFxTvMt8EqAncPLT5l TjohBsfsEQDuYHSSzwKz6oDC0RMUYkyHaBDlDRDlYY8lhOVQe3332mkvL PAJqzEZvDK0xnVVhMv4ltes37XX1wwxdWOKSgBrpDUsF+Pae0xgDCS+IG 0nB/UkRojLYWiyaY+MYmHw1M8NnNnFAONavM/HqcSEIuscCtjxX9GyYZh fam1Ej2ZBeuYkVy9lcO83VedSm8B8zTLm8npBLQ8AuSM7yNuNu57hl74I hAtruvOj2Yv+NXcISdCR557CSw0WkAB4mJnphi0NQl3IU/LdocE0P091A A==; X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="449611836" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="449611836" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:37:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10852"; a="1082415184" X-IronPort-AV: E=Sophos;i="6.03,199,1694761200"; d="scan'208";a="1082415184" Received: from oferweis-mobl.ger.corp.intel.com (HELO ggreenma-mobl2.intel.com) ([10.214.222.21]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2023 02:37:06 -0700 From: gregory.greenman@intel.com To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, iallouch , Nitsan Bar , Gregory Greenman Subject: [PATCH 10/15] wifi: iwlwifi: mvm: add start mac ctdp sum calculation debugfs handler Date: Wed, 4 Oct 2023 12:36:29 +0300 Message-Id: <20231004123422.024d75df9e03.I69fdc826f2931a6e1435b450f0602ea060704697@changeid> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20231004093634.131303-1-gregory.greenman@intel.com> References: <20231004093634.131303-1-gregory.greenman@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 04 Oct 2023 02:37:18 -0700 (PDT) From: iallouch mac_ctdp_sum contains the power consumption, appears in power save report, and is used for debugging and collection of statistics. Add a debugfs handler to start this calculation, iff ctdp command is supported in the firmware. While on it, add an option to force start/stop this calculation, which is safe from the firmware API side. Signed-off-by: iallouch Signed-off-by: Nitsan Bar Signed-off-by: Gregory Greenman --- .../net/wireless/intel/iwlwifi/mvm/debugfs.c | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c index cf27f106d4d5..2c93b5a442c4 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c @@ -50,8 +50,18 @@ static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm *mvm, char *buf, size_t count, loff_t *ppos) { int ret; + bool force; - if (!iwl_mvm_is_ctdp_supported(mvm)) + if (!kstrtobool(buf, &force)) + IWL_DEBUG_INFO(mvm, + "force start is %d [0=disabled, 1=enabled]\n", + force); + + /* we allow skipping cap support check and force stop ctdp + * statistics collection and with guerantee that it is + * safe to use. + */ + if (!force && !iwl_mvm_is_ctdp_supported(mvm)) return -EOPNOTSUPP; if (!iwl_mvm_firmware_running(mvm) || @@ -65,6 +75,36 @@ static ssize_t iwl_dbgfs_stop_ctdp_write(struct iwl_mvm *mvm, char *buf, return ret ?: count; } +static ssize_t iwl_dbgfs_start_ctdp_write(struct iwl_mvm *mvm, + char *buf, size_t count, + loff_t *ppos) +{ + int ret; + bool force; + + if (!kstrtobool(buf, &force)) + IWL_DEBUG_INFO(mvm, + "force start is %d [0=disabled, 1=enabled]\n", + force); + + /* we allow skipping cap support check and force enable ctdp + * for statistics collection and with guerantee that it is + * safe to use. + */ + if (!force && !iwl_mvm_is_ctdp_supported(mvm)) + return -EOPNOTSUPP; + + if (!iwl_mvm_firmware_running(mvm) || + mvm->fwrt.cur_fw_img != IWL_UCODE_REGULAR) + return -EIO; + + mutex_lock(&mvm->mutex); + ret = iwl_mvm_ctdp_command(mvm, CTDP_CMD_OPERATION_START, 0); + mutex_unlock(&mvm->mutex); + + return ret ?: count; +} + static ssize_t iwl_dbgfs_force_ctkill_write(struct iwl_mvm *mvm, char *buf, size_t count, loff_t *ppos) { @@ -1998,6 +2038,7 @@ MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64); /* Device wide debugfs entries */ MVM_DEBUGFS_READ_FILE_OPS(ctdp_budget); MVM_DEBUGFS_WRITE_FILE_OPS(stop_ctdp, 8); +MVM_DEBUGFS_WRITE_FILE_OPS(start_ctdp, 8); MVM_DEBUGFS_WRITE_FILE_OPS(force_ctkill, 8); MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16); MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8); @@ -2210,6 +2251,7 @@ void iwl_mvm_dbgfs_register(struct iwl_mvm *mvm) MVM_DEBUGFS_ADD_FILE(nic_temp, mvm->debugfs_dir, 0400); MVM_DEBUGFS_ADD_FILE(ctdp_budget, mvm->debugfs_dir, 0400); MVM_DEBUGFS_ADD_FILE(stop_ctdp, mvm->debugfs_dir, 0200); + MVM_DEBUGFS_ADD_FILE(start_ctdp, mvm->debugfs_dir, 0200); MVM_DEBUGFS_ADD_FILE(force_ctkill, mvm->debugfs_dir, 0200); MVM_DEBUGFS_ADD_FILE(stations, mvm->debugfs_dir, 0400); MVM_DEBUGFS_ADD_FILE(bt_notif, mvm->debugfs_dir, 0400); -- 2.38.1