]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Sun, 26 Sep 2021 22:59:07 +0000 (18:59 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 26 Sep 2021 22:59:07 +0000 (18:59 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/bnxt_en-fix-tx-timeout-when-tx-ring-size-is-set-to-t.patch [new file with mode: 0644]
queue-4.19/gpio-uniphier-fix-void-functions-to-remove-return-va.patch [new file with mode: 0644]
queue-4.19/net-mlx4_en-don-t-allow-arfs-for-encapsulated-packet.patch [new file with mode: 0644]
queue-4.19/net-mlx4_en-resolve-bad-operstate-value.patch [new file with mode: 0644]
queue-4.19/net-smc-add-missing-error-check-in-smc_clc_prfx_set.patch [new file with mode: 0644]
queue-4.19/series

diff --git a/queue-4.19/bnxt_en-fix-tx-timeout-when-tx-ring-size-is-set-to-t.patch b/queue-4.19/bnxt_en-fix-tx-timeout-when-tx-ring-size-is-set-to-t.patch
new file mode 100644 (file)
index 0000000..28a9def
--- /dev/null
@@ -0,0 +1,105 @@
+From 79aa30dc121cbd0217ca28c6f88cf9f7d3ea900e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Sep 2021 02:51:52 -0400
+Subject: bnxt_en: Fix TX timeout when TX ring size is set to the smallest
+
+From: Michael Chan <michael.chan@broadcom.com>
+
+[ Upstream commit 5bed8b0704c9ecccc8f4a2c377d7c8e21090a82e ]
+
+The smallest TX ring size we support must fit a TX SKB with MAX_SKB_FRAGS
++ 1.  Because the first TX BD for a packet is always a long TX BD, we
+need an extra TX BD to fit this packet.  Define BNXT_MIN_TX_DESC_CNT with
+this value to make this more clear.  The current code uses a minimum
+that is off by 1.  Fix it using this constant.
+
+The tx_wake_thresh to determine when to wake up the TX queue is half the
+ring size but we must have at least BNXT_MIN_TX_DESC_CNT for the next
+packet which may have maximum fragments.  So the comparison of the
+available TX BDs with tx_wake_thresh should be >= instead of > in the
+current code.  Otherwise, at the smallest ring size, we will never wake
+up the TX queue and will cause TX timeout.
+
+Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.")
+Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
+Signed-off-by: Michael Chan <michael.chan@broadocm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/broadcom/bnxt/bnxt.c         | 8 ++++----
+ drivers/net/ethernet/broadcom/bnxt/bnxt.h         | 5 +++++
+ drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 +-
+ 3 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+index 55827ac65a15..5e30299bcf64 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+@@ -294,7 +294,7 @@ static bool bnxt_txr_netif_try_stop_queue(struct bnxt *bp,
+        * netif_tx_queue_stopped().
+        */
+       smp_mb();
+-      if (bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh) {
++      if (bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh) {
+               netif_tx_wake_queue(txq);
+               return false;
+       }
+@@ -625,7 +625,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
+       smp_mb();
+       if (unlikely(netif_tx_queue_stopped(txq)) &&
+-          bnxt_tx_avail(bp, txr) > bp->tx_wake_thresh &&
++          bnxt_tx_avail(bp, txr) >= bp->tx_wake_thresh &&
+           READ_ONCE(txr->dev_state) != BNXT_DEV_STATE_CLOSING)
+               netif_tx_wake_queue(txq);
+ }
+@@ -1909,7 +1909,7 @@ static int bnxt_poll_work(struct bnxt *bp, struct bnxt_napi *bnapi, int budget)
+               if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) {
+                       tx_pkts++;
+                       /* return full budget so NAPI will complete. */
+-                      if (unlikely(tx_pkts > bp->tx_wake_thresh)) {
++                      if (unlikely(tx_pkts >= bp->tx_wake_thresh)) {
+                               rx_pkts = budget;
+                               raw_cons = NEXT_RAW_CMP(raw_cons);
+                               break;
+@@ -2712,7 +2712,7 @@ static int bnxt_init_tx_rings(struct bnxt *bp)
+       u16 i;
+       bp->tx_wake_thresh = max_t(int, bp->tx_ring_size / 2,
+-                                 MAX_SKB_FRAGS + 1);
++                                 BNXT_MIN_TX_DESC_CNT);
+       for (i = 0; i < bp->tx_nr_rings; i++) {
+               struct bnxt_tx_ring_info *txr = &bp->tx_ring[i];
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+index f3f5484c43e4..5c1c3a0ed928 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+@@ -484,6 +484,11 @@ struct rx_tpa_end_cmp_ext {
+ #define BNXT_MAX_RX_JUM_DESC_CNT      (RX_DESC_CNT * MAX_RX_AGG_PAGES - 1)
+ #define BNXT_MAX_TX_DESC_CNT          (TX_DESC_CNT * MAX_TX_PAGES - 1)
++/* Minimum TX BDs for a TX packet with MAX_SKB_FRAGS + 1.  We need one extra
++ * BD because the first TX BD is always a long BD.
++ */
++#define BNXT_MIN_TX_DESC_CNT          (MAX_SKB_FRAGS + 2)
++
+ #define RX_RING(x)    (((x) & ~(RX_DESC_CNT - 1)) >> (BNXT_PAGE_SHIFT - 4))
+ #define RX_IDX(x)     ((x) & (RX_DESC_CNT - 1))
+diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+index 511240e8246f..e75a47a9f511 100644
+--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
++++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+@@ -446,7 +446,7 @@ static int bnxt_set_ringparam(struct net_device *dev,
+       if ((ering->rx_pending > BNXT_MAX_RX_DESC_CNT) ||
+           (ering->tx_pending > BNXT_MAX_TX_DESC_CNT) ||
+-          (ering->tx_pending <= MAX_SKB_FRAGS))
++          (ering->tx_pending < BNXT_MIN_TX_DESC_CNT))
+               return -EINVAL;
+       if (netif_running(dev))
+-- 
+2.33.0
+
diff --git a/queue-4.19/gpio-uniphier-fix-void-functions-to-remove-return-va.patch b/queue-4.19/gpio-uniphier-fix-void-functions-to-remove-return-va.patch
new file mode 100644 (file)
index 0000000..7e8d655
--- /dev/null
@@ -0,0 +1,45 @@
+From ebab14b02741e3b3febb7225aaef2fb8914a0b30 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 Sep 2021 20:19:35 +0900
+Subject: gpio: uniphier: Fix void functions to remove return value
+
+From: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+
+[ Upstream commit 2dd824cca3407bc9a2bd11b00f6e117b66fcfcf1 ]
+
+The return type of irq_chip.irq_mask() and irq_chip.irq_unmask() should
+be void.
+
+Fixes: dbe776c2ca54 ("gpio: uniphier: add UniPhier GPIO controller driver")
+Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpio/gpio-uniphier.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpio/gpio-uniphier.c b/drivers/gpio/gpio-uniphier.c
+index 7fdac9060979..c72ec3ddf90b 100644
+--- a/drivers/gpio/gpio-uniphier.c
++++ b/drivers/gpio/gpio-uniphier.c
+@@ -197,7 +197,7 @@ static void uniphier_gpio_irq_mask(struct irq_data *data)
+       uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, 0);
+-      return irq_chip_mask_parent(data);
++      irq_chip_mask_parent(data);
+ }
+ static void uniphier_gpio_irq_unmask(struct irq_data *data)
+@@ -207,7 +207,7 @@ static void uniphier_gpio_irq_unmask(struct irq_data *data)
+       uniphier_gpio_reg_update(priv, UNIPHIER_GPIO_IRQ_EN, mask, mask);
+-      return irq_chip_unmask_parent(data);
++      irq_chip_unmask_parent(data);
+ }
+ static int uniphier_gpio_irq_set_type(struct irq_data *data, unsigned int type)
+-- 
+2.33.0
+
diff --git a/queue-4.19/net-mlx4_en-don-t-allow-arfs-for-encapsulated-packet.patch b/queue-4.19/net-mlx4_en-don-t-allow-arfs-for-encapsulated-packet.patch
new file mode 100644 (file)
index 0000000..bcfb8fb
--- /dev/null
@@ -0,0 +1,38 @@
+From 957232956a6a439f9d73bab16ffeeceb3cdef693 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 23 Sep 2021 09:51:45 +0300
+Subject: net/mlx4_en: Don't allow aRFS for encapsulated packets
+
+From: Aya Levin <ayal@nvidia.com>
+
+[ Upstream commit fdbccea419dc782079ce5881d2705cc9e3881480 ]
+
+Driver doesn't support aRFS for encapsulated packets, return early error
+in such a case.
+
+Fixes: 1eb8c695bda9 ("net/mlx4_en: Add accelerated RFS support")
+Signed-off-by: Aya Levin <ayal@nvidia.com>
+Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+index afd2dd8ebd73..d2a36c79714f 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+@@ -372,6 +372,9 @@ mlx4_en_filter_rfs(struct net_device *net_dev, const struct sk_buff *skb,
+       int nhoff = skb_network_offset(skb);
+       int ret = 0;
++      if (skb->encapsulation)
++              return -EPROTONOSUPPORT;
++
+       if (skb->protocol != htons(ETH_P_IP))
+               return -EPROTONOSUPPORT;
+-- 
+2.33.0
+
diff --git a/queue-4.19/net-mlx4_en-resolve-bad-operstate-value.patch b/queue-4.19/net-mlx4_en-resolve-bad-operstate-value.patch
new file mode 100644 (file)
index 0000000..98ce56d
--- /dev/null
@@ -0,0 +1,127 @@
+From 5f4d3e6040e070ab765ab674f38b8f8328c21407 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 19 Sep 2021 14:55:45 +0300
+Subject: net/mlx4_en: Resolve bad operstate value
+
+From: Lama Kayal <lkayal@nvidia.com>
+
+[ Upstream commit 72a3c58d18fd780eecd80178bb2132ce741a0a74 ]
+
+Any link state change that's done prior to net device registration
+isn't reflected on the state, thus the operational state is left
+obsolete, with 'UNKNOWN' status.
+
+To resolve the issue, query link state from FW upon open operations
+to ensure operational state is updated.
+
+Fixes: c27a02cd94d6 ("mlx4_en: Add driver for Mellanox ConnectX 10GbE NIC")
+Signed-off-by: Lama Kayal <lkayal@nvidia.com>
+Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/ethernet/mellanox/mlx4/en_netdev.c    | 47 ++++++++++++-------
+ drivers/net/ethernet/mellanox/mlx4/mlx4_en.h  |  1 -
+ 2 files changed, 29 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+index f3a0617733d8..afd2dd8ebd73 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
++++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+@@ -1269,7 +1269,6 @@ static void mlx4_en_do_set_rx_mode(struct work_struct *work)
+       if (!netif_carrier_ok(dev)) {
+               if (!mlx4_en_QUERY_PORT(mdev, priv->port)) {
+                       if (priv->port_state.link_state) {
+-                              priv->last_link_state = MLX4_DEV_EVENT_PORT_UP;
+                               netif_carrier_on(dev);
+                               en_dbg(LINK, priv, "Link Up\n");
+                       }
+@@ -1563,26 +1562,36 @@ static void mlx4_en_service_task(struct work_struct *work)
+       mutex_unlock(&mdev->state_lock);
+ }
+-static void mlx4_en_linkstate(struct work_struct *work)
++static void mlx4_en_linkstate(struct mlx4_en_priv *priv)
++{
++      struct mlx4_en_port_state *port_state = &priv->port_state;
++      struct mlx4_en_dev *mdev = priv->mdev;
++      struct net_device *dev = priv->dev;
++      bool up;
++
++      if (mlx4_en_QUERY_PORT(mdev, priv->port))
++              port_state->link_state = MLX4_PORT_STATE_DEV_EVENT_PORT_DOWN;
++
++      up = port_state->link_state == MLX4_PORT_STATE_DEV_EVENT_PORT_UP;
++      if (up == netif_carrier_ok(dev))
++              netif_carrier_event(dev);
++      if (!up) {
++              en_info(priv, "Link Down\n");
++              netif_carrier_off(dev);
++      } else {
++              en_info(priv, "Link Up\n");
++              netif_carrier_on(dev);
++      }
++}
++
++static void mlx4_en_linkstate_work(struct work_struct *work)
+ {
+       struct mlx4_en_priv *priv = container_of(work, struct mlx4_en_priv,
+                                                linkstate_task);
+       struct mlx4_en_dev *mdev = priv->mdev;
+-      int linkstate = priv->link_state;
+       mutex_lock(&mdev->state_lock);
+-      /* If observable port state changed set carrier state and
+-       * report to system log */
+-      if (priv->last_link_state != linkstate) {
+-              if (linkstate == MLX4_DEV_EVENT_PORT_DOWN) {
+-                      en_info(priv, "Link Down\n");
+-                      netif_carrier_off(priv->dev);
+-              } else {
+-                      en_info(priv, "Link Up\n");
+-                      netif_carrier_on(priv->dev);
+-              }
+-      }
+-      priv->last_link_state = linkstate;
++      mlx4_en_linkstate(priv);
+       mutex_unlock(&mdev->state_lock);
+ }
+@@ -2086,9 +2095,11 @@ static int mlx4_en_open(struct net_device *dev)
+       mlx4_en_clear_stats(dev);
+       err = mlx4_en_start_port(dev);
+-      if (err)
++      if (err) {
+               en_err(priv, "Failed starting port:%d\n", priv->port);
+-
++              goto out;
++      }
++      mlx4_en_linkstate(priv);
+ out:
+       mutex_unlock(&mdev->state_lock);
+       return err;
+@@ -3288,7 +3299,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+       spin_lock_init(&priv->stats_lock);
+       INIT_WORK(&priv->rx_mode_task, mlx4_en_do_set_rx_mode);
+       INIT_WORK(&priv->restart_task, mlx4_en_restart);
+-      INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate);
++      INIT_WORK(&priv->linkstate_task, mlx4_en_linkstate_work);
+       INIT_DELAYED_WORK(&priv->stats_task, mlx4_en_do_get_stats);
+       INIT_DELAYED_WORK(&priv->service_task, mlx4_en_service_task);
+       INIT_WORK(&priv->vxlan_add_task, mlx4_en_add_vxlan_offloads);
+diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+index 3d5597d5b10d..2e759cd0f66e 100644
+--- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
++++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
+@@ -571,7 +571,6 @@ struct mlx4_en_priv {
+       struct mlx4_hwq_resources res;
+       int link_state;
+-      int last_link_state;
+       bool port_up;
+       int port;
+       int registered;
+-- 
+2.33.0
+
diff --git a/queue-4.19/net-smc-add-missing-error-check-in-smc_clc_prfx_set.patch b/queue-4.19/net-smc-add-missing-error-check-in-smc_clc_prfx_set.patch
new file mode 100644 (file)
index 0000000..3fd4804
--- /dev/null
@@ -0,0 +1,45 @@
+From fd6565b2db12796cebe5ff5d24a09b6e62ba8037 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 Sep 2021 21:18:14 +0200
+Subject: net/smc: add missing error check in smc_clc_prfx_set()
+
+From: Karsten Graul <kgraul@linux.ibm.com>
+
+[ Upstream commit 6c90731980655280ea07ce4b21eb97457bf86286 ]
+
+Coverity stumbled over a missing error check in smc_clc_prfx_set():
+
+*** CID 1475954:  Error handling issues  (CHECKED_RETURN)
+/net/smc/smc_clc.c: 233 in smc_clc_prfx_set()
+>>>     CID 1475954:  Error handling issues  (CHECKED_RETURN)
+>>>     Calling "kernel_getsockname" without checking return value (as is done elsewhere 8 out of 10 times).
+233            kernel_getsockname(clcsock, (struct sockaddr *)&addrs);
+
+Add the return code check in smc_clc_prfx_set().
+
+Fixes: c246d942eabc ("net/smc: restructure netinfo for CLC proposal msgs")
+Reported-by: Julian Wiedmann <jwi@linux.ibm.com>
+Signed-off-by: Karsten Graul <kgraul@linux.ibm.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/smc/smc_clc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c
+index aa9a17ac1f7b..063acfbdcd89 100644
+--- a/net/smc/smc_clc.c
++++ b/net/smc/smc_clc.c
+@@ -162,7 +162,8 @@ static int smc_clc_prfx_set(struct socket *clcsock,
+               goto out_rel;
+       }
+       /* get address to which the internal TCP socket is bound */
+-      kernel_getsockname(clcsock, (struct sockaddr *)&addrs);
++      if (kernel_getsockname(clcsock, (struct sockaddr *)&addrs) < 0)
++              goto out_rel;
+       /* analyze IP specific data of net_device belonging to TCP socket */
+       addr6 = (struct sockaddr_in6 *)&addrs;
+       rcu_read_lock();
+-- 
+2.33.0
+
index d519b578a3741a35914fbeeb0ea3337f821aefbb..e6f3a0f448b266e9857d374393300c63692562fd 100644 (file)
@@ -16,3 +16,8 @@ usb-serial-option-add-device-id-for-foxconn-t99w265.patch
 mcb-fix-error-handling-in-mcb_alloc_bus.patch
 serial-mvebu-uart-fix-driver-s-tx_empty-callback.patch
 net-hso-fix-muxed-tty-registration.patch
+net-mlx4_en-resolve-bad-operstate-value.patch
+bnxt_en-fix-tx-timeout-when-tx-ring-size-is-set-to-t.patch
+net-smc-add-missing-error-check-in-smc_clc_prfx_set.patch
+gpio-uniphier-fix-void-functions-to-remove-return-va.patch
+net-mlx4_en-don-t-allow-arfs-for-encapsulated-packet.patch