Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4155702pxk; Tue, 8 Sep 2020 12:06:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxU4DonFUX7+Qv/CxpPe27o+ejMTS1hKI/Hj1j+dptAWmJ9Tn75trsnsh/7tS2nOxeE0Z4U X-Received: by 2002:a17:906:8687:: with SMTP id g7mr27849978ejx.129.1599591969095; Tue, 08 Sep 2020 12:06:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599591969; cv=none; d=google.com; s=arc-20160816; b=q4+DAoWk8MUK6K/U9d+WobfJYs90NjPwJ+JDMinHWENyNXH1YLLbxTfp8GdKmzbtyg dhG29Mts/0EXkxiX9AtHN1VA5CJaGBs8DSISXWdypUbEVoB9fGVycpmNpH0g19vaAep6 dgzTQ6AJme87iZVwwS1XllkxiQ8HsNVvWDmBD/CLSh3+F3lmzrDd3S4kV2q9h/woiwfk I5sQ7OHr6ONTnAwbULj4oeJbnX24FhZwhrDaHjSgr5thhSwK/7J63Mjc3M37prHmTnri Opx05w079Zlqiu+VASxBJ4r66opOaUozldo8MHxhRNWfxurGV5Du0fgU0S8O4JKIKBwX 1w7Q== 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=ZDrTJdFlduhUL152EvEcYh4s9jSyNV2zESN1SdczTUA=; b=l9FyLAG+cdLQRVHXpUSmJlHf1DQVU04RvjVqE8X8zUJnZKUZgkYhQqrbydvqiJzLZB dj6lQ+KDrQuVuXTm+X8rDBdj3UHOK94XZ4uecoNyAdDpUaTGVzLNnwVotR61CNdVBfQp lIIecbOOrjOvzqWwAOM/vUxT2nMBy7WClsL6gdKPKu83RRx4QNGl7FAOejuaoBBpW0Lc 6gVYiS22dUzsNuBiLo88V2AjsjONkS2Aaknnj3p76BKAjlIBywpmV7NfhBI6RCyFkNk2 hLCiEGrA2OvneNQGXjkySC6HcdqKoNubm2nW4/9uptPzSh9Ausq1FABpjCQn7834iZza dqOA== 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 f6si9830904edm.308.2020.09.08.12.05.45; Tue, 08 Sep 2020 12:06:09 -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 S1731722AbgIHTET (ORCPT + 99 others); Tue, 8 Sep 2020 15:04:19 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:52868 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731748AbgIHTD6 (ORCPT ); Tue, 8 Sep 2020 15:03:58 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 41C5A4F9B1B; Tue, 8 Sep 2020 19:03:57 +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 gFcnuN3e1vY5; Tue, 8 Sep 2020 19:03:54 +0000 (UTC) Received: from atlas.ibsgaard.io (c-73-223-60-234.hsd1.ca.comcast.net [73.223.60.234]) (Authenticated sender: thomas@adapt-ip.com) by web.adapt-ip.com (Postfix) with ESMTPSA id 39C164F9B27; Tue, 8 Sep 2020 19:03:26 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v3 21/22] mac80211_hwsim: fix TSF timestamp write to S1G beacon Date: Tue, 8 Sep 2020 12:03:22 -0700 Message-Id: <20200908190323.15814-22-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200908190323.15814-1-thomas@adapt-ip.com> References: <20200908190323.15814-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 --- 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