Commit 216902ae authored by Shannon Nelson's avatar Shannon Nelson Committed by David S. Miller
Browse files

ionic: set station addr only if needed



The code was working too hard and in some cases was trying to
delete filters that weren't there, generating a potentially
misleading error message.
    IONIC_CMD_RX_FILTER_DEL (32) failed: IONIC_RC_ENOENT (-2)

Fixes: 2a654540 ("ionic: Add Rx filter and rx_mode ndo support")
Signed-off-by: default avatarShannon Nelson <snelson@pensando.io>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7e4d4759
Loading
Loading
Loading
Loading
+19 −13
Original line number Diff line number Diff line
@@ -2341,10 +2341,12 @@ static int ionic_station_set(struct ionic_lif *lif)
	err = ionic_adminq_post_wait(lif, &ctx);
	if (err)
		return err;

	netdev_dbg(lif->netdev, "found initial MAC addr %pM\n",
		   ctx.comp.lif_getattr.mac);
	if (is_zero_ether_addr(ctx.comp.lif_getattr.mac))
		return 0;

	if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) {
		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);
@@ -2354,11 +2356,15 @@ 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);
	}

	netdev_dbg(lif->netdev, "adding station MAC addr %pM\n",
		   netdev->dev_addr);
	ionic_lif_addr(lif, netdev->dev_addr, true);