Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2943064lqt; Tue, 23 Apr 2024 06:30:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVC4T2O8KL2NlUgXOTVpSOgpfH19doJBXRuRFfGTIR7NRixsB1u25AQEkCKObeXnXiaXsDkJVAKr3pbSfFf/PkRthKIG38wB7RPa/FSBw== X-Google-Smtp-Source: AGHT+IGusRSnHut7Dd8OWrzYA8d4L5cU1udGlK56WqPTk81shropXDRZFeSbDViseTxaJzKsEGWQ X-Received: by 2002:a17:90a:a102:b0:2a4:b9db:acf5 with SMTP id s2-20020a17090aa10200b002a4b9dbacf5mr10593541pjp.24.1713879005559; Tue, 23 Apr 2024 06:30:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713879005; cv=pass; d=google.com; s=arc-20160816; b=cFsElTowX8T3khnxCpKos+3vcGvcWXxdaYlJRbVe3RfFVBwjhooNCqsZWDCQ7OGOAb 3AUCZ2bPs3Hnp3p111AEkq+2CjegixAwsEicC5V6UDNzFrI3NEQpFr3Kf3jUmEEBfMF2 khHTpgtEDcNQqBg+oG99AfXTSeolB+Gle6l7+dFAUcn31p49mE2wuflNfxegIWLPR9Xp upLllIJSNfsKF99EqCmAL+dv9K7JY2E89+4bbRHjMOS62Wflv0AKal3iyK4Vk7pj8IJo H4Xzb+0gwMiVV4sPlR6X35WqlrISb0wWkflAEadC2DHvLDRt79ceNoKAss4BzVRYK7RG 7T6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=PN1BMonGkeBnzv+/bOkqleU7De+ZAZvkj/AOWHtZHuU=; fh=MNKRx4WJmBaVWzQe39dfqMazHXuwPQWBzq8iA6LUjvg=; b=i7V6JAg/s7nbDJkUNn8VFkm6QJXuWWmGW5MsF63oNXr68NosTsrR9w94G+4djqhUWD dGA4/b5Ubn5D+qIuYhFbx1w0ccYLO8rYIOb7XmarLst0vZBPUeulbId9DGDX06z6PGrO bNVgZo46eXKuxefKnPwcXjUPLRQqoZWrF19Yz8oOmWz19zK6DukUFkSZagvjxiEbBwBT 329ta80tbh1gCNLlLK97eVgeLHmMi34QmYFyKknQV3teMjXNCvhcfvbwkQL6kue8v++X DGbiKM/dRm8zWSDQqXH+ylvnRPx8dyVOKe3FeWSQXOTf5IzP+EByHYP3wt4aR03n4DlZ unvA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6728-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6728-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bo13-20020a17090b090d00b002ac153d5f16si8780704pjb.112.2024.04.23.06.30.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 06:30:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-6728-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=realtek.com); spf=pass (google.com: domain of linux-wireless+bounces-6728-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-wireless+bounces-6728-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 509A428DCA4 for ; Tue, 23 Apr 2024 13:05:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7408C78C6E; Tue, 23 Apr 2024 13:05:52 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C31B85938 for ; Tue, 23 Apr 2024 13:05:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.75.126.72 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713877552; cv=none; b=kHVa07QU5z8i4BDMVSyK5xynzhYhNw0HbPtQXJml/rj0nL5uJHcLnk+Rw4MF+atUdnVQVsCk0o4C4CszdO1mcJLQaXOhbAgG263KUc71PGf1HJUefuk+/cmsURhE1yAkv4w/l/xUEWEiYtGhkEXGb/YhO/OjDcLz4GpBvBLDgzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713877552; c=relaxed/simple; bh=CkEsrOWvm+qrfwExkJqZTsqBpvAMNhwM0w8u3OWC2us=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eyrGzSYmSVnKD/ftV7wpj5rfEVeszVwSmUtwJyj/0juVlQek87dkUuPiUN/ko3GbRjhzZC6tH4Vu1jXH1KkEPuEepJkROFo7V6uyxeoctRQaE9++5XnRACsFp1LoK6B2xXnLcWv06TFGxVE86skS9x+4t86LiMXkjldBbBP1Aws= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; arc=none smtp.client-ip=211.75.126.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com X-SpamFilter-By: ArmorX SpamTrap 5.78 with qID 43ND5lYvA1251196, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.95/5.92) with ESMTPS id 43ND5lYvA1251196 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Tue, 23 Apr 2024 21:05:47 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 23 Apr 2024 21:05:48 +0800 Received: from [127.0.1.1] (172.16.20.182) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 23 Apr 2024 21:05:47 +0800 From: Ping-Ke Shih To: CC: Subject: [PATCH 5/8] wifi: rtw89: coex: Fix unexpected value in version 7 slot parameter Date: Tue, 23 Apr 2024 21:04:59 +0800 Message-ID: <20240423130502.32682-6-pkshih@realtek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240423130502.32682-1-pkshih@realtek.com> References: <20240423130502.32682-1-pkshih@realtek.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: RTEXMBS02.realtek.com.tw (172.21.6.95) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback From: Ching-Te Ku It will assign wrong value to version 7 slot parameter setting, because the structure member order has changed. Add a for-loop to assign variables manually. Signed-off-by: Ching-Te Ku Signed-off-by: Ping-Ke Shih --- drivers/net/wireless/realtek/rtw89/coex.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw89/coex.c b/drivers/net/wireless/realtek/rtw89/coex.c index 15e04440888d..374bc5aad2e8 100644 --- a/drivers/net/wireless/realtek/rtw89/coex.c +++ b/drivers/net/wireless/realtek/rtw89/coex.c @@ -827,8 +827,20 @@ static void _reset_btc_var(struct rtw89_dev *rtwdev, u8 type) /* set the slot_now table to original */ btc->dm.tdma_now = t_def[CXTD_OFF]; btc->dm.tdma = t_def[CXTD_OFF]; - memcpy(&btc->dm.slot_now, s_def, sizeof(btc->dm.slot_now)); - memcpy(&btc->dm.slot, s_def, sizeof(btc->dm.slot)); + if (ver->fcxslots >= 7) { + for (i = 0; i < ARRAY_SIZE(s_def); i++) { + btc->dm.slot.v7[i].dur = s_def[i].dur; + btc->dm.slot.v7[i].cxtype = s_def[i].cxtype; + btc->dm.slot.v7[i].cxtbl = s_def[i].cxtbl; + } + memcpy(&btc->dm.slot_now.v7, &btc->dm.slot.v7, + sizeof(btc->dm.slot_now.v7)); + } else { + memcpy(&btc->dm.slot_now.v1, s_def, + sizeof(btc->dm.slot_now.v1)); + memcpy(&btc->dm.slot.v1, s_def, + sizeof(btc->dm.slot.v1)); + } btc->policy_len = 0; btc->bt_req_len = 0; @@ -2319,7 +2331,7 @@ static void rtw89_btc_fw_set_slots(struct rtw89_dev *rtwdev) tlv_v7->type = SET_SLOT_TABLE; tlv_v7->ver = ver->fcxslots; - tlv_v7->len = sizeof(dm->slot.v7); + tlv_v7->len = ARRAY_SIZE(dm->slot.v7); memcpy(tlv_v7->val, dm->slot.v7, sizeof(dm->slot.v7)); _send_fw_cmd(rtwdev, BTFC_SET, SET_SLOT_TABLE, (u8 *)tlv_v7, len); -- 2.25.1