wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vif
Subsystems (2)
[email protected]
reviewerPATCH 1/2 wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vif
From: Sean Wang <[email protected]>
Move struct ieee80211_chanctx_conf up to struct mt76_vif to allow the connac2 library can access the struct ieee80211_chanctx_conf * member in struct mt76_vif.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7921/main.c | 16 ++++++++-------- .../net/wireless/mediatek/mt76/mt7921/mt7921.h | 1 - 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +1 -0
@@ -708,6 +708,7 @@ struct mt76_vif {u8 basic_rates_idx;u8 mcast_rates_idx;u8 beacon_rates_idx; +struct ieee80211_chanctx_conf *ctx; };struct mt76_phy {
drivers/net/wireless/mediatek/mt76/mt7921/main.c +8 -8
@@ -804,7 +804,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls)mt76_connac_mcu_uni_add_bss (&dev->mphy, vif, &mvif->sta.wcid, - true, mvif->ctx); + true, mvif->mt76.ctx);ewma_avg_signal_init (&msta->avg_ack_signal);
@@ -839,7 +839,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,if (!sta->tdls)mt76_connac_mcu_uni_add_bss (&dev->mphy, vif, &mvif->sta.wcid, false, - mvif->ctx); + mvif->mt76.ctx); }spin_lock_bh (&dev->mt76.sta_poll_lock);
@@ -1638,7 +1638,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mt7921_mutex_acquire (dev); err =mt76_connac_mcu_uni_add_bss (phy->mt76, vif, &mvif->sta.wcid, - true, mvif->ctx); + true, mvif->mt76.ctx);if (err) goto out;
@@ -1670,7 +1670,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out;mt76_connac_mcu_uni_add_bss (phy->mt76, vif, &mvif->sta.wcid, false, - mvif->ctx); + mvif->mt76.ctx); out:mt7921_mutex_release (dev);
@@ -1695,7 +1695,7 @@ static void mt7921_ctx_iter(void *priv, u8 *mac,struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;struct ieee80211_chanctx_conf *ctx = priv; -if (ctx != mvif->ctx) +if (ctx != mvif->mt76.ctx)return ;if (vif->type ==NL80211_IFTYPE_MONITOR )
@@ -1728,7 +1728,7 @@ mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,struct mt7921_dev *dev =mt7921_hw_dev (hw);mutex_lock (&dev->mt76.mutex); - mvif->ctx = ctx; + mvif->mt76.ctx = ctx;mutex_unlock (&dev->mt76.mutex);return 0 ;
@@ -1744,7 +1744,7 @@ mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,struct mt7921_dev *dev =mt7921_hw_dev (hw);mutex_lock (&dev->mt76.mutex); - mvif->ctx =NULL ; + mvif->mt76.ctx =NULL ;mutex_unlock (&dev->mt76.mutex); }
@@ -1758,7 +1758,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,jiffies_to_msecs (HZ );mt7921_mutex_acquire (dev); -mt7921_set_roc (mvif->phy, mvif, mvif->ctx->def.chan, duration, +mt7921_set_roc (mvif->phy, mvif, mvif->mt76.ctx->def.chan, duration,MT7921_ROC_REQ_JOIN );mt7921_mutex_release (dev); }
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +0 -1
@@ -173,7 +173,6 @@ struct mt7921_vif {struct ewma_rssi rssi;struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS ]; -struct ieee80211_chanctx_conf *ctx; };enum {
Signature · 1 line
2.25.1
[email protected]
reviewerPATCH 2/2 wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver
From: Sean Wang <[email protected]>
The variable band should be determined by the ieee80211_chanctx_conf when the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we added the extension to mt76_connac2_mac_tx_rate_val by distinguishing if it can support chanctx to fix the incorrect rate pickup.
--- drivers/net/wireless/mediatek/mt76/mac80211.c | 9 +++++++-- drivers/net/wireless/mediatek/mt76/mt76.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mac80211.c +7 -2
@@ -1698,11 +1698,16 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, }EXPORT_SYMBOL_GPL (mt76_init_queue); -u16 mt76_calculate_default_rate (struct mt76_phy *phy,int rateidx) +u16 mt76_calculate_default_rate (struct mt76_phy *phy, +struct ieee80211_vif *vif,int rateidx) { +struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; +struct cfg80211_chan_def *chandef = mvif->ctx ? + &mvif->ctx->def : + &phy->chandef;int offset =0 ; -if (phy->chandef.chan->band !=NL80211_BAND_2GHZ ) +if (chandef->chan->band !=NL80211_BAND_2GHZ ) offset =4 ;/* pick the lowest rate for hidden nodes */
drivers/net/wireless/mediatek/mt76/mt76.h +2 -1
@@ -1100,7 +1100,8 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len);struct mt76_queue *mt76_init_queue (struct mt76_dev *dev,int qid,int idx,int n_desc,int ring_base,u32 flags); -u16 mt76_calculate_default_rate (struct mt76_phy *phy,int rateidx); +u16 mt76_calculate_default_rate (struct mt76_phy *phy, +struct ieee80211_vif *vif,int rateidx);static inline int mt76_init_tx_queue (struct mt76_phy *phy,int qid,int idx,int n_desc,int ring_base,u32 flags) {
drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +5 -2
@@ -310,7 +310,10 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,struct ieee80211_vif *vif, bool beacon, bool mcast) { - u8 nss = 0, mode = 0, band = mphy->chandef.chan->band; + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; +struct cfg80211_chan_def *chandef = mvif->ctx ? + &mvif->ctx->def : &mphy->chandef; +u8 nss =0 , mode =0 , band = chandef->chan->band;int rateidx =0 , mcast_rate;if (!vif)
@@ -343,7 +346,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy, rateidx =ffs (vif->bss_conf.basic_rates) -1 ; legacy: - rateidx =mt76_calculate_default_rate (mphy, rateidx); + rateidx =mt76_calculate_default_rate (mphy, vif, rateidx); mode = rateidx >>8 ; rateidx &=GENMASK (7 ,0 ); out:
Signature · 1 line
2.25.1
Re: [PATCH 2/2] wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver
Quoted 81 lines · On Mon, Jul 24, 2023 at 5:20 PM <[email protected]> wrote:
From: Sean Wang <[email protected]>
The variable band should be determined by the
ieee80211_chanctx_confwhen the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we added the extension tomt76_connac2_mac_tx_rate_valby distinguishing if it can support chanctx to fix the incorrect rate pickup.Fixes 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")Signed-off-by Sean Wang <[email protected]>--- drivers/net/wireless/mediatek/mt76/mac80211.c | 9 +++++++-- drivers/net/wireless/mediatek/mt76/mt76.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-)drivers/net/wireless/mediatek/mt76/mac80211.c +7
-2@@ -1698,11 +1698,16 @@ mt76_init_queue(struct mt76_dev *dev, int qid, int idx, int n_desc, }EXPORT_SYMBOL_GPL (mt76_init_queue); -u16 mt76_calculate_default_rate (struct mt76_phy *phy,int rateidx) +u16 mt76_calculate_default_rate (struct mt76_phy *phy, +struct ieee80211_vif *vif,int rateidx) { +struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; +struct cfg80211_chan_def *chandef = mvif->ctx ? + &mvif->ctx->def : + &phy->chandef;int offset =0 ; -if (phy->chandef.chan->band !=NL80211_BAND_2GHZ ) +if (chandef->chan->band !=NL80211_BAND_2GHZ ) offset =4 ;/* pick the lowest rate for hidden nodes */ drivers/net/wireless/mediatek/mt76/mt76.h +2
-1@@ -1100,7 +1100,8 @@ int mt76_get_of_eeprom(struct mt76_dev *dev, void *data, int offset, int len);struct mt76_queue *mt76_init_queue (struct mt76_dev *dev,int qid,int idx,int n_desc,int ring_base,u32 flags); -u16 mt76_calculate_default_rate (struct mt76_phy *phy,int rateidx); +u16 mt76_calculate_default_rate (struct mt76_phy *phy, +struct ieee80211_vif *vif,int rateidx);static inline int mt76_init_tx_queue (struct mt76_phy *phy,int qid,int idx,int n_desc,int ring_base,u32 flags) {drivers/net/wireless/mediatek/mt76/mt76_connac_mac.c +5
-3@@ -310,7 +310,10 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy,struct ieee80211_vif *vif, bool beacon, bool mcast) { - u8 nss = 0, mode = 0, band = mphy->chandef.chan->band; + struct mt76_vif *mvif = (struct mt76_vif *)vif->drv_priv; +struct cfg80211_chan_def *chandef = mvif->ctx ? + &mvif->ctx->def : &mphy->chandef; +u8 nss =0 , mode =0 , band = chandef->chan->band;int rateidx =0 , mcast_rate;if (!vif)@@ -343,7 +346,7 @@ u16 mt76_connac2_mac_tx_rate_val(struct mt76_phy *mphy, rateidx =ffs (vif->bss_conf.basic_rates) -1 ; legacy: - rateidx =mt76_calculate_default_rate (mphy, rateidx); + rateidx =mt76_calculate_default_rate (mphy, vif, rateidx); mode = rateidx >>8 ; rateidx &=GENMASK (7 ,0 ); out: --2.25.1
Re: [PATCH 2/2] wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver
Quoted 2 lines · David Ruth
Reviewed-by David Ruth <[email protected]>Tested-by David Ruth <[email protected]>
Please don't top post and edit your quotes, otherwise use of patchwork becomes horrible for us maintainers.
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Quoted 117 lines · On Mon, Jul 24, 2023 at 5:20 PM <[email protected]> wrote:
From: Sean Wang <[email protected]>
Move struct
ieee80211_chanctx_confup to structmt76_vifto allow the connac2 library can access the structieee80211_chanctx_conf* member in structmt76_vif.Signed-off-by Sean Wang <[email protected]>--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt7921/main.c | 16 ++++++++-------- .../net/wireless/mediatek/mt76/mt7921/mt7921.h | 1 - 3 files changed, 9 insertions(+), 9 deletions(-)drivers/net/wireless/mediatek/mt76/mt76.h +1
-0@@ -708,6 +708,7 @@ struct mt76_vif {u8 basic_rates_idx;u8 mcast_rates_idx;u8 beacon_rates_idx; +struct ieee80211_chanctx_conf *ctx; };struct mt76_phy {drivers/net/wireless/mediatek/mt76/mt7921/main.c +8
-8@@ -804,7 +804,7 @@ void mt7921_mac_sta_assoc(struct mt76_dev *mdev, struct ieee80211_vif *vif,if (vif->type ==NL80211_IFTYPE_STATION && !sta->tdls)mt76_connac_mcu_uni_add_bss (&dev->mphy, vif, &mvif->sta.wcid, - true, mvif->ctx); + true, mvif->mt76.ctx);ewma_avg_signal_init (&msta->avg_ack_signal);@@ -839,7 +839,7 @@ void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,if (!sta->tdls)mt76_connac_mcu_uni_add_bss (&dev->mphy, vif, &mvif->sta.wcid, false, - mvif->ctx); + mvif->mt76.ctx); }spin_lock_bh (&dev->mt76.sta_poll_lock);@@ -1638,7 +1638,7 @@ mt7921_start_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,mt7921_mutex_acquire (dev); err =mt76_connac_mcu_uni_add_bss (phy->mt76, vif, &mvif->sta.wcid, - true, mvif->ctx); + true, mvif->mt76.ctx);if (err) goto out;@@ -1670,7 +1670,7 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out;mt76_connac_mcu_uni_add_bss (phy->mt76, vif, &mvif->sta.wcid, false, - mvif->ctx); + mvif->mt76.ctx); out:mt7921_mutex_release (dev);@@ -1695,7 +1695,7 @@ static void mt7921_ctx_iter(void *priv, u8 *mac,struct mt7921_vif *mvif = (struct mt7921_vif *)vif->drv_priv;struct ieee80211_chanctx_conf *ctx = priv; -if (ctx != mvif->ctx) +if (ctx != mvif->mt76.ctx)return ;if (vif->type ==NL80211_IFTYPE_MONITOR )@@ -1728,7 +1728,7 @@ mt7921_assign_vif_chanctx(struct ieee80211_hw *hw,struct mt7921_dev *dev =mt7921_hw_dev (hw);mutex_lock (&dev->mt76.mutex); - mvif->ctx = ctx; + mvif->mt76.ctx = ctx;mutex_unlock (&dev->mt76.mutex);return 0 ;@@ -1744,7 +1744,7 @@ mt7921_unassign_vif_chanctx(struct ieee80211_hw *hw,struct mt7921_dev *dev =mt7921_hw_dev (hw);mutex_lock (&dev->mt76.mutex); - mvif->ctx =NULL ; + mvif->mt76.ctx =NULL ;mutex_unlock (&dev->mt76.mutex); }@@ -1758,7 +1758,7 @@ static void mt7921_mgd_prepare_tx(struct ieee80211_hw *hw,jiffies_to_msecs (HZ );mt7921_mutex_acquire (dev); -mt7921_set_roc (mvif->phy, mvif, mvif->ctx->def.chan, duration, +mt7921_set_roc (mvif->phy, mvif, mvif->mt76.ctx->def.chan, duration,MT7921_ROC_REQ_JOIN );mt7921_mutex_release (dev); }drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +0
-2@@ -173,7 +173,6 @@ struct mt7921_vif {struct ewma_rssi rssi;struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS ]; -struct ieee80211_chanctx_conf *ctx; };enum { --2.25.1