]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jul 2023 13:29:26 +0000 (15:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Jul 2023 13:29:26 +0000 (15:29 +0200)
added patches:
net-ncsi-change-from-ndo_set_mac_address-to-dev_set_mac_address.patch
net-ncsi-make-one-oem_gma-function-for-all-mfr-id.patch

queue-6.4/net-ncsi-change-from-ndo_set_mac_address-to-dev_set_mac_address.patch [new file with mode: 0644]
queue-6.4/net-ncsi-make-one-oem_gma-function-for-all-mfr-id.patch [new file with mode: 0644]
queue-6.4/series

diff --git a/queue-6.4/net-ncsi-change-from-ndo_set_mac_address-to-dev_set_mac_address.patch b/queue-6.4/net-ncsi-change-from-ndo_set_mac_address-to-dev_set_mac_address.patch
new file mode 100644 (file)
index 0000000..c735884
--- /dev/null
@@ -0,0 +1,50 @@
+From 790071347a0a1a89e618eedcd51c687ea783aeb3 Mon Sep 17 00:00:00 2001
+From: Ivan Mikhaylov <fr0st61te@gmail.com>
+Date: Wed, 7 Jun 2023 18:17:42 +0300
+Subject: net/ncsi: change from ndo_set_mac_address to dev_set_mac_address
+
+From: Ivan Mikhaylov <fr0st61te@gmail.com>
+
+commit 790071347a0a1a89e618eedcd51c687ea783aeb3 upstream.
+
+Change ndo_set_mac_address to dev_set_mac_address because
+dev_set_mac_address provides a way to notify network layer about MAC
+change. In other case, services may not aware about MAC change and keep
+using old one which set from network adapter driver.
+
+As example, DHCP client from systemd do not update MAC address without
+notification from net subsystem which leads to the problem with acquiring
+the right address from DHCP server.
+
+Fixes: cb10c7c0dfd9e ("net/ncsi: Add NCSI Broadcom OEM command")
+Cc: stable@vger.kernel.org # v6.0+ 2f38e84 net/ncsi: make one oem_gma function for all mfr id
+Signed-off-by: Paul Fertser <fercerpav@gmail.com>
+Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
+Reviewed-by: Simon Horman <simon.horman@corigine.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ncsi/ncsi-rsp.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/net/ncsi/ncsi-rsp.c
++++ b/net/ncsi/ncsi-rsp.c
+@@ -616,7 +616,6 @@ static int ncsi_rsp_handler_oem_gma(stru
+ {
+       struct ncsi_dev_priv *ndp = nr->ndp;
+       struct net_device *ndev = ndp->ndev.dev;
+-      const struct net_device_ops *ops = ndev->netdev_ops;
+       struct ncsi_rsp_oem_pkt *rsp;
+       struct sockaddr saddr;
+       u32 mac_addr_off = 0;
+@@ -643,7 +642,9 @@ static int ncsi_rsp_handler_oem_gma(stru
+       /* Set the flag for GMA command which should only be called once */
+       ndp->gma_flag = 1;
+-      ret = ops->ndo_set_mac_address(ndev, &saddr);
++      rtnl_lock();
++      ret = dev_set_mac_address(ndev, &saddr, NULL);
++      rtnl_unlock();
+       if (ret < 0)
+               netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
diff --git a/queue-6.4/net-ncsi-make-one-oem_gma-function-for-all-mfr-id.patch b/queue-6.4/net-ncsi-make-one-oem_gma-function-for-all-mfr-id.patch
new file mode 100644 (file)
index 0000000..b1e9bc6
--- /dev/null
@@ -0,0 +1,157 @@
+From 74b449b98dccdf24288d562f9d207fa066da793d Mon Sep 17 00:00:00 2001
+From: Ivan Mikhaylov <fr0st61te@gmail.com>
+Date: Wed, 7 Jun 2023 18:17:41 +0300
+Subject: net/ncsi: make one oem_gma function for all mfr id
+
+From: Ivan Mikhaylov <fr0st61te@gmail.com>
+
+commit 74b449b98dccdf24288d562f9d207fa066da793d upstream.
+
+Make the one Get Mac Address function for all manufacturers and change
+this call in handlers accordingly.
+
+Reviewed-by: Simon Horman <simon.horman@corigine.com>
+Signed-off-by: Ivan Mikhaylov <fr0st61te@gmail.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ncsi/ncsi-rsp.c |   88 +++++++++++-----------------------------------------
+ 1 file changed, 19 insertions(+), 69 deletions(-)
+
+--- a/net/ncsi/ncsi-rsp.c
++++ b/net/ncsi/ncsi-rsp.c
+@@ -611,14 +611,15 @@ static int ncsi_rsp_handler_snfc(struct
+       return 0;
+ }
+-/* Response handler for Mellanox command Get Mac Address */
+-static int ncsi_rsp_handler_oem_mlx_gma(struct ncsi_request *nr)
++/* Response handler for Get Mac Address command */
++static int ncsi_rsp_handler_oem_gma(struct ncsi_request *nr, int mfr_id)
+ {
+       struct ncsi_dev_priv *ndp = nr->ndp;
+       struct net_device *ndev = ndp->ndev.dev;
+       const struct net_device_ops *ops = ndev->netdev_ops;
+       struct ncsi_rsp_oem_pkt *rsp;
+       struct sockaddr saddr;
++      u32 mac_addr_off = 0;
+       int ret = 0;
+       /* Get the response header */
+@@ -626,7 +627,19 @@ static int ncsi_rsp_handler_oem_mlx_gma(
+       saddr.sa_family = ndev->type;
+       ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
+-      memcpy(saddr.sa_data, &rsp->data[MLX_MAC_ADDR_OFFSET], ETH_ALEN);
++      if (mfr_id == NCSI_OEM_MFR_BCM_ID)
++              mac_addr_off = BCM_MAC_ADDR_OFFSET;
++      else if (mfr_id == NCSI_OEM_MFR_MLX_ID)
++              mac_addr_off = MLX_MAC_ADDR_OFFSET;
++      else if (mfr_id == NCSI_OEM_MFR_INTEL_ID)
++              mac_addr_off = INTEL_MAC_ADDR_OFFSET;
++
++      memcpy(saddr.sa_data, &rsp->data[mac_addr_off], ETH_ALEN);
++      if (mfr_id == NCSI_OEM_MFR_BCM_ID || mfr_id == NCSI_OEM_MFR_INTEL_ID)
++              eth_addr_inc((u8 *)saddr.sa_data);
++      if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
++              return -ENXIO;
++
+       /* Set the flag for GMA command which should only be called once */
+       ndp->gma_flag = 1;
+@@ -649,41 +662,10 @@ static int ncsi_rsp_handler_oem_mlx(stru
+       if (mlx->cmd == NCSI_OEM_MLX_CMD_GMA &&
+           mlx->param == NCSI_OEM_MLX_CMD_GMA_PARAM)
+-              return ncsi_rsp_handler_oem_mlx_gma(nr);
++              return ncsi_rsp_handler_oem_gma(nr, NCSI_OEM_MFR_MLX_ID);
+       return 0;
+ }
+-/* Response handler for Broadcom command Get Mac Address */
+-static int ncsi_rsp_handler_oem_bcm_gma(struct ncsi_request *nr)
+-{
+-      struct ncsi_dev_priv *ndp = nr->ndp;
+-      struct net_device *ndev = ndp->ndev.dev;
+-      const struct net_device_ops *ops = ndev->netdev_ops;
+-      struct ncsi_rsp_oem_pkt *rsp;
+-      struct sockaddr saddr;
+-      int ret = 0;
+-
+-      /* Get the response header */
+-      rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp);
+-
+-      saddr.sa_family = ndev->type;
+-      ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
+-      memcpy(saddr.sa_data, &rsp->data[BCM_MAC_ADDR_OFFSET], ETH_ALEN);
+-      /* Increase mac address by 1 for BMC's address */
+-      eth_addr_inc((u8 *)saddr.sa_data);
+-      if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
+-              return -ENXIO;
+-
+-      /* Set the flag for GMA command which should only be called once */
+-      ndp->gma_flag = 1;
+-
+-      ret = ops->ndo_set_mac_address(ndev, &saddr);
+-      if (ret < 0)
+-              netdev_warn(ndev, "NCSI: 'Writing mac address to device failed\n");
+-
+-      return ret;
+-}
+-
+ /* Response handler for Broadcom card */
+ static int ncsi_rsp_handler_oem_bcm(struct ncsi_request *nr)
+ {
+@@ -695,42 +677,10 @@ static int ncsi_rsp_handler_oem_bcm(stru
+       bcm = (struct ncsi_rsp_oem_bcm_pkt *)(rsp->data);
+       if (bcm->type == NCSI_OEM_BCM_CMD_GMA)
+-              return ncsi_rsp_handler_oem_bcm_gma(nr);
++              return ncsi_rsp_handler_oem_gma(nr, NCSI_OEM_MFR_BCM_ID);
+       return 0;
+ }
+-/* Response handler for Intel command Get Mac Address */
+-static int ncsi_rsp_handler_oem_intel_gma(struct ncsi_request *nr)
+-{
+-      struct ncsi_dev_priv *ndp = nr->ndp;
+-      struct net_device *ndev = ndp->ndev.dev;
+-      const struct net_device_ops *ops = ndev->netdev_ops;
+-      struct ncsi_rsp_oem_pkt *rsp;
+-      struct sockaddr saddr;
+-      int ret = 0;
+-
+-      /* Get the response header */
+-      rsp = (struct ncsi_rsp_oem_pkt *)skb_network_header(nr->rsp);
+-
+-      saddr.sa_family = ndev->type;
+-      ndev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
+-      memcpy(saddr.sa_data, &rsp->data[INTEL_MAC_ADDR_OFFSET], ETH_ALEN);
+-      /* Increase mac address by 1 for BMC's address */
+-      eth_addr_inc((u8 *)saddr.sa_data);
+-      if (!is_valid_ether_addr((const u8 *)saddr.sa_data))
+-              return -ENXIO;
+-
+-      /* Set the flag for GMA command which should only be called once */
+-      ndp->gma_flag = 1;
+-
+-      ret = ops->ndo_set_mac_address(ndev, &saddr);
+-      if (ret < 0)
+-              netdev_warn(ndev,
+-                          "NCSI: 'Writing mac address to device failed\n");
+-
+-      return ret;
+-}
+-
+ /* Response handler for Intel card */
+ static int ncsi_rsp_handler_oem_intel(struct ncsi_request *nr)
+ {
+@@ -742,7 +692,7 @@ static int ncsi_rsp_handler_oem_intel(st
+       intel = (struct ncsi_rsp_oem_intel_pkt *)(rsp->data);
+       if (intel->cmd == NCSI_OEM_INTEL_CMD_GMA)
+-              return ncsi_rsp_handler_oem_intel_gma(nr);
++              return ncsi_rsp_handler_oem_gma(nr, NCSI_OEM_MFR_INTEL_ID);
+       return 0;
+ }
index 1d497434a16fc2cf9dfca58751e5d2155fb37784..3a43bb59e6fd9c4d1c1bdde9430160a1f5b6be57 100644 (file)
@@ -288,3 +288,5 @@ net-dsa-ocelot-unlock-on-error-in-vsc9959_qos_port_tas_set.patch
 mips-kvm-fix-build-error-with-kvm_mips_debug_cop0_counters-enabled.patch
 revert-drm-amd-disable-psr-su-on-parade-0803-tcon.patch
 drm-atomic-fix-potential-use-after-free-in-nonblocking-commits.patch
+net-ncsi-make-one-oem_gma-function-for-all-mfr-id.patch
+net-ncsi-change-from-ndo_set_mac_address-to-dev_set_mac_address.patch