From patchwork Sat Nov 26 16:01:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 26261 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp4706842wrr; Sat, 26 Nov 2022 08:02:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf7vNtMhPFdjJC3WD/NOUUissuFEPYD/3Ex1cGbSsprkoUfZY3CEFIUKHHuPpsMbDEVRvwbl X-Received: by 2002:a17:902:db09:b0:186:f36a:63b2 with SMTP id m9-20020a170902db0900b00186f36a63b2mr23352054plx.128.1669478565033; Sat, 26 Nov 2022 08:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669478565; cv=none; d=google.com; s=arc-20160816; b=jyOBXKprsd3oqCtpksJdi3ACIXQR9FvrVApO11KBk3e9eaqOs4GW1GElszRoX06yLv KuLy27L0xmHEJLL1Q9ZYpcOb4f/Bm00mYPYz97zTyJr3CIcntzTSAFFvpGtOAtq0qOa4 +OcoC6CEl60aQpX5o3UIKLY05HLXN8EubXjQ7jHYEIjtXX5gDB2imTlkWB+2rPHZsF5D PmJxUmWNbKEGcHTnsF85mgnARvTK3K4Ua+KUwfT+XH/0G+6QZEWU7XSG1OQRumrUjT5d XcS4POsFINzilI1EFlLhVJm/GZfEkISCxTNOxIroe6TqVyzNhnaaK5M0m50YXZNCIxx/ kRJw== 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=a9saDzsVzhdECn3lF0EF9IIc/ALNYzSwycl8VLPlYJ4=; b=MYAvUUYAtRbNBNnuHO1Ny0l6R4A5HgrNsOrzDXUvwAKcU2ID2X8KURIdq/809WzU/T 38NBqdLPau9DRVII8CdSyyJv1G7zncTnQyQhY2cEC5ciJy2bR0Bg4GR1/XQd5NLFXQkz IhLmwnvqbVPLo9yDCrXqaArKlRCSakhpF2MW2xePPaaL+8wsC9N6hQtm97OUDiuWq9fs 3E8dLQvOqaDbi7EIrKz1xjGYKFH3uvFIbOXb5lCjetWd+iZl7fuuFYMv/UqUpar3q9oZ KAYs6QNji2wYSoJhUJE4jwRMXnxLnS70HhQ3bPoyg4tXLMvsLVwCsNx/DRndjdMxkg7b AcYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju12-20020a170903428c00b001892c399db0si6130899plb.363.2022.11.26.08.02.31; Sat, 26 Nov 2022 08:02:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229675AbiKZQBs (ORCPT + 99 others); Sat, 26 Nov 2022 11:01:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbiKZQBl (ORCPT ); Sat, 26 Nov 2022 11:01:41 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11593193E2 for ; Sat, 26 Nov 2022 08:01:41 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oyxcV-0000Ub-Jx; Sat, 26 Nov 2022 17:01:35 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 02/10] staging: r8188eu: read timestamp from ieee80211_mgmt Date: Sat, 26 Nov 2022 17:01:21 +0100 Message-Id: <20221126160129.178697-3-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750575156012519993?= X-GMAIL-MSGID: =?utf-8?q?1750575156012519993?= Read the 64-bit timestamp from struct ieee80211_mgmt instead of parsing the beacon message ourselves. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index 80342b53a129..66e3a90da3a3 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -389,21 +389,6 @@ static u32 p2p_listen_state_process(struct adapter *padapter, unsigned char *da) return _SUCCESS; } -static void update_TSF(struct mlme_ext_priv *pmlmeext, u8 *pframe) -{ - u8 *pIE; - __le32 *pbuf; - - pIE = pframe + sizeof(struct ieee80211_hdr_3addr); - pbuf = (__le32 *)pIE; - - pmlmeext->TSFValue = le32_to_cpu(*(pbuf + 1)); - - pmlmeext->TSFValue = pmlmeext->TSFValue << 32; - - pmlmeext->TSFValue |= le32_to_cpu(*pbuf); -} - static void correct_TSF(struct adapter *padapter) { u8 reg; @@ -592,8 +577,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) /* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe + sizeof(struct ieee80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); - /* update TSF Value */ - update_TSF(pmlmeext, pframe); + pmlmeext->TSFValue = le64_to_cpu(mgmt->u.beacon.timestamp); /* start auth */ start_clnt_auth(padapter); @@ -635,8 +619,7 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) return; } - /* update TSF Value */ - update_TSF(pmlmeext, pframe); + pmlmeext->TSFValue = le64_to_cpu(mgmt->u.beacon.timestamp); /* report sta add event */ report_add_sta_event(padapter, GetAddr2Ptr(pframe), cam_idx);