From patchwork Wed Jul 3 21:42:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809889 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 0DA0817F51A for ; Wed, 3 Jul 2024 21:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042970; cv=none; b=TQk4enQEdHdQXU4UOdjxET8B+FAWIfdirKTPln092RPynIH56yoc2sVFaQnWL7AtCgybC2GJZ6cixW3GJKKealYde9MMAagHf/KZF30hx0/jhIUuIXdIM5KNFQhFGBw1eBnDsOACpljtSaV+N7lorF9fV6fGJX15C6pAyZT24+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042970; c=relaxed/simple; bh=hBBFZBmKbWmJHc6vGhmioiyoyMMl/7LaaxUCKb+yQno=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MknJqBVcobn6Bc6iZ+xi1GF0C1Y21/sp4g12cLwZ2HWdKAzDOMBWGl+lzzsyIFyNkCKvMZM1rgXTZIAqU6Iz6+xAd/j+jAjOaPfhc7o/4WSSc86HeNM73Yt/ANnhnTMU/NAMclH1OtbW8SrfQdOCVDbFsbADGzLSp2cni8hmDSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-700cee3c5f6so115687a34.1 for ; Wed, 03 Jul 2024 14:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042968; x=1720647768; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2ZTio5F8p35DlD4asDjPvybCMwGfLPum9VeO2lVI5Tw=; b=aXgNHO+FIOkpy0LnFRrM0mNv0SV1ElD3TeMTPy75fx6F0PUd3Eq7k/vEaBwjCDR0AO Dw92oJmTqOXUu/tKgZPzh38c58IWSXdyYqZvKIzmNnE1rTUKElfAz1ribds5aP4abZRM Fe/83etAS0V6xpIApc72yNmcIuj7OxiA5GwPOapoyzH3WIBlehzb88DeELEc0DBnoUA4 nJL0ic48anrNxemDRBCHLvtAkwwBai+E4YO0fJgX8V7Iiljr0jCEhgyzdtoAYxmZ5wph OVOSCGqPex1kjQOi7/SLIY0coR2BwVuzX2rYypCHiUf8Dp7EFzuvw56VF/l3Rf4MuurF 0AGA== X-Forwarded-Encrypted: i=1; AJvYcCXCKCUUMoshNtRpeZk33k6aGy5HWZuHDWMjxrHEaZDJ8mqUhzkkmDVACy9og+8LbIqTYD7eZWZ1liegpG+yAhZ+yLylrDvsIYyHIDitQtY= X-Gm-Message-State: AOJu0Ywosod4w+SPq6BHkSAqvdK4CmXQcEjBRW04ZJW0oBWEX4ChbfHn G71BgaxHcXORuEG+ZthLoJWMCcAmXIzMSbbYNXqopILFHyeWWh3KJamCzft+ X-Google-Smtp-Source: AGHT+IGRunLO6mFzSc2Jy3s5TzQ57XC4kIYZhicOz2t0jYUM6P5DBFc/NWlT3v1DejDwVVb0J3v/0g== X-Received: by 2002:a9d:6b15:0:b0:700:d428:1cd1 with SMTP id 46e09a7af769-702077756d3mr12771626a34.3.1720042968011; Wed, 03 Jul 2024 14:42:48 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:46 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 01/29] wifi: mt76: mt7925: update mt76_connac_mcu_uni_add_dev for MLO Date: Wed, 3 Jul 2024 14:42:06 -0700 Message-Id: <6b2502d0c3a53093f83ae33329e9d782ba2465b3.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Set OMAC address with the per-link BSS. The change remains compatible with the non-MLO mode and the older firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c index 4e3c8af98fe7..4dce03ddbfa4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c @@ -1214,7 +1214,7 @@ int mt76_connac_mcu_uni_add_dev(struct mt76_phy *phy, idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx; basic_req.basic.hw_bss_idx = idx; - memcpy(dev_req.tlv.omac_addr, bss_conf->vif->addr, ETH_ALEN); + memcpy(dev_req.tlv.omac_addr, bss_conf->addr, ETH_ALEN); cmd = enable ? MCU_UNI_CMD(DEV_INFO_UPDATE) : MCU_UNI_CMD(BSS_INFO_UPDATE); data = enable ? (void *)&dev_req : (void *)&basic_req; From patchwork Wed Jul 3 21:42:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810306 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 C4AF01940A1 for ; Wed, 3 Jul 2024 21:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042973; cv=none; b=hIXmLkWYEssuQmr95MbrlIaX0FFAUCbYqaTkTGu2WKVCI79SnTA5PU6Oi97xn3hgZxBbpLknKD0A5TzasZ3tcNhiOoo+sJQLrdZMYs/T2IiaoOhqyLf4in/ZFRr6Yn1mtxK8ZD4BFVfLCKoz3YeTYQ3ZGshAxTwAmPq04jPkpEM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042973; c=relaxed/simple; bh=BQOKox6gvCJPMPBKCw8xwpXd8RFIe6cdNw0D1f+XhFs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UdD+RklLJ9fVlj7vXkKjEQx0i/R0BHGOQ1+RVSvQI2KLLKz371cZdI1eYCRHL3Fakt0w+X3qFgZKfFOOII/VWHTww6LwamfC6lcswGobiDgomO74TaZXys3jbuYSn8p6bZOsBZZcLnj5wXoTc0AXJ2ZGetuVbpN8HO+fWMT+NnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-700caf4cc3bso113609a34.0 for ; Wed, 03 Jul 2024 14:42:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042971; x=1720647771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4D8GOqEYIjIhd4nO67HazbxOlKo7VMKVeEfzgJOHMfM=; b=p21t8oiWEeL4Q8wp1vrZi8e8ozFqeLoHjib4MwBn4OMlj8IY4f0SZ0PY0dbL4dRa/W wAESa/l+WNOrariHubQSmozZfKjBqr1lOteWniH/AEMm7try58nwL1d0uU0EX2Td9VRg efPBzQcIvJ/DLVhpWvS6N17AdcEtFqdWNIJBBSzJawnwek6WxDvMS+em0108SnT3r54o uU8YebFb/gI1f/VfpBjBReBW/GwR5TcOV4aL+MLQIbhU/7X3Llj4TrKiJFR0dGAinkpg RRF+KBo4dgeAF1JscNnFiDJtTPWYmGxia8o/l4Q+UQp5MVk5XMHktCtnm78sE6bKIpa5 9jwg== X-Forwarded-Encrypted: i=1; AJvYcCVbZCHgZpfS5fnmH8pO8qoPgEqCpnwksAekpb/usV7CYv2GVJXiwtDBos5SdmRyLCfxGGl7L97Xgx7lFIUDK/aw+7CY7H+30t5uJc6wXjs= X-Gm-Message-State: AOJu0YzxnjoPc9tfA1RcSOrXYQnQY8mf9jX98eTg615Y+81Vu/JRlFHq RFnOSBFuimy/WV9tV8SvfBYgAv3Ve127fZedRCi90sD7JwoYFUWpfHHL1p7U X-Google-Smtp-Source: AGHT+IFEM8AtOC4VbrN1MHEZJ0NHJbO6KnrzFOQm439w+AkKKPB6yfmZQC83oKo5lnuyh8d2s8jkcQ== X-Received: by 2002:a05:6830:1bfb:b0:700:d064:36d3 with SMTP id 46e09a7af769-70207742e4bmr13770945a34.2.1720042970791; Wed, 03 Jul 2024 14:42:50 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:48 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 02/29] wifi: mt76: mt7925: update mt7925_mac_link_sta_[add, remove] for MLO Date: Wed, 3 Jul 2024 14:42:07 -0700 Message-Id: <0fce480ad67237ce4f65138fe5e45f8090ae08f2.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang [add, remove] the per-link STA from the corresponding to per-link BSS with the same link id. The change remains compatible with the non-MLO mode. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 8b10b63bc98d..1c8a44789e51 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -728,12 +728,13 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_bss_conf *link_conf; + u8 link_id = link_sta->link_id; struct mt792x_link_sta *mlink; struct mt792x_sta *msta; int ret, idx; msta = (struct mt792x_sta *)link_sta->sta->drv_priv; - mlink = mt792x_sta_to_link(msta, link_sta->link_id); + mlink = mt792x_sta_to_link(msta, link_id); idx = mt76_wcid_alloc(dev->mt76.wcid_mask, MT792x_WTBL_STA - 1); if (idx < 0) @@ -753,12 +754,16 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mt7925_mac_wtbl_update(dev, idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + link_conf = mt792x_vif_to_bss_conf(vif, link_id); /* should update bss info before STA add */ - if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) - mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, + if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { + struct mt792x_bss_conf *mconf; + + mconf = mt792x_vif_to_link(mvif, link_id); + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); + } ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, MT76_STA_INFO_STATE_NONE); @@ -830,11 +835,12 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, { struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct ieee80211_bss_conf *link_conf; + u8 link_id = link_sta->link_id; struct mt792x_link_sta *mlink; struct mt792x_sta *msta; msta = (struct mt792x_sta *)link_sta->sta->drv_priv; - mlink = mt792x_sta_to_link(msta, link_sta->link_id); + mlink = mt792x_sta_to_link(msta, link_id); mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); mt76_connac_pm_wake(&dev->mphy, &dev->pm); @@ -844,12 +850,14 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, mt7925_mac_wtbl_update(dev, mlink->wcid.idx, MT_WTBL_UPDATE_ADM_COUNT_CLEAR); - link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + link_conf = mt792x_vif_to_bss_conf(vif, link_id); if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - mt7925_mcu_add_bss_info(&dev->phy, - mvif->bss_conf.mt76.ctx, link_conf, + struct mt792x_bss_conf *mconf; + + mconf = mt792x_vif_to_link(mvif, link_id); + mt7925_mcu_add_bss_info(&dev->phy, mconf->mt76.ctx, link_conf, link_sta, false); } From patchwork Wed Jul 3 21:42:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809888 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 E419619415F for ; Wed, 3 Jul 2024 21:42:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042975; cv=none; b=nzl11A5Mb7eTjTSDHt184v2Y0ZRPbH+kTXFH4TjTBLtWISepDkUuR8y4SJE6yEm8kydEkfGT5aKxtAO7nVkDVzBKzPs2Sgob7CAd84H8cb44yQmgINtOc1zYVYssEa9QceGibzDcrepjCuMP1NrdfM48OA6oV7F3dJGdy6LsggM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042975; c=relaxed/simple; bh=V/PhR96m9Pu3ULpoAZcLDyCZ21NroV/1pXyOGrrAVh0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rpHieD+QIkUxWisL6I9soDBNRbOdoulmy2CKhO5oWtwI7jnI2mTPoAp5+MK04Y6HaDNvDtiV3qE/efFTGX/5tnK/iqKyiHJljzS6vQlT6LBoP4BmzV7PbzgBSvXANh6Vs7xuHwlN5ShnVwI3M8W/8sfD6UFnPzhHS1ZuegHJAi8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-254925e6472so7773fac.0 for ; Wed, 03 Jul 2024 14:42:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042973; x=1720647773; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8K/G1mFnUqG5/XVm+Bjq0BOwIjr9NKGtmLZt5vb8yyo=; b=Ggu3w8vwKItjPFi8x3WMkR2UWLGKWfWhNZTIf96ef/S5qXnM1ZryXWb4Wl3AkYyC9f SnbM786vBmYr67SDqSiwr82zOIlpUIV6EhtehinAEu+8In4j14tckkBIKjPpoFd9xshx VY8e5I0lI1WIcm5HJJgNz8wmNqsPGm6vALwJHrX3PW77GGZ0hCeaasnErVk+xxkDaMlP hDqK0jtMpnwFn8flJ/wVrGdIagrVrjBL4wO6cUqa2GlAdZoIa7T1cbRM6oGkKEandEAw KlppYAYJw8unttd3ts7Lek7g9vaMeGyt3uwSLMq2lPT62Ch+S/XuULabuNzoIbnUCaA8 tSjg== X-Forwarded-Encrypted: i=1; AJvYcCWqosoB8sO8WTObuSsKCDcysQGFY0YmHWrOLBo5fo9r2HTzfanhOL0NpY7Iv8Y+OsHD+QZoIS6WlJ5WiEi6/jQI9oAoI2GCI+NZz9Gqvyk= X-Gm-Message-State: AOJu0YyW7b2VWrR9W6wZO9F8ghGBkdlTg24yYx7i5JF0DGc/xMYhaM1m 4Sy2dVGoI9FGiYuJ9DjvxI+lT5+lAWb6i2l0/8bBncapGwerZMT+ X-Google-Smtp-Source: AGHT+IEneCCcR7ZDKxvEJ7/VqWpNOTdFJy5jMTeENZKYzVaf+ecNU+xe/U5qPtR6pGZa7/YqfGtU4g== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12823875a34.0.1720042973070; Wed, 03 Jul 2024 14:42:53 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:51 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 03/29] wifi: mt76: mt7925: set Tx queue parameters according to link id Date: Wed, 3 Jul 2024 14:42:08 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Configure TX queue parameters according to link id. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 1c8a44789e51..4e5868cd2a97 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1306,6 +1306,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, const struct ieee80211_tx_queue_params *params) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, link_id); static const u8 mq_to_aci[] = { [IEEE80211_AC_VO] = 3, [IEEE80211_AC_VI] = 2, @@ -1314,7 +1315,7 @@ mt7925_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, }; /* firmware uses access class index */ - mvif->bss_conf.queue_params[mq_to_aci[queue]] = *params; + mconf->queue_params[mq_to_aci[queue]] = *params; return 0; } From patchwork Wed Jul 3 21:42:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810305 Received: from mail-ot1-f53.google.com (mail-ot1-f53.google.com [209.85.210.53]) (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 685B9191F8E for ; Wed, 3 Jul 2024 21:42:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042980; cv=none; b=dSA5BR335tH8O91D8qbbL9dUeSC6dg/pVols07uBVf9EvfAymp+n7PepEaqTeVav9yZrJdq6Kqsmm0tuXL51l1SsmRbtMb8c7OSqtdmGopA1BWHTt60rWUCCB8geao1kCim0/pPHp1ElNJepEmfbWV79ImfUC0JQey8z5X1CAdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042980; c=relaxed/simple; bh=lk19O4waW96WYRN+73b/SbS4Casl06tEnEn0RWitTQc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dpG5en35MiMEFkO8e2nMB/VUQV1u0oVzNECXE+uEjliBr5ZDsZeFhbAczE7CeUmAWVa1FCLqIVH2tkuqfDOS85gVA5qfvIMRTKWSJyiXcjR29Y4UzH4ePEu0Ucl3qrpFXgw/1KTDpM86l2L9TA3eBwytIKc3NW8LuX7rN8JrcQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f53.google.com with SMTP id 46e09a7af769-700cf03febfso89113a34.3 for ; Wed, 03 Jul 2024 14:42:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042978; x=1720647778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=goXkALOp2QwxSb3F7DJoCuE/hHvbXbI8e1rMayLRwD8=; b=N9UyIpK6lrAekYTOAxTYR1xBQe+1LXY95DTa1zSDwB/1M6WKpMikkoPfEOb1DW1tsA cdLWBV3siI+lpRvEmT7lCIMHTsVJjfg1+U0DX7hvXZc0ORMzrSew4I0bsqAEupaeAkQh ags8O3htqrSskHcTvHhzH7f5/8a9EXjKpHa0QI+0Gzpw8fXJVFagGiEHA71jHkhaQeJv js2A3pnlGtn2MSeWZ9erDr48c4YumtxWg8eLnMom2RM0c9oqLGg8lAWbGdaFFCl8C2Ef jaifd7ev9UcJmx4BjYuKjv9fKsQ3S/+z55xjr54etBRIObOSGM27HKVuQYLcAdqk2qrL eaFA== X-Forwarded-Encrypted: i=1; AJvYcCWoc7KBlj95SHA2zQFBakL5Oxe4F1ZbDw0zH6/HTZ1Y4ec3xWitZbnxP0XpA+/6p2cSMP+/5KqFhqviC1n6miiiby1J/DOXtMbga39cQ0I= X-Gm-Message-State: AOJu0YylgRcwqbY8Qxo6DLTRZBSGdv7ew3lPUS70tf3cRMCMNH98+DBO FIDG5FSbA1EsIrvZdAy8BvaxT/fYKV3TGLgiE5GjKKEb7PcPWk7pZTJt3xd6 X-Google-Smtp-Source: AGHT+IFuEHcrEkFGiG9Dyf8kec2Kt4DL7xC2+P5Vzquxj3GgGa3ypEjfwcD1TpMXK4x8XZb03jfDgw== X-Received: by 2002:a05:6830:1095:b0:701:f306:ad39 with SMTP id 46e09a7af769-7020768b4a0mr12292209a34.1.1720042977460; Wed, 03 Jul 2024 14:42:57 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:53 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 04/29] wifi: mt76: mt7925: set mt7925_mcu_sta_key_tlv according to link id Date: Wed, 3 Jul 2024 14:42:09 -0700 Message-Id: <2a6000f8e280ceacc4e19240ff41863426839776.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang configure mt7925_mcu_sta_key_tlv according to link id We created a link id field in the common structure mt76_wcid so that mt7925_mcu_sta_key_tlv can access per-link STA/BSS. Additionally, .link_id will be required when reporting the link information of Rx status to mac80211. We will submit the changes for reporting the Rx status in a separate patch. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7925/main.c | 1 + drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 +++++++++++---- drivers/net/wireless/mediatek/mt76/mt792x.h | 11 +++++++++++ 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 11b9f22ca7f3..01646538087a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -349,6 +349,7 @@ struct mt76_wcid { u8 sta:1; u8 amsdu:1; u8 phy_idx:2; + u8 link_id:4; u8 rx_check_pn; u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 4e5868cd2a97..0b486afe9352 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -746,6 +746,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->wcid.phy_idx = mvif->bss_conf.mt76.band_idx; mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies; + mlink->wcid.link_id = link_sta->link_id; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index a67d8dd6075f..ba91c8e37dff 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -967,6 +967,7 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, struct mt792x_sta *msta = container_of(mlink, struct mt792x_sta, deflink); struct sta_rec_sec_uni *sec; struct mt792x_vif *mvif = msta->vif; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, wcid->link_id); struct ieee80211_sta *sta; struct ieee80211_vif *vif; struct tlv *tlv; @@ -978,17 +979,23 @@ mt7925_mcu_sta_key_tlv(struct mt76_wcid *wcid, tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_KEY_V3, sizeof(*sec)); sec = (struct sta_rec_sec_uni *)tlv; - sec->bss_idx = mvif->bss_conf.mt76.idx; + sec->bss_idx = mconf->mt76.idx; sec->is_authenticator = 0; - sec->mgmt_prot = 0; + sec->mgmt_prot = 1; /* only used in MLO mode */ sec->wlan_idx = (u8)wcid->idx; if (sta) { + struct ieee80211_link_sta *link_sta; + sec->tx_key = 1; sec->key_type = 1; - memcpy(sec->peer_addr, sta->addr, ETH_ALEN); + link_sta = mt792x_sta_to_link_sta(vif, sta, wcid->link_id); + memcpy(sec->peer_addr, link_sta->addr, ETH_ALEN); } else { - memcpy(sec->peer_addr, vif->bss_conf.bssid, ETH_ALEN); + struct ieee80211_bss_conf *link_conf; + + link_conf = mt792x_vif_to_bss_conf(vif, wcid->link_id); + memcpy(sec->peer_addr, link_conf->bssid, ETH_ALEN); } if (cmd == SET_KEY) { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 69eb8dac0b70..fe5a6c932705 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -273,6 +273,17 @@ mt792x_vif_to_bss_conf(struct ieee80211_vif *vif, unsigned int link_id) return link_conf_dereference_protected(vif, link_id); } +static inline struct ieee80211_link_sta * +mt792x_sta_to_link_sta(struct ieee80211_vif *vif, struct ieee80211_sta *sta, + unsigned int link_id) +{ + if (!ieee80211_vif_is_mld(vif) || + link_id >= IEEE80211_LINK_UNSPECIFIED) + return &sta->deflink; + + return link_sta_dereference_protected(sta, link_id); +} + static inline struct mt792x_dev * mt792x_hw_dev(struct ieee80211_hw *hw) { From patchwork Wed Jul 3 21:42:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809887 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 ADA2D191F8E for ; Wed, 3 Jul 2024 21:43:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042983; cv=none; b=r7l8UWu7Xf8827OaeLvf94Qfgv5jr3n50Pd1UILOum+VKkFW2PGG+u9LRORWd2/+59QevC3Oavj5z9EQPv8zqhhe6MSBa8UBZOGIev8gK9S9NDQHBrFAXox06/zq3+vfJ/kanB6L4l7TgKA4bdZVL9cwRfl/K3lnW47yjk1cE3A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042983; c=relaxed/simple; bh=fZ+q4k6EtyTiCawLAsLQ7QOu69VREGmdTk46T5kSjPA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eSHm+QwTRTHEkhmjUnmK23sc6mdfrWlcbdqYp3TBSd/bIAwDHQSA8LYv+MVKm53yYH74wl/M3IZeSbKxI1SramvfTyj6SSFp/e+c8qDGOh205lBNdhoialoi0lQRpCzj3KpY7Vbf5myKCuyE9MuZdy6nhzpwOxupBFdhSqoIdS0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700cd6afa3eso204787a34.1 for ; Wed, 03 Jul 2024 14:43:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042981; x=1720647781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W7PGupETUQJAUNPNhJLXB9UGMjXfuQAyAWBEVi1wM2c=; b=dWAgxzLnttu1hnlz6Mw6yBGSy/EXgVzfYqwct4O73/JPJgpSea3+miMInZqsA+nlhs 44WwUPb9v8JvxHEHwU8Oi43rMGWUuOL1qjF12TNu2NwB9jwUsnVJA45+Jbzku6I9IUbx +LbVwbFa3Nhmrqai+613SWSl2soSaQrOAfsEw/NHckhGXxZyodH3eWHhySyxDyLFSQpg qbGytLPGYw2whVMxIPj9Ann77rWppM9e57oqVM6xkv6DXdsTBNbHwePro2/CQa9CZQ3f ozvT365n+FGBE1txiNauBUhmdIwSyX6cyth2Ga6wwKR5VOHZBYJIP9WAMyF6eDPcZyVB Fm/A== X-Forwarded-Encrypted: i=1; AJvYcCV35KrdjZNpkzmEhjMnmMTKr4uT36h0/+X7nnZ8fFSX8RSY+8xI+Yyrg9Ln8NPzlA9fHROdOmCtaIluBXYi5m6xX8QFZYxS3gdnLubHBbk= X-Gm-Message-State: AOJu0YzyjaMcEJtqeqJu+HmxLw6cI6B4EQhLB7yIWC+L0uJKC+Y92xmx /WIc0Y6qiKRM3VlBedlnCY0Nh5sAgW1nHFQZ5nSPQuJw0Liu4a2lCIPEbGF4 X-Google-Smtp-Source: AGHT+IFs8z5tFdp9iaiINsY/W0pW70iwOppFb6clHGmnsTdd61oxtC5rmZXGAMjMJWq4P01yGijDAg== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877316a34.1.1720042980638; Wed, 03 Jul 2024 14:43:00 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.42.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:42:59 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 05/29] wifi: mt76: mt7925: add mt7925_set_link_key Date: Wed, 3 Jul 2024 14:42:10 -0700 Message-Id: <6526aeab0d71104fff8453e086f8afe0d5eec70c.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add mt7925_set_link_key to set up the key according to the link id Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 66 ++++++++++++------- 1 file changed, 42 insertions(+), 24 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0b486afe9352..264517fd3bf7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -499,31 +499,28 @@ static int mt7925_cancel_remain_on_channel(struct ieee80211_hw *hw, return mt7925_abort_roc(phy, &mvif->bss_conf); } -static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, - struct ieee80211_vif *vif, struct ieee80211_sta *sta, - struct ieee80211_key_conf *key) +static int mt7925_set_link_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key, int link_id) { struct mt792x_dev *dev = mt792x_hw_dev(hw); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL; - struct mt76_wcid *wcid = &msta->deflink.wcid; struct ieee80211_bss_conf *link_conf; - u8 *wcid_keyidx = &wcid->hw_key_idx; + struct ieee80211_link_sta *link_sta; int idx = key->keyidx, err = 0; + struct mt792x_link_sta *mlink; + struct mt792x_bss_conf *mconf; + struct mt76_wcid *wcid; + u8 *wcid_keyidx; - link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); - - /* The hardware does not support per-STA RX GTK, fallback - * to software mode for these. - */ - if ((vif->type == NL80211_IFTYPE_ADHOC || - vif->type == NL80211_IFTYPE_MESH_POINT) && - (key->cipher == WLAN_CIPHER_SUITE_TKIP || - key->cipher == WLAN_CIPHER_SUITE_CCMP) && - !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) - return -EOPNOTSUPP; + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + link_sta = sta ? mt792x_sta_to_link_sta(vif, sta, link_id) : NULL; + mconf = mt792x_vif_to_link(mvif, link_id); + mlink = mt792x_sta_to_link(msta, link_id); + wcid = &mlink->wcid; + wcid_keyidx = &wcid->hw_key_idx; /* fall back to sw encryption for unsupported ciphers */ switch (key->cipher) { @@ -547,12 +544,10 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, return -EOPNOTSUPP; } - mt792x_mutex_acquire(dev); - - if (cmd == SET_KEY && !mvif->bss_conf.mt76.cipher) { + if (cmd == SET_KEY && !mconf->mt76.cipher) { struct mt792x_phy *phy = mt792x_hw_phy(hw); - mvif->bss_conf.mt76.cipher = mt7925_mcu_get_cipher(key->cipher); + mconf->mt76.cipher = mt7925_mcu_get_cipher(key->cipher); mt7925_mcu_add_bss_info(phy, mvif->bss_conf.mt76.ctx, link_conf, link_sta, true); } @@ -567,9 +562,9 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mt76_wcid_key_setup(&dev->mt76, wcid, cmd == SET_KEY ? key : NULL); - err = mt7925_mcu_add_key(&dev->mt76, vif, &msta->deflink.bip, + err = mt7925_mcu_add_key(&dev->mt76, vif, &mlink->bip, key, MCU_UNI_CMD(STA_REC_UPDATE), - &msta->deflink.wcid, cmd); + &mlink->wcid, cmd); if (err) goto out; @@ -579,8 +574,31 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, err = mt7925_mcu_add_key(&dev->mt76, vif, &mvif->wep_sta->deflink.bip, key, MCU_WMWA_UNI_CMD(STA_REC_UPDATE), &mvif->wep_sta->deflink.wcid, cmd); - out: + return err; +} + +static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + struct ieee80211_vif *vif, struct ieee80211_sta *sta, + struct ieee80211_key_conf *key) +{ + struct mt792x_dev *dev = mt792x_hw_dev(hw); + int err; + + /* The hardware does not support per-STA RX GTK, fallback + * to software mode for these. + */ + if ((vif->type == NL80211_IFTYPE_ADHOC || + vif->type == NL80211_IFTYPE_MESH_POINT) && + (key->cipher == WLAN_CIPHER_SUITE_TKIP || + key->cipher == WLAN_CIPHER_SUITE_CCMP) && + !(key->flags & IEEE80211_KEY_FLAG_PAIRWISE)) + return -EOPNOTSUPP; + + mt792x_mutex_acquire(dev); + + err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + mt792x_mutex_release(dev); return err; From patchwork Wed Jul 3 21:42:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810304 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 CDC711946B0 for ; Wed, 3 Jul 2024 21:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042985; cv=none; b=tdPmniI1YDF8ajma9aTBz/Ec5gXw4FjzTOYZpcds0VY4QHUXsksFtq4XN10R6ZSoSfBaPXgCtQaHIMbLiF0VC1ByRn4uNJ2mOzB9ygvFdR0rUWSvyHfpChHCR/PlgfpQJkxwWqJrEksY+woDYXNHMshMX+o8Jby4fk6pZXV9imc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042985; c=relaxed/simple; bh=5BCjT8wQktgyZweSNsUONgUbliDraAamanZAVP0gcOY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qGarYKbzRC7A92T/EsHpoWkA3E4m1eE9q2vTLZ3VdTnf83f5Hm8/FeokGdG+X2fS5t6rH5Ywt4j0OxBcyyLIPGGChTEXPxQwbDEPxqOL1iNxxW+KdG3/NfJfYWksHfjo1cfJrFF+6HXxrJyLrKMat8nHrzlIGhCQ2GUtXqHJL54= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-70218c133adso134073a34.2 for ; Wed, 03 Jul 2024 14:43:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042983; x=1720647783; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t0BFel98EDVIGHnXe5DFOMwxtme8/0IpNqrQiHcZbZk=; b=vkR5Qcm/s90dKJ4I705i7EqKJ0ZE3sZRKAzt4aU2mPkfdHG25v7HpmufZ1GTPhWGDv jB2OVx9VTwqC2OZDfKY6G1pi4zUWU2WhxZgwKGufxBaG4vClRfH2n4mdMxS9jqVzehin SGd+JUFEaoAJVIdKCGir1yAdCTtohg32OpgZFofEQl3KecdKzMAWFnW5UZMSnPkKEO1c V/6SQ4P4FI883U7Outy9dmZjFmZUBbuEYK+CbOmvr8GxmLq5oGy35MRtjWq9lyWjzccK P9ug2gUxr2aPjYsSVIbmeSUYnOaWRkn5tvswByVOuoMpXCS36MbbdxnYat7zMD8dTMLt 2kPg== X-Forwarded-Encrypted: i=1; AJvYcCVcAdrR1OKbLvCdjWx4ULyHlWMT/7ejDRKuUJMe10MVL0aZGRDzLzvxYf5wBBzhkLC3GjBqJcbmP3J2pH8mkgobHZHyrcF56QJM5AfO2Ms= X-Gm-Message-State: AOJu0Yy1v3eFvzWPo4tqykNg41Le1UQPXil0LFC3/waNI7BXN9YyZyFv KJF1KCsjyc3vq5BS+VpLgkoQxOjOUSbfBgyB5gw/al6mrBLtpTw5 X-Google-Smtp-Source: AGHT+IHIBPuhs8S/MmmkZNFJsi7Mj84zI6cdYeuYdxvyA0eRKWGxKSOxqLyhUH0gAs/hnQgh4qCzhw== X-Received: by 2002:a05:6830:4623:b0:700:ce5f:968c with SMTP id 46e09a7af769-702077496d6mr11309998a34.3.1720042982755; Wed, 03 Jul 2024 14:43:02 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:01 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 06/29] wifi: mt76: mt7925: extend mt7925_mcu_uni_roc_event Date: Wed, 3 Jul 2024 14:42:11 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang We extended the function to be able multiple pieces of information in a single event, supporting the future MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 31 ++++++++++++++++--- .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index ba91c8e37dff..5693c21bfb4a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -313,16 +313,14 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) mvif->band_idx = grant->dbdcband; } -static void -mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) +static void mt7925_mcu_roc_handle_grant(struct mt792x_dev *dev, + struct tlv *tlv) { struct ieee80211_hw *hw = dev->mt76.hw; struct mt7925_roc_grant_tlv *grant; - struct mt7925_mcu_rxd *rxd; int duration; - rxd = (struct mt7925_mcu_rxd *)skb->data; - grant = (struct mt7925_roc_grant_tlv *)(rxd->tlv + 4); + grant = (struct mt7925_roc_grant_tlv *)tlv; /* should never happen */ WARN_ON_ONCE((le16_to_cpu(grant->tag) != UNI_EVENT_ROC_GRANT)); @@ -340,6 +338,29 @@ mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) jiffies + msecs_to_jiffies(duration)); } +static void +mt7925_mcu_uni_roc_event(struct mt792x_dev *dev, struct sk_buff *skb) +{ + struct tlv *tlv; + int i = 0; + + skb_pull(skb, sizeof(struct mt7925_mcu_rxd) + 4); + + while (i < skb->len) { + tlv = (struct tlv *)(skb->data + i); + + switch (le16_to_cpu(tlv->tag)) { + case UNI_EVENT_ROC_GRANT: + mt7925_mcu_roc_handle_grant(dev, tlv); + break; + case UNI_EVENT_ROC_GRANT_SUB_LINK: + break; + } + + i += tlv->len; + } +} + static void mt7925_mcu_scan_event(struct mt792x_dev *dev, struct sk_buff *skb) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 8ec5a3a20202..2de1e38689e7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -41,6 +41,7 @@ enum mt7925_roc_req { enum { UNI_EVENT_ROC_GRANT = 0, + UNI_EVENT_ROC_GRANT_SUB_LINK = 4, UNI_EVENT_ROC_TAG_NUM }; From patchwork Wed Jul 3 21:42:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809886 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 0389A1946B0 for ; Wed, 3 Jul 2024 21:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042987; cv=none; b=VRLSTB79uUbaG7abWy9nRYS6HP1oacLJz5UNSg+tm+UQqYWJ0nQhyfDH6JQ+2aLxARil0+9x+Ti7ZOYt8xLgH+XB8uQ2wbWB/HzJs1KEEAVTdJKTGyjrSWHX04RAAgCaAeprTkRQvVzC8sqx6FvgnGO2N/dmyFlaqjZ5rPp9/OM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042987; c=relaxed/simple; bh=3a55hjKTkumzar5/VR0vwfgL+Fry5OaNFYQXx8ltqn8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Bf9QBf17aBZvU0aBrslueB9joQgD/54IWvYhPAq61Fl/Ae0WCW2VzSDJRForfQuY1EoI/JKuvzgrskL0PPNKFC8F5egobdXzS5Yk5q8XoXH4GUilFLXfjpZfwXzIg5tXB0tSwDPoESzPLUbAJFF/SxA+YSJR+tlzHrzGtFbM7fM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-700cf03febfso89117a34.3 for ; Wed, 03 Jul 2024 14:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042985; x=1720647785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jnnFcNIlRLu9h3/UZWU/y9qWihK6R2k0jAbg00BAKDs=; b=uBok629Z5qsd6vUsLYegDIuIAUcAvXPxaR/o40Ldu/copiCw7d6HUUVTPN1XkSv6yR Hy8fs6PicK0teE2Bi78y5Pc4FT+YwU2dGd6LyyaJAZtt4usGsNdrkL0XyFXbk1oYwZEn yxBsX1V6sevrroRnqYormqbV50brKSnMFJ0vyYwdalJul5fRVmhlgRjKM6r4dZ1LoEx4 i5br4MgIFz4lFmfDR4E4QUli/0SJe22YL3af+urmhgEqUP2wK2De2jzSPvCy/QVHxIX4 BPVqBsXIL+IOmMbPY5DQXN0JSEnFtqU1GfFVIX39YIZFK9vAfd8vQ2t42ZiE8HEbKiwA svmA== X-Forwarded-Encrypted: i=1; AJvYcCXNNYSqV8V2sW9Hw9mUW4VPh0mSHh7WPfsBNm5ClZ7/q0dOA3Dqc6i1BEQw7T11JKK6eI7k5u8jzEMgRBMjZLEdLYGLpCSvmRs1axJKr54= X-Gm-Message-State: AOJu0YwJmAVNeVsNhwsvj+1GKk2wp8MhkH7IVBVctaBt/6UOZQrKBLKu YvdEJgBEwhRdVBSiG8KWF0Hv4oDnTp+xyfQNgyNx7+06XrUljv4C X-Google-Smtp-Source: AGHT+IFRSikQVc8FWQX6gO02PCmAbad71auZ/8T91RgSglqwFXC1GLz5+48snIR2vtKUFVtZ8rW8MQ== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12824234a34.0.1720042984959; Wed, 03 Jul 2024 14:43:04 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:03 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 07/29] wifi: mt76: mt7925: add mt7925_change_vif_links Date: Wed, 3 Jul 2024 14:42:12 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Add mt7925_change_vif_links to change the valid links on an interface, supporting the MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 130 ++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 117 +++++++++++++--- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 20 +++ .../wireless/mediatek/mt76/mt7925/mt7925.h | 6 + drivers/net/wireless/mediatek/mt76/mt792x.h | 5 + .../net/wireless/mediatek/mt76/mt792x_core.c | 23 +++- 6 files changed, 275 insertions(+), 26 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 264517fd3bf7..c9119a222427 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -472,6 +472,33 @@ static int mt7925_set_roc(struct mt792x_phy *phy, return err; } +static int mt7925_set_mlo_roc(struct mt792x_phy *phy, + struct mt792x_bss_conf *mconf, + u16 sel_links) +{ + int err; + + if (WARN_ON_ONCE(test_and_set_bit(MT76_STATE_ROC, &phy->mt76->state))) + return -EBUSY; + + phy->roc_grant = false; + + err = mt7925_mcu_set_mlo_roc(mconf, sel_links, 5, ++phy->roc_token_id); + if (err < 0) { + clear_bit(MT76_STATE_ROC, &phy->mt76->state); + goto out; + } + + if (!wait_event_timeout(phy->roc_wait, phy->roc_grant, 4 * HZ)) { + mt7925_mcu_abort_roc(phy, mconf, phy->roc_token_id); + clear_bit(MT76_STATE_ROC, &phy->mt76->state); + err = -ETIMEDOUT; + } + +out: + return err; +} + static int mt7925_remain_on_channel(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_channel *chan, @@ -1521,6 +1548,108 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, mt792x_mutex_release(dev); } +static int +mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + u16 old_links, u16 new_links, + struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]) +{ + struct mt792x_bss_conf *mconfs[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mconf; + struct mt792x_link_sta *mlinks[IEEE80211_MLD_MAX_NUM_LINKS] = {}, *mlink; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long add = new_links & ~old_links; + unsigned long rem = old_links & ~new_links; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct ieee80211_bss_conf *link_conf; + unsigned int link_id; + int err; + + if (old_links == new_links) + return 0; + + mt792x_mutex_acquire(dev); + + for_each_set_bit(link_id, &rem, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mt792x_vif_to_link(mvif, link_id); + mlink = mt792x_sta_to_link(&mvif->sta, link_id); + + if (!mconf || !mlink) + continue; + + if (mconf != &mvif->bss_conf) { + mt792x_mac_link_bss_remove(dev, mconf, mlink); + devm_kfree(dev->mt76.dev, mconf); + devm_kfree(dev->mt76.dev, mlink); + } + + rcu_assign_pointer(mvif->link_conf[link_id], NULL); + rcu_assign_pointer(mvif->sta.link[link_id], NULL); + } + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + if (!old_links) { + mconf = &mvif->bss_conf; + mlink = &mvif->sta.deflink; + } else { + mconf = devm_kzalloc(dev->mt76.dev, sizeof(*mconf), + GFP_KERNEL); + mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), + GFP_KERNEL); + } + + mconfs[link_id] = mconf; + mlinks[link_id] = mlink; + mconf->link_id = link_id; + mconf->vif = mvif; + mlink->wcid.link_id = link_id; + } + + if (hweight16(mvif->valid_links) == 0) + mt792x_mac_link_bss_remove(dev, &mvif->bss_conf, + &mvif->sta.deflink); + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mconfs[link_id]; + mlink = mlinks[link_id]; + link_conf = mt792x_vif_to_bss_conf(vif, link_id); + + rcu_assign_pointer(mvif->link_conf[link_id], mconf); + rcu_assign_pointer(mvif->sta.link[link_id], mlink); + + err = mt7925_mac_link_bss_add(dev, link_conf, mlink); + if (err < 0) + goto free; + + if (mconf != &mvif->bss_conf) { + err = mt7925_set_mlo_roc(phy, &mvif->bss_conf, + vif->active_links); + if (err < 0) + goto free; + } + } + + mvif->valid_links = new_links; + + mt792x_mutex_release(dev); + + return 0; + +free: + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + rcu_assign_pointer(mvif->link_conf[link_id], NULL); + rcu_assign_pointer(mvif->sta.link[link_id], NULL); + + if (mconf != &mvif->bss_conf) + devm_kfree(dev->mt76.dev, mconfs[link_id]); + if (mlink != &mvif->sta.deflink) + devm_kfree(dev->mt76.dev, mlinks[link_id]); + } + + mt792x_mutex_release(dev); + + return err; +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1579,6 +1708,7 @@ const struct ieee80211_ops mt7925_ops = { .mgd_complete_tx = mt7925_mgd_complete_tx, .vif_cfg_changed = mt7925_vif_cfg_changed, .link_info_changed = mt7925_link_info_changed, + .change_vif_links = mt7925_change_vif_links, }; EXPORT_SYMBOL_GPL(mt7925_ops); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 5693c21bfb4a..b62153671350 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -307,6 +307,9 @@ mt7925_mcu_roc_iter(void *priv, u8 *mac, struct ieee80211_vif *vif) struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; struct mt7925_roc_grant_tlv *grant = priv; + if (ieee80211_vif_is_mld(vif) && vif->type == NL80211_IFTYPE_STATION) + return; + if (mvif->idx != grant->bss_idx) return; @@ -1079,6 +1082,100 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, return mt76_mcu_skb_send_msg(dev, skb, mcu_cmd, true); } +int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, + int duration, u8 token_id) +{ + struct mt792x_vif *mvif = mconf->vif; + struct ieee80211_vif *vif = container_of((void *)mvif, + struct ieee80211_vif, drv_priv); + struct ieee80211_bss_conf *link_conf; + struct ieee80211_channel *chan; + const u8 ch_band[] = { + [NL80211_BAND_2GHZ] = 1, + [NL80211_BAND_5GHZ] = 2, + [NL80211_BAND_6GHZ] = 3, + }; + enum mt7925_roc_req type; + int center_ch, i = 0; + bool is_AG_band = false; + struct { + u8 id; + u8 bss_idx; + u16 tag; + struct mt792x_bss_conf *mconf; + struct ieee80211_channel *chan; + } links[2]; + + struct { + struct { + u8 rsv[4]; + } __packed hdr; + struct roc_acquire_tlv roc[2]; + } __packed req; + + if (!mconf || hweight16(vif->valid_links) < 2 || + hweight16(sel_links) != 2) + return -EPERM; + + for (i = 0; i < ARRAY_SIZE(links); i++) { + links[i].id = i ? __ffs(~BIT(mconf->link_id) & sel_links) : + mconf->link_id; + link_conf = mt792x_vif_to_bss_conf(vif, links[i].id); + if (WARN_ON_ONCE(!link_conf)) + return -EPERM; + + links[i].chan = link_conf->chanreq.oper.chan; + if (WARN_ON_ONCE(!links[i].chan)) + return -EPERM; + + links[i].mconf = mt792x_vif_to_link(mvif, links[i].id); + links[i].tag = links[i].id == mconf->link_id ? + UNI_ROC_ACQUIRE : UNI_ROC_SUB_LINK; + + is_AG_band |= links[i].chan->band == NL80211_BAND_2GHZ; + } + + if (vif->cfg.eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP) + type = is_AG_band ? MT7925_ROC_REQ_MLSR_AG : + MT7925_ROC_REQ_MLSR_AA; + else + type = MT7925_ROC_REQ_JOIN; + + for (i = 0; i < ARRAY_SIZE(links) && i < hweight16(vif->active_links); i++) { + if (WARN_ON_ONCE(!links[i].mconf || !links[i].chan)) + continue; + + chan = links[i].chan; + center_ch = ieee80211_frequency_to_channel(chan->center_freq); + req.roc[i].len = cpu_to_le16(sizeof(struct roc_acquire_tlv)); + req.roc[i].tag = cpu_to_le16(links[i].tag); + req.roc[i].tokenid = token_id; + req.roc[i].reqtype = type; + req.roc[i].maxinterval = cpu_to_le32(duration); + req.roc[i].bss_idx = links[i].mconf->mt76.idx; + req.roc[i].control_channel = chan->hw_value; + req.roc[i].bw = CMD_CBW_20MHZ; + req.roc[i].bw_from_ap = CMD_CBW_20MHZ; + req.roc[i].center_chan = center_ch; + req.roc[i].center_chan_from_ap = center_ch; + + /* STR : 0xfe indicates BAND_ALL with enabling DBDC + * EMLSR : 0xff indicates (BAND_AUTO) without DBDC + */ + req.roc[i].dbdcband = type == MT7925_ROC_REQ_JOIN ? 0xfe : 0xff; + + if (chan->hw_value < center_ch) + req.roc[i].sco = 1; /* SCA */ + else if (chan->hw_value > center_ch) + req.roc[i].sco = 3; /* SCB */ + + req.roc[i].band = ch_band[chan->band]; + } + + return mt76_mcu_send_msg(&mvif->phy->dev->mt76, MCU_UNI_CMD(ROC), + &req, sizeof(req), false); +} + int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, struct ieee80211_channel *chan, int duration, enum mt7925_roc_req type, u8 token_id) @@ -1089,25 +1186,7 @@ int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, struct { u8 rsv[4]; } __packed hdr; - struct roc_acquire_tlv { - __le16 tag; - __le16 len; - u8 bss_idx; - u8 tokenid; - u8 control_channel; - u8 sco; - u8 band; - u8 bw; - u8 center_chan; - u8 center_chan2; - u8 bw_from_ap; - u8 center_chan_from_ap; - u8 center_chan2_from_ap; - u8 reqtype; - __le32 maxinterval; - u8 dbdcband; - u8 rsv[3]; - } __packed roc; + struct roc_acquire_tlv roc; } __packed req = { .roc = { .tag = cpu_to_le16(UNI_ROC_ACQUIRE), diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index da4e84f468d2..fefb6ab384bb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -554,6 +554,26 @@ struct mt7925_wow_pattern_tlv { u8 rsv[7]; } __packed; +struct roc_acquire_tlv { + __le16 tag; + __le16 len; + u8 bss_idx; + u8 tokenid; + u8 control_channel; + u8 sco; + u8 band; + u8 bw; + u8 center_chan; + u8 center_chan2; + u8 bw_from_ap; + u8 center_chan_from_ap; + u8 center_chan2_from_ap; + u8 reqtype; + __le32 maxinterval; + u8 dbdcband; + u8 rsv[3]; +} __packed; + static inline enum connac3_mcu_cipher_type mt7925_mcu_get_cipher(int cipher) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 2de1e38689e7..54693624b182 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -30,12 +30,16 @@ enum { UNI_ROC_ACQUIRE, UNI_ROC_ABORT, + UNI_ROC_SUB_LINK = 3, UNI_ROC_NUM }; enum mt7925_roc_req { MT7925_ROC_REQ_JOIN, MT7925_ROC_REQ_ROC, + MT7925_ROC_REQ_SUB_LINK, + MT7925_ROC_REQ_MLSR_AG = 10, + MT7925_ROC_REQ_MLSR_AA, MT7925_ROC_REQ_NUM }; @@ -295,6 +299,8 @@ int mt7925_set_tx_sar_pwr(struct ieee80211_hw *hw, int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set); int mt7925_mcu_set_clc(struct mt792x_dev *dev, u8 *alpha2, enum environment_cap env_cap); +int mt7925_mcu_set_mlo_roc(struct mt792x_bss_conf *mconf, u16 sel_links, + int duration, u8 token_id); int mt7925_mcu_set_roc(struct mt792x_phy *phy, struct mt792x_bss_conf *mconf, struct ieee80211_channel *chan, int duration, enum mt7925_roc_req type, u8 token_id); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index fe5a6c932705..9a7443a8a951 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -112,6 +112,7 @@ struct mt792x_bss_conf { struct mt792x_vif *vif; struct ewma_rssi rssi; struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS]; + unsigned int link_id; }; struct mt792x_vif { @@ -122,6 +123,7 @@ struct mt792x_vif { struct mt792x_sta *wep_sta; struct mt792x_phy *phy; + u16 valid_links; }; struct mt792x_phy { @@ -398,6 +400,9 @@ mt792x_get_mac80211_ops(struct device *dev, int mt792x_init_wcid(struct mt792x_dev *dev); int mt792x_mcu_drv_pmctrl(struct mt792x_dev *dev); int mt792x_mcu_fw_pmctrl(struct mt792x_dev *dev); +void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, + struct mt792x_bss_conf *mconf, + struct mt792x_link_sta *mlink); static inline char *mt792x_ram_name(struct mt792x_dev *dev) { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 813296fad0ed..62f471b5498f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -113,14 +113,17 @@ void mt792x_stop(struct ieee80211_hw *hw, bool suspend) } EXPORT_SYMBOL_GPL(mt792x_stop); -static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, - struct ieee80211_bss_conf *link_conf, - struct mt792x_link_sta *mlink) +void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, + struct mt792x_bss_conf *mconf, + struct mt792x_link_sta *mlink) { - struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); + struct ieee80211_vif *vif = container_of((void *)mconf->vif, + struct ieee80211_vif, drv_priv); + struct ieee80211_bss_conf *link_conf; int idx = mlink->wcid.idx; - mt792x_mutex_acquire(dev); + link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id); + mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid); mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mlink->wcid, false); @@ -128,7 +131,6 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, dev->mt76.vif_mask &= ~BIT_ULL(mconf->mt76.idx); mconf->vif->phy->omac_mask &= ~BIT_ULL(mconf->mt76.omac_idx); - mt792x_mutex_release(dev); spin_lock_bh(&dev->mt76.sta_poll_lock); if (!list_empty(&mlink->wcid.poll_list)) @@ -137,14 +139,21 @@ static void mt792x_mac_link_bss_remove(struct mt792x_dev *dev, mt76_wcid_cleanup(&dev->mt76, &mlink->wcid); } +EXPORT_SYMBOL_GPL(mt792x_mac_link_bss_remove); void mt792x_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_bss_conf *mconf; - mt792x_mac_link_bss_remove(dev, &vif->bss_conf, &mvif->sta.deflink); + mt792x_mutex_acquire(dev); + + mconf = mt792x_link_conf_to_mconf(&vif->bss_conf); + mt792x_mac_link_bss_remove(dev, mconf, &mvif->sta.deflink); + + mt792x_mutex_release(dev); } EXPORT_SYMBOL_GPL(mt792x_remove_interface); From patchwork Wed Jul 3 21:42:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810303 Received: from mail-ot1-f52.google.com (mail-ot1-f52.google.com [209.85.210.52]) (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 823411946B0 for ; Wed, 3 Jul 2024 21:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042990; cv=none; b=Ue0SSanN9ZeOewAX2xhlB18Kz9YWz+ZuHr0BtGqqzqf1NWpZTXd1Uj+zta2tP8bvuJ+LAYkQyLyNLmekmesxODpH+xwSrr9cJ7YB7VA3FRb/gBaHMDJ1VsfaNG8i52OHea+g0i5Mo5PL5cH6zBKSvniwGhZ3jwybvgtH212X+mk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042990; c=relaxed/simple; bh=THKNZI4jrpFWwBZoTQY9CQERKD/jg4vCX/LEXCm33jI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SbVy+0oW/FCfUmvi0MTAR8PDJLp7k8Cn8MafNgGT94yzT5Ywx9L9l9SQ12p5W1ytgKJQejWG/DQWCnavbVTppNJM1ugbt1BrpyquzV3u6Wq4x3pafJlIzCTO9krQb6ELpjgN8FdWCus/f3+9juECPyVSjeqqfhrWy1eV+227sa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f52.google.com with SMTP id 46e09a7af769-700d29f33a0so89045a34.1 for ; Wed, 03 Jul 2024 14:43:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042987; x=1720647787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9TOWM2avYXo/xP6pN6yETRbPs1gdrDHvtIHr+R1SQlw=; b=sUaAUIbaopWpSzGz4pRfuvmvLdl6d4NFWUz2O9v5ZBVfgZGU/N95gi5CROsCgTPDlG JYsZrVmsdKR/1NRoCUMQ7PRJsJEgzuUfNQEI0g50b3iM3ykPuPWdTCzbtzZ8tjI9qgEX fsZaXOeKFvEEGtnovha5r3Ii6R2yW6swkQfopJ2ljUOdtO9flUpCWKnp+LhiSHuMJmif zygqr+YCN0YxakmBDlGtFkGcERBowP1lIrgVr/uIwQG1olMuuFrkhvFzF99CYmqSoNc8 lOJO5adPvWCRa/p4PXB9+mdEiDJf0Dir4paU/2AEFlH+ap0IuGZSKs9676uZO5qyp3Tm 9xew== X-Forwarded-Encrypted: i=1; AJvYcCXoMnz70zExC4H+MBdQM3PhYelBaicsYlBuC01PAsQyfIzuEgkSKC6ld3rgFIcXRM00cRWDG/nzhfmmWeN9m5/qdanylArpJFwHejPGwS4= X-Gm-Message-State: AOJu0Yx4E47EJCjeh5mYeQie6PB0pmzLJ+GH/VK1OkVGYTd2fFiiQuKW uqJNoT6Gu61uaXfEGlZ+yOGL29roAPCltNAyoxYkqRggr64WZ3I3 X-Google-Smtp-Source: AGHT+IHB+8D92ICxDGrelbsO6+AY0q19flJoPxzsqBAYCuqHkQXeoHpWCeXCgy/9CJA3vEU2E60bXg== X-Received: by 2002:a05:6830:2007:b0:700:d1c1:e12d with SMTP id 46e09a7af769-7020775bef2mr12607744a34.3.1720042987444; Wed, 03 Jul 2024 14:43:07 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:05 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 08/29] wifi: mt76: mt7925: add mt7925_change_sta_links Date: Wed, 3 Jul 2024 14:42:13 -0700 Message-Id: <8003cfbdec2c1357fb9d7ac8ba93af5fd0b4ec5d.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add mt7925_change_sta_links to change the valid links of a station, supporting the MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 142 +++++++++++++++++- drivers/net/wireless/mediatek/mt76/mt792x.h | 7 + 2 files changed, 145 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index c9119a222427..0e554b21692e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -811,16 +811,79 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, link_conf, link_sta, false); } - ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, - MT76_STA_INFO_STATE_NONE); - if (ret) - return ret; + if (ieee80211_vif_is_mld(vif) && + link_sta == mlink->pri_link) { + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_NONE); + if (ret) + return ret; + } else if (ieee80211_vif_is_mld(vif) && + link_sta != mlink->pri_link) { + ret = mt7925_mcu_sta_update(dev, mlink->pri_link, vif, + true, MT76_STA_INFO_STATE_ASSOC); + if (ret) + return ret; + + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_ASSOC); + if (ret) + return ret; + } else { + ret = mt7925_mcu_sta_update(dev, link_sta, vif, true, + MT76_STA_INFO_STATE_NONE); + if (ret) + return ret; + } mt76_connac_power_save_sched(&dev->mphy, &dev->pm); return 0; } +static int +mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, unsigned long new_links) +{ + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt76_wcid *wcid; + unsigned int link_id; + int err = 0; + + for_each_set_bit(link_id, &new_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; + + if (msta->deflink_id == IEEE80211_LINK_UNSPECIFIED) { + mlink = &msta->deflink; + msta->deflink_id = link_id; + } else { + mlink = devm_kzalloc(dev->mt76.dev, sizeof(*mlink), GFP_KERNEL); + if (!mlink) { + err = -ENOMEM; + break; + } + + wcid = &mlink->wcid; + ewma_signal_init(&wcid->rssi); + rcu_assign_pointer(dev->mt76.wcid[wcid->idx], wcid); + mt76_wcid_init(wcid); + ewma_avg_signal_init(&mlink->avg_ack_signal); + memset(mlink->airtime_ac, 0, + sizeof(msta->deflink.airtime_ac)); + } + + msta->valid_links |= BIT(link_id); + rcu_assign_pointer(msta->link[link_id], mlink); + mlink->sta = msta; + mlink->pri_link = &sta->deflink; + + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta); + } + + return err; +} + int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -915,6 +978,48 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev, mt76_connac_power_save_sched(&dev->mphy, &dev->pm); } +static int +mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, unsigned long old_links) +{ + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt76_dev *mdev = &dev->mt76; + struct mt76_wcid *wcid; + unsigned int link_id; + + for_each_set_bit(link_id, &old_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; + + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + if (!link_sta) + continue; + + mlink = mt792x_sta_to_link(msta, link_id); + if (!mlink) + continue; + + mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta); + + wcid = &mlink->wcid; + rcu_assign_pointer(msta->link[link_id], NULL); + msta->valid_links &= ~BIT(link_id); + mlink->sta = NULL; + mlink->pri_link = NULL; + + if (link_sta != mlink->pri_link) { + mt76_wcid_cleanup(mdev, wcid); + mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx); + mt76_wcid_mask_clear(mdev->wcid_phy_mask, wcid->idx); + } + + if (msta->deflink_id == link_id) + msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; + } + + return 0; +} + void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -1650,6 +1755,34 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return err; } +static int +mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, u16 old_links, u16 new_links) +{ + unsigned long add = new_links & ~old_links; + unsigned long rem = old_links & ~new_links; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + int err = 0; + + if (old_links == new_links) + return 0; + + mt792x_mutex_acquire(dev); + + err = mt7925_mac_sta_remove_links(dev, vif, sta, rem); + if (err < 0) + goto out; + + err = mt7925_mac_sta_add_links(dev, vif, sta, add); + if (err < 0) + goto out; + +out: + mt792x_mutex_release(dev); + + return err; +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1709,6 +1842,7 @@ const struct ieee80211_ops mt7925_ops = { .vif_cfg_changed = mt7925_vif_cfg_changed, .link_info_changed = mt7925_link_info_changed, .change_vif_links = mt7925_change_vif_links, + .change_sta_links = mt7925_change_sta_links, }; EXPORT_SYMBOL_GPL(mt7925_ops); diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 9a7443a8a951..af9a103dc7f4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -92,6 +92,10 @@ struct mt792x_link_sta { unsigned long last_txs; struct mt76_connac_sta_key_conf bip; + + struct mt792x_sta *sta; + + struct ieee80211_link_sta *pri_link; }; struct mt792x_sta { @@ -99,6 +103,9 @@ struct mt792x_sta { struct mt792x_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS]; struct mt792x_vif *vif; + + u16 valid_links; + u8 deflink_id; }; DECLARE_EWMA(rssi, 10, 8); From patchwork Wed Jul 3 21:42:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809885 Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) (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 5F8671946D4 for ; Wed, 3 Jul 2024 21:43:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042991; cv=none; b=m9LjlpsS/kBCbooM1l6lqc5yBI8336QRaFqPC9Si0iqT7HuzVyKB//g90ms2l48oJwww2V2FuyzirQ+tDVl3D+zKdFPaTr/amtC3Feo4D8Ow4w2wijRtABUMd8TCtoFjG5AZzVD+a1I+gZ3hBuH9pWdCz8vMdgXrw3rhRcH5IFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042991; c=relaxed/simple; bh=hgDH89PcHMEjqnzilmIyMF8vwg/OzKEt/d2R79A2ZqY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Y16QxlihtVYJGuoT+ZpTYG2xo+E/I89bmx3Lt15eOo0nSiTHunKJ+CThtAccSAYFb2BAh2Zs2Hu5uRXcymVmXSU2Sxk51C97WkWCvNEtUP2RWGWIqaFEQ1U9PdRMOPBQuOzZ55ZTmeS+gIhwV34k1BTXhe3wTDMi/agd5o6fwEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-700cd6afa3eso204793a34.1 for ; Wed, 03 Jul 2024 14:43:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042989; x=1720647789; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a5jt3ki0dxujpF+hrHkEF4OlQEJHlnIToDmNgU6Pwh8=; b=UCfTAGQyNqK2qfmK1sOGJ2cT2XewuP/z4suvzJNDtslE6IKXOVrT5i3KtNPyg7YStV VbEyk0ZjpfG7+Km64Uvgh04oi3H48leeBZCcNG6ljLTWs134xYP+ylpQt3wRqYXr3jcq K1PmY1Hp/CMRZcx4idTSO3b3KcGkPolfMoAeb17DsQcN5+IMXC+bbdl9yAEur9mg6t1d /+VL0m0ZLr3ZD/5XlUA+L2h0vYLO1IkfuFHceLBxSK7WNSXsRPRqig+GCNv8G+IPYPUy I5KSuD9ZL0wea+QkWnnjt7ar0IP6iiC/2v6NKqsLjdW0rC/SUsLGXqH8DZXItEOR03c+ 9Kfw== X-Forwarded-Encrypted: i=1; AJvYcCVkDY+iCnNvWpOjQ7qehvD1v/f5fCS1kaLiS00V8OzXW1q7jq/oalSVWH0y8IJklaBhYqgWLkHfss9CpfBP/UGN1PFnV/42DiVIGEzk+dE= X-Gm-Message-State: AOJu0Yww9s7kyvZq2V5JRd9Vjfc2x+mqROR9I7Iw1fM0ZmcrEH/Z2rjn TSwEXE8wPR4kxsIkmJryiKL6OAYZkawU0x3ZP5zfdvau87hlrvzU X-Google-Smtp-Source: AGHT+IH+yhvRJNPDLOf155UX4LN+InGILwsLbUzzyWl2sYHJHsM69Z5/iy6EGQ/+WKVapU70TMpjBw== X-Received: by 2002:a05:6830:4623:b0:700:ce5f:968c with SMTP id 46e09a7af769-702077496d6mr11310220a34.3.1720042989603; Wed, 03 Jul 2024 14:43:09 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:07 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 09/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_add Date: Wed, 3 Jul 2024 14:42:14 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Added link handling to mt7925_mac_sta_add to support MLD devices. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 0e554b21692e..82d16208764f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -887,15 +887,25 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + int err; msta->vif = mvif; if (vif->type == NL80211_IFTYPE_STATION) mvif->wep_sta = msta; - return mt7925_mac_link_sta_add(mdev, vif, &sta->deflink); + if (ieee80211_vif_is_mld(vif)) { + msta->deflink_id = IEEE80211_LINK_UNSPECIFIED; + + err = mt7925_mac_sta_add_links(dev, vif, sta, sta->valid_links); + } else { + err = mt7925_mac_link_sta_add(mdev, vif, &sta->deflink); + } + + return err; } EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); From patchwork Wed Jul 3 21:42:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810302 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (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 838B7190694 for ; Wed, 3 Jul 2024 21:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042993; cv=none; b=V70bGsHJCC7yLUVFoPcA5gqvq2MeP5kA35MIeY/r7KxPsq/ssarpXh6qIua6xqSmIIQhbOSlqW7blaFyEQqEjjYmWKKf8VVwm+9E4hH5A9zrvxAsDrFmsAoYeL12+5pnfqojTBaLGz1xWXQ74m//U8QXgNnxo1ZrTMuAVN5uD8g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042993; c=relaxed/simple; bh=IfrV4OM0MCVyEdNdRpfkefs0ffPMKX+cMF1K0Qi3ILc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UtnWNakuBUCu/fEx0lMsDPn30t6B+kttf7k7J8l5nxdZe/hKLIm61AyZU57tgcO9BxmwbiMKCNbOJnmc4Dj+IhYfswWqxVI9ZzCVB83saE4QUZEzgoQ6xRAuUSuFyZiDKDBflWSYo9sVhrQ9YLkezY++lmY91G1B677nnHlPVz8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-700cd6afa3eso204795a34.1 for ; Wed, 03 Jul 2024 14:43:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042991; x=1720647791; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xjjV9MoW6/GqqLbyBVNCqJec5vStgsiVvPCH52PPCaU=; b=uFFVZRKHNXE7gp1vVCPTHTuGCqI+xzzyrNdbx9MrbvBXqVWVpFT05y8+uTHW2WiHwd 4TfMVuTr0oLE+q8RjQcBa42IBpyrUokIxl1fOWCZUo0X+cw+XmBhHRq08rNqdATym1pg OJJlkiah2zhtIDA9n4JPXIdW94aV5s1XfDoRC7Mqm5r2J80pTzPOTU9STlfjttQiQOQK pEXN4yxc/KpA3YZKjV5U3E1v+0XJ9I6m5yVKCL00t7RiuHmyctG52QZLiYpumRFp31ud wpLVmlZXrTut61gC8I3zQ+SFQAixQ5+zRi4ntKI41SVArJXfay8WatJ5CsJSENXaX7os SxKw== X-Forwarded-Encrypted: i=1; AJvYcCUVJSNfTu537qY49PkH31oWqN0Ar9Y9h21r1rU+BkzGdLxfx4SM4ZlvLWdfcdrgtmW9gZwn8LR0hgJgmbq7q+Ppomfagh/dAcxL0RZzGGk= X-Gm-Message-State: AOJu0Yy/YlsfsMOALomC/sX7m8gKA3s7PB++KUbjZEsUdzW2IZjMzIy0 bhUaJgdKk7WsXEUarVvnQ2AEO7wi2v2zgRe7ymwrEe7KEVPZegbO3FA86+aZ X-Google-Smtp-Source: AGHT+IHzTUePuwQCPzYY/JacfKT/2WyEXRpG6nm5RKejU7QJGziRTmVQSCSVqAKa2hnz66ETj0H/8A== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877677a34.1.1720042991623; Wed, 03 Jul 2024 14:43:11 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:10 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 10/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_remove Date: Wed, 3 Jul 2024 14:42:15 -0700 Message-Id: <84e2ec56c995fdf562b1d3146dd1456ec5cd05af.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Added link handling to mt7925_mac_sta_remove, supporting the MLO-enabled firmware. The change remains comptabile with the non-MLO mode. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 82d16208764f..5360f8a71655 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1033,7 +1033,13 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - mt7925_mac_link_sta_remove(mdev, vif, &sta->deflink); + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + unsigned long rem; + + rem = ieee80211_vif_is_mld(vif) ? msta->valid_links : BIT(0); + + mt7925_mac_sta_remove_links(dev, vif, sta, rem); if (vif->type == NL80211_IFTYPE_STATION) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; From patchwork Wed Jul 3 21:42:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809884 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 2F851194A4C for ; Wed, 3 Jul 2024 21:43:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042995; cv=none; b=rWuVusiCIn7PrkzkomNx6jJ6EX9ObJ56ZcUZbQKSPPwHKvgsVbj4tLuza8N7WpJHLjSUZoti6hQ9VnU4e8wp17SlmhVN7jrYs/31Mi1N4PjAnD010f9/Ll9mB2mAg14qhOL6QXZCuodxXJcU3JtWnZDo1YnvRzYVhp0VTLqKR2M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042995; c=relaxed/simple; bh=JsfggounGl8/Va5lkoe5OefWPYNuj1XOjPdGm9QMewE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=eFFwgukUk1a0unwZq5aEYw57cD501+XwTmToKUWV0UvrzH7D7c+YSEAOalATMLipM7+g54aYs5gI9TIa5nzL2HrQtEXsu/L9v7cA2VO9cS5WJNsTglLCBKGQVPBjIJrbkbdK5r3vf0TDg/m4LXQbgZaUTUt/7ybFXJbppdnYiF0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-700d281dcecso104219a34.0 for ; Wed, 03 Jul 2024 14:43:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042993; x=1720647793; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6EEPHIPorQ9nGaiT0HOjyRcsXyquZCZmG1NVm4BqrTE=; b=wdImUY6nKdF34TMxXuP5JViWit3TxrwVxCszyCL/Feyq3JlDk9ZVy9XFjmA2Tc7ECJ lKxGlVAQz84f2aUABnLwJ+kA/vbhproTCjv02NERVjKBS9TZV6iR7iiwvGb9/zgdeqZv Zk6uQpfNYATqkptkDL/ZPOYxg7BTAismc6Z4IxVALSMnhNXehv0bQQzQaY7vOMxyWDoU eAGLhbFMpXLEkC3LRateEUOX9TzTCZcL1MdOtECSwMZUr4CCCHzwE7/I0nGTv+masE/l WwexKdQ1YsI3IF/CaZYgTxyYlBuLQXa4E8+n12DpxDOXxFRC91Dd81ILHF3sLIIzAzLe dA/Q== X-Forwarded-Encrypted: i=1; AJvYcCWdEOa4uVBjc2APihUSo8B2knMVMbk1+pCf0HYl5AYfTmZHIx7TJdJWcfsPnsAYfDN6E0LbeZ11p2U5bUyGvh/1F5n4NLjOKj40hzMOwdE= X-Gm-Message-State: AOJu0Yz7/S3QNUj71Wkr6wcvoJQLVxgcYuDxjEEM1Sz5WnvjXHCi+M9b JguqR1dFpwHDLlsMWHjV1d+MJc3XbSpdVu9CGVN4QsdHVGhYJFHOqmLP6usF X-Google-Smtp-Source: AGHT+IHggK4Kg30dd8NLdj3jI1DxXMyqkfqDw4O6ut1WvmHHhY2tP43NFyj/9iepNGjGPUI4kHOJCg== X-Received: by 2002:a9d:5c89:0:b0:701:f366:71d7 with SMTP id 46e09a7af769-7020767ab30mr12877738a34.1.1720042993253; Wed, 03 Jul 2024 14:43:13 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:12 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 11/29] wifi: mt76: mt7925: add link handling to txwi Date: Wed, 3 Jul 2024 14:42:16 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling to mt792x_tx and writing txwi. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mac.c | 12 ++++++--- .../net/wireless/mediatek/mt76/mt792x_core.c | 26 +++++++++++++++++-- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 2be2ab914411..6f5f2130420e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -740,8 +740,12 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, BSS_CHANGED_BEACON_ENABLED)); bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP | BSS_CHANGED_FILS_DISCOVERY)); + struct mt792x_bss_conf *mconf; + + mconf = vif ? mt792x_vif_to_link((struct mt792x_vif *)vif->drv_priv, + wcid->link_id) : NULL; + mvif = mconf ? (struct mt76_vif *)&mconf->mt76 : NULL; - mvif = vif ? (struct mt76_vif *)vif->drv_priv : NULL; if (mvif) { omac_idx = mvif->omac_idx; wmm_idx = mvif->wmm_idx; @@ -802,8 +806,10 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, txwi[5] = cpu_to_le32(val); - val = MT_TXD6_DIS_MAT | MT_TXD6_DAS | - FIELD_PREP(MT_TXD6_MSDU_CNT, 1); + val = MT_TXD6_DAS | FIELD_PREP(MT_TXD6_MSDU_CNT, 1); + if (!ieee80211_vif_is_mld(vif) || + (q_idx >= MT_LMAC_ALTX0 && q_idx <= MT_LMAC_BCN0)) + val |= MT_TXD6_DIS_MAT; txwi[6] = cpu_to_le32(val); txwi[7] = 0; diff --git a/drivers/net/wireless/mediatek/mt76/mt792x_core.c b/drivers/net/wireless/mediatek/mt76/mt792x_core.c index 62f471b5498f..ae2ac146a7f7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x_core.c +++ b/drivers/net/wireless/mediatek/mt76/mt792x_core.c @@ -59,13 +59,17 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_vif *vif = info->control.vif; struct mt76_wcid *wcid = &dev->mt76.global_wcid; + u8 link_id; int qid; if (control->sta) { + struct mt792x_link_sta *mlink; struct mt792x_sta *sta; - + link_id = u32_get_bits(info->control.flags, + IEEE80211_TX_CTRL_MLO_LINK); sta = (struct mt792x_sta *)control->sta->drv_priv; - wcid = &sta->deflink.wcid; + mlink = mt792x_sta_to_link(sta, link_id); + wcid = &mlink->wcid; } if (vif && !control->sta) { @@ -75,6 +79,24 @@ void mt792x_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, wcid = &mvif->sta.deflink.wcid; } + if (vif && control->sta && ieee80211_vif_is_mld(vif)) { + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + struct ieee80211_link_sta *link_sta; + struct ieee80211_bss_conf *conf; + + link_id = wcid->link_id; + rcu_read_lock(); + conf = rcu_dereference(vif->link_conf[link_id]); + memcpy(hdr->addr2, conf->addr, ETH_ALEN); + + link_sta = rcu_dereference(control->sta->link[link_id]); + memcpy(hdr->addr1, link_sta->addr, ETH_ALEN); + + if (vif->type == NL80211_IFTYPE_STATION) + memcpy(hdr->addr3, conf->bssid, ETH_ALEN); + rcu_read_unlock(); + } + if (mt76_connac_pm_ref(mphy, &dev->pm)) { mt76_tx(mphy, control->sta, wcid, skb); mt76_connac_pm_unref(mphy, &dev->pm); From patchwork Wed Jul 3 21:42:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810301 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 46997194A5D for ; Wed, 3 Jul 2024 21:43:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042997; cv=none; b=QUntUhi3WHpaseYcM10XgI/0XVZlv1+5NjaFwPnpD2OQGTgSxrLPLq7MVOh0DYxUQEosDKSBdglhJJX+PdlwJfroLM2uk7aql92bP3iOtcz/gT1lYt+rEWsEg2oYHRTjpDO1dfTt5kQK4covuS9VSaG/60+FOMPVZmgJ9lRP7DU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042997; c=relaxed/simple; bh=o3JWqIB+QFj3PR4Zo0Mi3St9FZxkV/2KV9p0sfLibg0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p0r3aXW1bH96QWz6TCX9W12rDvSqRrkL6+XipTR1ewycGJ539Nunr0F5/lOgWjeVfYd/pSjTDhf904+lew4gkWsrTHNfbvCzn9pFKp0Lj5pAHJ6jiNeggxSZ6oGns2OBvmhl0hxxe/xDOHMbQnLG0rs/hSGjCjtDHWr23k1f7CU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-701fa02e5c1so84613a34.2 for ; Wed, 03 Jul 2024 14:43:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042995; x=1720647795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P9X2Ept/O0sdVjyMsMVTI9tmtIsMoebdCU/+EmBDr+w=; b=da58I72q29kkIXWq/c0AiSC4FisasDb3yPVVyhwrfmh05bW/8DvwdehTnIH7L3juN6 lQfdZfWlWc5j65FdG4d/Gua4KEt6zc95an7AOKpIqPPDlEUA9t5qzf5ICjFyuOaprBwb YKPQfRvUKMrh797Xeb5XjQtmJ+YACymZH/8ouXAtaeC0tvWWDMFCtZ+L8DuAenyH+zfr OpGdLxr4F7zXJqDr1wXfjP8C1Q+DXaDYfyKkL8lVT2Me14/bZRRcjgWSYEmzUWwFPFIq qCqTvbC/Vp2/sDEjdppHVhbBe1lQ6PpIM8dSMl6IOG7aP0VlIQ1Z84JJYXuEQeJRM0NH 69VA== X-Forwarded-Encrypted: i=1; AJvYcCXYLSq7cPGRGEi/f6IoKWp8bNqAPHsdV8045He7N7rKDa6O0VWPro6kEVlThn7AIL9rngSOHABWWoDYWOUW4cHmmQMg+JV2l+xDAXO1vKE= X-Gm-Message-State: AOJu0YxLNoib5dplacXgBAm4ogvBFttPlLM2VRi/U2ZLVN1WqnyTSow/ XQZtmFH+CZ5m4p/0/6hkpLSMLtYyaZ170UC8anaasoY+EkjgZ5Y3 X-Google-Smtp-Source: AGHT+IGGHAjakzXvQuXS7WHahMXqf59L78wQDAu9H4Irc6qqb9rGmo15ve1Zm6DDdwZ7tNsGV/Gmdg== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585002a34.0.1720042995442; Wed, 03 Jul 2024 14:43:15 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:13 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 12/29] wifi: mt76: mt7925: add link handling in mt7925_set_key Date: Wed, 3 Jul 2024 14:42:17 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling in mt7925_set_key to support MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 5360f8a71655..f85f7ea01f67 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -610,6 +610,9 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, struct ieee80211_key_conf *key) { struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_sta *msta = sta ? (struct mt792x_sta *)sta->drv_priv : + &mvif->sta; int err; /* The hardware does not support per-STA RX GTK, fallback @@ -624,7 +627,20 @@ static int mt7925_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, mt792x_mutex_acquire(dev); - err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + if (ieee80211_vif_is_mld(vif)) { + unsigned int link_id; + unsigned long add; + + add = key->link_id != -1 ? BIT(key->link_id) : msta->valid_links; + + for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { + err = mt7925_set_link_key(hw, cmd, vif, sta, key, link_id); + if (err < 0) + break; + } + } else { + err = mt7925_set_link_key(hw, cmd, vif, sta, key, vif->bss_conf.link_id); + } mt792x_mutex_release(dev); From patchwork Wed Jul 3 21:42:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809883 Received: from mail-oa1-f44.google.com (mail-oa1-f44.google.com [209.85.160.44]) (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 663CD194A61 for ; Wed, 3 Jul 2024 21:43:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042999; cv=none; b=CziAA1BZYzBVHav07i22ui1dmtpffW+CO5SsLQsSueEUxaTcqMkermOFMqwSIsNg6VMeaPKjl9wGSgV2bJZNGBuBg8H/h6d5UFSV0wfrjDQN46HVbVceNNoWstBx1lzy3aP+vRySvchgv+PuV6fj05qqoSDHD7BKVL55lv4V5qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720042999; c=relaxed/simple; bh=s3ixwMsyp7a2FAgbTEkcDhadNGLmDjJPv+VJNxcNjec=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cOUCbqi49urS3twqM861AxHMOSCIddGFDbbsKgdsgn2sDnwzU8DyFCHk7F5BccUKH7Tyq0wiesnNUxluI+4cn6YCyglNU06kBKV2V9ZleUHCyYVDFBDkYQrP5PChnEYEsZjAHtv5TaSYGCWR8j2AdWmyeFnT9SnG2QgjEdpNBtk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f44.google.com with SMTP id 586e51a60fabf-25e19ad0050so9218fac.0 for ; Wed, 03 Jul 2024 14:43:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042997; x=1720647797; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sDQgeUMdcNQThv6Pb9X0Ecyn9jvt1k59yxEbX8sQC7Q=; b=Gnko0Ktx/uZlMqLaKbf8ZUSpvnIwaq+c0yt6OGcR/zMmoPKzW3lLh4b5zCslXiF7U7 yPV2Yngx7/ysYxcU0pXBRXAohUVTN2+GPNvm2zhcNiVZZLG3rjP4wQCfQ6RrQFFkF5Qd HPL277eOs4FUAqtx099BkJsGHqBucacAaJ7aW5MxT/gKxRmi3oQEXP33vXGPN8RL0lRE BwQ5CAiY3ktO7hZMap7M3Bnga26h1PG4+mVEMuPWg4NmXzk1ieiW1Rsq+GxpuLh0siKq /MgZV5IyFg5jpnHW4isqWm7CW83FA1OAfcRJfkjSMsxGI8mJjGYEyrjdd0SR144modGo l46g== X-Forwarded-Encrypted: i=1; AJvYcCVxj3zJKVS7SRPuSFI8/rJwDtCUq7N4ooXYNeYURf0/m6msQUEcb2SbUhNkD23wHsXfVvzb2MM2OaFucCCTHiEGGmLIeHpkx21r3w4TseI= X-Gm-Message-State: AOJu0Yx/62RHBhq2SR2gS9Flf9uPU13v4oWBx03mEF+Kv2XOePcONyHF Y7RXgj3XQ8LGr2OkzNcxauaSR0DiVoaRiKF56UC9yS5l7IQyR8Cp X-Google-Smtp-Source: AGHT+IGyQO7IDv06Wu4jz/B8hpscCKFXRufWrE7Xm5ZF0rOGZnIDhXYzyXWDJbvg8U06ruakry8ojw== X-Received: by 2002:a05:6870:8192:b0:24f:e599:9168 with SMTP id 586e51a60fabf-25db33732ffmr13537211fac.1.1720042997561; Wed, 03 Jul 2024 14:43:17 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:15 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 13/29] wifi: mt76: mt7925: add link handling to mt7925_change_chanctx Date: Wed, 3 Jul 2024 14:42:18 -0700 Message-Id: <88c5887954b04849adb0597d9a1ced7e976af897.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling to mt7925_change_chanctx Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index f85f7ea01f67..69849146610e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1571,6 +1571,7 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, { struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct mt792x_bss_conf *mconf; struct ieee80211_vif *vif; struct mt792x_vif *mvif; @@ -1585,7 +1586,22 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, mt7925_mcu_set_sniffer(mvif->phy->dev, vif, true); mt7925_mcu_config_sniffer(mvif, ctx); } else { - mt7925_mcu_set_chctx(mvif->phy->mt76, &mvif->bss_conf.mt76, ctx); + if (ieee80211_vif_is_mld(vif)) { + unsigned long valid = mvif->valid_links; + u8 i; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + mconf = mt792x_vif_to_link(mvif, i); + if (mconf && mconf->mt76.ctx == ctx) + break; + } + + } else { + mconf = &mvif->bss_conf; + } + + if (mconf) + mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx); } mt792x_mutex_release(phy->dev); } From patchwork Wed Jul 3 21:42:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810300 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (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 20FF1194A63 for ; Wed, 3 Jul 2024 21:43:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043001; cv=none; b=eL65hxTkZzQwmI6Zd1oqaR/VWfq+93uVW/Nkdts7Td0eLKZs8IXgJg5w5VJyBZiL40QQvJsgRu7OLAMEdEjhTBiCXzQB5ZpWXpoe14OdTjUI6ipwEKG47Gaxa55rF99Dl+VI1NzZ9dhfFGQjOcS54TSFnyIrOrpaEftPlUki+Hw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043001; c=relaxed/simple; bh=R/ZvWBthPSPIFunjOS+rSuUHq015y5tp/QrhkrxwleE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OLpjI9Nw/vD5BUdG7He25qApdFKzD03i8oF7trX1tyLAzNFyabvlWVxjZpkGTkN24nUpeUzLl2huskC8EUqog4g4NWlSbbpnu9c7f2l5TROx6RtTr8oY7cjlJ0Ug5g38Fxt1Cytmqo2TjsuFTXhIJiIVDAE3FnUBTvDdFoMs/vE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-25dff23459cso3559fac.3 for ; Wed, 03 Jul 2024 14:43:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720042999; x=1720647799; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4B3iA/wt292iPzlQ3NlN/3BkJe4Kss6jwJQvuDphHUk=; b=KJAYBqsZQw2tig5YvCGC1juo/d4WyYHfcx8JekZseHyXC1eLeKOfleOgKpWJBdfcAc /pbq/V43u9SuYKma8uxZ282gTwzwJGgV8KhVvaxmsELGtYbhHf8hLUJHhMFs5HIRqTkZ Tc+rSP4g1CYOadadOe/T2Sf468bVGAh1z6Q87Q7wkwmsiCWMuYa0mI+PuD5Ld9LM7Zzu 6h1ghD8q7Cq5Te+3zpOmYDcsJUuPatmU0/YVqVlAiY5PHurSAIbFucXsvlk7nqU9B5q/ IOytn1v9RSP7frMpWM9eHx64FSZpZ4UA/lv6KOCfL/1QBEgL7b7uahzK5K2MBNz6LGm0 wJ3A== X-Forwarded-Encrypted: i=1; AJvYcCUMEpPjpMxGMR/zzXE1VKnRH6g/yXiGYLYSIKDpDeflNjX3cv0JdqO9TGZvAufIL/JCcGAeyhC7RxXWBDL7jF8262GOn9fSL/J3k9y1X+4= X-Gm-Message-State: AOJu0YzonZv3jMDyOXTJKx/LcG3ZWH3fQ1/wVFAqo8zs/Xkmt+RTVwjV nczTHpERrc3DXAH3nTeLs3NO4wdj6Aws81201stUXBGgDGW3peB5 X-Google-Smtp-Source: AGHT+IGagnQr9R2SqTk/ttCi+flx1eUf6vzlrnRL8I6wKE/xqEuIlzcLpsgBjl1PvNgCgA3Equ378w== X-Received: by 2002:a05:6870:55d4:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e0dce4b4amr2524158fac.1.1720042999249; Wed, 03 Jul 2024 14:43:19 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:18 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 14/29] wifi: mt76: mt7925: add link handling in the BSS_CHANGED_PS handler Date: Wed, 3 Jul 2024 14:42:19 -0700 Message-Id: <4e072a7ac17d2f7c97569ba724b74434ac414db3.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Added link handling in the BSS_CHANGED_PS handler. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 69849146610e..46ce23c7ec27 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1635,6 +1635,7 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u64 changed) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); mt792x_mutex_acquire(dev); @@ -1651,8 +1652,17 @@ static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76); } - if (changed & BSS_CHANGED_PS) - mt7925_mcu_uni_bss_ps(dev, &vif->bss_conf); + if (changed & BSS_CHANGED_PS) { + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + int i; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + mt7925_mcu_uni_bss_ps(dev, bss_conf); + } + } mt792x_mutex_release(dev); } From patchwork Wed Jul 3 21:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809882 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 E1894194A6F for ; Wed, 3 Jul 2024 21:43:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043003; cv=none; b=Oqpvu04mJsz0Owjkffse5TFqty2X84Kgeic+jyEMK99zNynkhj/TV2w0DcE+GAtUfbxJLtGNxjJJzD6fJT5+KE2yhF3z6W/TAOUyFMEerzGGaEyvDSWUTVj67d5Cfz8dLSzoRd9P4TtBbX5yKM0UXN8jB9v1CfBGzMncBIkWp6M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043003; c=relaxed/simple; bh=EzlE5/SzFEcmDWIHzYqdvmSuQcohgHQ3wheoXk8/Q0o=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dW64voi3l1DuSsifa+mX+zi+ZxJAvv7VuahaMbPOvV9+0J8iwdIBF8FY7+agqtGkET37LbeC6mXTJRiJH8l3kjASuQrCHdZRpaZD1wMEx85vDxwYQx6wgxg7r3eOy+wq3hnIfa7FMS+4XybXNB6TLgicH06gWcs6NlxjJUuLdWU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700ca24a8ebso117340a34.0 for ; Wed, 03 Jul 2024 14:43:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043001; x=1720647801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=peHtFkucpkPBpD5rHx4xIXV2z8XQ+Jk1EN6IvhoGfSo=; b=iDd00a/XhacOA+XXvLYfTn1/szGTV6yM4r2DSYqCmxH0DrZ74wz1yAMudI2IvgnY8z mDXt/4Njix5HQn16K+1iAWacWSv1wYLJCWRozEdtZOwCd1lDNBiaP/RqaALbe773fpdC xBCxp2syaNdp/G/ej6I1oRFBDMMhUpPFvDmYisfbjHac9+PT7Z4H64+f0nsXpNx9iAxt lCzBH8HBKB0pEhXAuIK2/A2b5pxKOlZxkOvwGsRX5OiZheQOZEN4WKXqbSpFCRie5C4w 6LmqEjhjx/5y+KAGAkELU9vdWfItszfG18eLE1SkH4zv7rhEMXZl3LWuh3vct2pOf1pm B2lQ== X-Forwarded-Encrypted: i=1; AJvYcCWvHzPRRYYGsHOHFLFGvV3wOoajgUyw7FYun1yGSXDLUrNFaRSSm+5UdUGuKpQ0gYIm9ua2WLEHnp7hsEZnOkQAQA/vll/cPCpnj7pka0g= X-Gm-Message-State: AOJu0YxpOO+dFvNv2iKTqpdf7xRcRcDxHC/kL3x7ValUWuI8r22/lz3b 2IFgvprN7g/aZ+3iyXddKv/i8iEAQIPZy+p6JAIXUzsaNkn4jRPX59LoOOPK X-Google-Smtp-Source: AGHT+IEqzeo8RoR6l2yEjD7P2xm5c7YuPu83j3lo5/VHbBcEZ6c8yqDGnp7kWYGmbvaY1rl3PlnIew== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585180a34.0.1720043000855; Wed, 03 Jul 2024 14:43:20 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:19 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 15/29] wifi: mt76: mt7925: add link handling in mt7925_mcu_set_beacon_filter Date: Wed, 3 Jul 2024 14:42:20 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling in mt7925_mcu_set_beacon_filter Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index b62153671350..cf0377d26752 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1814,11 +1814,20 @@ int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, #define MT7925_FIF_BIT_CLR BIT(1) #define MT7925_FIF_BIT_SET BIT(0) int err = 0; + int i; if (enable) { - err = mt7925_mcu_uni_bss_bcnft(dev, &vif->bss_conf, true); - if (err) - return err; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + unsigned long valid = ieee80211_vif_is_mld(vif) ? + mvif->valid_links : BIT(0); + struct ieee80211_bss_conf *bss_conf; + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + bss_conf = mt792x_vif_to_bss_conf(vif, i); + err = mt7925_mcu_uni_bss_bcnft(dev, bss_conf, true); + if (err < 0) + return err; + } return mt7925_mcu_set_rxfilter(dev, 0, MT7925_FIF_BIT_SET, From patchwork Wed Jul 3 21:42:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810299 Received: from mail-oi1-f179.google.com (mail-oi1-f179.google.com [209.85.167.179]) (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 DB421194AC1 for ; Wed, 3 Jul 2024 21:43:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043005; cv=none; b=DOIR5ZCuTg3upmQxfOIwsd6Y6UrxSDre+1ZqWod5QVGgyrsLx/sBrD20IhoSVdB4yzesgDXNRztepLqk/U2wLZL50ejIjWHOochozxxW1vHrwB5Wb6foQYTlghoOfLwKPlG9snLGU08TPATtXUAYAeJvFTlPyRfjq6BOAr/kP9g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043005; c=relaxed/simple; bh=z2R7bu+zU5L3zkRr31kvRE2fDKNGIHI3mkPpKhvKgb8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QRzfYvnuLzgH8ij326dPdWjGh+ned7A7hH9/bOCep3alZXQekTRhtKuP8lEiN7bqVik2bJGezyk3DP+jVtlKrzUsc6pHjGbdEfDJGyaMVBqkRhRklhU2s8XetZED9XHH0kaoml5iMHxXLQkq7WyNETu2ar9f6swA9JMJ+HR7i14= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f179.google.com with SMTP id 5614622812f47-3d561131a3cso3575b6e.3 for ; Wed, 03 Jul 2024 14:43:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043003; x=1720647803; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wtG0qWg5QbR5VYZF/R9pSkSDu8jWaNi65JIbi2fadJs=; b=kgJl/8fgLP/FrocEXk7m9mgBTztg5wa387bhr8a1Qo7qox+RGLMUxbL9Q/5DCresR9 ivAoDDDGuToVXy1KV/ZhCLXPAU3c5odqcblkAfn9NquEVgN+K5QVp2HgoK9u6mbJRByD krnTfcXym19oS3OPepDu3DmFIOlTD2TFOFb0Bv9WAbOZj6PSydLXJLuAX1C1SDhPI8qf DOvQX+YXS2UherYTLFo0QmXDxhob0tZ3EMpBP3v6riTpQMNd3qEZv5Pc2UVHIKlOhWtd 4yCiihs89HIwPDyGP++x6e86RnIj5IQWtJwNBEogO6HtVshsoAnP2cMKMMVOVI/qzas8 m+DA== X-Forwarded-Encrypted: i=1; AJvYcCXZiS0MTefoKjxCeCbBgBvq4eTkk9ea8mS+yAiJYnmbyotklE6G6eoRQ7tx3Q6fQNsJIerbCCF8l/AhjTVUhHVQu+XcVkrUo/Xh7GlaTRc= X-Gm-Message-State: AOJu0YylTZAqsa7NKzVPHUM1Gh+BmKXvKHu06ELUvxvxsu2e+xIDHpW1 Wwxog0/BHaKporjjDNIQSldcXahInM3fssS6NdXXTrTN6WPwKQwB X-Google-Smtp-Source: AGHT+IHcOT2ePMPmXXvJS0IdwhfyVS1tVzOxF6uH1qeSR+V7tKTr7QafSgJ6K+RsYA6EQXkV3+UWow== X-Received: by 2002:a05:6870:a511:b0:259:f03c:4e90 with SMTP id 586e51a60fabf-25db36a52edmr13771890fac.4.1720043002793; Wed, 03 Jul 2024 14:43:22 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:21 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 16/29] wifi: mt76: mt7925: add link handling in mt7925_txwi_free Date: Wed, 3 Jul 2024 14:42:21 -0700 Message-Id: <2b70dccb2735f4ca02db102bb6bd02cdbd539c2f.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling in mt7925_txwi_free. MT7996 should have the similar the logic, we try to copy from there to ensure consistency between both. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mac.c | 54 +++++++++++++------ .../wireless/mediatek/mt76/mt7925/mt7925.h | 2 +- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c index 6f5f2130420e..0cb9031e9fdd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c @@ -839,27 +839,53 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, } EXPORT_SYMBOL_GPL(mt7925_mac_write_txwi); -static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, __le32 *txwi) +static void mt7925_tx_check_aggr(struct ieee80211_sta *sta, struct sk_buff *skb, + struct mt76_wcid *wcid) { + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); + struct ieee80211_link_sta *link_sta; + struct mt792x_link_sta *mlink; struct mt792x_sta *msta; + bool is_8023; u16 fc, tid; - u32 val; - if (!sta || !(sta->deflink.ht_cap.ht_supported || sta->deflink.he_cap.has_he)) + link_sta = rcu_dereference(sta->link[wcid->link_id]); + if (!link_sta) return; - tid = le32_get_bits(txwi[1], MT_TXD1_TID); - if (tid >= 6) /* skip VO queue */ + if (!sta || !(link_sta->ht_cap.ht_supported || link_sta->he_cap.has_he)) return; - val = le32_to_cpu(txwi[2]); - fc = FIELD_GET(MT_TXD2_FRAME_TYPE, val) << 2 | - FIELD_GET(MT_TXD2_SUB_TYPE, val) << 4; + tid = skb->priority & IEEE80211_QOS_CTL_TID_MASK; + is_8023 = info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP; + + if (is_8023) { + fc = IEEE80211_FTYPE_DATA | + (sta->wme ? IEEE80211_STYPE_QOS_DATA : + IEEE80211_STYPE_DATA); + } else { + /* No need to get precise TID for Action/Management Frame, + * since it will not meet the following Frame Control + * condition anyway. + */ + + struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; + + fc = le16_to_cpu(hdr->frame_control) & + (IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE); + } + if (unlikely(fc != (IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA))) return; msta = (struct mt792x_sta *)sta->drv_priv; - if (!test_and_set_bit(tid, &msta->deflink.wcid.ampdu_state)) + + if (sta->mlo && msta->deflink_id != IEEE80211_LINK_UNSPECIFIED) + mlink = rcu_dereference(msta->link[msta->deflink_id]); + else + mlink = &msta->deflink; + + if (!test_and_set_bit(tid, &mlink->wcid.ampdu_state)) ieee80211_start_tx_ba_session(sta, tid, 0); } @@ -1039,7 +1065,7 @@ void mt7925_mac_add_txs(struct mt792x_dev *dev, void *data) } void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, - struct ieee80211_sta *sta, bool clear_status, + struct ieee80211_sta *sta, struct mt76_wcid *wcid, struct list_head *free_list) { struct mt76_dev *mdev = &dev->mt76; @@ -1052,10 +1078,8 @@ void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, txwi = (__le32 *)mt76_get_txwi_ptr(mdev, t); if (sta) { - struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; - if (likely(t->skb->protocol != cpu_to_be16(ETH_P_PAE))) - mt7925_tx_check_aggr(sta, txwi); + mt7925_tx_check_aggr(sta, t->skb, wcid); wcid_idx = wcid->idx; } else { @@ -1140,7 +1164,7 @@ mt7925_mac_tx_free(struct mt792x_dev *dev, void *data, int len) if (!txwi) continue; - mt7925_txwi_free(dev, txwi, sta, 0, &free_list); + mt7925_txwi_free(dev, txwi, sta, wcid, &free_list); } } @@ -1426,7 +1450,7 @@ void mt7925_usb_sdio_tx_complete_skb(struct mt76_dev *mdev, sta = wcid_to_sta(wcid); if (sta && likely(e->skb->protocol != cpu_to_be16(ETH_P_PAE))) - mt7925_tx_check_aggr(sta, txwi); + mt76_connac2_tx_check_aggr(sta, txwi); skb_pull(e->skb, headroom); mt76_tx_complete_skb(mdev, e->wcid, e->skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 54693624b182..252d9de81d99 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -260,7 +260,7 @@ void mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, struct ieee80211_key_conf *key, int pid, enum mt76_txq_id qid, u32 changed); void mt7925_txwi_free(struct mt792x_dev *dev, struct mt76_txwi_cache *t, - struct ieee80211_sta *sta, bool clear_status, + struct ieee80211_sta *sta, struct mt76_wcid *wcid, struct list_head *free_list); int mt7925_mcu_parse_response(struct mt76_dev *mdev, int cmd, struct sk_buff *skb, int seq); From patchwork Wed Jul 3 21:42:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809881 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (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 085661946AC for ; Wed, 3 Jul 2024 21:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043007; cv=none; b=pB4VPTsljNOV9URBKFb/nN6c2kj0xuKjbpWOE1wKemsY10sbjkvWMbyDA31OYcyoF4nxiDck553aXkLbzmRN4g5yR/Fwa14ejJudnuQobJwJsYgxawoEAwWQIKp5AQk19Fx1nBcvbbBc5WzTS9sTrwMogKwocWd2Id4sHWzDcx0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043007; c=relaxed/simple; bh=Xjbro3Th6KCFnsPtSub/I458ig1ju/qRziVCG4mvsmo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=EKrkF82lgdNp1AOAKlKEJDiVrahlVi4t+6hFTQllf/A+7mckcH0k+3XL4a5sskJXQrnRvhVW2EiVO7ejkjdELur3vhjcf3YxFRPjjsDD+HYESlIgNmFfdgU1ZSFkNkNjDVDK93AWKsZof1Ng984AefqmQslj4n5GTMlp7KN57ns= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25d0f8d79ebso8155fac.0 for ; Wed, 03 Jul 2024 14:43:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043005; x=1720647805; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EDtWWoGxNXsA+VUrVMlH9NUVtfOdfQhzGFLU7KDEjg4=; b=bbXHzpYbazsLBl5WGhVcyDxzL08CFe8+c5STBUjSn5B4Gd7MgXecnagXfQIU/nRMB2 np8B/JFfYcMKhDXf/s5sHMkA1VRYgk3aEhrdxzkBwmd5mucIf7GsvtYSx2IYcwB6puYO tr+dHVEyuuddViaryr+/twgTboWcUXNODgUYGeMCuEfDXbMRd34+09N4KCKZLWNGD0oY AvHqtiQmJiwgUFgX1kqlVF+35I/Xsz7nQQGV0HsC9FgqUOSRIBqrEJzP5+SQxPtJSqIx P07UEIjkAcB0JVe8u9EQauHbgYuvGA9EmaRVEbkSd6iO9xa9yPIKkbjhx2pwIG3Cd39X VtHA== X-Forwarded-Encrypted: i=1; AJvYcCVLvgOzK3UXnX4455gpydO9vxbIQUBhZvwpXIjm8szOEAOHbLbOHV2jqWkaQAPatZknFz1HkPfc70Xfpo7Yx9tzZ4KVf16ux2dLbgI2JTs= X-Gm-Message-State: AOJu0YxConXTKjcIhgX3FNby7f6JHJj9XVDEALJjl0JvGcxFF//dyMLm VBun7bRw9ceQ5Cp3+95bGbbF2wqehcCImkk/5QpcNZdyZ7Z3bNqZ X-Google-Smtp-Source: AGHT+IHHL00osxe9L6uV/ZIfVF6TzeBtZZdxa46wI52tc5jjTe51dQO8lcXzLe69OaHVmiNHiz2Wcw== X-Received: by 2002:a05:6870:55d4:b0:25e:dce:491b with SMTP id 586e51a60fabf-25e0dce4b4amr2524322fac.1.1720043005063; Wed, 03 Jul 2024 14:43:25 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:23 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 17/29] wifi: mt76: mt7925: add link handling in mt7925_mac_sta_assoc Date: Wed, 3 Jul 2024 14:42:22 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add links handling in mt7925_mac_sta_assoc Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 90 ++++++++++++++++++- drivers/net/wireless/mediatek/mt76/mt792x.h | 1 + 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 46ce23c7ec27..3a9d526f8085 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -387,6 +387,7 @@ mt7925_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) mvif->phy = phy; mvif->bss_conf.vif = mvif; mvif->sta.vif = mvif; + mvif->deflink_id = IEEE80211_LINK_UNSPECIFIED; ret = mt7925_mac_link_bss_add(dev, &vif->bss_conf, &mvif->sta.deflink); if (ret < 0) @@ -925,6 +926,75 @@ int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, } EXPORT_SYMBOL_GPL(mt7925_mac_sta_add); +static u16 +mt7925_mac_select_links(struct mt76_dev *mdev, struct ieee80211_vif *vif) +{ + unsigned long usable_links = ieee80211_vif_usable_links(vif); + struct { + enum nl80211_band band; + } data[IEEE80211_MLD_MAX_NUM_LINKS]; + u16 sel_links = 0; + u8 link_id; + int i = -1; + + if (vif->active_links == usable_links) + return vif->active_links; + + rcu_read_lock(); + for_each_set_bit(link_id, &usable_links, IEEE80211_MLD_MAX_NUM_LINKS) { + struct ieee80211_bss_conf *link_conf = + rcu_dereference(vif->link_conf[link_id]); + + if (!link_conf) + continue; + + if (!(BIT(link_id) & vif->active_links)) + continue; + + if (i == -1 || data[i].band != link_conf->chanreq.oper.chan->band) { + i = i + 1; + data[i].band = link_conf->chanreq.oper.chan->band; + sel_links |= link_id; + } + } + rcu_read_unlock(); + + return sel_links; +} + +static void +mt7925_mac_set_links(struct mt76_dev *mdev, struct ieee80211_vif *vif) +{ + struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76); + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct ieee80211_bss_conf *link_conf = + mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + struct cfg80211_chan_def *chandef = &link_conf->chanreq.oper; + enum nl80211_band band = chandef->chan->band, secondary_band; + + u16 sel_links = mt7925_mac_select_links(mdev, vif); + u8 secondary_link_id = __ffs(~BIT(mvif->deflink_id) & sel_links); + + if (!ieee80211_vif_is_mld(vif) || hweight16(sel_links) < 2) + return; + + link_conf = mt792x_vif_to_bss_conf(vif, secondary_link_id); + secondary_band = link_conf->chanreq.oper.chan->band; + + if (band == NL80211_BAND_2GHZ || + (band == NL80211_BAND_5GHZ && secondary_band == NL80211_BAND_6GHZ)) { + mt7925_abort_roc(mvif->phy, &mvif->bss_conf); + + mt792x_mutex_acquire(dev); + + mt7925_set_mlo_roc(mvif->phy, &mvif->bss_conf, sel_links); + + mt792x_mutex_release(dev); + } + + ieee80211_set_active_links_async(vif, sel_links); +} + static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_link_sta *link_sta) @@ -940,7 +1010,11 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, mt792x_mutex_acquire(dev); - link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + if (ieee80211_vif_is_mld(vif)) { + link_conf = mt792x_vif_to_bss_conf(vif, msta->deflink_id); + } else { + link_conf = mt792x_vif_to_bss_conf(vif, vif->bss_conf.link_id); + } if (vif->type == NL80211_IFTYPE_STATION && !link_sta->sta->tdls) mt7925_mcu_add_bss_info(&dev->phy, mvif->bss_conf.mt76.ctx, @@ -960,7 +1034,18 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev, void mt7925_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink); + if (ieee80211_vif_is_mld(vif)) { + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct ieee80211_link_sta *link_sta; + + link_sta = mt792x_sta_to_link_sta(vif, sta, msta->deflink_id); + + mt7925_mac_set_links(mdev, vif); + + mt7925_mac_link_sta_assoc(mdev, vif, link_sta); + } else { + mt7925_mac_link_sta_assoc(mdev, vif, &sta->deflink); + } } EXPORT_SYMBOL_GPL(mt7925_mac_sta_assoc); @@ -1751,6 +1836,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, for_each_set_bit(link_id, &add, IEEE80211_MLD_MAX_NUM_LINKS) { if (!old_links) { + mvif->deflink_id = link_id; mconf = &mvif->bss_conf; mlink = &mvif->sta.deflink; } else { diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index af9a103dc7f4..5ede24116748 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -131,6 +131,7 @@ struct mt792x_vif { struct mt792x_phy *phy; u16 valid_links; + u8 deflink_id; }; struct mt792x_phy { From patchwork Wed Jul 3 21:42:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810298 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (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 1EE07194AE0 for ; Wed, 3 Jul 2024 21:43:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043009; cv=none; b=sB5eTaVVTnyCnDlm/6tH2HSFVZ4eh6MlES1HiyWpx/8qel8FuT6wibyzw+2hadSXay1F4uFXJ84Z8jHpbAzTIvHvfeWnQLhDf4qW2IIKO0QfuA0B4sIB5Y9UQJjfCo7Qj6jCzrUsIleBmaQByLH5DTYLsvKz3NmJTt73DS3s1Kg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043009; c=relaxed/simple; bh=8Cw+Y3Rvc50icxpNiQ8eoyoLkq/z4vSUHDfCpbFCjCQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=iWPpiooqxIvDsiEmj0uCEXxIF9fUQBPhecPw/hfcIsC9jXyuZZOpeNl0zOPwtTGWeU1AdBsCT9dm/Xp13TBN6exTqkNwglZISVz3pPacZJlh6y23FoeL7Na2n/cGmhjFEQMf28eK8OyASWu0cF4bcrQ0s9JkIhOVa9LWwkETd/Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-254c411d816so3752fac.1 for ; Wed, 03 Jul 2024 14:43:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043007; x=1720647807; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Erih5+NFArlq4U+QMfF/4G3Ja6X1QAPdgNncz1l2jKk=; b=XwqeeolOQMPAmK57IIyblLoFvckDwaEL5ENOjmh6FjSGlKR5h1HEeeXd9k2Lkmkrf9 3sLlZnhmW2ITd7BDE1YeOhIteFYUuGlDmM16eB655DtjNsYsnZ5FRrgvboOeeH2EdUMg VKrCZC/v/AsAyw/8Zd5ZKHtSX9YNEOC1SMBjWSx6ZGCduirUAe9vG4xnn6xoU3YGSoNW eQzJai7WHxlyE+RGgBJDj1Z0ge0qPRMaeTcStyI3ePuGDK96Gf3s3HH6PngQQx0IJ4cC hCoXZ6+ppQ05Bs9wHqYv6i2NkI3eG/e7IDeWhSqSyAlhuNBlZo44NaJ9syhlUKcnlSrl 5CtQ== X-Forwarded-Encrypted: i=1; AJvYcCVk+ptOvAWJDRoLXXafDuEYZ/qYnkA4fbpIRobMBQtjuwjfDUaEFPXHCGLe1AgpJDhXDjHU7mQ8yHWlZOaKzIzPlBR8v+rA4TcTlCtxlcM= X-Gm-Message-State: AOJu0Yz2jsL/MfemACRbfNNX+PiC0HNi05K6FIZFsYKyiwu+EK/5O9TX /W9cDJ50rSR0/2iUhuFGw2o7U78lW1N4WR4WCW7FFvV+b++5zBDE X-Google-Smtp-Source: AGHT+IE2XP0Wra+Ep1R6FhpkFyT7lT9uipofVy38SxEXErnDmraYC0MmGSBrSm4GRN8CBQxS8S2Wiw== X-Received: by 2002:a05:6808:1494:b0:3d5:618e:193f with SMTP id 5614622812f47-3d6b2935863mr14288644b6e.1.1720043007114; Wed, 03 Jul 2024 14:43:27 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:25 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 18/29] wifi: mt76: mt7925: add link handling in mt7925_sta_set_decap_offload Date: Wed, 3 Jul 2024 14:42:23 -0700 Message-Id: <6e48351e9543d8225e09255f802732d635e533d0.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add link handling in mt7925_sta_set_decap_offload Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 21 ++++++++++++---- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 24 ++++++++++++++----- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 ++- 3 files changed, 36 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 3a9d526f8085..265ef7ade6e4 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1450,16 +1450,27 @@ static void mt7925_sta_set_decap_offload(struct ieee80211_hw *hw, bool enabled) { struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_dev *dev = mt792x_hw_dev(hw); + unsigned long valid = mvif->valid_links; + u8 i; mt792x_mutex_acquire(dev); - if (enabled) - set_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); - else - clear_bit(MT_WCID_FLAG_HDR_TRANS, &msta->deflink.wcid.flags); + valid = ieee80211_vif_is_mld(vif) ? mvif->valid_links : BIT(0); + + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + struct mt792x_link_sta *mlink; - mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta); + mlink = mt792x_sta_to_link(msta, i); + + if (enabled) + set_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); + else + clear_bit(MT_WCID_FLAG_HDR_TRANS, &mlink->wcid.flags); + + mt7925_mcu_wtbl_update_hdr_trans(dev, vif, sta, i); + } mt792x_mutex_release(dev); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index cf0377d26752..75149baab7e5 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -887,10 +887,15 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, else hdr_trans->from_ds = true; - if (link_sta) - wcid = (struct mt76_wcid *)link_sta->sta->drv_priv; - else + if (link_sta) { + struct mt792x_sta *msta = (struct mt792x_sta *)link_sta->sta->drv_priv; + struct mt792x_link_sta *mlink; + + mlink = mt792x_sta_to_link(msta, link_sta->link_id); + wcid = &mlink->wcid; + } else { wcid = &mvif->sta.deflink.wcid; + } if (!wcid) return; @@ -904,17 +909,24 @@ mt7925_mcu_sta_hdr_trans_tlv(struct sk_buff *skb, int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta) + struct ieee80211_sta *sta, + int link_id) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct ieee80211_link_sta *link_sta = sta ? &sta->deflink : NULL; + struct mt792x_link_sta *mlink; + struct mt792x_bss_conf *mconf; struct mt792x_sta *msta; struct sk_buff *skb; msta = sta ? (struct mt792x_sta *)sta->drv_priv : &mvif->sta; - skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mvif->bss_conf.mt76, - &msta->deflink.wcid, + mlink = mt792x_sta_to_link(msta, link_id); + link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); + mconf = mt792x_vif_to_link(mvif, link_id); + + skb = __mt76_connac_mcu_alloc_sta_req(&dev->mt76, &mconf->mt76, + &mlink->wcid, MT7925_STA_UPDATE_MAX_SIZE); if (IS_ERR(skb)) return PTR_ERR(skb); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 252d9de81d99..4c0ecae8e49b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -315,6 +315,7 @@ int mt7925_mcu_add_key(struct mt76_dev *dev, struct ieee80211_vif *vif, int mt7925_mcu_set_rts_thresh(struct mt792x_phy *phy, u32 val); int mt7925_mcu_wtbl_update_hdr_trans(struct mt792x_dev *dev, struct ieee80211_vif *vif, - struct ieee80211_sta *sta); + struct ieee80211_sta *sta, + int link_id); #endif From patchwork Wed Jul 3 21:42:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809880 Received: from mail-oa1-f47.google.com (mail-oa1-f47.google.com [209.85.160.47]) (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 D91BB194C65 for ; Wed, 3 Jul 2024 21:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043011; cv=none; b=B8JIWuGJ78AZnq8O/YX6qxr81H1I15+b+Twky9wtz2ocllTRPef6/bpcf8Y/7nJppyb+mY6BC29q6LJW/wJL+jndfrbC82OFLkTJ8tkom1q0op/CnWnAjlyZ5N1EIx3gks6pfNrOOQFTtK9SGcb6JQIx2WL0Qguraq3z7yFc8dM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043011; c=relaxed/simple; bh=zeQmtMRSYLQMgmy5nGr2uOuAgoTUM/ddMoPu7sAOu0s=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=sGeK5vBBjKqTyh0c6AUec2r0ZwaWhbQ+zY0n4vNcGKtDkluepsbDDhiPXvz6DE1Dhhlg/ig4N5ZCLLHaWrjE23yMGwgs8qXMvxEgkA0731X3PnxEUHz7FQ36r2CRoHK1pVyYl4nBTJ8hradzdKBowojGQ+nVu8YvTuRLU4s1+Dw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f47.google.com with SMTP id 586e51a60fabf-25dff23459cso3577fac.3 for ; Wed, 03 Jul 2024 14:43:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043009; x=1720647809; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WCSz8cUWGD3Jpbgh3b2PR3W+Co/hw9DDq4m/R/ZmJnU=; b=jxMVGDDyJXIGgNgCblC0UfnGkoefiUzlAB48/TR7G+rlT6u8ORfy8D8PrbaJh3X+xA 6AJtcD2KlcnvZ3LfMFnGCQg6qFGWaoFLGUwCpNDPaHfLEBtaeuBoBrEOCecBLMcGgWuc lraOs3fJDGy2eSaUkJvgtKnYaE0HGcb8c7twIP7jbDP2OW5X0mxqaS8E4+0GSRuftYNl PinlpAadi6admH4iUSjfqjqwrWJyZIwSJm8Jhy2fyB07C3YQ2oJYNBtriUKfI/yQtwFn UtwFXgYTjCB1LTz43hrNzURp7TEkVqqITXK2Lk3tG64DWKksR0CggzOibklX1E+bq7C8 ptKA== X-Forwarded-Encrypted: i=1; AJvYcCWTGm8T1vvvGLvpQaj5a9xw9Hj/w8A6ctZLy6shfinZGczsott9vY1JucSMZKyBvQMgwjhVWR9Vmk9cJF/dxbOYyPCEQx4dV91x6gvTXVY= X-Gm-Message-State: AOJu0YzLIglLU2rGaWS8U5SMvXNK8LSwgjjr0kylea9iSHk1WIHnoYFN guUGzlPzuytjKhDRI8SLY+LXtM7baaV/d0t+Ad6fYaI0+mOgFKw8 X-Google-Smtp-Source: AGHT+IHHdwjRum0Ixy2aektx2Alqi2y35iYb/E46T4+QqCxUIGi/GS+D5lOna7bDGqNjEWMqIfYCRA== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585381a34.0.1720043008866; Wed, 03 Jul 2024 14:43:28 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:27 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 19/29] wifi: mt76: mt7925: update rate index according to link id Date: Wed, 3 Jul 2024 14:42:24 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Update rate index according to link id. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 265ef7ade6e4..173934ec1e71 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1768,9 +1768,12 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, struct ieee80211_bss_conf *info, u64 changed) { - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; struct mt792x_phy *phy = mt792x_hw_phy(hw); struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct mt792x_bss_conf *mconf; + + mconf = mt792x_vif_to_link(mvif, info->link_id); mt792x_mutex_acquire(dev); @@ -1784,16 +1787,16 @@ static void mt7925_link_info_changed(struct ieee80211_hw *hw, } if (changed & BSS_CHANGED_MCAST_RATE) - mvif->mcast_rates_idx = + mconf->mt76.mcast_rates_idx = mt7925_get_rates_table(hw, vif, false, true); if (changed & BSS_CHANGED_BASIC_RATES) - mvif->basic_rates_idx = + mconf->mt76.basic_rates_idx = mt7925_get_rates_table(hw, vif, false, false); if (changed & (BSS_CHANGED_BEACON | BSS_CHANGED_BEACON_ENABLED)) { - mvif->beacon_rates_idx = + mconf->mt76.beacon_rates_idx = mt7925_get_rates_table(hw, vif, true, false); mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, From patchwork Wed Jul 3 21:42:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810297 Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) (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 87DA4194C85 for ; Wed, 3 Jul 2024 21:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043012; cv=none; b=EMsP5iLnfupEBxTVF/oRSwyTdoDxNkYVBrDseWa/RWH4Md3gLaiNqP3sKCCsIPV51MMMUcQSJawu1GA2MTJxAmjPVfbenLjs0YohexF74O6nYSuSW5OQnbIcRyYrwAasraM+iUnyI5n6cT2AJsWUZtDDieT+eEZcVmuUbpS8i4g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043012; c=relaxed/simple; bh=MGxBKNhNKEAHOnOWdkVxlzJ5h9LGWEMpMkrlgwINVqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=RmjS61BYeA4EKE1pY/v5M00xFDC7EjJ6fsn3ylrbRqUa+bOf1UHdKyLjsXGWa1W1AkhZ7BTzuKR0Q3lVa+hfvm2Xr+VDA82l83r6s8948RHanEIXzW5+2sopny1k4/QzxwUmbqxV6/7ECYbB9NIMrcv1GDdL+9wjjWsr5d1vGYw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-25cd49906aeso3993fac.2 for ; Wed, 03 Jul 2024 14:43:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043010; x=1720647810; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ffWOmyzGdQmn/1ElFIgBjJf1v30KLPcOBR1pd24Nq7I=; b=EWI0zp8DFJraTLK9UweeBF6Y3ewq7zSMe6NC/tfBZvVtCwz+v+1b/EnnS0pKKTJTV/ 2QYmIcRI8aqdRhRS5dp+hzaHliicxagIPdWiRGhwpZWeDEsfYWNOEqjK1t5faXYWvp+M lT0ykxWX2Y25qWiRFz5Hh5IJBMZ5+ExsRWQ9B+7m+y726fPsLDj81OcTczV72WgJoGR2 7N4cP43ChPYsQRf42r39giEcPtVTT69Y/T/hC2jLZxf2gP2/CuC8/LNFDv4EZZYzL+QQ kVEU3sZGLClpMZhykVzLCXG8ZVMlPgEMtwP1zAT1sGBYVaRr+h8NXP6Xi0C89aHmmplp +GBw== X-Forwarded-Encrypted: i=1; AJvYcCVk1/Tu+sxLZf+f/V6VgVsxgh0nREUEFBVfXDJmOVcWr7/ovlYOzG94JWVAdRcqVdXAJFl1hWsWQBa+qRCHtxd0wy7/2r1uCid1ofgnbpU= X-Gm-Message-State: AOJu0YyQ6i2LN/kFpyphvMmWiw5aF00e3onuYGsJBsL50Gn2GLMaV/ng Bjid3FZ+kYI4bmwFTdHi0MGnnZkR9OukNUHtqwDZazHaKrzCAq5c X-Google-Smtp-Source: AGHT+IEg9up3tNNH6BCf3a0LDbIZh3GhmduGK33TP3hQf2RrI2NvFjW6FtNxtHICn/l6idPmrPoZVw== X-Received: by 2002:a05:6830:8c5:b0:6f9:7373:9421 with SMTP id 46e09a7af769-7020774aa24mr11940398a34.3.1720043010569; Wed, 03 Jul 2024 14:43:30 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:29 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 20/29] wifi: mt76: mt7925: report link information in rx status Date: Wed, 3 Jul 2024 14:42:25 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang report link information in rx status Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mac80211.c | 5 +++++ drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wireless/mediatek/mt76/mac80211.c index e8ba2e4e8484..bb291fe314fb 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -1125,6 +1125,11 @@ mt76_rx_convert(struct mt76_dev *dev, struct sk_buff *skb, memcpy(status->chain_signal, mstat.chain_signal, sizeof(mstat.chain_signal)); + if (mstat.wcid) { + status->link_valid = mstat.wcid->link_valid; + status->link_id = mstat.wcid->link_id; + } + *sta = wcid_to_sta(mstat.wcid); *hw = mt76_phy_hw(dev, mstat.phy_idx); } diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index 01646538087a..c0e529d0b3ef 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -350,6 +350,7 @@ struct mt76_wcid { u8 amsdu:1; u8 phy_idx:2; u8 link_id:4; + bool link_valid; u8 rx_check_pn; u8 rx_key_pn[IEEE80211_NUM_TIDS + 1][6]; diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 173934ec1e71..c3ce57d36168 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -809,6 +809,7 @@ static int mt7925_mac_link_sta_add(struct mt76_dev *mdev, mlink->wcid.tx_info |= MT_WCID_TX_INFO_SET; mlink->last_txs = jiffies; mlink->wcid.link_id = link_sta->link_id; + mlink->wcid.link_valid = !!link_sta->sta->valid_links; ret = mt76_connac_pm_wake(&dev->mphy, &dev->pm); if (ret) @@ -1865,6 +1866,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mconf->link_id = link_id; mconf->vif = mvif; mlink->wcid.link_id = link_id; + mlink->wcid.link_valid = !!vif->valid_links; } if (hweight16(mvif->valid_links) == 0) From patchwork Wed Jul 3 21:42:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809879 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 05762194C94 for ; Wed, 3 Jul 2024 21:43:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043014; cv=none; b=Vsui/wB7tL0RhO0bva39X6yDoo94hEceb4Ggcc4agGYGzGsqLlRo1dTA5ksk0NyVKobn90F+lC0juWq0rRcVZWsqSKMTs78+LgFdCTu6AV3SBrrbCiehis62oKBFIHTd+e+W+x2/94sIPqZvI3Ai7axRPYyjy5RUqQfe/m9c3i4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043014; c=relaxed/simple; bh=f6Pfr5Vq6FUAVKa61YJT/hYqrClzFJDo1bmm3YyysQ8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CbEOyZOMlV7WPdoRpcdrrkpXwKwrSGH8AT4coCG4boiPzelxyBPUNUlYjj9nwnBOPZkmvTN747iZrsgCEzuQSqPCXG2OrzHS8C/OhO5InVsu7qZCC22VKAWFh09pvGJlWWjRwwjhUzzDVgVPJRQf4PuIbM/7ov6Mcu6QgqM09DQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-70204bcd5eeso80654a34.2 for ; Wed, 03 Jul 2024 14:43:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043012; x=1720647812; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RxSmN3RyGqtOMcnaemjIRPhc3UORadWI0djDIJjxFRQ=; b=HlgL5PR5N9tc/piQySqYh95swPu0OV6cBZDIUm3M4VYCO38DFkVtnMWLFcaQTN6fWp 1pAfoVtLv/YPFjZ0cLw1+PxrtMmOQ8QpYhoa8e4EYagHkxFSwqo4zc8BSNIRGMEBNe0q XtTrdn3pWHrxbgMqxR84F4d/89WXh9YouUMRYQGNteRcytF/E2BXbSGmggfNH66TydRT JgI9a7jO7NBwHOyAqZY7xFpgQmUnjOT+t5I8lKohVKLPeOBFDhbu11FJRaPG1/CVOt9A 5J5vWhlpfkqc1kKXyqvkeqYWBGsdGxtDtEAe1qnp0/YcvlMxl8J8b7lUAksg0nuBBQIX eqIg== X-Forwarded-Encrypted: i=1; AJvYcCXqQT7momwHUALetBmf3C30HNCBIjPCIzHKb7biR6Dj6f1dGwjRSYv1du+C7eEqHInEXfjhqoFUnXRg223w6WoQA9MvqRxV9BW/7Q4CjDE= X-Gm-Message-State: AOJu0YygmhBm+2X4d0LWHWq8hOTmkqvrvUZF7t/4B60sFeDsysbXKLE8 1gSAHzn9tzgy5xkzef+xg8XmQKt5K92phOsHf2Bx2cqSQT5w8fcO4vdB5Dyv X-Google-Smtp-Source: AGHT+IF/LGon8YWCTWFG30B8KA0KF181GSiy3MGe5Zpy91+M/CxwYtnXKl8o1WBcM0358pYIOT8lnw== X-Received: by 2002:a9d:7e8a:0:b0:700:e0e8:5e2 with SMTP id 46e09a7af769-70207560e89mr12825062a34.0.1720043012083; Wed, 03 Jul 2024 14:43:32 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:31 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 21/29] wifi: mt76: add def_wcid to struct mt76_wcid Date: Wed, 3 Jul 2024 14:42:26 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add def_wcid to struct mt76_wcid to allow per-link wcid to retrieve the struct ieee80211_sta structure. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt76.h | 5 +++++ drivers/net/wireless/mediatek/mt76/mt7925/main.c | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76.h b/drivers/net/wireless/mediatek/mt76/mt76.h index c0e529d0b3ef..f8431b889c78 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76.h +++ b/drivers/net/wireless/mediatek/mt76/mt76.h @@ -368,6 +368,8 @@ struct mt76_wcid { struct mt76_sta_stats stats; struct list_head poll_list; + + struct mt76_wcid *def_wcid; }; struct mt76_txq { @@ -1258,6 +1260,9 @@ wcid_to_sta(struct mt76_wcid *wcid) if (!wcid || !wcid->sta) return NULL; + if (wcid->def_wcid) + ptr = wcid->def_wcid; + return container_of(ptr, struct ieee80211_sta, drv_priv); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index c3ce57d36168..339888086076 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -894,6 +894,7 @@ mt7925_mac_sta_add_links(struct mt792x_dev *dev, struct ieee80211_vif *vif, rcu_assign_pointer(msta->link[link_id], mlink); mlink->sta = msta; mlink->pri_link = &sta->deflink; + mlink->wcid.def_wcid = &msta->deflink.wcid; link_sta = mt792x_sta_to_link_sta(vif, sta, link_id); mt7925_mac_link_sta_add(&dev->mt76, vif, link_sta); @@ -1867,6 +1868,7 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, mconf->vif = mvif; mlink->wcid.link_id = link_id; mlink->wcid.link_valid = !!vif->valid_links; + mlink->wcid.def_wcid = &mvif->sta.deflink.wcid; } if (hweight16(mvif->valid_links) == 0) From patchwork Wed Jul 3 21:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810296 Received: from mail-oi1-f169.google.com (mail-oi1-f169.google.com [209.85.167.169]) (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 8AB281946D0 for ; Wed, 3 Jul 2024 21:43:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043016; cv=none; b=rNIq0Fc0mbMhka8sXYRQzJ6O433cThyxDfnak2eEVnxEKr+o6c6UTxRXHPfHGWd6tVqqdkyCwOWZLgc3qvyE0x0DVNtVIjVk8cFcxWfd/4BlNtU4lGWdj/znTyfzhNTjhoYXfdRVF0LyGRks2pigDJpIGtqRne+hBhJlyhyMhRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043016; c=relaxed/simple; bh=Ou+L2suKHd+wAVFlMzZ0GQFhFXdymWxbOC6vZOUviq8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GTna4dRrLKEeqkOnxUniZ3JihllKSBk5Bzo2UxKzRg2zyMan0X0MxfW3FBbJlNU270G62dogmooaimM1H0+u3UCqqdU9XkALz9HKIw56NaRV8knNXDfMxFEyfQqMApisFXklFj8gWdWxih9135z6AX/n0qx7O6ybLu4YzVtrd6U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.167.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oi1-f169.google.com with SMTP id 5614622812f47-3d56754a4ceso4543b6e.1 for ; Wed, 03 Jul 2024 14:43:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043014; x=1720647814; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S/u1Acf2UXke2/1kGXt/5Ovbf/IwEe45D/E6XFOOEDQ=; b=CWALsCmjpdyY1Tuz17i2IQ544ZeQyzy1Kpr1AtkxQjHs2jFj+SK+opjidfEMm9rAn0 otangBB1LmJOZwy44QtXR30b8obvCsxXnpKheW+KVZk70e2OImYIX7CxjS+x9lUWc/NV jGPmwnGSyAHYL+PQZ4LkMEnl1q0whyZYhbL7roRDqCYkSuLnwxpH042l8ju7NmCC5Ygy BCvim71d62ym6eQletKNJJ9TH3yD0co6a5GcL16eRmSu2rtg3W6QpXtGkEkGPcJRTE14 waRkAg1Mzo+n8/tao7a4AHQ3+ECAzsm4L2nrpjDcxIaiS1r6GeDobU4oj87JUIh3Ku3Y Cc0A== X-Forwarded-Encrypted: i=1; AJvYcCVAnqOL8bEATdKb3aLgAT6blhYe1IOEWrAEIUqjNmzpHRq4IweWZR1LFH6oPDKQQWiKnLlA06BNoK+zNiHPp7GsVE3W9z1LgLMLcN1yYyM= X-Gm-Message-State: AOJu0YwveXLacAv/cJ/S6ymU8sfLzsR5hqRHZo09QDCHWdzAl9+1eEs7 WVxVOrIrCG1ogSZMr8ttjDSKMPXcZFFwzUyWzUPWl38ga81Pl11E X-Google-Smtp-Source: AGHT+IGwBzpGzOI8UnmzyhZbE1IyHQCB/GWkLPI3zSldgtr6vXIrNvfGhEM715WnuXcqelbUbUaHDQ== X-Received: by 2002:a05:6830:100d:b0:702:1e62:8698 with SMTP id 46e09a7af769-7021e629011mr7518817a34.0.1720043013632; Wed, 03 Jul 2024 14:43:33 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:32 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 22/29] wifi: mt76: mt7925: add mt7925_[assign,unassign]_vif_chanctx Date: Wed, 3 Jul 2024 14:42:27 -0700 Message-Id: <1f856d6529a62f64be23e7c9fd5f255f1d9c0127.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add mt7925_[assign,unassign]_vif_chanctx to assign and unassign chanctx to the specific link configuration. If the chctx is not pass in the parameter, we will look up the channel information from link_conf->chanreq.oper. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/main.c | 75 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 17 +++-- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 1 + 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 339888086076..13b40032cd72 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -1698,8 +1698,13 @@ mt7925_change_chanctx(struct ieee80211_hw *hw, mconf = &mvif->bss_conf; } - if (mconf) - mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, ctx); + if (mconf) { + struct ieee80211_bss_conf *link_conf; + + link_conf = mt792x_vif_to_bss_conf(vif, mconf->link_id); + mt7925_mcu_set_chctx(mvif->phy->mt76, &mconf->mt76, + link_conf, ctx); + } } mt792x_mutex_release(phy->dev); } @@ -1945,6 +1950,68 @@ mt7925_change_sta_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return err; } +static int mt7925_assign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, + struct ieee80211_chanctx_conf *ctx) +{ + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct ieee80211_bss_conf *pri_link_conf; + struct mt792x_bss_conf *mconf; + + mutex_lock(&dev->mt76.mutex); + + if (ieee80211_vif_is_mld(vif)) { + mconf = mt792x_vif_to_link(mvif, link_conf->link_id); + pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + + if (vif->type == NL80211_IFTYPE_STATION && + mconf == &mvif->bss_conf) + mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf, + NULL, true); + } else { + mconf = &mvif->bss_conf; + } + + mconf->mt76.ctx = ctx; + mctx->bss_conf = &mvif->bss_conf; + mutex_unlock(&dev->mt76.mutex); + + return 0; +} + +static void mt7925_unassign_vif_chanctx(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *link_conf, + struct ieee80211_chanctx_conf *ctx) +{ + struct mt792x_chanctx *mctx = (struct mt792x_chanctx *)ctx->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_dev *dev = mt792x_hw_dev(hw); + struct ieee80211_bss_conf *pri_link_conf; + struct mt792x_bss_conf *mconf; + + mutex_lock(&dev->mt76.mutex); + + if (ieee80211_vif_is_mld(vif)) { + mconf = mt792x_vif_to_link(mvif, link_conf->link_id); + pri_link_conf = mt792x_vif_to_bss_conf(vif, mvif->deflink_id); + + if (vif->type == NL80211_IFTYPE_STATION && + mconf == &mvif->bss_conf) + mt7925_mcu_add_bss_info(&dev->phy, NULL, pri_link_conf, + NULL, false); + } else { + mconf = &mvif->bss_conf; + } + + mctx->bss_conf = NULL; + mconf->mt76.ctx = NULL; + mutex_unlock(&dev->mt76.mutex); +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1997,8 +2064,8 @@ const struct ieee80211_ops mt7925_ops = { .add_chanctx = mt7925_add_chanctx, .remove_chanctx = mt7925_remove_chanctx, .change_chanctx = mt7925_change_chanctx, - .assign_vif_chanctx = mt792x_assign_vif_chanctx, - .unassign_vif_chanctx = mt792x_unassign_vif_chanctx, + .assign_vif_chanctx = mt7925_assign_vif_chanctx, + .unassign_vif_chanctx = mt7925_unassign_vif_chanctx, .mgd_prepare_tx = mt7925_mgd_prepare_tx, .mgd_complete_tx = mt7925_mgd_complete_tx, .vif_cfg_changed = mt7925_vif_cfg_changed, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 75149baab7e5..3f0ceebed2f8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2074,9 +2074,11 @@ mt7925_mcu_uni_add_beacon_offload(struct mt792x_dev *dev, static void mt7925_mcu_bss_rlm_tlv(struct sk_buff *skb, struct mt76_phy *phy, + struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { - struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; int freq1 = chandef->center_freq1, freq2 = chandef->center_freq2; enum nl80211_band band = chandef->chan->band; struct bss_rlm_tlv *req; @@ -2143,6 +2145,7 @@ __mt7925_mcu_alloc_bss_req(struct mt76_dev *dev, struct mt76_vif *mvif, int len) } int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx) { struct sk_buff *skb; @@ -2152,7 +2155,7 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, if (IS_ERR(skb)) return PTR_ERR(skb); - mt7925_mcu_bss_rlm_tlv(skb, phy, ctx); + mt7925_mcu_bss_rlm_tlv(skb, phy, link_conf, ctx); return mt76_mcu_skb_send_msg(phy->dev, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); @@ -2214,7 +2217,8 @@ mt7925_mcu_bss_basic_tlv(struct sk_buff *skb, { struct ieee80211_vif *vif = link_conf->vif; struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); - struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; enum nl80211_band band = chandef->chan->band; struct mt76_connac_bss_basic_tlv *basic_req; struct mt792x_link_sta *mlink; @@ -2339,7 +2343,8 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, struct ieee80211_chanctx_conf *ctx, struct ieee80211_bss_conf *link_conf) { - struct cfg80211_chan_def *chandef = ctx ? &ctx->def : &phy->mt76->chandef; + struct cfg80211_chan_def *chandef = ctx ? &ctx->def : + &link_conf->chanreq.oper; struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); enum nl80211_band band = chandef->chan->band; struct mt76_vif *mvif = &mconf->mt76; @@ -2479,8 +2484,6 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, int enable) { struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; - struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, - link_conf->link_id); struct mt792x_dev *dev = phy->dev; struct sk_buff *skb; @@ -2504,7 +2507,7 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } - mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, mconf->mt76.ctx); + mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index fefb6ab384bb..f0b890ad43e7 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -623,6 +623,7 @@ int mt7925_mcu_set_deep_sleep(struct mt792x_dev *dev, bool enable); int mt7925_mcu_set_channel_domain(struct mt76_phy *phy); int mt7925_mcu_set_radio_en(struct mt792x_phy *phy, bool enable); int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, + struct ieee80211_bss_conf *link_conf, struct ieee80211_chanctx_conf *ctx); int mt7925_mcu_set_rate_txpower(struct mt76_phy *phy); int mt7925_mcu_update_arp_filter(struct mt76_dev *dev, From patchwork Wed Jul 3 21:42:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809878 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 371B11953AD for ; Wed, 3 Jul 2024 21:43:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043017; cv=none; b=So0ISMEiCEEJ/jeVbMdzeszkTRy5zThWgq9ITOiEQEIShd2qtdHHLladVS2GAxIii7KgEp3BmzMZZgXIWMA8Si6sduR6vbMEg+lsUc2VxJFnKTASfoxkkRpD8K6s5Sf3H+5B83totZFLbVGngDx6x7Gz3nH+dQ+YYgJjG6Pb+V0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043017; c=relaxed/simple; bh=4PtZzdcoL+KyTVA5WplrfHYl6ZYgyYEk3N99uL7q0fI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A0khOPd1XccfHQ5j8+6pBO+lYbHszLLiUhvyWL3YCDf2oab10Ag9By8xIobiXlhmrYhr2EmaxfIVBb40HmfehO+Ce2OpGKvX3+eXhdP9nONR6ykUG9a0nlPYNzqxudVqVHq7gMVMBiafvnjY62meeYU+TXQlX3CADZtp9rOdzFE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-701fa02e5c1so84615a34.2 for ; Wed, 03 Jul 2024 14:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043015; x=1720647815; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g37T4CjI6r9HOceV/Z2FL5pGlk5t0qMk/CEhDyaAnXw=; b=LQ9SE4IgUm+yzOq4g/AHjkQ/xRVrPYJF6nmdx/sveboez+A8UgAv7qGwvLTfCBKMQq kRuZN3a7QsiipX2fBB7Q+355PE4y0v/rQoQTM/bplIL+y6zdMWVsZeYtVTNN+V4UHvp/ /D0G814q2C5K8cKQXtQFt4FhPk9s/Nb+C4CrGwbPczdRlgkXghRWD/cW/pPQeBrE3bGE 4mJLAe28NgWOymfMIk50dOFKRSUCe4cr6hSXImdoafy+oGCkIYo2JyJGD9+zAn+5kdF3 dhtFsiFA55kQLmmjjZ4PftG9UCxLIDqJ/GTBW4IvWjDV0/10hd4MYuLAbtlKoX5cL2ff VYfQ== X-Forwarded-Encrypted: i=1; AJvYcCXxDI5HbRV+M0x1JOdLfkjTkBKUtHvCmdYoSksxcF1tfGc9y0mj62NRVHDIajMpn9762oWxrVagq2w/olHc2lJfdQdJUmTPMsG76XYZFwU= X-Gm-Message-State: AOJu0Yz3zfyHkHHZJnR2lPwzNvRl0/Q6Jp9luJhRsO80A2w3eQwaRA+O u26eO3FhBASAzy1fRLf9LF/bz+F5fWnp/Eura7tlAA3ALRL3VaKC X-Google-Smtp-Source: AGHT+IGZQAxkdXIk+I8F4X/wcmiceJqFKgT51xCUKYrAA7cmb2oD4iG5Df3wtgYhrthp3Cx1CY5XHA== X-Received: by 2002:a9d:5c89:0:b0:700:ca11:1158 with SMTP id 46e09a7af769-702076766bcmr11947539a34.1.1720043015253; Wed, 03 Jul 2024 14:43:35 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:34 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 23/29] wifi: mt76: mt7925: update mt7925_mcu_sta_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:28 -0700 Message-Id: <99eac993f7020488f0debf972e2fc71f4bca36a4.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Update mt7925_mcu_sta_mld_tlv for the MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 3f0ceebed2f8..71f1fb9fbe2f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1735,19 +1735,34 @@ static void mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { - struct mt76_wcid *wcid = (struct mt76_wcid *)sta->drv_priv; + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv; + unsigned long valid = mvif->valid_links; + struct mt792x_bss_conf *mconf; + struct mt792x_link_sta *mlink; struct sta_rec_mld *mld; struct tlv *tlv; + int i, cnt = 0; tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_MLD, sizeof(*mld)); mld = (struct sta_rec_mld *)tlv; - memcpy(mld->mac_addr, vif->addr, ETH_ALEN); - mld->primary_id = cpu_to_le16(wcid->idx); - mld->wlan_id = cpu_to_le16(wcid->idx); + memcpy(mld->mac_addr, sta->addr, ETH_ALEN); + mld->primary_id = cpu_to_le16(msta->deflink.wcid.idx); + mld->wlan_id = cpu_to_le16(msta->deflink.wcid.idx); + mld->link_num = min_t(u8, hweight16(mvif->valid_links), 2); - /* TODO: 0 means deflink only, add secondary link(1) later */ - mld->link_num = !!(hweight8(vif->active_links) > 1); - WARN_ON_ONCE(mld->link_num); + for_each_set_bit(i, &valid, IEEE80211_MLD_MAX_NUM_LINKS) { + if (cnt == mld->link_num) + break; + + mconf = mt792x_vif_to_link(mvif, i); + mlink = mt792x_sta_to_link(msta, i); + mld->link[cnt].wlan_id = cpu_to_le16(mlink->wcid.idx); + mld->link[cnt++].bss_idx = cpu_to_le16(mconf->mt76.idx); + + if (mlink != &msta->deflink) + mld->secondary_id = cpu_to_le16(mlink->wcid.idx); + } } static int From patchwork Wed Jul 3 21:42:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810295 Received: from mail-oa1-f46.google.com (mail-oa1-f46.google.com [209.85.160.46]) (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 224CC1957F5 for ; Wed, 3 Jul 2024 21:43:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043019; cv=none; b=JsD+8IO+LAU75dY0GxU3GqlBy9EEoHNFrIu+aaBv4DhG3ecEhJRQWvNnUhpz0o3zeE4/vSf7be+KQu26nURZPjkh/lUXDMBycjHscdLYaLxbwmg4bzbhG1ZSv8ERvrDctycAfwaQseKcCphAq8q1vpfVgSwFKj4oOqce5AsGgtw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043019; c=relaxed/simple; bh=XQIwFXJfarn/tZxiFN9JwHtsZDPrVdRaFY2it+P0FmQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aR9IRIOqyzo1ilx3lIS6fOaM5fzOHIbaauC+Qym5SYE0NP0IBn0Ht6EjytkInR6p/KdSYDYsC0wF9Y5AJcTlIfvjqh8RfXIZQT2e9vRIAoTP0QHzE7Gg+xALK2cnrYSfdkS6pda24dq1tIl5O2iMNpfhAGXLZGAdrTJwOLSvfa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f46.google.com with SMTP id 586e51a60fabf-24c5ec50da1so3622fac.3 for ; Wed, 03 Jul 2024 14:43:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043017; x=1720647817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sW7nAYSBD4glkIK9OSU6ZgZqDA0uvjteIHLwvRqU2zg=; b=MSLlpj/v2Rdt5PNhtXyWXIVQhlyYn8fjs9oOqVWe7nPaUhvXYEAadlhDrPHyl4ZU69 NCVBPwMErBhxdCWF8+UwJ5t1p9Lx294FkkXkx+CCLHGZWzRLdlA332C+eUUBpltl7rIS F2ilr9Wk4+lNRXkxmDgm+KhdnVRqB12OrVmRfIYLVk4hlk3eN0R7hLiibGLtXgfZ9rLs MEgXgsz8Aei6AKwwwa+o1Ti9M6velTFBZp3+05wQDvZE/jRZJGuJoYVQ3ZgDD2jCsugu O3681tv+/A+HIHCvGU3N55vSALC5W6yGonb2+rAFVJrr22nMgHo53VCNwLk5kfgq5E5m U3gQ== X-Forwarded-Encrypted: i=1; AJvYcCX8m4zB3pI9yhY8bkLQsaqy2cLuxXp5g8/P5WDL1e4+sAzX5iR+89mdBKsIMK30obV35O1Zgi/LsmJXL6y2k9bzJqXretfGkF6aIKXo7gs= X-Gm-Message-State: AOJu0YzCid1GpPIzX+m0lFvKkhYMs9yRa4fJf9saLC5Y4FFS3aEPAX6n jbel2X6F22Opy1P47HyIcXBz2U+350xagsm16QerngJTstg+QeIt X-Google-Smtp-Source: AGHT+IH4XOZT62iIvZhEGPj3+iU/gi4uuYHksxIRuTmMEG197w45CPTYhpsRRPAJv8JVvFwYI78Ckg== X-Received: by 2002:a9d:6b12:0:b0:701:f9f0:73d8 with SMTP id 46e09a7af769-7020772bb17mr13165353a34.2.1720043017154; Wed, 03 Jul 2024 14:43:37 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:35 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 24/29] wifi: mt76: mt7925: update mt7925_mcu_bss_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:29 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware, the change remains compatible with the non-MLO mode and the older firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 19 +++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 5 ++++- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 71f1fb9fbe2f..8e36fb211dcc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2384,24 +2384,28 @@ mt7925_mcu_bss_bmc_tlv(struct sk_buff *skb, struct mt792x_phy *phy, static void mt7925_mcu_bss_mld_tlv(struct sk_buff *skb, - struct ieee80211_bss_conf *link_conf, - struct ieee80211_link_sta *link_sta) + struct ieee80211_bss_conf *link_conf) { struct mt792x_bss_conf *mconf = mt792x_link_conf_to_mconf(link_conf); - bool is_mld = ieee80211_vif_is_mld(link_conf->vif); + struct mt792x_vif *mvif = (struct mt792x_vif *)link_conf->vif->drv_priv; struct bss_mld_tlv *mld; struct tlv *tlv; + bool is_mld; + + is_mld = ieee80211_vif_is_mld(link_conf->vif) || + (hweight16(mvif->valid_links) > 1); tlv = mt76_connac_mcu_add_tlv(skb, UNI_BSS_INFO_MLD, sizeof(*mld)); mld = (struct bss_mld_tlv *)tlv; - mld->link_id = link_sta ? (is_mld ? link_conf->link_id : 0) : 0xff; + mld->link_id = is_mld ? link_conf->link_id : 0xff; mld->group_mld_id = is_mld ? mconf->mt76.idx : 0xff; mld->own_mld_id = mconf->mt76.idx + 32; mld->remap_idx = 0xff; + mld->eml_enable = !!(link_conf->vif->cfg.eml_cap & + IEEE80211_EML_CAP_EMLSR_SUPP); - if (link_sta) - memcpy(mld->mac_addr, link_sta->addr, ETH_ALEN); + memcpy(mld->mac_addr, link_conf->addr, ETH_ALEN); } static void @@ -2511,10 +2515,9 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_basic_tlv(skb, link_conf, link_sta, ctx, phy->mt76, mvif->sta.deflink.wcid.idx, enable); mt7925_mcu_bss_sec_tlv(skb, link_conf); - mt7925_mcu_bss_bmc_tlv(skb, phy, ctx, link_conf); mt7925_mcu_bss_qos_tlv(skb, link_conf); - mt7925_mcu_bss_mld_tlv(skb, link_conf, link_sta); + mt7925_mcu_bss_mld_tlv(skb, link_conf); mt7925_mcu_bss_ifs_tlv(skb, link_conf); if (link_conf->he_support) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index f0b890ad43e7..545f6b2d524c 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -366,7 +366,10 @@ struct bss_mld_tlv { u8 mac_addr[ETH_ALEN]; u8 remap_idx; u8 link_id; - u8 __rsv[2]; + u8 eml_enable; + u8 max_link_num; + u8 hybrid_mode; + u8 __rsv[3]; } __packed; struct sta_rec_ba_uni { From patchwork Wed Jul 3 21:42:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809877 Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 E3AA2195807 for ; Wed, 3 Jul 2024 21:43:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043021; cv=none; b=WyOjM/fUAqZrj/ychVpa5t7Vl/7z0E6XDKvKd6xgnS1ks12sx52BYt3PBBrgkrDutsNlQ2wSANoy+HdEQDwJ1JrrIQay0/5zkOzPTZntcYRaLvNO3ZGjULdVD5ZrRSFdl48TqSu2ylmV0LDHt0N0UYZHivyv2K94GUh46EggP78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043021; c=relaxed/simple; bh=ioAFecPopJl88mFoOHfpl3wgFVC3td8PCpgcMoFQv7M=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GZ6LsqisA5EIhgKarc7gYC+y0rMiTygAOOp8/9VKK0WWzPWBodwcg6lJkTicY6jbLctil/JIGgZZ3xZzpV6U2oZ/VTduAEohTJQP6xpbb7d7x+mjb8kZsnUpXhdm9YEd6gUMPaFYx7sRrpsfL3euYbDEnJ6oKX1RgljlIIqPBRY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-700cd6afa3eso204803a34.1 for ; Wed, 03 Jul 2024 14:43:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043019; x=1720647819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bwqorZoTFFCKliGP8pRCTs9efMb53TYnGt4MRvbI/og=; b=ZAX3jE0y08Nhib4DPi8J5nIqE/XLv0zgzLIWFzF04uLhR7AzAqL0h0LfPXj8vPMfG1 RpcaECP2f1aTqz2++8xgi+G0Q7Wb8fA11EvfM1+dHE6hGQwZLCAgt18y16GdFZHwchUH Gb9u51pHi8lgpznljzInvNuGnYBhFdKIB2MJIn+acrjC4RldMmHy+U67T+jK30B+ZO8N kFpIxxGo4dYNwV3rMSQqMv/T3j8j6SQOmfSkRdzibGycRTpK7cIjH0thOHg8yZf9DTpb 8PREp2Flq2/66OIRAfSITG6OkSGmryQlM+iLkdaPc1AvZ2WwP9mtkA3+h1cVx99u+3AH ny0g== X-Forwarded-Encrypted: i=1; AJvYcCUFmwzpK8aqdocr30Jga3xRY1LKR5euhLF61H4EmV55xtsMfjkkwyfP9wNiOlq+OxF27Koodziu3Tznb8YNyqc0om1mPnDnf/K3zfeXI1w= X-Gm-Message-State: AOJu0YwDYN+Q78oz9+ttxs/ovQhaX7khFYye6AZGkr35Ss7Kwd8XuFhX xD2Xb15aSzyuJpAySv9nS1kf+PgS7612i1/vmOsGR+JIGR0SDxmb X-Google-Smtp-Source: AGHT+IHo1AAWxD+r1FVufqOGwJZIiBIJ5Fr19n7yL5Sc8XkDMXkfUza+KBsv5oIqzuNNAzCLC0jxKg== X-Received: by 2002:a9d:6b12:0:b0:701:f9f0:73d8 with SMTP id 46e09a7af769-7020772bb17mr13165401a34.2.1720043018979; Wed, 03 Jul 2024 14:43:38 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:37 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 25/29] wifi: mt76: mt7925: update mt7925_mcu_add_bss_info for MLO Date: Wed, 3 Jul 2024 14:42:30 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Update mt7925_mcu_bss_mld_tlv for the MLO-enabled firmware The change remains compatible with the non-MLO mode and the older firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 8e36fb211dcc..218efe543dbb 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -2525,7 +2525,8 @@ int mt7925_mcu_add_bss_info(struct mt792x_phy *phy, mt7925_mcu_bss_color_tlv(skb, link_conf, enable); } - mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); + if (enable) + mt7925_mcu_bss_rlm_tlv(skb, phy->mt76, link_conf, ctx); return mt76_mcu_skb_send_msg(&dev->mt76, skb, MCU_UNI_CMD(BSS_INFO_UPDATE), true); From patchwork Wed Jul 3 21:42:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810294 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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 29D34198836 for ; Wed, 3 Jul 2024 21:43:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043026; cv=none; b=BVAa2FRFPeO2FVcz6PF0kg+qOtUwCNIVFFtAV6/todk5TbP69AJfxiov4ka3inGJw4GZ2F7bmyOQg6yuu+p/yTc17pqtsnAieO1fEcX/U3bxQZMdJFUtH2DfiyKoXuqLmKUENhgmbZuiXDZ9agjDgTZOYilu/T2znM6Rv645SMU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043026; c=relaxed/simple; bh=BsRb2k1kWlxFWNjynAEmcF0M/HqeBIkEDC/5yz/MlMo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Sq/8433HQcQ/jq9QH800HhuBNf8MeSKMP+NJpd4p8QFCaCfgX2Gm27VlEjcMV+XBgSd2+4YcTdWZ9RSX3NpGafjVkK9H5dynLyHG5k5z6HL9ynaWQvstNd2/2AdQLx/ChNW57LX4HjshYopHflE0cK7d6K4/EsWEEx037iRwCKY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.160.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-254c411d816so3772fac.1 for ; Wed, 03 Jul 2024 14:43:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043024; x=1720647824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B6qob4+aEz9AnxDvyJPADamvZqFlBJwBhBj073zgKUw=; b=Iwp63aoDZtKvcdJEZnj2GAR53OvSQCyLktmg9+RFZ+hc0kR8WTOWtpwYd4XJnfeCMq RwjLoWRPyNPyOq6eVhOk2rNeh8SlhCjjgbPj0yVul+EyeC80f+hT3cdC8Rfa1gGSG1Pt cNYpsSovi0BDdirBE2Mp5CGg3duwhh/4tU4NS1AVwqfREpKoz+te9hB1XkNiqfrAb5Py u5SDnRdDD21xo4Sy/Pb9OHpNn4DG58CkCtslaf5Cwg+5lweVTGc6uLljovjH2DLTpAuO qdK6Xp4KWof+ECXu1oimuP7MSVEKXR92PNl0HiYhvrIrMCcS5Rs2k6VUeSSkhk8sEXob trzw== X-Forwarded-Encrypted: i=1; AJvYcCW6ay6peeJdiR6FhhfwGWd5h1xQS2afsKP4FPMwrc2U/vlHnv32R6RQSpbiOTw7OrwGdTQoZsFxsNj5l7b4iiI0Lz0fDujA+vyOIH/j5y8= X-Gm-Message-State: AOJu0YxrwAs1AoiziScmLn9v+CqRv1f52JbmWtkHI8dCVhPkMt1YLi2d 166Oyop2l4EX45/rVTTVh8eIbU/q6EWTRXbzSSk4YtxVkY40/OCy X-Google-Smtp-Source: AGHT+IFRqrqB0oJS3To8CcpUlTALffwBa/HcXjrOdTq70HVTagouqm9arBdBlmJYNrdzs27Y8+RfEA== X-Received: by 2002:a05:6830:68cd:b0:700:d697:6ca7 with SMTP id 46e09a7af769-70207554355mr12585737a34.0.1720043022162; Wed, 03 Jul 2024 14:43:42 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:39 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 26/29] wifi: mt76: mt7925: update mt7925_mcu_sta_update for MLO Date: Wed, 3 Jul 2024 14:42:31 -0700 Message-Id: <8b39975133d1c41ff724669562bd340eb2894617.1720042294.git.sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang update mt7925_mcu_sta_update for the MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 9 +++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 65 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +- 3 files changed, 75 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index e636b033b87e..9329c959674f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -545,6 +545,13 @@ struct sta_rec_muru { } mimo_ul; } __packed; +struct sta_rec_remove { + __le16 tag; + __le16 len; + u8 action; + u8 pad[3]; +} __packed; + struct sta_phy { u8 type; u8 flag; @@ -814,6 +821,8 @@ enum { STA_REC_HE_V2 = 0x19, STA_REC_MLD = 0x20, STA_REC_EHT = 0x22, + STA_REC_MLD_OFF = 0x23, + STA_REC_REMOVE = 0x25, STA_REC_PN_INFO = 0x26, STA_REC_KEY_V3 = 0x27, STA_REC_HDRT = 0x28, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 218efe543dbb..dcb8c506543b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1805,6 +1805,63 @@ mt7925_mcu_sta_cmd(struct mt76_phy *phy, return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); } +static void +mt7925_mcu_sta_remove_tlv(struct sk_buff *skb) +{ + struct sta_rec_remove *rem; + struct tlv *tlv; + + tlv = mt76_connac_mcu_add_tlv(skb, 0x25, sizeof(*rem)); + rem = (struct sta_rec_remove *)tlv; + rem->action = 0; +} + +static int +mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, + struct mt76_sta_cmd_info *info) +{ + struct mt76_vif *mvif = (struct mt76_vif *)info->vif->drv_priv; + struct mt76_dev *dev = phy->dev; + struct sk_buff *skb; + + skb = __mt76_connac_mcu_alloc_sta_req(dev, mvif, info->wcid, + MT7925_STA_UPDATE_MAX_SIZE); + if (IS_ERR(skb)) + return PTR_ERR(skb); + + if (info->enable) + mt76_connac_mcu_sta_basic_tlv(dev, skb, info->vif, + info->link_sta, + info->enable, info->newly); + + if (info->enable && info->link_sta) { + mt7925_mcu_sta_phy_tlv(skb, info->vif, info->link_sta); + mt7925_mcu_sta_ht_tlv(skb, info->link_sta); + mt7925_mcu_sta_vht_tlv(skb, info->link_sta); + mt76_connac_mcu_sta_uapsd(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_amsdu_tlv(skb, info->vif, info->link_sta); + mt7925_mcu_sta_he_tlv(skb, info->link_sta); + mt7925_mcu_sta_he_6g_tlv(skb, info->link_sta); + mt7925_mcu_sta_eht_tlv(skb, info->link_sta); + mt7925_mcu_sta_rate_ctrl_tlv(skb, info->vif, + info->link_sta); + mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, + info->vif, info->rcpi, + info->state); + if (info->state != MT76_STA_INFO_STATE_NONE) + mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); + } + + if (!info->enable) { + mt7925_mcu_sta_remove_tlv(skb); + mt76_connac_mcu_add_tlv(skb, STA_REC_MLD_OFF, + sizeof(struct tlv)); + } + + return mt76_mcu_skb_send_msg(dev, skb, info->cmd, true); +} + int mt7925_mcu_sta_update(struct mt792x_dev *dev, struct ieee80211_link_sta *link_sta, struct ieee80211_vif *vif, bool enable, @@ -1823,6 +1880,7 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, }; struct mt792x_sta *msta; struct mt792x_link_sta *mlink; + int err; if (link_sta) { msta = (struct mt792x_sta *)link_sta->sta->drv_priv; @@ -1831,7 +1889,12 @@ int mt7925_mcu_sta_update(struct mt792x_dev *dev, info.wcid = link_sta ? &mlink->wcid : &mvif->sta.deflink.wcid; info.newly = link_sta ? state != MT76_STA_INFO_STATE_ASSOC : true; - return mt7925_mcu_sta_cmd(&dev->mphy, &info); + if (ieee80211_vif_is_mld(vif)) + err = mt7925_mcu_mlo_sta_cmd(&dev->mphy, &info); + else + err = mt7925_mcu_sta_cmd(&dev->mphy, &info); + + return err; } int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index 545f6b2d524c..8a0196699230 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -492,7 +492,8 @@ struct bss_rlm_tlv { sizeof(struct sta_rec_eht) + \ sizeof(struct sta_rec_hdr_trans) + \ sizeof(struct sta_rec_mld) + \ - sizeof(struct tlv)) + sizeof(struct tlv) * 2 + \ + sizeof(struct sta_rec_remove)) #define MT7925_BSS_UPDATE_MAX_SIZE (sizeof(struct bss_req_hdr) + \ sizeof(struct mt76_connac_bss_basic_tlv) + \ From patchwork Wed Jul 3 21:42:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809876 Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 4EC83194A54 for ; Wed, 3 Jul 2024 21:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043028; cv=none; b=K7+Y4zTc6455Nj9zPEaqx27rVWTFxLVYT2395fcMMHlQZgcGoLS3YSNN4ClsYHeKpAq+PYpCBFB+VoEmbr9YNRjAJHYOCB2OnItDm35aBM4IAZIj2hSpCFjnS8MN+5MdJvrkidmyWhQH06AB3QM90rzhc1rTX6zX439gbHEHMdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043028; c=relaxed/simple; bh=M5H6EPOyjRb4OpuF/XTy2Z6gvWVoYnoJc5CSv4U2y3Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=QU7yqzfoljFDb2W7PBAMdKXbqHV1bh+81ky6eK83v6EkoeIBVU6omOgJ6Wy5VzHShPH9kze6agqnXoQSmQxtZAJpSSRh5zr5zBajYqUoR6GRnWw57jPsWMJAyWv2xx5X8KmxXbZpnzklDi304WdP9yWjGuguktiQH6AFC0JKv7Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-700cee3c5f6so115696a34.1 for ; Wed, 03 Jul 2024 14:43:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043026; x=1720647826; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5Zm2u2GDuUR87ImOZGiIFmMyIIv/8lErTyscfyIFe+M=; b=sJ6QkhYscsYIGKiT7xQDACaAAyWr9bAEYreYRlx2dlgsVBDwr4i6mxibiXXEoGDH86 XR9BJUZShiM154rVzIhqShGjRP6zhfyEMlZJXm8z9fCBtO6vO8w81F4S7w/NPQfNxuHx R7rUNnvnaJygPFwft+K8lDkNQT4XdiB41TjHjr7rJoIIMOyEj5d9pr1ErOhQaD05S28w JGBQKPpQLdjq+2i9Wkh7qgL+GdFsWpGUFnPi8/a6Xq8vfMh025hIINo9w63VIdcF34e7 gVPDqt2/tg0mHTi2CYVV0qEtqw1oOw9YHopoy/0iCuy47THkLh+Yi6KO5j8ZQEJWW9ne Z7yw== X-Forwarded-Encrypted: i=1; AJvYcCXNFP9NU0Z6fi25jNQ44cq3FaWZbuCw8R3RUKmvmnaeTAXYp68aVwYjxjTyZEzjskItkfID+gCl7KjoF3NGGEetwlCD9cUaUT35UfvbPSo= X-Gm-Message-State: AOJu0Yz/2xcwDSop5sD2PuxfAIInOIhuwjbwKuWojuWBejLSVpYRYM2t icPmfaNqzsJdLyku2qi67osy4iea4Pwt56B7O/4TbVHK1Oo3m1eS7F365oGH X-Google-Smtp-Source: AGHT+IHOSLauwODbtAedsub0S622gbphfmI+pOTqu9GNMm9cAI1Tx7iKjETXO6xlPoYg3paWmDA2LQ== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703603a34.2.1720043026332; Wed, 03 Jul 2024 14:43:46 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:44 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 27/29] wifi: mt76: mt7925: add mt7925_mcu_sta_eht_mld_tlv for MLO Date: Wed, 3 Jul 2024 14:42:32 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang add mt7925_mcu_sta_eht_mld_tlv for the MLO-enabled firmware. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7925/mcu.c | 42 ++++++++++++++++++- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 11 +++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index 9329c959674f..d6882c9fd6bc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -820,6 +820,7 @@ enum { STA_REC_HE_6G = 0x17, STA_REC_HE_V2 = 0x19, STA_REC_MLD = 0x20, + STA_REC_EHT_MLD = 0x21, STA_REC_EHT = 0x22, STA_REC_MLD_OFF = 0x23, STA_REC_REMOVE = 0x25, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index dcb8c506543b..36ddc64ed7d6 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1731,6 +1731,42 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, HT_MCS_MASK_NUM); } +static void +mt7925_mcu_sta_eht_mld_tlv(struct sk_buff *skb, + struct ieee80211_vif *vif, struct ieee80211_sta *sta) +{ + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + struct wiphy *wiphy = mvif->phy->mt76->hw->wiphy; + const struct wiphy_iftype_ext_capab *ext_capa; + struct sta_rec_eht_mld *eht_mld; + struct tlv *tlv; + u16 eml_cap; + + tlv = mt76_connac_mcu_add_tlv(skb, STA_REC_EHT_MLD, sizeof(*eht_mld)); + eht_mld = (struct sta_rec_eht_mld *)tlv; + eht_mld->mld_type = 0xff; + + if (!ieee80211_vif_is_mld(vif)) + return; + + ext_capa = cfg80211_get_iftype_ext_capa(wiphy, + ieee80211_vif_type_p2p(vif)); + if (!ext_capa) + return; + + eml_cap = (vif->cfg.eml_cap & (IEEE80211_EML_CAP_EMLSR_SUPP | + IEEE80211_EML_CAP_TRANSITION_TIMEOUT)) | + (ext_capa->eml_capabilities & (IEEE80211_EML_CAP_EMLSR_PADDING_DELAY | + IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY)); + + if (eml_cap & IEEE80211_EML_CAP_EMLSR_SUPP) { + eht_mld->eml_cap[0] = u16_get_bits(eml_cap, GENMASK(7, 0)); + eht_mld->eml_cap[1] = u16_get_bits(eml_cap, GENMASK(15, 8)); + } else { + eht_mld->str_cap[0] = BIT(1); + } +} + static void mt7925_mcu_sta_mld_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, struct ieee80211_sta *sta) @@ -1848,8 +1884,12 @@ mt7925_mcu_mlo_sta_cmd(struct mt76_phy *phy, mt7925_mcu_sta_state_v2_tlv(phy, skb, info->link_sta, info->vif, info->rcpi, info->state); - if (info->state != MT76_STA_INFO_STATE_NONE) + + if (info->state != MT76_STA_INFO_STATE_NONE) { mt7925_mcu_sta_mld_tlv(skb, info->vif, info->link_sta->sta); + mt7925_mcu_sta_eht_mld_tlv(skb, info->vif, info->link_sta->sta); + } + mt7925_mcu_sta_hdr_trans_tlv(skb, info->vif, info->link_sta); } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index 8a0196699230..5703176056db 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -443,6 +443,17 @@ struct sta_rec_mld { } __packed link[2]; } __packed; +struct sta_rec_eht_mld { + __le16 tag; + __le16 len; + u8 nsep; + u8 mld_type; + u8 __rsv1[1]; + u8 str_cap[3]; + u8 eml_cap[3]; + u8 __rsv2[3]; +} __packed; + struct bss_ifs_time_tlv { __le16 tag; __le16 len; From patchwork Wed Jul 3 21:42:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 810293 Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com [209.85.210.45]) (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 42DF8199225 for ; Wed, 3 Jul 2024 21:43:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043030; cv=none; b=LyP/jmh6604Q0jQN2yvdEMEZTHnkamsWbDm9HgJ1AOeiT3P+uUTQAALP/yaeoQA3sFO/vY66RLBe9X7LoqczkFb9NF+VVBWkfG4S/TQ37EI+7/YunyoqaQncE2nVRcDOZxSUe6wNYqTmdyPdT2yT2dklF85g0RmRz65HnHLh8fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043030; c=relaxed/simple; bh=LPmmqlk5uxY2VbbisSrv8wxqM80Bk0v2EZanD+wc9qU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rR7/G2qQAqmiw2+hCuzTQubLKBw4B7mYMOokyVovLjeNXtrNBGPFWCWhezkKqkvlceGviLqli5okyfMIW4ctpELCw/0gf0c+wbYn8L0KU5/GsvDrHRHqAwvddviKy8cE/5KS1z0Mg3VXEYa61gHsUHT9YwfFLieM/+ZDwwpj5KE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f45.google.com with SMTP id 46e09a7af769-700d68d3195so136695a34.3 for ; Wed, 03 Jul 2024 14:43:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043028; x=1720647828; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2J9B7zhjK3f29ovrL4Llul+VWCgxd/DHWLce6tzebVg=; b=WQlRBD7pBOCHK+TNKJ1+bD7+i/ockEt6k0x5MzpR3LZBO64AIthJZB+lLGNHd0jgG8 FJf4w/KHYTF+sauLwjzaKtx713eLE++MJNox6KVmrvGDhj8D9H2Fn3ydOl3WyxyKO5MU SDuaDFB8LxBS2ToK4K+Zh565vrefiTw4QTSYjvZ6GV3t6/2aZ/Oqv6Pe36YtgRVwJQbX kyYWyUI+wNGMG43WVZYJi0RlCccMOqTEw21Nt8bOgf1etHYRbiZ7XdiMNWmx7THfK3m9 u4WVpvwRS2pegTrDZ2zDcssTcEk+n0XK3fO2ttg57Q53H42ixc5FgbI8XhHiqROLVs1V gXjg== X-Forwarded-Encrypted: i=1; AJvYcCU9IU8DGtUeOPnouYPwoS4Cg85q/drAdNjcqAdkZBlmLsAS9txt1J1oX0tyTgxUOzsiVE1qLbt2ABgOJrYVL2+4eZLEtXQbPWhAe7vOSGI= X-Gm-Message-State: AOJu0YzQgaHed8ghtnwjotfyvHhSGwhFr/JsyKldjB5aJS+wxX81JeEW y88WGkx53a1VIBD9q+R3CWwPN8KLjvFA2jM9hp/Iv0DS549Ted+q X-Google-Smtp-Source: AGHT+IGmS4lxO+9/5KpWC0FYHXRgQxAMPZY/PNjXZVYVqL4NuwCgC1ZKfvRFuBZHJYGD3zKGbvWLeg== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703664a34.2.1720043028356; Wed, 03 Jul 2024 14:43:48 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:46 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 28/29] wifi: mt76: mt7925: update mt7925_mcu_sta_rate_ctrl_tlv for MLO Date: Wed, 3 Jul 2024 14:42:33 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Get band information from the per-link BSS. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 36ddc64ed7d6..829d87d4eb95 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -1707,7 +1707,9 @@ mt7925_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct ieee80211_link_sta *link_sta) { struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - struct cfg80211_chan_def *chandef = &mvif->bss_conf.mt76.ctx->def; + struct mt792x_bss_conf *mconf = mt792x_vif_to_link(mvif, + link_sta->link_id); + struct cfg80211_chan_def *chandef = &mconf->mt76.ctx->def; enum nl80211_band band = chandef->chan->band; struct sta_rec_ra_info *ra_info; struct tlv *tlv; From patchwork Wed Jul 3 21:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 809875 Received: from mail-ot1-f46.google.com (mail-ot1-f46.google.com [209.85.210.46]) (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 7796B199225 for ; Wed, 3 Jul 2024 21:43:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043033; cv=none; b=UXXdsqQYp6RZYEEe1OSqMAj9KvJ3/nxeaIrHCrCH+dhLlDSdl3LqIYSKa3bB8gy96pqgSgpqC4zuI+F2TYlDQnfR27nzMVkHXfo+/9352MzvX9DJpQhcz/HFn28zghmR2FMveGBrU13ntBajRWw/f7I05w7AjxA7hmSE4Au0abg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720043033; c=relaxed/simple; bh=E27SgwsGh71v1USUawd1DzvMoHzMVVfw44uNpuWdDNk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=p5r1Vp4BU9HlT9OD+ZTGy/LfMaWT3GvvzcgmQMKHHJ3fWEbkNyLoqvYtl5cQiaEnvJOhLGWjzeVpVo//vF8E6+tcYaXHj+tvOBJInH+8d6rz3SI9SxVkfdVLNLmW4ob7Nyj2cFq8ZIOkdwg5+mcutBAmV9z8rkViEHFJZ+B3Rfo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.210.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ot1-f46.google.com with SMTP id 46e09a7af769-700cee3c5f6so115698a34.1 for ; Wed, 03 Jul 2024 14:43:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720043030; x=1720647830; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I/n7VZ7fj0o/3ai4SZ3SKcdBS97sLOgxIRvgNtfo2Zc=; b=mzw0jYA8CGouKxzuR/ifMymRU25LhZExEZyNhW+c1wSH2AZZCxQ/ro5tJdvrv7kKNO gAkPpcC3+9SiGF/OX+glNh+aZGJmUquUxxY7d2RiLqUoVNf3uvdrnNvCqLFK3TwKg4hb WUGPVI8VP7y/CaXlm24I4r6/ZTaHFC16ujQJNXgLL63XFxyGID2FQAeZAaj8ZLlflMqR QKW/UX+1xZVOq4eFetC8glBWnwt2RC1iUdgwsXm+ftr4TxKwRI6sDe5DViaWGG8djjC5 2CQGA+tYIxkfXiywQHE6s6IXhur0ApFO6miCxs1Is4f+Adce5i1DEWmdnWMXc11MqZ+m re8w== X-Forwarded-Encrypted: i=1; AJvYcCUJN76VqnPNWNbEXAw0TimF9458yG5kh4uM2nI0XVh5QnzNDmGR+xVBW7VMG1Ap7+Aw0/k/ApDyItGG0HW2CSqBmCxsYiZUUrhf/NTx17c= X-Gm-Message-State: AOJu0YwjRYTbx0GR0caWylttrKHFeo14Z4PiM9TUSeLxySD8wab/+1ac XPKTItSd799fYlOLfWctffr99b7+ouXZKo91wZIeLWY5B25Wlr5g X-Google-Smtp-Source: AGHT+IE4LsxQwXh0EZDYiJMTt6PW30ChD/EOSWZ2xrYLO5k/bhg54hR3h6oqAdq7s9sb9spqCpytDg== X-Received: by 2002:a9d:65c5:0:b0:700:ca13:30bc with SMTP id 46e09a7af769-70207763b58mr13703746a34.2.1720043030407; Wed, 03 Jul 2024 14:43:50 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-701f7b20953sm2111417a34.54.2024.07.03.14.43.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jul 2024 14:43:48 -0700 (PDT) From: sean.wang@kernel.org To: nbd@nbd.name, lorenzo.bianconi@redhat.com Cc: sean.wang@mediatek.com, deren.wu@mediatek.com, mingyen.hsieh@mediatek.com, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH 29/29] wifi: mt76: mt7925: enabling MLO when the firmware supports it Date: Wed, 3 Jul 2024 14:42:34 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Sean Wang Register MLD capability for the firmware supporting MLO. Co-developed-by: Ming Yen Hsieh Signed-off-by: Ming Yen Hsieh Co-developed-by: Deren Wu Signed-off-by: Deren Wu Signed-off-by: Sean Wang --- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7925/init.c | 6 ++++ .../net/wireless/mediatek/mt76/mt7925/main.c | 29 +++++++++++++++++++ .../net/wireless/mediatek/mt76/mt7925/mcu.c | 20 +++++++++++++ .../wireless/mediatek/mt76/mt7925/mt7925.h | 1 + drivers/net/wireless/mediatek/mt76/mt792x.h | 2 ++ 6 files changed, 59 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h index d6882c9fd6bc..4242d436de26 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h @@ -1402,6 +1402,7 @@ enum { MT_NIC_CAP_WFDMA_REALLOC, MT_NIC_CAP_6G, MT_NIC_CAP_CHIP_CAP = 0x20, + MT_NIC_CAP_EML_CAP = 0x22, }; #define UNI_WOW_DETECT_TYPE_MAGIC BIT(0) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/init.c b/drivers/net/wireless/mediatek/mt76/mt7925/init.c index c4cbc8976046..039949b344b9 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/init.c @@ -179,6 +179,12 @@ static void mt7925_init_work(struct work_struct *work) mt76_set_stream_caps(&dev->mphy, true); mt7925_set_stream_he_eht_caps(&dev->phy); + ret = mt7925_init_mlo_caps(&dev->phy); + if (ret) { + dev_err(dev->mt76.dev, "MLO init failed\n"); + return; + } + ret = mt76_register_device(&dev->mt76, true, mt76_rates, ARRAY_SIZE(mt76_rates)); if (ret) { diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 13b40032cd72..213331a92166 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -236,6 +236,35 @@ mt7925_init_eht_caps(struct mt792x_phy *phy, enum nl80211_band band, eht_nss->bw._160.rx_tx_mcs13_max_nss = val; } +int mt7925_init_mlo_caps(struct mt792x_phy *phy) +{ + struct wiphy *wiphy = phy->mt76->hw->wiphy; + static const u8 ext_capa_sta[] = { + [7] = WLAN_EXT_CAPA8_OPMODE_NOTIF, + }; + static struct wiphy_iftype_ext_capab ext_capab[] = { + { + .iftype = NL80211_IFTYPE_STATION, + .extended_capabilities = ext_capa_sta, + .extended_capabilities_mask = ext_capa_sta, + .extended_capabilities_len = sizeof(ext_capa_sta), + }, + }; + + if (!(phy->chip_cap & MT792x_CHIP_CAP_MLO_EVT_EN)) + return 0; + + ext_capab[0].eml_capabilities = phy->eml_cap; + ext_capab[0].mld_capa_and_ops = + u16_encode_bits(1, IEEE80211_MLD_CAP_OP_MAX_SIMUL_LINKS); + + wiphy->flags |= WIPHY_FLAG_SUPPORTS_MLO; + wiphy->iftype_ext_capab = ext_capab; + wiphy->num_iftype_ext_capab = ARRAY_SIZE(ext_capab); + + return 0; +} + static void __mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy, struct ieee80211_supported_band *sband, diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c index 829d87d4eb95..d4b020b50be1 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -749,6 +749,20 @@ mt7925_mcu_parse_phy_cap(struct mt792x_dev *dev, char *data) dev->has_eht = cap->eht; } +static void +mt7925_mcu_parse_eml_cap(struct mt792x_dev *dev, char *data) +{ + struct mt7925_mcu_eml_cap { + u8 rsv[4]; + __le16 eml_cap; + u8 rsv2[6]; + } __packed * cap; + + cap = (struct mt7925_mcu_eml_cap *)data; + + dev->phy.eml_cap = le16_to_cpu(cap->eml_cap); +} + static int mt7925_mcu_get_nic_capability(struct mt792x_dev *dev) { @@ -803,6 +817,12 @@ mt7925_mcu_get_nic_capability(struct mt792x_dev *dev) case MT_NIC_CAP_PHY: mt7925_mcu_parse_phy_cap(dev, tlv->data); break; + case MT_NIC_CAP_CHIP_CAP: + memcpy(&dev->phy.chip_cap, (void *)skb->data, sizeof(u64)); + break; + case MT_NIC_CAP_EML_CAP: + mt7925_mcu_parse_eml_cap(dev, tlv->data); + break; default: break; } diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h index 4c0ecae8e49b..d51cc8a02b9e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h @@ -235,6 +235,7 @@ void mt7925_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q, struct sk_buff *skb, u32 *info); void mt7925_stats_work(struct work_struct *work); void mt7925_set_stream_he_eht_caps(struct mt792x_phy *phy); +int mt7925_init_mlo_caps(struct mt792x_phy *phy); int mt7925_init_debugfs(struct mt792x_dev *dev); int mt7925_mcu_set_beacon_filter(struct mt792x_dev *dev, diff --git a/drivers/net/wireless/mediatek/mt76/mt792x.h b/drivers/net/wireless/mediatek/mt76/mt792x.h index 5ede24116748..30635aeba363 100644 --- a/drivers/net/wireless/mediatek/mt76/mt792x.h +++ b/drivers/net/wireless/mediatek/mt76/mt792x.h @@ -27,6 +27,7 @@ #define MT792x_CHIP_CAP_CLC_EVT_EN BIT(0) #define MT792x_CHIP_CAP_RSSI_NOTIFY_EVT_EN BIT(1) +#define MT792x_CHIP_CAP_MLO_EVT_EN BIT(2) /* NOTE: used to map mt76_rates. idx may change if firmware expands table */ #define MT792x_BASIC_RATES_TBL 11 @@ -163,6 +164,7 @@ struct mt792x_phy { #endif void *clc[MT792x_CLC_MAX_NUM]; u64 chip_cap; + u16 eml_cap; struct work_struct roc_work; struct timer_list roc_timer;