* [PATCH 0/2] Feed current txrate information for mac80211 @ 2020-03-18 8:26 Chris Chiu 2020-03-18 8:26 ` [PATCH 1/2] rtl8xxxu: add enumeration for channel bandwidth Chris Chiu 2020-03-18 8:27 ` [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 Chris Chiu 0 siblings, 2 replies; 7+ messages in thread From: Chris Chiu @ 2020-03-18 8:26 UTC (permalink / raw) To: Jes.Sorensen, kvalo, davem; +Cc: linux-wireless, netdev, linux-kernel, linux This patchset fills the txrate, sgi, bandwidth information in the sta_statistics function. Then the nl80211 commands such as 'iw link' can show the correct txrate information. Chris Chiu (2): rtl8xxxu: add enumeration for channel bandwidth rtl8xxxu: Feed current txrate information for nl80211 commands .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 21 ++++- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 77 ++++++++++++++++++- 2 files changed, 95 insertions(+), 3 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] rtl8xxxu: add enumeration for channel bandwidth 2020-03-18 8:26 [PATCH 0/2] Feed current txrate information for mac80211 Chris Chiu @ 2020-03-18 8:26 ` Chris Chiu 2020-03-18 8:27 ` [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 Chris Chiu 1 sibling, 0 replies; 7+ messages in thread From: Chris Chiu @ 2020-03-18 8:26 UTC (permalink / raw) To: Jes.Sorensen, kvalo, davem; +Cc: linux-wireless, netdev, linux-kernel, linux There's a data field in H2C and C2H commands which is used to carry channel bandwidth information. Add enumeration to make it more descriptive in code. Signed-off-by: Chris Chiu <chiu@endlessm.com> --- drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 9 +++++++++ drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 6598c8d786ea..86d1d50511a8 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1133,6 +1133,15 @@ enum bt_mp_oper_opcode_8723b { BT_MP_OP_ENABLE_CFO_TRACKING = 0x24, }; +enum rtl8xxxu_bw_mode { + RTL8XXXU_CHANNEL_WIDTH_20 = 0, + RTL8XXXU_CHANNEL_WIDTH_40 = 1, + RTL8XXXU_CHANNEL_WIDTH_80 = 2, + RTL8XXXU_CHANNEL_WIDTH_160 = 3, + RTL8XXXU_CHANNEL_WIDTH_80_80 = 4, + RTL8XXXU_CHANNEL_WIDTH_MAX = 5, +}; + struct rtl8723bu_c2h { u8 id; u8 seq; diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 54a1a4ea107b..511a3b4ed72a 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -4328,7 +4328,7 @@ void rtl8xxxu_gen2_update_rate_mask(struct rtl8xxxu_priv *priv, u32 ramask, u8 rateid, int sgi) { struct h2c_cmd h2c; - u8 bw = 0; + u8 bw = RTL8XXXU_CHANNEL_WIDTH_20; memset(&h2c, 0, sizeof(struct h2c_cmd)); -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 2020-03-18 8:26 [PATCH 0/2] Feed current txrate information for mac80211 Chris Chiu 2020-03-18 8:26 ` [PATCH 1/2] rtl8xxxu: add enumeration for channel bandwidth Chris Chiu @ 2020-03-18 8:27 ` Chris Chiu 2020-03-19 0:52 ` kbuild test robot 2020-03-19 0:52 ` kbuild test robot 1 sibling, 2 replies; 7+ messages in thread From: Chris Chiu @ 2020-03-18 8:27 UTC (permalink / raw) To: Jes.Sorensen, kvalo, davem; +Cc: linux-wireless, netdev, linux-kernel, linux The nl80211 commands such as 'iw link' can't get current txrate information from the driver. This commit fills in the tx rate information from the C2H RA report in the sta_statistics function. Signed-off-by: Chris Chiu <chiu@endlessm.com> --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h | 12 ++- .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 75 ++++++++++++++++++- 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h index 86d1d50511a8..e6fd1ecaca9c 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h @@ -1183,13 +1183,16 @@ struct rtl8723bu_c2h { } __packed bt_info; struct { u8 rate:7; - u8 dummy0_0:1; + u8 sgi:1; u8 macid; u8 ldpc:1; u8 txbf:1; u8 noisy_state:1; u8 dummy2_0:5; u8 dummy3_0; + u8 dummy4_0; + u8 dummy5_0; + u8 bw; } __packed ra_report; }; }; @@ -1269,6 +1272,12 @@ struct rtl8xxxu_btcoex { #define RTL8XXXU_SNR_THRESH_HIGH 50 #define RTL8XXXU_SNR_THRESH_LOW 20 +struct rtl8xxxu_ra_report { + struct rate_info txrate; + u32 bit_rate; + u8 desc_rate; +}; + struct rtl8xxxu_priv { struct ieee80211_hw *hw; struct usb_device *udev; @@ -1384,6 +1393,7 @@ struct rtl8xxxu_priv { struct sk_buff_head c2hcmd_queue; spinlock_t c2hcmd_lock; struct rtl8xxxu_btcoex bt_coex; + struct rtl8xxxu_ra_report ra_report; }; struct rtl8xxxu_rx_urb { diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 511a3b4ed72a..49dfa32b572a 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5389,6 +5389,35 @@ void rtl8723bu_handle_bt_info(struct rtl8xxxu_priv *priv) } } +static struct ieee80211_rate rtl8xxxu_legacy_ratetable[] = { + {.bitrate = 10, .hw_value = 0x00,}, + {.bitrate = 20, .hw_value = 0x01,}, + {.bitrate = 55, .hw_value = 0x02,}, + {.bitrate = 110, .hw_value = 0x03,}, + {.bitrate = 60, .hw_value = 0x04,}, + {.bitrate = 90, .hw_value = 0x05,}, + {.bitrate = 120, .hw_value = 0x06,}, + {.bitrate = 180, .hw_value = 0x07,}, + {.bitrate = 240, .hw_value = 0x08,}, + {.bitrate = 360, .hw_value = 0x09,}, + {.bitrate = 480, .hw_value = 0x0a,}, + {.bitrate = 540, .hw_value = 0x0b,}, +}; + +void rtl8xxxu_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) +{ + if (rate <= DESC_RATE_54M) + return; + + if (rate >= DESC_RATE_MCS0 && rate <= DESC_RATE_MCS15) { + if (rate < DESC_RATE_MCS8) + *nss = 1; + else + *nss = 2; + *mcs = rate - DESC_RATE_MCS0; + } +} + static void rtl8xxxu_c2hcmd_callback(struct work_struct *work) { struct rtl8xxxu_priv *priv; @@ -5397,9 +5426,14 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work) unsigned long flags; u8 bt_info = 0; struct rtl8xxxu_btcoex *btcoex; + struct rtl8xxxu_ra_report *rarpt; + u8 rate, sgi, bw; + u32 bit_rate; + u8 mcs = 0, nss = 0; priv = container_of(work, struct rtl8xxxu_priv, c2hcmd_work); btcoex = &priv->bt_coex; + rarpt = &priv->ra_report; if (priv->rf_paths > 1) goto out; @@ -5422,6 +5456,34 @@ static void rtl8xxxu_c2hcmd_callback(struct work_struct *work) } rtl8723bu_handle_bt_info(priv); break; + case C2H_8723B_RA_REPORT: + rarpt->txrate.flags = 0; + rate = c2h->ra_report.rate; + sgi = c2h->ra_report.sgi; + bw = c2h->ra_report.bw; + + if (rate < DESC_RATE_MCS0) { + rarpt->txrate.legacy = + rtl8xxxu_legacy_ratetable[rate].bitrate; + } else { + rtl8xxxu_desc_to_mcsrate(rate, &mcs, &nss); + rarpt->txrate.flags |= RATE_INFO_FLAGS_MCS; + + rarpt->txrate.mcs = mcs; + rarpt->txrate.nss = nss; + + if (sgi) { + rarpt->txrate.flags |= + RATE_INFO_FLAGS_SHORT_GI; + } + + if (bw == RATE_INFO_BW_20) + rarpt->txrate.bw |= RATE_INFO_BW_20; + } + bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate); + rarpt->bit_rate = bit_rate; + rarpt->desc_rate = rate; + break; default: break; } @@ -5465,7 +5527,7 @@ static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv, case C2H_8723B_RA_REPORT: dev_dbg(dev, "C2H RA RPT: rate %02x, unk %i, macid %02x, noise %i\n", - c2h->ra_report.rate, c2h->ra_report.dummy0_0, + c2h->ra_report.rate, c2h->ra_report.sgi, c2h->ra_report.macid, c2h->ra_report.noisy_state); break; default: @@ -6069,6 +6131,16 @@ rtl8xxxu_ampdu_action(struct ieee80211_hw *hw, struct ieee80211_vif *vif, return 0; } +static void +rtl8xxxu_sta_statistics(struct ieee80211_hw *hw, struct ieee80211_vif *vif, + struct ieee80211_sta *sta, struct station_info *sinfo) +{ + struct rtl8xxxu_priv *priv = hw->priv; + + sinfo->txrate = priv->ra_report.txrate; + sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE); +} + static u8 rtl8xxxu_signal_to_snr(int signal) { if (signal < RTL8XXXU_NOISE_FLOOR_MIN) @@ -6371,6 +6443,7 @@ static const struct ieee80211_ops rtl8xxxu_ops = { .sw_scan_complete = rtl8xxxu_sw_scan_complete, .set_key = rtl8xxxu_set_key, .ampdu_action = rtl8xxxu_ampdu_action, + .sta_statistics = rtl8xxxu_sta_statistics, }; static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv, -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 2020-03-18 8:27 ` [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 Chris Chiu @ 2020-03-19 0:52 ` kbuild test robot 2020-03-19 0:52 ` kbuild test robot 1 sibling, 0 replies; 7+ messages in thread From: kbuild test robot @ 2020-03-19 0:52 UTC (permalink / raw) To: Chris Chiu Cc: kbuild-all, Jes.Sorensen, kvalo, davem, linux-wireless, netdev, linux-kernel, linux Hi Chris, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on v5.6-rc6] [also build test WARNING on next-20200318] [cannot apply to jes/rtl8xxxu-devel] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Chris-Chiu/Feed-current-txrate-information-for-mac80211/20200318-194357 base: fb33c6510d5595144d585aa194d377cf74d31911 reproduce: # apt-get install sparse # sparse version: v0.6.1-180-g0558317d-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:4819:17: sparse: sparse: cast from restricted __le16 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:4892:17: sparse: sparse: cast from restricted __le16 >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:5407:6: sparse: sparse: symbol 'rtl8xxxu_desc_to_mcsrate' was not declared. Should it be static? Please review and possibly fold the followup patch. --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 @ 2020-03-19 0:52 ` kbuild test robot 0 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2020-03-19 0:52 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 1507 bytes --] Hi Chris, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on v5.6-rc6] [also build test WARNING on next-20200318] [cannot apply to jes/rtl8xxxu-devel] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Chris-Chiu/Feed-current-txrate-information-for-mac80211/20200318-194357 base: fb33c6510d5595144d585aa194d377cf74d31911 reproduce: # apt-get install sparse # sparse version: v0.6.1-180-g0558317d-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> sparse warnings: (new ones prefixed by >>) drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:4819:17: sparse: sparse: cast from restricted __le16 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:4892:17: sparse: sparse: cast from restricted __le16 >> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:5407:6: sparse: sparse: symbol 'rtl8xxxu_desc_to_mcsrate' was not declared. Should it be static? Please review and possibly fold the followup patch. --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* [RFC PATCH] rtl8xxxu: rtl8xxxu_desc_to_mcsrate() can be static 2020-03-18 8:27 ` [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 Chris Chiu @ 2020-03-19 0:52 ` kbuild test robot 2020-03-19 0:52 ` kbuild test robot 1 sibling, 0 replies; 7+ messages in thread From: kbuild test robot @ 2020-03-19 0:52 UTC (permalink / raw) To: Chris Chiu Cc: kbuild-all, Jes.Sorensen, kvalo, davem, linux-wireless, netdev, linux-kernel, linux Fixes: b509af994715 ("rtl8xxxu: Feed current txrate information for mac80211") Signed-off-by: kbuild test robot <lkp@intel.com> --- rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 49dfa32b572a3..4f0d0bce48b03 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5404,7 +5404,7 @@ static struct ieee80211_rate rtl8xxxu_legacy_ratetable[] = { {.bitrate = 540, .hw_value = 0x0b,}, }; -void rtl8xxxu_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) +static void rtl8xxxu_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) { if (rate <= DESC_RATE_54M) return; ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [RFC PATCH] rtl8xxxu: rtl8xxxu_desc_to_mcsrate() can be static @ 2020-03-19 0:52 ` kbuild test robot 0 siblings, 0 replies; 7+ messages in thread From: kbuild test robot @ 2020-03-19 0:52 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 807 bytes --] Fixes: b509af994715 ("rtl8xxxu: Feed current txrate information for mac80211") Signed-off-by: kbuild test robot <lkp@intel.com> --- rtl8xxxu_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 49dfa32b572a3..4f0d0bce48b03 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -5404,7 +5404,7 @@ static struct ieee80211_rate rtl8xxxu_legacy_ratetable[] = { {.bitrate = 540, .hw_value = 0x0b,}, }; -void rtl8xxxu_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) +static void rtl8xxxu_desc_to_mcsrate(u16 rate, u8 *mcs, u8 *nss) { if (rate <= DESC_RATE_54M) return; ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-03-19 0:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-03-18 8:26 [PATCH 0/2] Feed current txrate information for mac80211 Chris Chiu 2020-03-18 8:26 ` [PATCH 1/2] rtl8xxxu: add enumeration for channel bandwidth Chris Chiu 2020-03-18 8:27 ` [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211 Chris Chiu 2020-03-19 0:52 ` kbuild test robot 2020-03-19 0:52 ` kbuild test robot 2020-03-19 0:52 ` [RFC PATCH] rtl8xxxu: rtl8xxxu_desc_to_mcsrate() can be static kbuild test robot 2020-03-19 0:52 ` kbuild test robot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.