Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp358732rdh; Tue, 19 Dec 2023 00:38:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRkTx2Hh9dSa7pLTqQ+sNKHFkdWtMCantzNpBDvlPH5FgsownmAGaO7JJsg5M6CYWssj8O X-Received: by 2002:a17:907:6d0c:b0:9fc:93e1:c6bc with SMTP id sa12-20020a1709076d0c00b009fc93e1c6bcmr11947124ejc.33.1702975105593; Tue, 19 Dec 2023 00:38:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702975105; cv=none; d=google.com; s=arc-20160816; b=dBVgA9s/8C9yNfNxWzs4Wiv1LUxZ3tTLQzEkinK10Fy+dpsnHEJlFv3LHj5Z5NYb3X rbQedMSPTSAPLyNVoUDEgsC6NiSjgWzk5ofXrK5yrEGjgbUuW8gkxG+2n1Egi5nWk/na Nb7EtZEqvFD7icvZK1utE99VQS1zExuFjcvIppCnfKe+ILXTU6qlbhSyZUELWJb+DkN1 6vOU1f2ICgATuznLvcgBjz4DGZtkBQKpBPooJIm1kdzffe3XO3EeLHpdLIXfbuBCS7aO ZBa4+pQkgAG9RMXffpwG1okQRAHo4hSRIwBzqyHg/FRCyuRIebCf9kNzGbPKaU3Y2CHC wWKA== ARC-Message-Signature: i=1; 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=aV20f0ee2MV/zhlSGTD3H3cHSAQv0f59VUa2GeIOt5A=; fh=/7PoNOCmrnmWiG0Xn2h4iiOikfXtAzmdc5ERB5rAobg=; b=T3z9c1gJumzs5hRrwjRDmlsEuQYZ1KMyNmbWQLc/LfFA/IiWNTQ1gnAxh7/HrWHLVf 03As+Rt6ltGnxkPNU16omhnynWjDjZuOWXn02sRtdkB6arbCPPtlE8VWIo+Wb4NooQ5M dUhNNQa0x+faGtlS0gTZtsGKi54CDFQqctYHGejPgJAkHDY730Op032WU1WUKcCwmRGF rfMDvaaIZWLng2yHPH/MTdlDJcWmf8P2br06fQt2SwjS34vdDSgoQU4JSK51XGgsgh0b u9QgGoZtFyymELgZvDPjjntpm+InTVIPX1Z21Z/hhbzMOK8XJ1mrGzryMn9TczOEyhoo b1Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=ecFQbw2E; spf=pass (google.com: domain of linux-wireless+bounces-971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s22-20020a170906bc5600b00a2363129eb5si1177743ejv.403.2023.12.19.00.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 00:38:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=fail header.i=@intel.com header.s=Intel header.b=ecFQbw2E; spf=pass (google.com: domain of linux-wireless+bounces-971-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-971-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 am.mirrors.kernel.org (Postfix) with ESMTPS id 382DA1F250B4 for ; Tue, 19 Dec 2023 08:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A6BCB125C0; Tue, 19 Dec 2023 08:38:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ecFQbw2E" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) (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 3DBC511C9C for ; Tue, 19 Dec 2023 08:37:59 +0000 (UTC) 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=1702975079; x=1734511079; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AiOJALF7j4rgUTg7bT6QoF5UoTLFe44maFPK0My+EFM=; b=ecFQbw2EkHAaI7P7t1l96j4oVV8bP6hLj7gnMzaUKAjwLEnq4Dr7rT1/ ptgzJiq2o0PjyNenVyd7c3Pv7ucU54QZSrD5yGLJqXahD3p5wCQebXu76 IF5KnWBrSiCx8MyRkPFIuRINNSx5nOUwVt4j/FQDZ3PlbqZDzy+nE8S81 ZTqY57tR/zyL5vrDpBkMBsp3x9bwmJBurTBK7pB1KW/suLlOuU4hZv8s7 FliOJG8jaWehLozqJjdvPeACU45ZCnq38yUUiFjxEMuhtwcOIkc2/lpI8 tw/WhTCNSDlVrzfPR0ABdyAso9mAp3LmU0X6lIaVel4G5QcSiGz7tN426 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10928"; a="459969217" X-IronPort-AV: E=Sophos;i="6.04,287,1695711600"; d="scan'208";a="459969217" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 00:37:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10928"; a="846266380" X-IronPort-AV: E=Sophos;i="6.04,287,1695711600"; d="scan'208";a="846266380" Received: from unknown (HELO WEIS0040.iil.intel.com) ([10.12.217.108]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Dec 2023 00:37:56 -0800 From: Miri Korenblit To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Johannes Berg , Greenman@web.codeaurora.org, Gregory , Berg@web.codeaurora.org, Benjamin Subject: [PATCH 07/15] wifi: mac80211: allow 64-bit radiotap timestamps Date: Wed, 20 Dec 2023 04:37:55 +0200 Message-Id: <20231220043149.27acc3ad9d81.Ie3ce5eae33cce88fa01178e7aea94661ded1ac24@changeid> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231220023803.2901117-1-miriam.rachel.korenblit@intel.com> References: <20231220023803.2901117-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 When reporting the radiotap timestamp, the mactime field is usually unused, we take the data from the device_timestamp. However, there can be cases where the radiotap timestamp is better reported as a 64-bit value, so since the mactime is free, add a flag to support using the mactime as a 64-bit radiotap timestamp. Signed-off-by: Johannes Berg Reviewed-by: Greenman, Gregory Reviewed-by: Berg, Benjamin Signed-off-by: Miri Korenblit --- include/net/mac80211.h | 7 ++++++- net/mac80211/rx.c | 13 +++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 00274d1cdeeb..58328d0c1cf5 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h @@ -1374,6 +1374,11 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) * (including FCS) was received. * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime * field) is valid and contains the time the SYNC preamble was received. + * @RX_FLAG_MACTIME_IS_RTAP_TS64: The timestamp passed in the RX status @mactime + * is only for use in the radiotap timestamp header, not otherwise a valid + * @mactime value. Note this is a separate flag so that we continue to see + * %RX_FLAG_MACTIME as unset. Also note that in this case the timestamp is + * reported to be 64 bits wide, not just 32. * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present. * Valid only for data frames (mainly A-MPDU) * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference @@ -1449,7 +1454,7 @@ enum mac80211_rx_flags { RX_FLAG_IV_STRIPPED = BIT(4), RX_FLAG_FAILED_FCS_CRC = BIT(5), RX_FLAG_FAILED_PLCP_CRC = BIT(6), - /* one free bit at 7 */ + RX_FLAG_MACTIME_IS_RTAP_TS64 = BIT(7), RX_FLAG_NO_SIGNAL_VAL = BIT(8), RX_FLAG_AMPDU_DETAILS = BIT(9), RX_FLAG_PN_VALIDATED = BIT(10), diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index bbfdcb0ade72..a57c8272c1dc 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -566,7 +566,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, if (local->hw.radiotap_timestamp.units_pos >= 0) { u16 accuracy = 0; - u8 flags = IEEE80211_RADIOTAP_TIMESTAMP_FLAG_32BIT; + u8 flags; + u64 ts; rthdr->it_present |= cpu_to_le32(BIT(IEEE80211_RADIOTAP_TIMESTAMP)); @@ -575,7 +576,15 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local, while ((pos - (u8 *)rthdr) & 7) pos++; - put_unaligned_le64(status->device_timestamp, pos); + if (status->flag & RX_FLAG_MACTIME_IS_RTAP_TS64) { + flags = IEEE80211_RADIOTAP_TIMESTAMP_FLAG_64BIT; + ts = status->mactime; + } else { + flags = IEEE80211_RADIOTAP_TIMESTAMP_FLAG_32BIT; + ts = status->device_timestamp; + } + + put_unaligned_le64(ts, pos); pos += sizeof(u64); if (local->hw.radiotap_timestamp.accuracy >= 0) { -- 2.34.1