On Thu, 29 Aug 2019 11:27:13 -0700, Shannon Nelson wrote:
> @@ -588,8 +866,26 @@ static int ionic_set_features(struct net_device *netdev,
>  
>  static int ionic_set_mac_address(struct net_device *netdev, void *sa)
>  {
> -     netdev_info(netdev, "%s: stubbed\n", __func__);
> -     return 0;
> +     struct sockaddr *addr = sa;
> +     u8 *mac;
> +
> +     mac = (u8 *)addr->sa_data;
> +     if (ether_addr_equal(netdev->dev_addr, mac))
> +             return 0;
> +
> +     if (!is_valid_ether_addr(mac))
> +             return -EADDRNOTAVAIL;
> +
> +     if (!is_zero_ether_addr(netdev->dev_addr)) {
> +             netdev_info(netdev, "deleting mac addr %pM\n",
> +                         netdev->dev_addr);
> +             ionic_addr_del(netdev, netdev->dev_addr);
> +     }
> +
> +     memcpy(netdev->dev_addr, mac, netdev->addr_len);
> +     netdev_info(netdev, "updating mac addr %pM\n", mac);
> +
> +     return ionic_addr_add(netdev, mac);
>  }

Please use the eth_prepare_mac_addr_change() and
eth_commit_mac_addr_change() helpers.

Reply via email to