Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1306824pxk; Mon, 31 Aug 2020 15:56:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs13afGyFv5fGb4a6+3/KEIDVD843/uTJpsN4ZmioLxLo2w5p0TxukellvdRnNQRJLHV49 X-Received: by 2002:a17:906:b2c3:: with SMTP id cf3mr3126969ejb.387.1598914580966; Mon, 31 Aug 2020 15:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598914580; cv=none; d=google.com; s=arc-20160816; b=cgbD6A3wAIRHUxhU0UDwtBo33tiV728tp2bORPRYWl13BqncPqp8W9A18cUI28XQcC LobfIRQIjOFbSGdT6WyiVBPde8A4pPxBlZYoADzhqpkT+WVQeczF9VAmUJOuxpxFzaZL keR1+ZSdEE+wQaN+4U5tlk0hKd6zCfvu0NBnqkROA5FMAGdA2q7EZu37L34tdpTQ+ZNj dZSU5BcwEBzzU5s0WdXdAKtJX2yS12PNDocdblh+OSaHuEnorV4ZF14lt0m8gAShh/FO iezCnQZR6P26XjGc6IQ4h9ZPw2mWydrmMJDSxvxlQN500llBIONdmlTuNJNweKc7PuEw LO9w== 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=YUcc/d6wDwTy6zhfZSoe24L3nZ7xkb32o6Sgfq3guag=; b=G+SoiHaTpjWSx2lalu6yh3cnH7wXE6N+ROm9vZNSChgSC4zjQtV+mbDFcczN7mS99k eq1PNzOwiRFcUH5w6AwaHN4V0/CdH4eAOGiUp3xEws6tN6262XkbmOvP9d8D4I/YUo+b CYor6LEF6HeWIdHsmsmaSPZpTFgY+PE16lyZxXO61agNK+BC9abIHsFKLQJ42+y+wkLJ YWynWrfixn0E0rOa/ZhSWnE2J2JppZUvkQCcOqa9IuvWaBaaql0CvuCcCj4zMgFHzVax yl5VD0fbDvfWLz6gCNOTUBW3VDY7mrfCHEw9oFlAyiiuSDQadDZUgnBdrLXlk+HXRfjH tw8w== 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 c14si6317806edr.574.2020.08.31.15.55.57; Mon, 31 Aug 2020 15:56:20 -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 S1730181AbgHaU45 (ORCPT + 99 others); Mon, 31 Aug 2020 16:56:57 -0400 Received: from mail.adapt-ip.com ([173.164.178.19]:52460 "EHLO web.adapt-ip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728597AbgHaU45 (ORCPT ); Mon, 31 Aug 2020 16:56:57 -0400 Received: from localhost (localhost [127.0.0.1]) by web.adapt-ip.com (Postfix) with ESMTP id 4CE924F90AD; Mon, 31 Aug 2020 20:56:56 +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 UFvmJPRPtpfn; Mon, 31 Aug 2020 20:56:53 +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 200304EC91A; Mon, 31 Aug 2020 20:56:14 +0000 (UTC) From: Thomas Pedersen To: Johannes Berg Cc: linux-wireless , Thomas Pedersen Subject: [PATCH v2 22/22] mac80211_hwsim: fix TSF timestamp write to S1G beacon Date: Mon, 31 Aug 2020 13:56:00 -0700 Message-Id: <20200831205600.21058-23-thomas@adapt-ip.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200831205600.21058-1-thomas@adapt-ip.com> References: <20200831205600.21058-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 83d8f54ef93e..18dd23a11ddf 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1742,9 +1742,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