Re: [PATCH v7 2/3] vdpa_sim_net: Add the support of set mac address

From: Cindy Lu
Date: Mon Jul 29 2024 - 21:28:57 EST


On Tue, 30 Jul 2024 at 03:15, Andrew Lunn <andrew@xxxxxxx> wrote:
>
> > +static int vdpasim_net_set_attr(struct vdpa_mgmt_dev *mdev, struct vdpa_device *dev,
> > + const struct vdpa_dev_set_config *config)
> > +{
> > + struct vdpasim *vdpasim = container_of(dev, struct vdpasim, vdpa);
> > + struct virtio_net_config *vio_config = vdpasim->config;
> > +
> > + mutex_lock(&vdpasim->mutex);
> > +
> > + if (config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR)) {
> > + ether_addr_copy(vio_config->mac, config->net.mac);
> > + mutex_unlock(&vdpasim->mutex);
> > + return 0;
> > + }
> > +
> > + mutex_unlock(&vdpasim->mutex);
> > + return -EINVAL;
>
> EOPNOTSUPP would be more appropriate.
>
> Andrew
>
will change this
Thanks
cindy