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

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
...@@ -2341,24 +2341,30 @@ static int ionic_station_set(struct ionic_lif *lif) ...@@ -2341,24 +2341,30 @@ static int ionic_station_set(struct ionic_lif *lif)
err = ionic_adminq_post_wait(lif, &ctx); err = ionic_adminq_post_wait(lif, &ctx);
if (err) if (err)
return 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)) if (is_zero_ether_addr(ctx.comp.lif_getattr.mac))
return 0; return 0;
memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len); if (!ether_addr_equal(ctx.comp.lif_getattr.mac, netdev->dev_addr)) {
addr.sa_family = AF_INET; memcpy(addr.sa_data, ctx.comp.lif_getattr.mac, netdev->addr_len);
err = eth_prepare_mac_addr_change(netdev, &addr); addr.sa_family = AF_INET;
if (err) { err = eth_prepare_mac_addr_change(netdev, &addr);
netdev_warn(lif->netdev, "ignoring bad MAC addr from NIC %pM - err %d\n", if (err) {
addr.sa_data, err); netdev_warn(lif->netdev, "ignoring bad MAC addr from NIC %pM - err %d\n",
return 0; addr.sa_data, err);
} return 0;
}
netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n", if (!is_zero_ether_addr(netdev->dev_addr)) {
netdev->dev_addr); netdev_dbg(lif->netdev, "deleting station MAC addr %pM\n",
ionic_lif_addr(lif, netdev->dev_addr, false); netdev->dev_addr);
ionic_lif_addr(lif, netdev->dev_addr, false);
}
eth_commit_mac_addr_change(netdev, &addr);
}
eth_commit_mac_addr_change(netdev, &addr);
netdev_dbg(lif->netdev, "adding station MAC addr %pM\n", netdev_dbg(lif->netdev, "adding station MAC addr %pM\n",
netdev->dev_addr); netdev->dev_addr);
ionic_lif_addr(lif, netdev->dev_addr, true); ionic_lif_addr(lif, netdev->dev_addr, true);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment