Skip to contentSkip to conversation

Feed current txrate information for mac80211

PATCH Superseded Chris Chiu 2 participants 5 messages Mar 18, 2020 – Mar 19, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chris Chiu

author
#0 lore raw

cover Feed current txrate information for mac80211

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(-)
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 1/2 rtl8xxxu: add enumeration for channel bandwidth

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.

---
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h      | 9 +++++++++
 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +9 -0
index 6598c8d786ea..86d1d50511a8 100644
@@ -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;
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -1
index 54a1a4ea107b..511a3b4ed72a 100644
@@ -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));
 
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH 2/2 rtl8xxxu: Feed current txrate information for mac80211

In reply to Chris Chiu

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.

---
 .../net/wireless/realtek/rtl8xxxu/rtl8xxxu.h  | 12 ++-
 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 75 ++++++++++++++++++-
 2 files changed, 85 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.h +11 -1
index 86d1d50511a8..e6fd1ecaca9c 100644
@@ -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 {
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +74 -1

114 lines not on this page · raw message

Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH 2/2] rtl8xxxu: Feed current txrate information for mac80211

Thank you for the patch! Perhaps something to improve:

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

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

#4 lore raw

[RFC PATCH] rtl8xxxu: rtl8xxxu_desc_to_mcsrate() can be static

In reply to Chris Chiu
Fixes: b509af994715 ("rtl8xxxu: Feed current txrate information for mac80211")
Fixes b509af994715 ("rtl8xxxu: Feed current txrate information for mac80211")
---
 rtl8xxxu_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +1 -1
index 49dfa32b572a3..4f0d0bce48b03 100644
@@ -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;