hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
....@@ -1607,18 +1607,18 @@
16071607 static int rtl8xxxu_identify_chip(struct rtl8xxxu_priv *priv)
16081608 {
16091609 struct device *dev = &priv->udev->dev;
1610
- u32 val32, bonding;
1610
+ u32 val32, bonding, sys_cfg;
16111611 u16 val16;
16121612
1613
- val32 = rtl8xxxu_read32(priv, REG_SYS_CFG);
1614
- priv->chip_cut = (val32 & SYS_CFG_CHIP_VERSION_MASK) >>
1613
+ sys_cfg = rtl8xxxu_read32(priv, REG_SYS_CFG);
1614
+ priv->chip_cut = (sys_cfg & SYS_CFG_CHIP_VERSION_MASK) >>
16151615 SYS_CFG_CHIP_VERSION_SHIFT;
1616
- if (val32 & SYS_CFG_TRP_VAUX_EN) {
1616
+ if (sys_cfg & SYS_CFG_TRP_VAUX_EN) {
16171617 dev_info(dev, "Unsupported test chip\n");
16181618 return -ENOTSUPP;
16191619 }
16201620
1621
- if (val32 & SYS_CFG_BT_FUNC) {
1621
+ if (sys_cfg & SYS_CFG_BT_FUNC) {
16221622 if (priv->chip_cut >= 3) {
16231623 sprintf(priv->chip_name, "8723BU");
16241624 priv->rtl_chip = RTL8723B;
....@@ -1640,7 +1640,7 @@
16401640 if (val32 & MULTI_GPS_FUNC_EN)
16411641 priv->has_gps = 1;
16421642 priv->is_multi_func = 1;
1643
- } else if (val32 & SYS_CFG_TYPE_ID) {
1643
+ } else if (sys_cfg & SYS_CFG_TYPE_ID) {
16441644 bonding = rtl8xxxu_read32(priv, REG_HPON_FSM);
16451645 bonding &= HPON_FSM_BONDING_MASK;
16461646 if (priv->fops->tx_desc_size ==
....@@ -1688,7 +1688,7 @@
16881688 case RTL8188E:
16891689 case RTL8192E:
16901690 case RTL8723B:
1691
- switch (val32 & SYS_CFG_VENDOR_EXT_MASK) {
1691
+ switch (sys_cfg & SYS_CFG_VENDOR_EXT_MASK) {
16921692 case SYS_CFG_VENDOR_ID_TSMC:
16931693 sprintf(priv->chip_vendor, "TSMC");
16941694 break;
....@@ -1705,7 +1705,7 @@
17051705 }
17061706 break;
17071707 default:
1708
- if (val32 & SYS_CFG_VENDOR_ID) {
1708
+ if (sys_cfg & SYS_CFG_VENDOR_ID) {
17091709 sprintf(priv->chip_vendor, "UMC");
17101710 priv->vendor_umc = 1;
17111711 } else {
....@@ -4045,6 +4045,7 @@
40454045 RCR_ACCEPT_MGMT_FRAME | RCR_HTC_LOC_CTRL |
40464046 RCR_APPEND_PHYSTAT | RCR_APPEND_ICV | RCR_APPEND_MIC;
40474047 rtl8xxxu_write32(priv, REG_RCR, val32);
4048
+ priv->regrcr = val32;
40484049
40494050 /*
40504051 * Accept all multicast
....@@ -4369,12 +4370,9 @@
43694370 void rtl8xxxu_gen2_report_connect(struct rtl8xxxu_priv *priv,
43704371 u8 macid, bool connect)
43714372 {
4372
-#ifdef RTL8XXXU_GEN2_REPORT_CONNECT
43734373 /*
4374
- * Barry Day reports this causes issues with 8192eu and 8723bu
4375
- * devices reconnecting. The reason for this is unclear, but
4376
- * until it is better understood, leave the code in place but
4377
- * disabled, so it is not lost.
4374
+ * The firmware turns on the rate control when it knows it's
4375
+ * connected to a network.
43784376 */
43794377 struct h2c_cmd h2c;
43804378
....@@ -4387,7 +4385,6 @@
43874385 h2c.media_status_rpt.parm &= ~BIT(0);
43884386
43894387 rtl8xxxu_gen2_h2c_cmd(priv, &h2c, sizeof(h2c.media_status_rpt));
4390
-#endif
43914388 }
43924389
43934390 void rtl8xxxu_gen1_init_aggregation(struct rtl8xxxu_priv *priv)
....@@ -5188,7 +5185,7 @@
51885185 pending = priv->rx_urb_pending_count;
51895186 } else {
51905187 skb = (struct sk_buff *)rx_urb->urb.context;
5191
- dev_kfree_skb(skb);
5188
+ dev_kfree_skb_irq(skb);
51925189 usb_free_urb(&rx_urb->urb);
51935190 }
51945191
....@@ -5495,9 +5492,6 @@
54955492 btcoex = &priv->bt_coex;
54965493 rarpt = &priv->ra_report;
54975494
5498
- if (priv->rf_paths > 1)
5499
- goto out;
5500
-
55015495 while (!skb_queue_empty(&priv->c2hcmd_queue)) {
55025496 spin_lock_irqsave(&priv->c2hcmd_lock, flags);
55035497 skb = __skb_dequeue(&priv->c2hcmd_queue);
....@@ -5520,7 +5514,6 @@
55205514 rarpt->txrate.flags = 0;
55215515 rate = c2h->ra_report.rate;
55225516 sgi = c2h->ra_report.sgi;
5523
- bw = c2h->ra_report.bw;
55245517
55255518 if (rate < DESC_RATE_MCS0) {
55265519 rarpt->txrate.legacy =
....@@ -5537,8 +5530,13 @@
55375530 RATE_INFO_FLAGS_SHORT_GI;
55385531 }
55395532
5540
- if (bw == RATE_INFO_BW_20)
5541
- rarpt->txrate.bw |= RATE_INFO_BW_20;
5533
+ if (skb->len >= offsetofend(typeof(*c2h), ra_report.bw)) {
5534
+ if (c2h->ra_report.bw == RTL8XXXU_CHANNEL_WIDTH_40)
5535
+ bw = RATE_INFO_BW_40;
5536
+ else
5537
+ bw = RATE_INFO_BW_20;
5538
+ rarpt->txrate.bw = bw;
5539
+ }
55425540 }
55435541 bit_rate = cfg80211_calculate_bitrate(&rarpt->txrate);
55445542 rarpt->bit_rate = bit_rate;
....@@ -5547,10 +5545,9 @@
55475545 default:
55485546 break;
55495547 }
5550
- }
55515548
5552
-out:
5553
- dev_kfree_skb(skb);
5549
+ dev_kfree_skb(skb);
5550
+ }
55545551 }
55555552
55565553 static void rtl8723bu_handle_c2h(struct rtl8xxxu_priv *priv,
....@@ -5912,7 +5909,6 @@
59125909 {
59135910 struct rtl8xxxu_priv *priv = hw->priv;
59145911 struct device *dev = &priv->udev->dev;
5915
- u16 val16;
59165912 int ret = 0, channel;
59175913 bool ht40;
59185914
....@@ -5921,14 +5917,6 @@
59215917 "%s: channel: %i (changed %08x chandef.width %02x)\n",
59225918 __func__, hw->conf.chandef.chan->hw_value,
59235919 changed, hw->conf.chandef.width);
5924
-
5925
- if (changed & IEEE80211_CONF_CHANGE_RETRY_LIMITS) {
5926
- val16 = ((hw->conf.long_frame_max_tx_count <<
5927
- RETRY_LIMIT_LONG_SHIFT) & RETRY_LIMIT_LONG_MASK) |
5928
- ((hw->conf.short_frame_max_tx_count <<
5929
- RETRY_LIMIT_SHORT_SHIFT) & RETRY_LIMIT_SHORT_MASK);
5930
- rtl8xxxu_write16(priv, REG_RETRY_LIMIT, val16);
5931
- }
59325920
59335921 if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
59345922 switch (hw->conf.chandef.width) {
....@@ -6012,7 +6000,7 @@
60126000 unsigned int *total_flags, u64 multicast)
60136001 {
60146002 struct rtl8xxxu_priv *priv = hw->priv;
6015
- u32 rcr = rtl8xxxu_read32(priv, REG_RCR);
6003
+ u32 rcr = priv->regrcr;
60166004
60176005 dev_dbg(&priv->udev->dev, "%s: changed_flags %08x, total_flags %08x\n",
60186006 __func__, changed_flags, *total_flags);
....@@ -6058,6 +6046,7 @@
60586046 */
60596047
60606048 rtl8xxxu_write32(priv, REG_RCR, rcr);
6049
+ priv->regrcr = rcr;
60616050
60626051 *total_flags &= (FIF_ALLMULTI | FIF_FCSFAIL | FIF_BCN_PRBRESP_PROMISC |
60636052 FIF_CONTROL | FIF_OTHER_BSS | FIF_PSPOLL |