Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp716280lqt; Tue, 19 Mar 2024 01:12:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVunfAers7bEUbqczT0CriBsLuFg1mypOQhLTztqU3+zmMgP/CauXrbyqPY8drSvC4zNicz3Au8wxoG8rA/ko+0O3c80ovjE+CDkKXstg== X-Google-Smtp-Source: AGHT+IEqpZ0fRUnhyVt3+cez4lI9Pj7ngIQkEBoEVrsyy2aTS5LMt8c7pnk1GULBrZZuyqTeHhNP X-Received: by 2002:a05:6a20:c742:b0:1a3:673b:62b8 with SMTP id hj2-20020a056a20c74200b001a3673b62b8mr1462713pzb.35.1710835972920; Tue, 19 Mar 2024 01:12:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710835972; cv=pass; d=google.com; s=arc-20160816; b=iSdItvmOvQI8AiGQkrVZOzpj947c53xi0+ZaJRu9HrfkayNu4v8xA0tH/gC53e0Y9L QQon1UKNp85Zrc/zl5NF4jIFnXQdeQ1s4L8Wk+myVs3fUqG0TohCL0bGni14NfjalOXP CMPcSX/6QotiIOmrJOE6jtP2VU/5AKLwplaNNFxXJK50XuaSjfU9iOVM18dreQwAfx3z v9xJt1um0Bf9Je4MR+GNoKtlmqOb8agtXqwNHWoQQXRa24pC9habDfGKl3U8igWuETNY 4QZvgX5Xyh4KxzjQxh6+S37VUvZHop6jg47IZ8a9UTVtMMs0fz7saGEVlePBR71FC5Y/ rfOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=EzRzqD1ByZXP9w0PhMVbXhpH82n1klxB188RZTto7gQ=; fh=TquNsOiV+zNY1csTpltVB6A9QFW5SbuNs6JlqcKCQkw=; b=S7krRp0dIZDxZmkQTweGuarvpij+3gfoUgy5hkE2W6k/gNZ2ENr2oLuS1BcbgIByR2 WCcSbZdP8Xp2Q0mdjokey4Z1j4l+o81xWnCecVDD6PqBwxJCnC7IeFL+jddGya15ra3f /pV5YCfVkWpwq7V2ECwdLWVPXZdsIjC4Qb0XCybz2ZANz8Ii/MdUs2u7EtndNvQjxsen RqIWLtMhbsX5sa7yhgkOozkewT/A8WpioL5vkQZREyAEGUwN11ZMt0CRw/sVJArAnRsu rovJssbVD2o7E25Frt0JJIHPxviOLRvehvp8SsEq08bu0a+WaJ5lykOG4zV509ThJ/uI oPTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m4fVvuLP; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-4889-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id a7-20020a170902ecc700b001e030ca061asi2698389plh.452.2024.03.19.01.12.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 01:12:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4889-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m4fVvuLP; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-wireless+bounces-4889-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 82D1D2815F4 for ; Tue, 19 Mar 2024 08:12:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E23707CF27; Tue, 19 Mar 2024 08:11:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="m4fVvuLP" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3C3BA7CF37 for ; Tue, 19 Mar 2024 08:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710835862; cv=none; b=t0u6odgFynDfmhnQTkhkQeTPs/lCpcSrmgWqvIQpYCzJD8/BiX4FSQCgT6PQioLat7q6hNldG0tpQiDGPIdEo70SQqDw6cS5EQbHPbFpslrW5pw/kb8dptXtt4dU8W73t+MYk/ysSHzzbpfx7dlho5o4353L/fZpVcFxvZeY+00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710835862; c=relaxed/simple; bh=S0r9bx+a0izm3lX9lcQ0XX0BBceAOPdURSemdMxg278=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QiNrRzJyffEayQJuZNWFH/3DkjkBJKOQSDY0jMQrcqtpiCwbTExm25nAn1l0cd7NbUawcxujwIOdjzwQLzQk84GVJJ69Gpch14VALtYyfrRFDXSDlzMio2GX2Crnjod369n8wJD8NyGima6QU4eNxyETW6hzaTz0efHQRft6wlg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=m4fVvuLP; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710835861; x=1742371861; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=S0r9bx+a0izm3lX9lcQ0XX0BBceAOPdURSemdMxg278=; b=m4fVvuLPYzicfbGmGGBb5flYdi7b1BXzp2k8aUyQGTted6mH1sU1JrV2 k5/y+NwWuEw1bH0/pv+r+D9IXQK9qYKuqApsvPyH9tjy/H/B+weDVKmZr dci4QMx68jHM/QYGJkb/H8hUiOQ+yKKiG9ukt0WznH0P7M8czI8Eq0Xcq CRdU25V5C+yzKtvjY80aJVGBlgIHYEVOOP6vEoPN8/PGCyQPJPMB2Dio5 btC/I1VVle9SVB4Uvm+0yV262lG9SR5i1v2h3lQ9dqS3xhYxNz4wFpteB nrnizYVzHV0+DlnhsF7WvEPcPIvCzHIhYz7dV9s3ho4Mx6ML/RDIrirhl g==; X-IronPort-AV: E=McAfee;i="6600,9927,11017"; a="5810565" X-IronPort-AV: E=Sophos;i="6.07,136,1708416000"; d="scan'208";a="5810565" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2024 01:11:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,136,1708416000"; d="scan'208";a="18447633" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2024 01:11:00 -0700 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg Subject: [PATCH 09/15] wifi: iwlwifi: fw: add clarifying comments about iwl_fwrt_dump_data Date: Tue, 19 Mar 2024 10:10:21 +0200 Message-Id: <20240319100755.49c3a39737cc.I91c588e0d66b49f0ee9103e8d4a0e501c2fd36d6@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240319081027.3853611-1-miriam.rachel.korenblit@intel.com> References: <20240319081027.3853611-1-miriam.rachel.korenblit@intel.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Israel (74) Limited Content-Transfer-Encoding: 8bit From: Johannes Berg iwl_fw_dbg_collect_sync() unconditionally accesses 'trig' at the beginning of the function, even though the data has an inner union and 'trig' isn't necessarily always used, it can be 'desc' instead. Add comments clarifying why this is OK, that 'trig'/'desc' must be first in the struct and how in it the use of the union's sub-structs is differentiated. Signed-off-by: Johannes Berg Signed-off-by: Miri Korenblit --- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 1 + drivers/net/wireless/intel/iwlwifi/fw/runtime.h | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c index c3bdf433d8f7..fe4e1bea30bb 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/dbg.c +++ b/drivers/net/wireless/intel/iwlwifi/fw/dbg.c @@ -3084,6 +3084,7 @@ static void iwl_fw_dbg_collect_sync(struct iwl_fw_runtime *fwrt, u8 wk_idx) if (!test_bit(wk_idx, &fwrt->dump.active_wks)) return; + /* also checks 'desc' for pre-ini mode, since that shadows in union */ if (!dump_data->trig) { IWL_ERR(fwrt, "dump trigger data is not set\n"); goto out; diff --git a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h index b2bc4fd37abf..4204e999bbf2 100644 --- a/drivers/net/wireless/intel/iwlwifi/fw/runtime.h +++ b/drivers/net/wireless/intel/iwlwifi/fw/runtime.h @@ -46,6 +46,10 @@ struct iwl_fwrt_shared_mem_cfg { * struct iwl_fwrt_dump_data - dump data * @trig: trigger the worker was scheduled upon * @fw_pkt: packet received from FW + * + * Note that the decision which part of the union is used + * is based on iwl_trans_dbg_ini_valid(): the 'trig' part + * is used if it is %true, the 'desc' part otherwise. */ struct iwl_fwrt_dump_data { union { @@ -54,6 +58,7 @@ struct iwl_fwrt_dump_data { struct iwl_rx_packet *fw_pkt; }; struct { + /* must be first to be same as 'trig' */ const struct iwl_fw_dump_desc *desc; bool monitor_only; }; -- 2.34.1