Blame SOURCES/0016-netdrv-bnxt-move-bp-switch_id-initialization-to-PF-p.patch

f95c89
From 1271da6fd65bb6129a99946546cdd8e1f9e69e2d Mon Sep 17 00:00:00 2001
f95c89
From: Jonathan Toppins <jtoppins@redhat.com>
f95c89
Date: Wed, 2 Oct 2019 18:22:30 -0400
f95c89
Subject: [PATCH 16/96] [netdrv] bnxt: move bp->switch_id initialization to PF
f95c89
 probe
f95c89
f95c89
Message-id: <edbaf01b25b2dce490cff02ddb2092da527353fa.1570027456.git.jtoppins@redhat.com>
f95c89
Patchwork-id: 276431
f95c89
O-Subject: [RHEL-8.2 PATCH 08/78] bnxt: move bp->switch_id initialization to PF probe
f95c89
Bugzilla: 1724766
f95c89
RH-Acked-by: John Linville <linville@redhat.com>
f95c89
RH-Acked-by: Jarod Wilson <jarod@redhat.com>
f95c89
f95c89
Currently the switch_id is being only initialized when switching eswitch
f95c89
mode from "legacy" to "switchdev". However, nothing prevents the id to
f95c89
be initialized from the very beginning. Physical ports can show it even
f95c89
in "legacy" mode.
f95c89
f95c89
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
f95c89
Signed-off-by: David S. Miller <davem@davemloft.net>
f95c89
(cherry picked from commit 03213a996531e507e03c085d411a313e34357498)
f95c89
Bugzilla: 1724766
f95c89
Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=23809532
f95c89
Tested: build, boot, basic ping
f95c89
Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
f95c89
Signed-off-by: Bruno Meneguele <bmeneg@redhat.com>
f95c89
---
f95c89
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 25 +++++++++++++++++++++++++
f95c89
 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 25 -------------------------
f95c89
 2 files changed, 25 insertions(+), 25 deletions(-)
f95c89
f95c89
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt.c
f95c89
===================================================================
f95c89
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:23:12.414543406 +0100
f95c89
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt.c	2020-02-06 16:23:12.563542039 +0100
f95c89
@@ -10473,6 +10473,26 @@
f95c89
 	return rc;
f95c89
 }
f95c89
 
f95c89
+static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
f95c89
+{
f95c89
+	struct pci_dev *pdev = bp->pdev;
f95c89
+	int pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DSN);
f95c89
+	u32 dw;
f95c89
+
f95c89
+	if (!pos) {
f95c89
+		netdev_info(bp->dev, "Unable do read adapter's DSN");
f95c89
+		return -EOPNOTSUPP;
f95c89
+	}
f95c89
+
f95c89
+	/* DSN (two dw) is at an offset of 4 from the cap pos */
f95c89
+	pos += 4;
f95c89
+	pci_read_config_dword(pdev, pos, &dw);
f95c89
+	put_unaligned_le32(dw, &dsn[0]);
f95c89
+	pci_read_config_dword(pdev, pos + 4, &dw);
f95c89
+	put_unaligned_le32(dw, &dsn[4]);
f95c89
+	return 0;
f95c89
+}
f95c89
+
f95c89
 static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
f95c89
 {
f95c89
 	static int version_printed;
f95c89
@@ -10613,6 +10633,11 @@
f95c89
 		goto init_err_pci_clean;
f95c89
 	}
f95c89
 
f95c89
+	/* Read the adapter's DSN to use as the eswitch switch_id */
f95c89
+	rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
f95c89
+	if (rc)
f95c89
+		goto init_err_pci_clean;
f95c89
+
f95c89
 	bnxt_hwrm_func_qcfg(bp);
f95c89
 	bnxt_hwrm_vnic_qcaps(bp);
f95c89
 	bnxt_hwrm_port_led_qcaps(bp);
f95c89
Index: src/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
f95c89
===================================================================
f95c89
--- src.orig/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c	2020-02-06 16:23:12.415543397 +0100
f95c89
+++ src/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c	2020-02-06 16:23:12.563542039 +0100
f95c89
@@ -406,26 +406,6 @@
f95c89
 	dev->min_mtu = ETH_ZLEN;
f95c89
 }
f95c89
 
f95c89
-static int bnxt_pcie_dsn_get(struct bnxt *bp, u8 dsn[])
f95c89
-{
f95c89
-	struct pci_dev *pdev = bp->pdev;
f95c89
-	int pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_DSN);
f95c89
-	u32 dw;
f95c89
-
f95c89
-	if (!pos) {
f95c89
-		netdev_info(bp->dev, "Unable do read adapter's DSN");
f95c89
-		return -EOPNOTSUPP;
f95c89
-	}
f95c89
-
f95c89
-	/* DSN (two dw) is at an offset of 4 from the cap pos */
f95c89
-	pos += 4;
f95c89
-	pci_read_config_dword(pdev, pos, &dw);
f95c89
-	put_unaligned_le32(dw, &dsn[0]);
f95c89
-	pci_read_config_dword(pdev, pos + 4, &dw);
f95c89
-	put_unaligned_le32(dw, &dsn[4]);
f95c89
-	return 0;
f95c89
-}
f95c89
-
f95c89
 static int bnxt_vf_reps_create(struct bnxt *bp)
f95c89
 {
f95c89
 	u16 *cfa_code_map = NULL, num_vfs = pci_num_vf(bp->pdev);
f95c89
@@ -490,11 +470,6 @@
f95c89
 		}
f95c89
 	}
f95c89
 
f95c89
-	/* Read the adapter's DSN to use as the eswitch switch_id */
f95c89
-	rc = bnxt_pcie_dsn_get(bp, bp->switch_id);
f95c89
-	if (rc)
f95c89
-		goto err;
f95c89
-
f95c89
 	/* publish cfa_code_map only after all VF-reps have been initialized */
f95c89
 	bp->cfa_code_map = cfa_code_map;
f95c89
 	bp->eswitch_mode = DEVLINK_ESWITCH_MODE_SWITCHDEV;