Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3675929pxk; Mon, 21 Sep 2020 22:39:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxbtJJSuR2085XOajDsOY4GlOuWEzrG+sAIqIYX0N+Q3fKw2oZk61nva/AivXphIhzigFEw X-Received: by 2002:a17:906:aacb:: with SMTP id kt11mr3047887ejb.294.1600753196760; Mon, 21 Sep 2020 22:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600753196; cv=none; d=google.com; s=arc-20160816; b=FIDtFQ8P5mSw3nDkVZ8hakP0UyvIIzluSlaimeLyfXY1DebGthyFnRKiZ/AnNlXhLT i9pnfHtGKfzBWyqqZjpPPOKXh66U9vacbCox+j1H7oDl7BoxC56s0/G5iV0aR5I5zMch cBFgkjm2FOQOPLSum6iJRXTmrGPQcKIuTANHbfR37jH2lCjOkeW2R7iGOv3DKKlcJ0YX m87OV7K+ghkgY8gbIhT8UD8o1HenTRfGn3+HuRI9Uas9s+p0vrVCOXYOf8Mj4wx6Oss+ /GvkM4EWj0Lf6kJy/scUzvruB6wmLdPEgX9EHqRScT0ia61348sHapBusujXJGojTNmX gB1g== 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; bh=ZDrTJdFlduhUL152EvEcYh4s9jSyNV2zESN1SdczTUA=; b=xX9HSrelSqpqpCSIdiOF5osKl1UY7ABCq5W/+UQ6o84QUtv2P4E8DlB6rR1NZXcx5s 6ZHz3VeYODZYBHadU9fhyTpTlszscMzkButXu8goBGapsV8rBBj+el/HPf1oYitwaFD/ DHeyN9QZXquJODCjtoeW4EVtR99vAv9Ue82eG0bOZeUDtq2t6RNQ+Gc7szeJKh165zj6 hAtDRQvk7E4qDZERR19s5CwHxJ9LDgtFYho4eA1aYXYe0qjH6TYCdG8q9PtBT2dqDT3P PQp+buGCaksTFDZ5IGLnvACKnyReqBoRJId7LUmdYuADmFFk9OFwRyu9Kem10v8WDBbd Nygg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x99si9967821ede.160.2020.09.21.22.39.32; Mon, 21 Sep 2020 22:39:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729094AbgIVFho (ORCPT + 99 others); Tue, 22 Sep 2020 01:37:44 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:34144 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728928AbgIVFhn (ORCPT ); Tue, 22 Sep 2020 01:37:43 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 984724F9E04; Tue, 22 Sep 2020 05:37:43 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at web.adapt-ip.com Received: from web.adapt-ip.com ([127.0.0.1]) by localhost (web.adapt-ip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id lic9W0jsQ-ed; Tue, 22 Sep 2020 05:37:41 +0000 (UTC) Received: from atlas.campbell.adapt-ip.com (gateway.adapt-ip.com [173.164.178.20]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id 32D714F9E05; Tue, 22 Sep 2020 05:37:21 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v4 16/17] mac80211_hwsim: fix TSF timestamp write to S1G beacon Date: Mon, 21 Sep 2020 19:28:17 -0700 Message-Id: <20200922022818.15855-17-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200922022818.15855-1-thomas@adapt-ip.com> References: <20200922022818.15855-1-thomas@adapt-ip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org mac80211_hwsim was corrupting the S1G beacon because the timestamp location (and size) does not match the management beacon. Signed-off-by: Thomas Pedersen --- v3: - fix this before claiming S1G support Reported-by: kernel test robot --- drivers/net/wireless/mac80211_hwsim.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index dce3bc9c9f84..3daf5b399ebf 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1687,9 +1687,19 @@ static void mac80211_hwsim_beacon_tx(void *arg, u8 *mac, mgmt = (struct ieee80211_mgmt *) skb->data; /* fake header transmission time */ data->abs_bcn_ts = mac80211_hwsim_get_tsf_raw(); - mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + - data->tsf_offset + - 24 * 8 * 10 / txrate->bitrate); + if (ieee80211_is_s1g_beacon(mgmt->frame_control)) { + struct ieee80211_ext *ext = (void *) mgmt; + + ext->u.s1g_beacon.timestamp = cpu_to_le32(data->abs_bcn_ts + + data->tsf_offset + + 10 * 8 * 10 / + txrate->bitrate); + } else { + mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + + data->tsf_offset + + 24 * 8 * 10 / + txrate->bitrate); + } mac80211_hwsim_tx_frame(hw, skb, rcu_dereference(vif->chanctx_conf)->def.chan); -- 2.20.1