]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Mar 2021 12:16:24 +0000 (13:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Mar 2021 12:16:24 +0000 (13:16 +0100)
added patches:
net-dsa-tag_rtl4_a-fix-egress-tags.patch
net-enetc-don-t-overwrite-the-rss-indirection-table-when-initializing.patch
net-enetc-take-the-mdio-lock-only-once-per-napi-poll-cycle.patch
sh_eth-fix-trscer-mask-for-sh771x.patch

queue-5.10/net-dsa-tag_rtl4_a-fix-egress-tags.patch [new file with mode: 0644]
queue-5.10/net-enetc-don-t-overwrite-the-rss-indirection-table-when-initializing.patch [new file with mode: 0644]
queue-5.10/net-enetc-take-the-mdio-lock-only-once-per-napi-poll-cycle.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/sh_eth-fix-trscer-mask-for-sh771x.patch [new file with mode: 0644]

diff --git a/queue-5.10/net-dsa-tag_rtl4_a-fix-egress-tags.patch b/queue-5.10/net-dsa-tag_rtl4_a-fix-egress-tags.patch
new file mode 100644 (file)
index 0000000..0386192
--- /dev/null
@@ -0,0 +1,67 @@
+From 9eb8bc593a5eed167dac2029abef343854c5ba75 Mon Sep 17 00:00:00 2001
+From: DENG Qingfang <dqfext@gmail.com>
+Date: Mon, 1 Mar 2021 01:08:23 +0800
+Subject: net: dsa: tag_rtl4_a: fix egress tags
+
+From: DENG Qingfang <dqfext@gmail.com>
+
+commit 9eb8bc593a5eed167dac2029abef343854c5ba75 upstream.
+
+Commit 86dd9868b878 has several issues, but was accepted too soon
+before anyone could take a look.
+
+- Double free. dsa_slave_xmit() will free the skb if the xmit function
+  returns NULL, but the skb is already freed by eth_skb_pad(). Use
+  __skb_put_padto() to avoid that.
+- Unnecessary allocation. It has been done by DSA core since commit
+  a3b0b6479700.
+- A u16 pointer points to skb data. It should be __be16 for network
+  byte order.
+- Typo in comments. "numer" -> "number".
+
+Fixes: 86dd9868b878 ("net: dsa: tag_rtl4_a: Support also egress tags")
+Signed-off-by: DENG Qingfang <dqfext@gmail.com>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/dsa/tag_rtl4_a.c |   12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+--- a/net/dsa/tag_rtl4_a.c
++++ b/net/dsa/tag_rtl4_a.c
+@@ -35,14 +35,12 @@ static struct sk_buff *rtl4a_tag_xmit(st
+                                     struct net_device *dev)
+ {
+       struct dsa_port *dp = dsa_slave_to_port(dev);
++      __be16 *p;
+       u8 *tag;
+-      u16 *p;
+       u16 out;
+       /* Pad out to at least 60 bytes */
+-      if (unlikely(eth_skb_pad(skb)))
+-              return NULL;
+-      if (skb_cow_head(skb, RTL4_A_HDR_LEN) < 0)
++      if (unlikely(__skb_put_padto(skb, ETH_ZLEN, false)))
+               return NULL;
+       netdev_dbg(dev, "add realtek tag to package to port %d\n",
+@@ -53,13 +51,13 @@ static struct sk_buff *rtl4a_tag_xmit(st
+       tag = skb->data + 2 * ETH_ALEN;
+       /* Set Ethertype */
+-      p = (u16 *)tag;
++      p = (__be16 *)tag;
+       *p = htons(RTL4_A_ETHERTYPE);
+       out = (RTL4_A_PROTOCOL_RTL8366RB << 12) | (2 << 8);
+-      /* The lower bits is the port numer */
++      /* The lower bits is the port number */
+       out |= (u8)dp->index;
+-      p = (u16 *)(tag + 2);
++      p = (__be16 *)(tag + 2);
+       *p = htons(out);
+       return skb;
diff --git a/queue-5.10/net-enetc-don-t-overwrite-the-rss-indirection-table-when-initializing.patch b/queue-5.10/net-enetc-don-t-overwrite-the-rss-indirection-table-when-initializing.patch
new file mode 100644 (file)
index 0000000..2cb55c6
--- /dev/null
@@ -0,0 +1,145 @@
+From c646d10dda2dcde82c6ce5a474522621ab2b8b19 Mon Sep 17 00:00:00 2001
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+Date: Mon, 1 Mar 2021 13:18:11 +0200
+Subject: net: enetc: don't overwrite the RSS indirection table when initializing
+
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+
+commit c646d10dda2dcde82c6ce5a474522621ab2b8b19 upstream.
+
+After the blamed patch, all RX traffic gets hashed to CPU 0 because the
+hashing indirection table set up in:
+
+enetc_pf_probe
+-> enetc_alloc_si_resources
+   -> enetc_configure_si
+      -> enetc_setup_default_rss_table
+
+is overwritten later in:
+
+enetc_pf_probe
+-> enetc_init_port_rss_memory
+
+which zero-initializes the entire port RSS table in order to avoid ECC errors.
+
+The trouble really is that enetc_init_port_rss_memory really neads
+enetc_alloc_si_resources to be called, because it depends upon
+enetc_alloc_cbdr and enetc_setup_cbdr. But that whole enetc_configure_si
+thing could have been better thought out, it has nothing to do in a
+function called "alloc_si_resources", especially since its counterpart,
+"free_si_resources", does nothing to unwind the configuration of the SI.
+
+The point is, we need to pull out enetc_configure_si out of
+enetc_alloc_resources, and move it after enetc_init_port_rss_memory.
+This allows us to set up the default RSS indirection table after
+initializing the memory.
+
+Fixes: 07bf34a50e32 ("net: enetc: initialize the RFS and RSS memories")
+Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
+Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/freescale/enetc/enetc.c    |   11 +++--------
+ drivers/net/ethernet/freescale/enetc/enetc.h    |    1 +
+ drivers/net/ethernet/freescale/enetc/enetc_pf.c |    7 +++++++
+ drivers/net/ethernet/freescale/enetc/enetc_vf.c |    7 +++++++
+ 4 files changed, 18 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c
+@@ -1098,13 +1098,12 @@ static int enetc_setup_default_rss_table
+       return 0;
+ }
+-static int enetc_configure_si(struct enetc_ndev_priv *priv)
++int enetc_configure_si(struct enetc_ndev_priv *priv)
+ {
+       struct enetc_si *si = priv->si;
+       struct enetc_hw *hw = &si->hw;
+       int err;
+-      enetc_setup_cbdr(hw, &si->cbd_ring);
+       /* set SI cache attributes */
+       enetc_wr(hw, ENETC_SICAR0,
+                ENETC_SICAR_RD_COHERENT | ENETC_SICAR_WR_COHERENT);
+@@ -1152,6 +1151,8 @@ int enetc_alloc_si_resources(struct enet
+       if (err)
+               return err;
++      enetc_setup_cbdr(&si->hw, &si->cbd_ring);
++
+       priv->cls_rules = kcalloc(si->num_fs_entries, sizeof(*priv->cls_rules),
+                                 GFP_KERNEL);
+       if (!priv->cls_rules) {
+@@ -1159,14 +1160,8 @@ int enetc_alloc_si_resources(struct enet
+               goto err_alloc_cls;
+       }
+-      err = enetc_configure_si(priv);
+-      if (err)
+-              goto err_config_si;
+-
+       return 0;
+-err_config_si:
+-      kfree(priv->cls_rules);
+ err_alloc_cls:
+       enetc_clear_cbdr(&si->hw);
+       enetc_free_cbdr(priv->dev, &si->cbd_ring);
+--- a/drivers/net/ethernet/freescale/enetc/enetc.h
++++ b/drivers/net/ethernet/freescale/enetc/enetc.h
+@@ -293,6 +293,7 @@ void enetc_get_si_caps(struct enetc_si *
+ void enetc_init_si_rings_params(struct enetc_ndev_priv *priv);
+ int enetc_alloc_si_resources(struct enetc_ndev_priv *priv);
+ void enetc_free_si_resources(struct enetc_ndev_priv *priv);
++int enetc_configure_si(struct enetc_ndev_priv *priv);
+ int enetc_open(struct net_device *ndev);
+ int enetc_close(struct net_device *ndev);
+--- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
+@@ -1115,6 +1115,12 @@ static int enetc_pf_probe(struct pci_dev
+               goto err_init_port_rss;
+       }
++      err = enetc_configure_si(priv);
++      if (err) {
++              dev_err(&pdev->dev, "Failed to configure SI\n");
++              goto err_config_si;
++      }
++
+       err = enetc_alloc_msix(priv);
+       if (err) {
+               dev_err(&pdev->dev, "MSIX alloc failed\n");
+@@ -1143,6 +1149,7 @@ err_phylink_create:
+       enetc_mdiobus_destroy(pf);
+ err_mdiobus_create:
+       enetc_free_msix(priv);
++err_config_si:
+ err_init_port_rss:
+ err_init_port_rfs:
+ err_alloc_msix:
+--- a/drivers/net/ethernet/freescale/enetc/enetc_vf.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc_vf.c
+@@ -177,6 +177,12 @@ static int enetc_vf_probe(struct pci_dev
+               goto err_alloc_si_res;
+       }
++      err = enetc_configure_si(priv);
++      if (err) {
++              dev_err(&pdev->dev, "Failed to configure SI\n");
++              goto err_config_si;
++      }
++
+       err = enetc_alloc_msix(priv);
+       if (err) {
+               dev_err(&pdev->dev, "MSIX alloc failed\n");
+@@ -193,6 +199,7 @@ static int enetc_vf_probe(struct pci_dev
+ err_reg_netdev:
+       enetc_free_msix(priv);
++err_config_si:
+ err_alloc_msix:
+       enetc_free_si_resources(priv);
+ err_alloc_si_res:
diff --git a/queue-5.10/net-enetc-take-the-mdio-lock-only-once-per-napi-poll-cycle.patch b/queue-5.10/net-enetc-take-the-mdio-lock-only-once-per-napi-poll-cycle.patch
new file mode 100644 (file)
index 0000000..97c28a8
--- /dev/null
@@ -0,0 +1,173 @@
+From 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 Mon Sep 17 00:00:00 2001
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+Date: Mon, 1 Mar 2021 13:18:13 +0200
+Subject: net: enetc: take the MDIO lock only once per NAPI poll cycle
+
+From: Vladimir Oltean <vladimir.oltean@nxp.com>
+
+commit 6d36ecdbc4410e61a0e02adc5d3abeee22a8ffd3 upstream.
+
+The workaround for the ENETC MDIO erratum caused a performance
+degradation of 82 Kpps (seen with IP forwarding of two 1Gbps streams of
+64B packets). This is due to excessive locking and unlocking in the fast
+path, which can be avoided.
+
+By taking the MDIO read-side lock only once per NAPI poll cycle, we are
+able to regain 54 Kpps (65%) of the performance hit. The rest of the
+performance degradation comes from the TX data path, but unfortunately
+it doesn't look like we can optimize that away easily, even with
+netdev_xmit_more(), there just isn't any skb batching done, to help with
+taking the MDIO lock less often than once per packet.
+
+We need to change the register accessor type for enetc_get_tx_tstamp,
+because it now runs under the enetc_lock_mdio as per the new call path
+detailed below:
+
+enetc_msix
+-> napi_schedule
+   -> enetc_poll
+      -> enetc_lock_mdio
+      -> enetc_clean_tx_ring
+         -> enetc_get_tx_tstamp
+      -> enetc_clean_rx_ring
+      -> enetc_unlock_mdio
+
+Fixes: fd5736bf9f23 ("enetc: Workaround for MDIO register access issue")
+Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/freescale/enetc/enetc.c    |   31 ++++++------------------
+ drivers/net/ethernet/freescale/enetc/enetc_hw.h |    2 +
+ 2 files changed, 11 insertions(+), 22 deletions(-)
+
+--- a/drivers/net/ethernet/freescale/enetc/enetc.c
++++ b/drivers/net/ethernet/freescale/enetc/enetc.c
+@@ -321,6 +321,8 @@ static int enetc_poll(struct napi_struct
+       int work_done;
+       int i;
++      enetc_lock_mdio();
++
+       for (i = 0; i < v->count_tx_rings; i++)
+               if (!enetc_clean_tx_ring(&v->tx_ring[i], budget))
+                       complete = false;
+@@ -331,8 +333,10 @@ static int enetc_poll(struct napi_struct
+       if (work_done)
+               v->rx_napi_work = true;
+-      if (!complete)
++      if (!complete) {
++              enetc_unlock_mdio();
+               return budget;
++      }
+       napi_complete_done(napi, work_done);
+@@ -341,8 +345,6 @@ static int enetc_poll(struct napi_struct
+       v->rx_napi_work = false;
+-      enetc_lock_mdio();
+-
+       /* enable interrupts */
+       enetc_wr_reg_hot(v->rbier, ENETC_RBIER_RXTIE);
+@@ -367,8 +369,8 @@ static void enetc_get_tx_tstamp(struct e
+ {
+       u32 lo, hi, tstamp_lo;
+-      lo = enetc_rd(hw, ENETC_SICTR0);
+-      hi = enetc_rd(hw, ENETC_SICTR1);
++      lo = enetc_rd_hot(hw, ENETC_SICTR0);
++      hi = enetc_rd_hot(hw, ENETC_SICTR1);
+       tstamp_lo = le32_to_cpu(txbd->wb.tstamp);
+       if (lo <= tstamp_lo)
+               hi -= 1;
+@@ -398,9 +400,7 @@ static bool enetc_clean_tx_ring(struct e
+       i = tx_ring->next_to_clean;
+       tx_swbd = &tx_ring->tx_swbd[i];
+-      enetc_lock_mdio();
+       bds_to_clean = enetc_bd_ready_count(tx_ring, i);
+-      enetc_unlock_mdio();
+       do_tstamp = false;
+@@ -443,8 +443,6 @@ static bool enetc_clean_tx_ring(struct e
+                       tx_swbd = tx_ring->tx_swbd;
+               }
+-              enetc_lock_mdio();
+-
+               /* BD iteration loop end */
+               if (is_eof) {
+                       tx_frm_cnt++;
+@@ -455,8 +453,6 @@ static bool enetc_clean_tx_ring(struct e
+               if (unlikely(!bds_to_clean))
+                       bds_to_clean = enetc_bd_ready_count(tx_ring, i);
+-
+-              enetc_unlock_mdio();
+       }
+       tx_ring->next_to_clean = i;
+@@ -700,8 +696,6 @@ static int enetc_clean_rx_ring(struct en
+               u32 bd_status;
+               u16 size;
+-              enetc_lock_mdio();
+-
+               if (cleaned_cnt >= ENETC_RXBD_BUNDLE) {
+                       int count = enetc_refill_rx_ring(rx_ring, cleaned_cnt);
+@@ -712,19 +706,15 @@ static int enetc_clean_rx_ring(struct en
+               rxbd = enetc_rxbd(rx_ring, i);
+               bd_status = le32_to_cpu(rxbd->r.lstatus);
+-              if (!bd_status) {
+-                      enetc_unlock_mdio();
++              if (!bd_status)
+                       break;
+-              }
+               enetc_wr_reg_hot(rx_ring->idr, BIT(rx_ring->index));
+               dma_rmb(); /* for reading other rxbd fields */
+               size = le16_to_cpu(rxbd->r.buf_len);
+               skb = enetc_map_rx_buff_to_skb(rx_ring, i, size);
+-              if (!skb) {
+-                      enetc_unlock_mdio();
++              if (!skb)
+                       break;
+-              }
+               enetc_get_offloads(rx_ring, rxbd, skb);
+@@ -736,7 +726,6 @@ static int enetc_clean_rx_ring(struct en
+               if (unlikely(bd_status &
+                            ENETC_RXBD_LSTATUS(ENETC_RXBD_ERR_MASK))) {
+-                      enetc_unlock_mdio();
+                       dev_kfree_skb(skb);
+                       while (!(bd_status & ENETC_RXBD_LSTATUS_F)) {
+                               dma_rmb();
+@@ -776,8 +765,6 @@ static int enetc_clean_rx_ring(struct en
+               enetc_process_skb(rx_ring, skb);
+-              enetc_unlock_mdio();
+-
+               napi_gro_receive(napi, skb);
+               rx_frm_cnt++;
+--- a/drivers/net/ethernet/freescale/enetc/enetc_hw.h
++++ b/drivers/net/ethernet/freescale/enetc/enetc_hw.h
+@@ -453,6 +453,8 @@ static inline u64 _enetc_rd_reg64_wa(voi
+ #define enetc_wr_reg(reg, val)                _enetc_wr_reg_wa((reg), (val))
+ #define enetc_rd(hw, off)             enetc_rd_reg((hw)->reg + (off))
+ #define enetc_wr(hw, off, val)                enetc_wr_reg((hw)->reg + (off), val)
++#define enetc_rd_hot(hw, off)         enetc_rd_reg_hot((hw)->reg + (off))
++#define enetc_wr_hot(hw, off, val)    enetc_wr_reg_hot((hw)->reg + (off), val)
+ #define enetc_rd64(hw, off)           _enetc_rd_reg64_wa((hw)->reg + (off))
+ /* port register accessors - PF only */
+ #define enetc_port_rd(hw, off)                enetc_rd_reg((hw)->port + (off))
index e6801d335759ca4e25a5ec28632043d5f9514ebc..a59543ccef6a728c3db231d324e1d53952567aea 100644 (file)
@@ -35,3 +35,7 @@ mount-fix-mounting-of-detached-mounts-onto-targets-that-reside-on-shared-mounts.
 cifs-return-proper-error-code-in-statfs-2.patch
 revert-mm-slub-consider-rest-of-partial-list-if-acquire_slab-fails.patch
 docs-networking-drop-special-stable-handling.patch
+net-dsa-tag_rtl4_a-fix-egress-tags.patch
+sh_eth-fix-trscer-mask-for-sh771x.patch
+net-enetc-don-t-overwrite-the-rss-indirection-table-when-initializing.patch
+net-enetc-take-the-mdio-lock-only-once-per-napi-poll-cycle.patch
diff --git a/queue-5.10/sh_eth-fix-trscer-mask-for-sh771x.patch b/queue-5.10/sh_eth-fix-trscer-mask-for-sh771x.patch
new file mode 100644 (file)
index 0000000..abaa70e
--- /dev/null
@@ -0,0 +1,36 @@
+From 8c91bc3d44dfef8284af384877fbe61117e8b7d1 Mon Sep 17 00:00:00 2001
+From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
+Date: Sun, 28 Feb 2021 23:25:43 +0300
+Subject: sh_eth: fix TRSCER mask for SH771x
+
+From: Sergey Shtylyov <s.shtylyov@omprussia.ru>
+
+commit 8c91bc3d44dfef8284af384877fbe61117e8b7d1 upstream.
+
+According  to  the SH7710, SH7712, SH7713 Group User's Manual: Hardware,
+Rev. 3.00, the TRSCER register actually has only bit 7 valid (and named
+differently), with all the other bits reserved. Apparently, this was not
+the case with some early revisions of the manual as we have the other
+bits declared (and set) in the original driver.  Follow the suit and add
+the explicit sh_eth_cpu_data::trscer_err_mask initializer for SH771x...
+
+Fixes: 86a74ff21a7a ("net: sh_eth: add support for Renesas SuperH Ethernet")
+Signed-off-by: Sergey Shtylyov <s.shtylyov@omprussia.ru>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/renesas/sh_eth.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/ethernet/renesas/sh_eth.c
++++ b/drivers/net/ethernet/renesas/sh_eth.c
+@@ -1089,6 +1089,9 @@ static struct sh_eth_cpu_data sh771x_dat
+                         EESIPR_CEEFIP | EESIPR_CELFIP |
+                         EESIPR_RRFIP | EESIPR_RTLFIP | EESIPR_RTSFIP |
+                         EESIPR_PREIP | EESIPR_CERFIP,
++
++      .trscer_err_mask = DESC_I_RINT8,
++
+       .tsu            = 1,
+       .dual_port      = 1,
+ };