All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <cel@kernel.org>
To: netdev@vger.kernel.org, linux-rdma@vger.kernel.org
Cc: BMT@zurich.ibm.com, tom@talpey.com
Subject: [PATCH RFC 1/3] net/tun: Ensure tun devices have a MAC address
Date: Fri, 05 May 2023 11:42:17 -0400	[thread overview]
Message-ID: <168330132769.5953.7109360341846745035.stgit@oracle-102.nfsv4bat.org> (raw)
In-Reply-To: <168330051600.5953.11366152375575299483.stgit@oracle-102.nfsv4bat.org>

From: Chuck Lever <chuck.lever@oracle.com>

A non-zero MAC address enables a network device to be assigned as
the underlying device for a virtual RDMA device. Without a non-
zero MAC address, cma_acquire_dev_by_src_ip() is unable to find the
underlying egress device that corresponds to a source IP address,
and rdma_resolve_address() fails.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 drivers/net/tun.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index d4d0a41a905a..da85abfcd254 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1384,7 +1384,7 @@ static void tun_net_initialize(struct net_device *dev)
 
 		/* Point-to-Point TUN Device */
 		dev->hard_header_len = 0;
-		dev->addr_len = 0;
+		dev->addr_len = ETH_ALEN;
 		dev->mtu = 1500;
 
 		/* Zero header length */
@@ -1399,8 +1399,6 @@ static void tun_net_initialize(struct net_device *dev)
 		dev->priv_flags &= ~IFF_TX_SKB_SHARING;
 		dev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
 
-		eth_hw_addr_random(dev);
-
 		/* Currently tun does not support XDP, only tap does. */
 		dev->xdp_features = NETDEV_XDP_ACT_BASIC |
 				    NETDEV_XDP_ACT_REDIRECT |
@@ -1409,6 +1407,8 @@ static void tun_net_initialize(struct net_device *dev)
 		break;
 	}
 
+	eth_hw_addr_random(dev);
+
 	dev->min_mtu = MIN_MTU;
 	dev->max_mtu = MAX_MTU - dev->hard_header_len;
 }



  reply	other threads:[~2023-05-05 15:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 15:41 [PATCH RFC 0/3] siw on tunnel devices Chuck Lever
2023-05-05 15:42 ` Chuck Lever [this message]
2023-05-05 16:59   ` [PATCH RFC 1/3] net/tun: Ensure tun devices have a MAC address Stephen Hemminger
2023-05-05 17:09     ` Chuck Lever III
2023-05-05 15:42 ` [PATCH RFC 2/3] net/lo: Ensure lo " Chuck Lever
2023-05-05 16:57   ` Stephen Hemminger
2023-05-05 15:43 ` [PATCH RFC 3/3] RDMA/siw: Require non-zero 6-byte MACs for soft iWARP Chuck Lever
2023-05-05 19:58   ` Jason Gunthorpe
2023-05-05 20:03     ` Chuck Lever III
2023-05-06 18:05       ` Chuck Lever III
2023-05-23 19:18     ` Chuck Lever III
2023-05-23 19:44       ` Tom Talpey
2023-05-23 22:50         ` Chuck Lever III
2023-05-31 19:04       ` Jason Gunthorpe
2023-05-31 19:11         ` Chuck Lever III
2023-05-31 20:09           ` Jason Gunthorpe
2023-05-31 20:19             ` Chuck Lever III

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=168330132769.5953.7109360341846745035.stgit@oracle-102.nfsv4bat.org \
    --to=cel@kernel.org \
    --cc=BMT@zurich.ibm.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=tom@talpey.com \
    /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.