Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2120561rdd; Thu, 11 Jan 2024 22:53:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IESQHqjmipJ7PI0fIfVJaTcQSPJIf8eAIGRtS3MZSIIVxdQUqvlPQJisTPykVma2lVbr/yS X-Received: by 2002:a05:622a:1920:b0:419:a2c6:820e with SMTP id w32-20020a05622a192000b00419a2c6820emr1236990qtc.12.1705042382106; Thu, 11 Jan 2024 22:53:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705042382; cv=none; d=google.com; s=arc-20160816; b=FizNRx+aJ6jewiWDYaG/8E8jijz1xHk+Y3bwPuV08x4u7g64tDHyEgJRnamwEnWqlB OvP3/GxeTYOvI1wYuGNWpau4pp6qJZg6qESROp4xbI4eBzICac3CpZbtkozAWf8JRotw oSYKFrGMpl7rOabMFQDvr/uWUDyh6V0YaXMvAJqKqT3WNp++myG8eSbIxkikXDDI90R7 GEtYdTf0UZ2PU3F4NkiKZS4Mjbe/Faj000HE8GRbreQuBbaJLTmvpDv6HsdpSEea/tDo b1a2yuhHKqvT95xcjX64nCFl8lY36mfeuwvPStm9HjDTsRqhNIKB7esGUw3Q4+8vV7OL ooXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-language:accept-language :in-reply-to:references:message-id:date:thread-index:thread-topic :subject:cc:to:from; bh=elLK0SFgU9hfXtYVrhtnkbl8ze8cwwsVGei7FFr5y+M=; fh=LtNDW618tW/QUXlZwMZ40ULfGAV7/JOxe80TK4RDACc=; b=EOGwqGIgJhtNu4KEcgDWyvCkQF5dzO4jh88NwmI465iNryUxaggvNbXPHiSvA/HDjP cWCAcQW8behB3tH1EOsST/xX8djJoPVVQknRXXW6hcGAi5xC/Y5yM+cxI36Bg6bbZRA+ HZcdw+J78Y4WwgzZteOS1XwOwpSp4VfGmo5ltG4+nZpRz/rz/AGq1q4gkiWynJ14JcL3 ecyzMm7iprBkxh/k61qupi0hY++4pLCgGvmk2PfUSES1hD6T4INyitMR4PKwni0bLAQd tUJhPFzIuLbF6EDKOt6sLC8MhUeBN5jCy4M2BpcsaRsK1JeS4OL7bTqkpHIhOAIM8zjM 3RXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w14-20020ac87e8e000000b00429bb36f71csi2455967qtj.565.2024.01.11.22.53.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 22:53:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1790-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1790-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CB4DB1C249FD for ; Fri, 12 Jan 2024 06:53:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3DA645C908; Fri, 12 Jan 2024 06:52:50 +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 3FBD55C901 for ; Fri, 12 Jan 2024 06:52:47 +0000 (UTC) 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 40C6qNz352191042, 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 40C6qNz352191042 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jan 2024 14:52:24 +0800 Received: from RTEXMBS01.realtek.com.tw (172.21.6.94) 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.2375.32; Fri, 12 Jan 2024 14:52:24 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXMBS01.realtek.com.tw (172.21.6.94) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 12 Jan 2024 14:52:24 +0800 Received: from RTEXMBS04.realtek.com.tw ([fe80::e4c4:c4f:4e4c:d23c]) by RTEXMBS04.realtek.com.tw ([fe80::e4c4:c4f:4e4c:d23c%5]) with mapi id 15.01.2507.035; Fri, 12 Jan 2024 14:52:24 +0800 From: Ping-Ke Shih To: Martin Kaistra , "linux-wireless@vger.kernel.org" CC: Jes Sorensen , Kalle Valo , Bitterblue Smith , Sebastian Andrzej Siewior , Zenm Chen Subject: RE: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode Thread-Topic: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mode Thread-Index: AQHaNC0sDGaHcKZrXkiVSN0UWy+01bDV2+dQ Date: Fri, 12 Jan 2024 06:52:24 +0000 Message-ID: <92fa5949e8094739883e665abb23ac01@realtek.com> References: <20231221164353.603258-1-martin.kaistra@linutronix.de> <20231221164353.603258-20-martin.kaistra@linutronix.de> In-Reply-To: <20231221164353.603258-20-martin.kaistra@linutronix.de> Accept-Language: en-US, zh-TW Content-Language: zh-TW x-kse-serverinfo: RTEXMBS01.realtek.com.tw, 9 x-kse-antispam-interceptor-info: fallback x-kse-antivirus-interceptor-info: fallback Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KSE-AntiSpam-Interceptor-Info: fallback 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 Hi Martin, > -----Original Message----- > From: Martin Kaistra > Sent: Friday, December 22, 2023 12:44 AM > To: linux-wireless@vger.kernel.org > Cc: Jes Sorensen ; Kalle Valo ;= Ping-Ke Shih > ; Bitterblue Smith ; Sebasti= an Andrzej Siewior > > Subject: [PATCH v2 19/21] wifi: rtl8xxxu: add hw crypto support for AP mo= de >=20 [...] Zenm reported [1] his RTL8192EU and RTL8192FU don't work in station mode, and cause is this patch. Please try if you can reproduce the symptom, and apply my suggestion to see if help. [1] https://lore.kernel.org/linux-wireless/20240112045104.12282-1-zenmchen@= gmail.com/T/#me0940f522249becf49f25bc281f1992c523673f6 >=20 > +static int rtl8xxxu_get_free_sec_cam(struct ieee80211_hw *hw) > +{ > + struct rtl8xxxu_priv *priv =3D hw->priv; We need to reserve entries 0~3 for keys that aren't pairwise key.=20 > + > + return find_first_zero_bit(priv->cam_map, priv->fops->max_sec_cam= _num); > +} > + > static int rtl8xxxu_set_key(struct ieee80211_hw *hw, enum set_key_cmd cm= d, > struct ieee80211_vif *vif, > struct ieee80211_sta *sta, > struct ieee80211_key_conf *key) > { > + struct rtl8xxxu_vif *rtlvif =3D (struct rtl8xxxu_vif *)vif->drv_p= riv; > struct rtl8xxxu_priv *priv =3D hw->priv; > struct device *dev =3D &priv->udev->dev; > u8 mac_addr[ETH_ALEN]; [...] > @@ -6899,16 +6915,28 @@ static int rtl8xxxu_set_key(struct ieee80211_hw *= hw, enum set_key_cmd cmd, >=20 > switch (cmd) { > case SET_KEY: > - key->hw_key_idx =3D key->keyidx; > + > + retval =3D rtl8xxxu_get_free_sec_cam(hw); > + if (retval < 0) > + return -EOPNOTSUPP; > + if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) key->hw_key_idx =3D retval; else key->hw_key_idx =3D key->keyidx; > + key->hw_key_idx =3D retval; > + > + if (vif->type =3D=3D NL80211_IFTYPE_AP && !(key->flags & = IEEE80211_KEY_FLAG_PAIRWISE)) > + rtlvif->hw_key_idx =3D key->hw_key_idx; > + > key->flags |=3D IEEE80211_KEY_FLAG_GENERATE_IV; > rtl8xxxu_cam_write(priv, key, mac_addr); > + set_bit(key->hw_key_idx, priv->cam_map); > retval =3D 0; > break; > case DISABLE_KEY: > rtl8xxxu_write32(priv, REG_CAM_WRITE, 0x00000000); > val32 =3D CAM_CMD_POLLING | CAM_CMD_WRITE | > - key->keyidx << CAM_CMD_KEY_SHIFT; > + key->hw_key_idx << CAM_CMD_KEY_SHIFT; > rtl8xxxu_write32(priv, REG_CAM_CMD, val32); > + rtlvif->hw_key_idx =3D 0xff; > + clear_bit(key->hw_key_idx, priv->cam_map); Shouldn't swap these two statements? I missed that during reviewing. > retval =3D 0; > break; > default: > -- > 2.39.2