All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem <davem@davemloft.net>, netdev <netdev@vger.kernel.org>,
	mst <mst@redhat.com>,
	virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH net-next] net: virtio: use eth_hw_addr_set()
Date: Wed, 27 Oct 2021 15:24:55 +0800	[thread overview]
Message-ID: <CACGkMEvWKOLWEuexbdZozYzzRWPM-Wnf8ms4wLk6gX76hWmzwA@mail.gmail.com> (raw)
In-Reply-To: <CACGkMEu6ZnyJF2nKS-GURc2Fz8BqUY6OGFEa71fNKPfGA0Wp7g@mail.gmail.com>

On Wed, Oct 27, 2021 at 10:45 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Wed, Oct 27, 2021 at 1:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
> > of VLANs...") introduced a rbtree for faster Ethernet address look
> > up. To maintain netdev->dev_addr in this tree we need to make all
> > the writes to it go through appropriate helpers.
>
> I think the title should be "net: virtio: use eth_hw_addr_set()"

I meant "dev_addr_set()" actually.

Thanks

>
> >
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> > ---
> > CC: mst@redhat.com
> > CC: jasowang@redhat.com
> > CC: virtualization@lists.linux-foundation.org
> > ---
> >  drivers/net/virtio_net.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index c501b5974aee..b7f35aff8e82 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -3177,12 +3177,16 @@ static int virtnet_probe(struct virtio_device *vdev)
> >         dev->max_mtu = MAX_MTU;
> >
> >         /* Configuration may specify what MAC to use.  Otherwise random. */
> > -       if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
> > +       if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
> > +               u8 addr[MAX_ADDR_LEN];
> > +
> >                 virtio_cread_bytes(vdev,
> >                                    offsetof(struct virtio_net_config, mac),
> > -                                  dev->dev_addr, dev->addr_len);
> > -       else
> > +                                  addr, dev->addr_len);
> > +               dev_addr_set(dev, addr);
> > +       } else {
> >                 eth_hw_addr_random(dev);
> > +       }
>
> Do we need to change virtnet_set_mac_address() as well?
>
> Thanks
>
> >
> >         /* Set up our device-specific information */
> >         vi = netdev_priv(dev);
> > --
> > 2.31.1
> >


WARNING: multiple messages have this Message-ID (diff)
From: Jason Wang <jasowang@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev <netdev@vger.kernel.org>,
	virtualization <virtualization@lists.linux-foundation.org>,
	davem <davem@davemloft.net>, mst <mst@redhat.com>
Subject: Re: [PATCH net-next] net: virtio: use eth_hw_addr_set()
Date: Wed, 27 Oct 2021 15:24:55 +0800	[thread overview]
Message-ID: <CACGkMEvWKOLWEuexbdZozYzzRWPM-Wnf8ms4wLk6gX76hWmzwA@mail.gmail.com> (raw)
In-Reply-To: <CACGkMEu6ZnyJF2nKS-GURc2Fz8BqUY6OGFEa71fNKPfGA0Wp7g@mail.gmail.com>

On Wed, Oct 27, 2021 at 10:45 AM Jason Wang <jasowang@redhat.com> wrote:
>
> On Wed, Oct 27, 2021 at 1:56 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
> > of VLANs...") introduced a rbtree for faster Ethernet address look
> > up. To maintain netdev->dev_addr in this tree we need to make all
> > the writes to it go through appropriate helpers.
>
> I think the title should be "net: virtio: use eth_hw_addr_set()"

I meant "dev_addr_set()" actually.

Thanks

>
> >
> > Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> > ---
> > CC: mst@redhat.com
> > CC: jasowang@redhat.com
> > CC: virtualization@lists.linux-foundation.org
> > ---
> >  drivers/net/virtio_net.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> > index c501b5974aee..b7f35aff8e82 100644
> > --- a/drivers/net/virtio_net.c
> > +++ b/drivers/net/virtio_net.c
> > @@ -3177,12 +3177,16 @@ static int virtnet_probe(struct virtio_device *vdev)
> >         dev->max_mtu = MAX_MTU;
> >
> >         /* Configuration may specify what MAC to use.  Otherwise random. */
> > -       if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC))
> > +       if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC)) {
> > +               u8 addr[MAX_ADDR_LEN];
> > +
> >                 virtio_cread_bytes(vdev,
> >                                    offsetof(struct virtio_net_config, mac),
> > -                                  dev->dev_addr, dev->addr_len);
> > -       else
> > +                                  addr, dev->addr_len);
> > +               dev_addr_set(dev, addr);
> > +       } else {
> >                 eth_hw_addr_random(dev);
> > +       }
>
> Do we need to change virtnet_set_mac_address() as well?
>
> Thanks
>
> >
> >         /* Set up our device-specific information */
> >         vi = netdev_priv(dev);
> > --
> > 2.31.1
> >

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-10-27  7:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 17:56 [PATCH net-next] net: virtio: use eth_hw_addr_set() Jakub Kicinski
2021-10-27  2:45 ` Jason Wang
2021-10-27  2:45   ` Jason Wang
2021-10-27  7:24   ` Jason Wang [this message]
2021-10-27  7:24     ` Jason Wang
2021-10-27  7:40     ` Michael S. Tsirkin
2021-10-27  7:40       ` Michael S. Tsirkin
2021-10-27 13:28   ` Jakub Kicinski
2021-10-27  7:23 ` Michael S. Tsirkin
2021-10-27  7:23   ` Michael S. Tsirkin
2021-10-27 13:26   ` Jakub Kicinski
2021-10-27 14:55     ` Michael S. Tsirkin
2021-10-27 14:55       ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CACGkMEvWKOLWEuexbdZozYzzRWPM-Wnf8ms4wLk6gX76hWmzwA@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.