netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>,
	wei.liu@kernel.org, paul@xen.org, boris.ostrovsky@oracle.com,
	jgross@suse.com, sstabellini@kernel.org,
	xen-devel@lists.xenproject.org
Subject: [PATCH net-next v2 01/12] net: xen: use eth_hw_addr_set()
Date: Thu, 21 Oct 2021 06:12:03 -0700	[thread overview]
Message-ID: <20211021131214.2032925-2-kuba@kernel.org> (raw)
In-Reply-To: <20211021131214.2032925-1-kuba@kernel.org>

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 got through appropriate helpers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: wei.liu@kernel.org
CC: paul@xen.org
CC: boris.ostrovsky@oracle.com
CC: jgross@suse.com
CC: sstabellini@kernel.org
CC: xen-devel@lists.xenproject.org
---
 drivers/net/xen-netback/interface.c | 6 ++++--
 drivers/net/xen-netfront.c          | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/net/xen-netback/interface.c b/drivers/net/xen-netback/interface.c
index c58996c1e230..fe8e21ad8ed9 100644
--- a/drivers/net/xen-netback/interface.c
+++ b/drivers/net/xen-netback/interface.c
@@ -494,6 +494,9 @@ static const struct net_device_ops xenvif_netdev_ops = {
 struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 			    unsigned int handle)
 {
+	static const u8 dummy_addr[ETH_ALEN] = {
+		0xfe, 0xff, 0xff, 0xff, 0xff, 0xff,
+	};
 	int err;
 	struct net_device *dev;
 	struct xenvif *vif;
@@ -551,8 +554,7 @@ struct xenvif *xenvif_alloc(struct device *parent, domid_t domid,
 	 * stolen by an Ethernet bridge for STP purposes.
 	 * (FE:FF:FF:FF:FF:FF)
 	 */
-	eth_broadcast_addr(dev->dev_addr);
-	dev->dev_addr[0] &= ~0x01;
+	eth_hw_addr_set(dev, dummy_addr);
 
 	netif_carrier_off(dev);
 
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index e31b98403f31..57437e4b8a94 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -2157,6 +2157,7 @@ static int talk_to_netback(struct xenbus_device *dev,
 	unsigned int max_queues = 0;
 	struct netfront_queue *queue = NULL;
 	unsigned int num_queues = 1;
+	u8 addr[ETH_ALEN];
 
 	info->netdev->irq = 0;
 
@@ -2170,11 +2171,12 @@ static int talk_to_netback(struct xenbus_device *dev,
 					"feature-split-event-channels", 0);
 
 	/* Read mac addr. */
-	err = xen_net_read_mac(dev, info->netdev->dev_addr);
+	err = xen_net_read_mac(dev, addr);
 	if (err) {
 		xenbus_dev_fatal(dev, err, "parsing %s/mac", dev->nodename);
 		goto out_unlocked;
 	}
+	eth_hw_addr_set(info->netdev, addr);
 
 	info->netback_has_xdp_headroom = xenbus_read_unsigned(info->xbdev->otherend,
 							      "feature-xdp-headroom", 0);
-- 
2.31.1


  reply	other threads:[~2021-10-21 13:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21 13:12 [PATCH net-next v2 00/12] net: don't write directly to netdev->dev_addr Jakub Kicinski
2021-10-21 13:12 ` Jakub Kicinski [this message]
2021-10-23  0:41   ` [PATCH net-next v2 01/12] net: xen: use eth_hw_addr_set() Boris Ostrovsky
2021-10-25 10:55   ` Wei Liu
2021-10-21 13:12 ` [PATCH net-next v2 02/12] usb: smsc: " Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 03/12] net: qmi_wwan: use dev_addr_mod() Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 04/12] net: usb: don't write directly to netdev->dev_addr Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 05/12] fddi: defxx,defza: use dev_addr_set() Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 06/12] fddi: skfp: constify and " Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 07/12] net: fjes: constify and use eth_hw_addr_set() Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 08/12] net: hippi: use dev_addr_set() Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 09/12] net: s390: constify and use eth_hw_addr_set() Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 10/12] net: plip: " Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 11/12] net: sb1000,rionet: " Jakub Kicinski
2021-10-21 13:12 ` [PATCH net-next v2 12/12] net: hldc_fr: use dev_addr_set() Jakub Kicinski
2021-10-22  6:22   ` Krzysztof Hałasa
2021-10-22 17:20 ` [PATCH net-next v2 00/12] net: don't write directly to netdev->dev_addr patchwork-bot+netdevbpf

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=20211021131214.2032925-2-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=davem@davemloft.net \
    --cc=jgross@suse.com \
    --cc=netdev@vger.kernel.org \
    --cc=paul@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu@kernel.org \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).