Received: by 2002:ab2:6f44:0:b0:1fd:c486:4f03 with SMTP id l4csp129143lqq; Wed, 12 Jun 2024 20:03:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVIblcjXhDW5jPoe2ZsHnW2Bshknoqv4rzgiGCbkk8/HMoL+VJBMCONMwar+2bkclP3Oc1PC/L9AGOetTm1i9CrAMV29AviRqGh447HJw== X-Google-Smtp-Source: AGHT+IEi2VIjqLQ0eh3ASJFNLwE9RXr4JAkFj89nQfSQ3J/pwIN4v2Jbe5rw7a36ilzNSavBB6J5 X-Received: by 2002:a05:6830:1d58:b0:6f9:679b:9b7 with SMTP id 46e09a7af769-6fa1be58a44mr3951982a34.3.1718247789536; Wed, 12 Jun 2024 20:03:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718247789; cv=pass; d=google.com; s=arc-20160816; b=PR5BUVKuBvOfmY1zAIH0y6Xo/I1KKd8ZRp+EdrFmqWfZGheaRdC3tzO/IvUxxponoX mSgRCHeel6kgYIOZnm4rx8LzFhIAt630IAxICEAcuzA2MpaiUGkA51Xmdt9QCi6JLOuK NC+jaaJ5L6M65uq20wjvUmNfusZiJBTO14dPclcFB9GCuqGuZh+89r0mYPqhFRfRIOKE 2PFLQbptOynIH0TgYOoLyMKJqR8fPVD1EvY9IKsx6g03RrIy/Vh3NkybgvevxJ3f/gBx ZeMPHE43egO3npWwleTIovt/AeSizo1P1zjk3sdPEHvFstsIX9aIuBjw2ZGCGwz3U3Vr V3YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=rTbknuCcxBFM/pXAboNibD22DPmvjD+qglC+dC8qFos=; fh=b8DGNnKVsrXExSpBnrdhhVcVs5bOyYNQ9XQBjMVrNeo=; b=Cn3mZWXy1ELgr4ufl2pW5TCVa1+Aq9gv49kqnp9f3QC7h4Ah+3LqCIlp3j7Qdj6abu pZdFt0EzhNB1z4PaXFeHCJ99K9o9fJ0D1xnhBxNkPZO51yONR3pnQNk4XB4L1wwS3j3w CgjX+y89NBHgjuQ71AImPo3OsKw+3q0RdkSRIp/7/Ju8JbkQcwvXPlpRXejKmeCZ3pna JvUapM0r0EiLxrfHwqFzRbCaFCB2cTAvG12vNzi2DTRsD8nGIE1hPEnW27ko6CtNSXdk 557w7Je46A3ZRfQpHvbMoz1X9UjIwQ9HR9m9UFImohOtk2r/gWu3szpTPWVljmHzZpph 4hHQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-8914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccb96c29si460396b3a.294.2024.06.12.20.03.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-8914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-wireless+bounces-8914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-8914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 95C0B283956 for ; Thu, 13 Jun 2024 03:03:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5701B12CDB1; Thu, 13 Jun 2024 03:02:58 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.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 A9B4212D770 for ; Thu, 13 Jun 2024 03:02:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247778; cv=none; b=bFc3XSCfim/75WTjozEbGUXqwv3cpjc1mfRVWi0FCP8MjvK3TFDhpKEVhpBtJW2Q2+VXlkBML65tteEotPHgu+KpIYTj3ICwoQxXFv5/XWZz8IfCsws5NXeKGML+Ula3jR7jmk11U6yXXEAlsG+O9j/Mswk+ISYKou110To4ccs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718247778; c=relaxed/simple; bh=minu0oqIMObPMsMTH4Gr9qXoicCRhjR5zYsPGvDoU84=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ehfLz/ru7Is59gCyxMwaE99ERMnxRXKF6lndvdoP2mKiKockiaRkN+DL593abePaXY962CxdsMajK5pMv4p+mxrvgNqzVel2WXZdegdf03p+E/0NukcYoEdPGSoosJjAsgTMZBS5f1RmrFMYg3UlWdnXyDcqBWYwcVbePRJUnhU= 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.161.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-oo1-f50.google.com with SMTP id 006d021491bc7-5bad4e45863so24356eaf.3 for ; Wed, 12 Jun 2024 20:02:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718247776; x=1718852576; 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=rTbknuCcxBFM/pXAboNibD22DPmvjD+qglC+dC8qFos=; b=tn0FefnSvXtoiCwEpqo+8nx9cL3CsIeLY3zORYYYKofXOeK74s1ZJjL0Kb1emXOYmQ AxLrd5swTGS3Ag3YftsSDlm/39Hu90PnCdQxcTbgDtRVF9/udoZoDAbzYNdQjXuIXQ25 L0ZUJ03T3pgWyjF8B2mSsSSYZnC5gVhqU2hhK3lzRBDYHeUOd4bpaReS06FqmZyl/2zd EMF144CrLkSWUqLemAp0/kzYXrVxe1WE1uWJ69kNSGEaND62CPSfUf+f1v3gEfe0ZPzt 9VRYLaL1xU5aQMXKlGZeQKzQRKzKeGbXlKk4yvpl06INoGTVJKTucvBz1JYhZ+YwL47h ByTg== X-Forwarded-Encrypted: i=1; AJvYcCUge/mMHfU+LxGHjEauu5ut3D0wRb+WXbHihzQsvkIEMzvE/VyFI+BloDiWxS0VxkZZ7AxWRQwb/j1EtHKP4w==@vger.kernel.org X-Gm-Message-State: AOJu0YzRDC6FDDVo9rLYFQOTda5c6+cCuEYUlnuIyMF5vX+RAj7Wyc8q 5BCpOIm8TcoiL2PobS56jApeQjLDBugxXi18KsP0PpmP3i9lz3u7 X-Received: by 2002:a05:6820:2c86:b0:5aa:3e4f:f01e with SMTP id 006d021491bc7-5bb3b9c614cmr3867601eaf.1.1718247775640; Wed, 12 Jun 2024 20:02:55 -0700 (PDT) Received: from sean-ThinkPad-T450s.lan ([207.191.35.252]) by smtp.gmail.com with ESMTPSA id 006d021491bc7-5bd629263c5sm67685eaf.46.2024.06.12.20.02.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 20:02:54 -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/47] wifi: mt76: mt7925: support for split bss_info_changed method Date: Wed, 12 Jun 2024 20:01:58 -0700 Message-Id: <20240613030241.5771-5-sean.wang@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240613030241.5771-1-sean.wang@kernel.org> References: <20240613030241.5771-1-sean.wang@kernel.org> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Deren Wu The .bss_info_changed method is being split into .vif_cfg_changed and .link_info_changed to support MLD devices, but it will still support non-MLD devices. Co-developed-by: Sean Wang Signed-off-by: Sean Wang Signed-off-by: Deren Wu --- .../net/wireless/mediatek/mt76/mt7925/main.c | 132 ++++++++++-------- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 7 +- .../net/wireless/mediatek/mt76/mt7925/mcu.h | 3 +- 3 files changed, 76 insertions(+), 66 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c index 91edbe076c22..397776ddf01a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c @@ -695,65 +695,6 @@ mt7925_get_rates_table(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return mvif->basic_rates_idx; } -static void mt7925_bss_info_changed(struct ieee80211_hw *hw, - struct ieee80211_vif *vif, - struct ieee80211_bss_conf *info, - u64 changed) -{ - struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; - struct mt792x_phy *phy = mt792x_hw_phy(hw); - struct mt792x_dev *dev = mt792x_hw_dev(hw); - - mt792x_mutex_acquire(dev); - - if (changed & BSS_CHANGED_ERP_SLOT) { - int slottime = info->use_short_slot ? 9 : 20; - - if (slottime != phy->slottime) { - phy->slottime = slottime; - mt7925_mcu_set_timing(phy, vif); - } - } - - if (changed & BSS_CHANGED_MCAST_RATE) - mvif->mcast_rates_idx = - mt7925_get_rates_table(hw, vif, false, true); - - if (changed & BSS_CHANGED_BASIC_RATES) - mvif->basic_rates_idx = - mt7925_get_rates_table(hw, vif, false, false); - - if (changed & (BSS_CHANGED_BEACON | - BSS_CHANGED_BEACON_ENABLED)) { - mvif->beacon_rates_idx = - mt7925_get_rates_table(hw, vif, true, false); - - mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, - info->enable_beacon); - } - - /* ensure that enable txcmd_mode after bss_info */ - if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) - mt7925_mcu_set_tx(dev, vif); - - if (changed & BSS_CHANGED_PS) - mt7925_mcu_uni_bss_ps(dev, vif); - - if (changed & BSS_CHANGED_ASSOC) { - mt7925_mcu_sta_update(dev, NULL, vif, true, - MT76_STA_INFO_STATE_ASSOC); - mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); - } - - if (changed & BSS_CHANGED_ARP_FILTER) { - struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; - - mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76, info); - } - - mt792x_mutex_release(dev); -} - int mt7925_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif, struct ieee80211_sta *sta) { @@ -1404,6 +1345,76 @@ static void mt7925_mgd_complete_tx(struct ieee80211_hw *hw, mt7925_abort_roc(mvif->phy, mvif); } +static void mt7925_vif_cfg_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + u64 changed) +{ + struct mt792x_dev *dev = mt792x_hw_dev(hw); + + mt792x_mutex_acquire(dev); + + if (changed & BSS_CHANGED_ASSOC) { + mt7925_mcu_sta_update(dev, NULL, vif, true, + MT76_STA_INFO_STATE_ASSOC); + mt7925_mcu_set_beacon_filter(dev, vif, vif->cfg.assoc); + } + + if (changed & BSS_CHANGED_ARP_FILTER) { + struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv; + + mt7925_mcu_update_arp_filter(&dev->mt76, &mvif->bss_conf.mt76); + } + + if (changed & BSS_CHANGED_PS) + mt7925_mcu_uni_bss_ps(dev, vif); + + mt792x_mutex_release(dev); +} + +static void mt7925_link_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *info, + u64 changed) +{ + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; + struct mt792x_phy *phy = mt792x_hw_phy(hw); + struct mt792x_dev *dev = mt792x_hw_dev(hw); + + mt792x_mutex_acquire(dev); + + if (changed & BSS_CHANGED_ERP_SLOT) { + int slottime = info->use_short_slot ? 9 : 20; + + if (slottime != phy->slottime) { + phy->slottime = slottime; + mt7925_mcu_set_timing(phy, vif); + } + } + + if (changed & BSS_CHANGED_MCAST_RATE) + mvif->mcast_rates_idx = + mt7925_get_rates_table(hw, vif, false, true); + + if (changed & BSS_CHANGED_BASIC_RATES) + mvif->basic_rates_idx = + mt7925_get_rates_table(hw, vif, false, false); + + if (changed & (BSS_CHANGED_BEACON | + BSS_CHANGED_BEACON_ENABLED)) { + mvif->beacon_rates_idx = + mt7925_get_rates_table(hw, vif, true, false); + + mt7925_mcu_uni_add_beacon_offload(dev, hw, vif, + info->enable_beacon); + } + + /* ensure that enable txcmd_mode after bss_info */ + if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED)) + mt7925_mcu_set_tx(dev, vif); + + mt792x_mutex_release(dev); +} + const struct ieee80211_ops mt7925_ops = { .tx = mt792x_tx, .start = mt7925_start, @@ -1413,7 +1424,6 @@ const struct ieee80211_ops mt7925_ops = { .config = mt7925_config, .conf_tx = mt7925_conf_tx, .configure_filter = mt7925_configure_filter, - .bss_info_changed = mt7925_bss_info_changed, .start_ap = mt7925_start_ap, .stop_ap = mt7925_stop_ap, .sta_state = mt76_sta_state, @@ -1461,6 +1471,8 @@ const struct ieee80211_ops mt7925_ops = { .unassign_vif_chanctx = mt792x_unassign_vif_chanctx, .mgd_prepare_tx = mt7925_mgd_prepare_tx, .mgd_complete_tx = mt7925_mgd_complete_tx, + .vif_cfg_changed = mt7925_vif_cfg_changed, + .link_info_changed = mt7925_link_info_changed, }; 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 67c05f785190..5e72f7278e8b 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.c @@ -121,11 +121,10 @@ int mt7925_mcu_regval(struct mt792x_dev *dev, u32 regidx, u32 *val, bool set) EXPORT_SYMBOL_GPL(mt7925_mcu_regval); int mt7925_mcu_update_arp_filter(struct mt76_dev *dev, - struct mt76_vif *vif, - struct ieee80211_bss_conf *info) + struct mt76_vif *vif) { - struct ieee80211_vif *mvif = container_of(info, struct ieee80211_vif, - bss_conf); + struct ieee80211_vif *mvif = container_of((void *)vif, struct ieee80211_vif, + drv_priv); struct sk_buff *skb; int i, len = min_t(int, mvif->cfg.arp_addr_cnt, IEEE80211_BSS_ARP_ADDR_LIST_LEN); diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h index b8315a89f4a9..b499b1d0531a 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mcu.h @@ -590,6 +590,5 @@ int mt7925_mcu_set_chctx(struct mt76_phy *phy, struct mt76_vif *mvif, 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, - struct mt76_vif *vif, - struct ieee80211_bss_conf *info); + struct mt76_vif *vif); #endif -- 2.34.1