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: 2a654540be ("ionic: Add Rx filter and rx_mode ndo support")
Signed-off-by: Shannon Nelson <snelson@pensando.io>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Shannon Nelson 2020-04-08 09:19:12 -07:00 committed by David S. Miller
parent 7e4d47596b
commit 216902ae77

View File

@ -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);