Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp770551pxa; Thu, 27 Aug 2020 15:35:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1B6U1+jc4T4B5+2MADsG4ghW24lj26fotgh/vWd3KG4A2wuAr182/4PPTgWwT2Ndwy9X7 X-Received: by 2002:a50:eb96:: with SMTP id y22mr15483496edr.371.1598567758465; Thu, 27 Aug 2020 15:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598567758; cv=none; d=google.com; s=arc-20160816; b=t9lFHFMsEsxM++tRsSXDTYSa7p07+HgdE7a4BcSGDBLG68umoJoJuyJZvAmwDOWRV/ UjdSmhP6q+EZE/361IUkFP9huEAfvZm3c2fWQqT/9ZUn4JTniar8BWrTaT3IpcnDXkTv pWuFfTimyvTRqVwFdp1WL+PfomNfsR+Y621p3SAYLx4zTUeVptbd7bi4P1DCXxIBntZc yeMWhd/nQFqPXNgtD9SbCJSGvLwAu1SiU8Amubf1uR4b4eDSVV0F0UkXZOwufwd8DHrx GUORmVyfhnAO8uuS0vUWxVUhbd54w2Y0hYChwxfPKUc3XxF45i5p4EXnYIuzX8POSO0G ztgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=TBvVXxoLACKe34jUjyggyWKugEytVZjp6MkBTF3CMO4=; b=XDGvIqI6I9Hmldu3aIZT7aL8BS5bqMVsjoENYtYJW2LN3ehEaQtGS7pDdviyPqirb5 PKwtHXmOIwWBZUNcJjymONSwBxExGiekJrJMUm8Pk3GGdMf+8B5unwm719yghF8yTocZ d9s1yRfsulRN3y2R5ERxnoW4Q2q2z5WbI9SJvi2VfgIUA58QNbzioTavVCJ/oFu0H2zF A7P1+K7wo2jh+QvrSJYuXFFjvwK1k/tmmiohI4YKcR1yGK5lfJZocRnD8QZD3f9icpX8 2CEyadfZnqZk3lndVAqGVPR9u766OQAQLtD/Y8qYBil95SbZ+nrM3STDNZcCl68Z3AzJ ujRQ== 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 b3si2769798edn.98.2020.08.27.15.35.34; Thu, 27 Aug 2020 15:35:58 -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 S1728089AbgH0Wdv (ORCPT + 99 others); Thu, 27 Aug 2020 18:33:51 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:50638 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728054AbgH0Wdu (ORCPT ); Thu, 27 Aug 2020 18:33:50 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id B8CEA4F858C; Thu, 27 Aug 2020 22:33:49 +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 trTqzuCzh3-T; Thu, 27 Aug 2020 22:33:47 +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 A88954F809F; Thu, 27 Aug 2020 22:33:14 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH 22/22] mac80211_hwsim: fix TSF timestamp write to S1G beacon Date: Thu, 27 Aug 2020 15:33:04 -0700 Message-Id: <20200827223304.16155-23-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200827223304.16155-1-thomas@adapt-ip.com> References: <20200827223304.16155-1-thomas@adapt-ip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org 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 --- drivers/net/wireless/mac80211_hwsim.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index ee2f3a008e01..f53b144c431b 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1743,9 +1743,18 @@ 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 / 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 / + bitrate); + } else { + mgmt->u.beacon.timestamp = cpu_to_le64(data->abs_bcn_ts + + data->tsf_offset + + 24 * 8 * 10 / bitrate); + } mac80211_hwsim_tx_frame(hw, skb, rcu_dereference(vif->chanctx_conf)->def.chan); -- 2.20.1