Skip to contentSkip to conversation

ionic fixes

PATCH In review Shannon Nelson 2 participants 4 messages May 11, 2020 – May 12, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ionic fixes

These are a couple more fixes after more fw-upgrade testing.

Shannon Nelson (2):
ionic: leave netdev mac alone after fw-upgrade
ionic: call ionic_port_init after fw-upgrade

 .../net/ethernet/pensando/ionic/ionic_lif.c   | 19 ++++++++++++-------
 .../net/ethernet/pensando/ionic/ionic_main.c  | 18 +++++++++---------
 2 files changed, 21 insertions(+), 16 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 ionic: leave netdev mac alone after fw-upgrade

When running in a bond setup, or some other potential configurations, the netdev mac may have been changed from the default device mac. Since the userland doesn't know about the changes going on under the covers in a fw-upgrade it doesn't know the re-push the mac filter. The driver needs to leave the netdev mac filter alone when rebuilding after the fw-upgrade.

Fixes c672412f6172 ("ionic: remove lifs on fw reset")
---
 .../net/ethernet/pensando/ionic/ionic_lif.c    | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +11 -7
index d5293bfded29..f8c626444da0 100644
@@ -2348,7 +2348,17 @@ static int ionic_station_set(struct ionic_lif *lif)
 	if (is_zero_ether_addr(ctx.comp.lif_getattr.mac))
 		return 0;
 
-	if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) {
+	if (!is_zero_ether_addr(netdev->dev_addr)) {
+		/* If the netdev mac is non-zero and doesn't match the default
+		 * device address, it was set by something earlier and we're
+		 * likely here again after a fw-upgrade reset.  We need to be
+		 * sure the netdev mac is in our filter list.
+		 */
+		if (!ether_addr_equal(ctx.comp.lif_getattr.mac,
+				      netdev->dev_addr))
+			ionic_lif_addr(lif, netdev->dev_addr, true);
+	} else {
+		/* Update the netdev mac with the device's mac */
 		memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len);
 		addr.sa_family = AF_INET;
 		err = eth_prepare_mac_addr_change(netdev, &addr);
@@ -2358,12 +2368,6 @@ static int ionic_station_set(struct ionic_lif *lif)
 			return 0;
 		}
 
-		if (!is_zero_ether_addr(netdev->dev_addr)) {
-			netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n",
-				   netdev->dev_addr);
-			ionic_lif_addr(lif, netdev->dev_addr, false);
-		}
-
 		eth_commit_mac_addr_change(netdev, &addr);
 	}
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 ionic: call ionic_port_init after fw-upgrade

In reply to Shannon Nelson

Since the fw has been re-inited, we need to refresh the port information dma address so we can see fresh port information. Let's call ionic_port_init again, and tweak it to allow for a call to simply refresh the existing dma address.

Fixes c672412f6172 ("ionic: remove lifs on fw reset")
---
 .../net/ethernet/pensando/ionic/ionic_lif.c    |  1 +
 .../net/ethernet/pensando/ionic/ionic_main.c   | 18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_lif.c +1 -0
index f8c626444da0..f8a9c1bcffc9 100644
@@ -2118,6 +2118,7 @@ static void ionic_lif_handle_fw_up(struct ionic_lif *lif)
 	dev_info(ionic->dev, "FW Up: restarting LIFs\n");
 
 	ionic_init_devinfo(ionic);
+	ionic_port_init(ionic);
 	err = ionic_qcqs_alloc(lif);
 	if (err)
 		goto err_out;
drivers/net/ethernet/pensando/ionic/ionic_main.c +9 -9
index 588c62e9add7..3344bc1f7671 100644
@@ -509,16 +509,16 @@ int ionic_port_init(struct ionic *ionic)
 	size_t sz;
 	int err;
 
-	if (idev->port_info)
-		return 0;
-
-	idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
-	idev->port_info = dma_alloc_coherent(ionic->dev, idev->port_info_sz,
-					     &idev->port_info_pa,
-					     GFP_KERNEL);
 	if (!idev->port_info) {
-		dev_err(ionic->dev, "Failed to allocate port info, aborting\n");
-		return -ENOMEM;
+		idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
+		idev->port_info = dma_alloc_coherent(ionic->dev,
+						     idev->port_info_sz,
+						     &idev->port_info_pa,
+						     GFP_KERNEL);
+		if (!idev->port_info) {
+			dev_err(ionic->dev, "Failed to allocate port info\n");
+			return -ENOMEM;
+		}
 	}
 
 	sz = min(sizeof(ident->port.config), sizeof(idev->dev_cmd_regs->data));
Signature · 1 line
2.17.1