Message ID | 20210319054218.3319-3-pkshih@realtek.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Kalle Valo |
Headers | show |
Series | rtw88: add some fixes and 8822c features | expand |
Ping-Ke Shih <pkshih@realtek.com> wrote: > From: Shao-Fu Cheng <shaofu@realtek.com> > > By default the driver uses the 1M and 6M rate for managemnt frames > in 2G and 5G bands respectively. But when the basic rates is configured > from the mac80211, we need to send the management frames according the > basic rates. > > This commit makes the driver use the lowest basic rates to send > the management frames and a debufs entry to enable/disable force to use > the lowest rate 1M/6M for 2.4G/5G bands. > > obtain current setting > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > force lowest rate: > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Why is a debugfs interface needed?
> -----Original Message----- > From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On > Behalf Of Kalle Valo > Sent: Sunday, April 11, 2021 5:21 PM > To: Pkshih > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven Ting; > Kevin Yang > Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > Ping-Ke Shih <pkshih@realtek.com> wrote: > > > From: Shao-Fu Cheng <shaofu@realtek.com> > > > > By default the driver uses the 1M and 6M rate for managemnt frames > > in 2G and 5G bands respectively. But when the basic rates is configured > > from the mac80211, we need to send the management frames according the > > basic rates. > > > > This commit makes the driver use the lowest basic rates to send > > the management frames and a debufs entry to enable/disable force to use > > the lowest rate 1M/6M for 2.4G/5G bands. > > > > obtain current setting > > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > force lowest rate: > > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> > > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> > > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> > > Why is a debugfs interface needed? > By default, driver follows AP's basic rates that may be 24M and above, and does association with 24M rate. If AP is far away, it may be hard to communicate with 24M rate. Therefore, we add a debugfs to allow driver to send management frames with low rate 6M or 1M. -- Ping-Ke
Pkshih <pkshih@realtek.com> writes: >> -----Original Message----- >> From: kvalo=codeaurora.org@mg.codeaurora.org >> [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On >> Behalf Of Kalle Valo >> Sent: Sunday, April 11, 2021 5:21 PM >> To: Pkshih >> Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; >> Bernie Huang; Shaofu; Steven Ting; >> Kevin Yang >> Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame >> >> Ping-Ke Shih <pkshih@realtek.com> wrote: >> >> > From: Shao-Fu Cheng <shaofu@realtek.com> >> > >> > By default the driver uses the 1M and 6M rate for managemnt frames >> > in 2G and 5G bands respectively. But when the basic rates is configured >> > from the mac80211, we need to send the management frames according the >> > basic rates. >> > >> > This commit makes the driver use the lowest basic rates to send >> > the management frames and a debufs entry to enable/disable force to use >> > the lowest rate 1M/6M for 2.4G/5G bands. >> > >> > obtain current setting >> > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates >> > >> > force lowest rate: >> > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates >> > >> > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> >> > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> >> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> >> >> Why is a debugfs interface needed? >> > > By default, driver follows AP's basic rates that may be 24M and above, and > does association with 24M rate. If AP is far away, it may be hard to communicate > with 24M rate. Therefore, we add a debugfs to allow driver to send management > frames with low rate 6M or 1M. debugfs is for R&D level testing and debugging, not normal user configuration. To me it looks like something like that should be in nl80211.
> -----Original Message----- > From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On > Behalf Of Kalle Valo > Sent: Monday, April 12, 2021 7:47 PM > To: Pkshih > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven Ting; > Kevin Yang > Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > Pkshih <pkshih@realtek.com> writes: > > >> -----Original Message----- > >> From: kvalo=codeaurora.org@mg.codeaurora.org > >> [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On > >> Behalf Of Kalle Valo > >> Sent: Sunday, April 11, 2021 5:21 PM > >> To: Pkshih > >> Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; > >> Bernie Huang; Shaofu; Steven Ting; > >> Kevin Yang > >> Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > >> > >> Ping-Ke Shih <pkshih@realtek.com> wrote: > >> > >> > From: Shao-Fu Cheng <shaofu@realtek.com> > >> > > >> > By default the driver uses the 1M and 6M rate for managemnt frames > >> > in 2G and 5G bands respectively. But when the basic rates is configured > >> > from the mac80211, we need to send the management frames according the > >> > basic rates. > >> > > >> > This commit makes the driver use the lowest basic rates to send > >> > the management frames and a debufs entry to enable/disable force to use > >> > the lowest rate 1M/6M for 2.4G/5G bands. > >> > > >> > obtain current setting > >> > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > >> > > >> > force lowest rate: > >> > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > >> > > >> > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> > >> > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> > >> > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> > >> > >> Why is a debugfs interface needed? > >> > > > > By default, driver follows AP's basic rates that may be 24M and above, and > > does association with 24M rate. If AP is far away, it may be hard to communicate > > with 24M rate. Therefore, we add a debugfs to allow driver to send management > > frames with low rate 6M or 1M. > > debugfs is for R&D level testing and debugging, not normal user > configuration. To me it looks like something like that should be in > nl80211. > I do not expect that the users could configure the basic rate for station by the normal way such as nl80211. This debugfs is for debugging purpose, not for normal user. -- Ping-Ke
> -----Original Message----- > From: Pkshih [mailto:pkshih@realtek.com] > Sent: Monday, April 12, 2021 4:11 PM > To: Kalle Valo > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven Ting; > Kevin Yang > Subject: RE: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > > > -----Original Message----- > > From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On > > Behalf Of Kalle Valo > > Sent: Sunday, April 11, 2021 5:21 PM > > To: Pkshih > > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven > Ting; > > Kevin Yang > > Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > > > Ping-Ke Shih <pkshih@realtek.com> wrote: > > > > > From: Shao-Fu Cheng <shaofu@realtek.com> > > > > > > By default the driver uses the 1M and 6M rate for managemnt frames > > > in 2G and 5G bands respectively. But when the basic rates is configured > > > from the mac80211, we need to send the management frames according the > > > basic rates. > > > > > > This commit makes the driver use the lowest basic rates to send > > > the management frames and a debufs entry to enable/disable force to use > > > the lowest rate 1M/6M for 2.4G/5G bands. > > > > > > obtain current setting > > > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > > > force lowest rate: > > > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > > > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> > > > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> > > > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> > > > > Why is a debugfs interface needed? > > > > By default, driver follows AP's basic rates that may be 24M and above, and > does association with 24M rate. If AP is far away, it may be hard to communicate > with 24M rate. Therefore, we add a debugfs to allow driver to send management > frames with low rate 6M or 1M. > If an AP is configured basic rate 24M or above, I think the IT wants STA follows the rates. If we have an interface for normal users, it will break the IT's desire. So, we use a debugfs to help remote debug only, in case user reports he can't connect to an AP with low RSSI. I think it's worth that driver can follow AP's basic rate, so I make it as an individual patch; debugfs as second one. If you need to think if debugfs is necessary, I hope we can land the first patch first. The patchset is sent https://lore.kernel.org/linux-wireless/20210422030413.9738-1-pkshih@realtek.com/T/#t -- Ping-Ke
> -----Original Message----- > From: Pkshih > Sent: Thursday, April 22, 2021 11:28 AM > To: Pkshih; Kalle Valo > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven Ting; > Kevin Yang > Subject: RE: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > > > -----Original Message----- > > From: Pkshih [mailto:pkshih@realtek.com] > > Sent: Monday, April 12, 2021 4:11 PM > > To: Kalle Valo > > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven > Ting; > > Kevin Yang > > Subject: RE: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > > > > > > -----Original Message----- > > > From: kvalo=codeaurora.org@mg.codeaurora.org [mailto:kvalo=codeaurora.org@mg.codeaurora.org] On > > > Behalf Of Kalle Valo > > > Sent: Sunday, April 11, 2021 5:21 PM > > > To: Pkshih > > > Cc: tony0620emma@gmail.com; linux-wireless@vger.kernel.org; DeanKu; Bernie Huang; Shaofu; Steven > > Ting; > > > Kevin Yang > > > Subject: Re: [PATCH 2/7] rtw88: follow the AP basic rates for tx mgmt frame > > > > > > Ping-Ke Shih <pkshih@realtek.com> wrote: > > > > > > > From: Shao-Fu Cheng <shaofu@realtek.com> > > > > > > > > By default the driver uses the 1M and 6M rate for managemnt frames > > > > in 2G and 5G bands respectively. But when the basic rates is configured > > > > from the mac80211, we need to send the management frames according the > > > > basic rates. > > > > > > > > This commit makes the driver use the lowest basic rates to send > > > > the management frames and a debufs entry to enable/disable force to use > > > > the lowest rate 1M/6M for 2.4G/5G bands. > > > > > > > > obtain current setting > > > > cat /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > > > > > force lowest rate: > > > > echo 1 > /sys/kernel/debug/ieee80211/phyX/rtw88/basic_rates > > > > > > > > Signed-off-by: Shao-Fu Cheng <shaofu@realtek.com> > > > > Signed-off-by: Yu-Yen Ting <steventing@realtek.com> > > > > Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> > > > > > > Why is a debugfs interface needed? > > > > > > > By default, driver follows AP's basic rates that may be 24M and above, and > > does association with 24M rate. If AP is far away, it may be hard to communicate > > with 24M rate. Therefore, we add a debugfs to allow driver to send management > > frames with low rate 6M or 1M. > > > > If an AP is configured basic rate 24M or above, I think the IT wants STA follows > the rates. If we have an interface for normal users, it will break the IT's desire. > So, we use a debugfs to help remote debug only, in case user reports he can't > connect to an AP with low RSSI. > > I think it's worth that driver can follow AP's basic rate, so I make it as an > individual patch; debugfs as second one. If you need to think if debugfs is necessary, > I hope we can land the first patch first. > > The patchset is sent > https://lore.kernel.org/linux-wireless/20210422030413.9738-1-pkshih@realtek.com/T/#t > Gentle ping. Since the state of patch v2 is still New in patchwork, I'd like to know if there's something I need to do for this patch, or I just wait for reviewing. Thank you -- Ping-Ke
diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c index 4539b673f6fd..067ce361e4fb 100644 --- a/drivers/net/wireless/realtek/rtw88/debug.c +++ b/drivers/net/wireless/realtek/rtw88/debug.c @@ -853,6 +853,39 @@ static int rtw_debugfs_get_fw_crash(struct seq_file *m, void *v) return 0; } +static ssize_t rtw_debugfs_set_basic_rates(struct file *filp, + const char __user *buffer, + size_t count, loff_t *loff) +{ + struct seq_file *seqpriv = (struct seq_file *)filp->private_data; + struct rtw_debugfs_priv *debugfs_priv = seqpriv->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + bool input; + int err; + + err = kstrtobool_from_user(buffer, count, &input); + if (err) + return err; + + if (input) + set_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags); + else + clear_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags); + + return count; +} + +static int rtw_debugfs_get_basic_rates(struct seq_file *m, void *v) +{ + struct rtw_debugfs_priv *debugfs_priv = m->private; + struct rtw_dev *rtwdev = debugfs_priv->rtwdev; + + seq_printf(m, "use lowest: %d\n", + test_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags)); + + return 0; +} + #define rtw_debug_impl_mac(page, addr) \ static struct rtw_debugfs_priv rtw_debug_priv_mac_ ##page = { \ .cb_read = rtw_debug_get_mac_page, \ @@ -961,6 +994,11 @@ static struct rtw_debugfs_priv rtw_debug_priv_fw_crash = { .cb_read = rtw_debugfs_get_fw_crash, }; +static struct rtw_debugfs_priv rtw_debug_priv_basic_rates = { + .cb_write = rtw_debugfs_set_basic_rates, + .cb_read = rtw_debugfs_get_basic_rates, +}; + #define rtw_debugfs_add_core(name, mode, fopname, parent) \ do { \ rtw_debug_priv_ ##name.rtwdev = rtwdev; \ @@ -1035,6 +1073,7 @@ void rtw_debugfs_init(struct rtw_dev *rtwdev) rtw_debugfs_add_r(rf_dump); rtw_debugfs_add_r(tx_pwr_tbl); rtw_debugfs_add_rw(fw_crash); + rtw_debugfs_add_rw(basic_rates); } #endif /* CONFIG_RTW88_DEBUGFS */ diff --git a/drivers/net/wireless/realtek/rtw88/main.h b/drivers/net/wireless/realtek/rtw88/main.h index d185209ee3cc..e01eb7feed4e 100644 --- a/drivers/net/wireless/realtek/rtw88/main.h +++ b/drivers/net/wireless/realtek/rtw88/main.h @@ -362,6 +362,7 @@ enum rtw_flags { RTW_FLAG_BUSY_TRAFFIC, RTW_FLAG_WOWLAN, RTW_FLAG_RESTARTING, + RTW_FLAG_USE_LOWEST_RATE, NUM_OF_RTW_FLAGS, }; diff --git a/drivers/net/wireless/realtek/rtw88/tx.c b/drivers/net/wireless/realtek/rtw88/tx.c index 0193708fc013..0aeed15736c8 100644 --- a/drivers/net/wireless/realtek/rtw88/tx.c +++ b/drivers/net/wireless/realtek/rtw88/tx.c @@ -233,17 +233,34 @@ void rtw_tx_report_handle(struct rtw_dev *rtwdev, struct sk_buff *skb, int src) spin_unlock_irqrestore(&tx_report->q_lock, flags); } +static u8 rtw_get_mgmt_rate(struct rtw_dev *rtwdev, struct sk_buff *skb, + u8 lowest_rate, bool ignore_rate) +{ + struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); + struct ieee80211_vif *vif = tx_info->control.vif; + bool use_lowest = test_bit(RTW_FLAG_USE_LOWEST_RATE, rtwdev->flags); + + if (!vif || !vif->bss_conf.basic_rates || ignore_rate || use_lowest) + return lowest_rate; + + return __ffs(vif->bss_conf.basic_rates) + lowest_rate; +} + static void rtw_tx_pkt_info_update_rate(struct rtw_dev *rtwdev, struct rtw_tx_pkt_info *pkt_info, - struct sk_buff *skb) + struct sk_buff *skb, + bool ignore_rate) { if (rtwdev->hal.current_band_type == RTW_BAND_2G) { pkt_info->rate_id = RTW_RATEID_B_20M; - pkt_info->rate = DESC_RATE1M; + pkt_info->rate = rtw_get_mgmt_rate(rtwdev, skb, DESC_RATE1M, + ignore_rate); } else { pkt_info->rate_id = RTW_RATEID_G; - pkt_info->rate = DESC_RATE6M; + pkt_info->rate = rtw_get_mgmt_rate(rtwdev, skb, DESC_RATE6M, + ignore_rate); } + pkt_info->use_rate = true; pkt_info->dis_rate_fallback = true; } @@ -280,7 +297,7 @@ static void rtw_tx_mgmt_pkt_info_update(struct rtw_dev *rtwdev, struct ieee80211_sta *sta, struct sk_buff *skb) { - rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb); + rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb, false); pkt_info->dis_qselseq = true; pkt_info->en_hwseq = true; pkt_info->hw_ssn_sel = 0; @@ -404,7 +421,7 @@ void rtw_tx_rsvd_page_pkt_info_update(struct rtw_dev *rtwdev, if (type != RSVD_BEACON && type != RSVD_DUMMY) pkt_info->qsel = TX_DESC_QSEL_MGMT; - rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb); + rtw_tx_pkt_info_update_rate(rtwdev, pkt_info, skb, true); bmc = is_broadcast_ether_addr(hdr->addr1) || is_multicast_ether_addr(hdr->addr1);