Message ID | 20210222121020.153222666@linuxfoundation.org |
---|---|
State | New |
Headers | show |
Series | None | expand |
Hi! > From: Stefano Garzarella <sgarzare@redhat.com> > > commit cf1a3b35382c10ce315c32bd2b3d7789897fbe13 upstream. > > As preparation for the next patches, we store the MAC address, > parsed during the vdpasim_create(), in a buffer that will be used > to fill 'config' together with other configurations. I'm not sure why this series is in stable. It is not documented to fix anything bad. > +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > @@ -42,6 +42,8 @@ static char *macaddr; > module_param(macaddr, charp, 0); > MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); > > +u8 macaddr_buf[ETH_ALEN]; > + Should this be static? Best regards, Pavel
On Mon, Feb 22, 2021 at 08:54:15PM +0100, Pavel Machek wrote: > Hi! > > > From: Stefano Garzarella <sgarzare@redhat.com> > > > > commit cf1a3b35382c10ce315c32bd2b3d7789897fbe13 upstream. > > > > As preparation for the next patches, we store the MAC address, > > parsed during the vdpasim_create(), in a buffer that will be used > > to fill 'config' together with other configurations. > > I'm not sure why this series is in stable. It is not documented to fix > anything bad. Please see https://lore.kernel.org/r/20210211162519.215418-1-sgarzare@redhat.com
On Mon, Feb 22, 2021 at 08:54:15PM +0100, Pavel Machek wrote: >Hi! > >> From: Stefano Garzarella <sgarzare@redhat.com> >> >> commit cf1a3b35382c10ce315c32bd2b3d7789897fbe13 upstream. >> >> As preparation for the next patches, we store the MAC address, >> parsed during the vdpasim_create(), in a buffer that will be used >> to fill 'config' together with other configurations. > >I'm not sure why this series is in stable. It is not documented to fix >anything bad. > >> +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c >> @@ -42,6 +42,8 @@ static char *macaddr; >> module_param(macaddr, charp, 0); >> MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); >> >> +u8 macaddr_buf[ETH_ALEN]; >> + > >Should this be static? Yes, there is already a patch [1] queued by Michael but not yet upstream. When it will be merged upstream I will make sure it will be backported. Thanks, Stefano [1] https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git/commit/?h=linux-next&id=8c0bea4adac9f1f9ac827210fa8862be4bde6290
Hi! > >>+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c > >>@@ -42,6 +42,8 @@ static char *macaddr; > >> module_param(macaddr, charp, 0); > >> MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); > >> > >>+u8 macaddr_buf[ETH_ALEN]; > >>+ > > > >Should this be static? > > Yes, there is already a patch [1] queued by Michael but not yet upstream. > When it will be merged upstream I will make sure it will be backported. Having it in mainline is enough, I don't really think it causes anything user-visible, so it does not need to be in stable. Best regards, Pavel -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
On Wed, Feb 24, 2021 at 09:29:54AM +0100, Pavel Machek wrote: >Hi! > >> >>+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c >> >>@@ -42,6 +42,8 @@ static char *macaddr; >> >> module_param(macaddr, charp, 0); >> >> MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); >> >> >> >>+u8 macaddr_buf[ETH_ALEN]; >> >>+ >> > >> >Should this be static? >> >> Yes, there is already a patch [1] queued by Michael but not yet upstream. >> When it will be merged upstream I will make sure it will be backported. > >Having it in mainline is enough, I don't really think it causes >anything user-visible, so it does not need to be in stable. Got it. Thanks, Stefano
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -42,6 +42,8 @@ static char *macaddr; module_param(macaddr, charp, 0); MODULE_PARM_DESC(macaddr, "Ethernet MAC address"); +u8 macaddr_buf[ETH_ALEN]; + struct vdpasim_virtqueue { struct vringh vring; struct vringh_kiov iov; @@ -392,13 +394,13 @@ static struct vdpasim *vdpasim_create(st goto err_iommu; if (macaddr) { - mac_pton(macaddr, vdpasim->config.mac); - if (!is_valid_ether_addr(vdpasim->config.mac)) { + mac_pton(macaddr, macaddr_buf); + if (!is_valid_ether_addr(macaddr_buf)) { ret = -EADDRNOTAVAIL; goto err_iommu; } } else { - eth_random_addr(vdpasim->config.mac); + eth_random_addr(macaddr_buf); } for (i = 0; i < dev_attr->nvqs; i++) @@ -532,6 +534,8 @@ static int vdpasim_set_features(struct v config->mtu = cpu_to_vdpasim16(vdpasim, 1500); config->status = cpu_to_vdpasim16(vdpasim, VIRTIO_NET_S_LINK_UP); + memcpy(config->mac, macaddr_buf, ETH_ALEN); + return 0; }