diff mbox series

[RFC,2/3] net/lo: Ensure lo devices have a MAC address

Message ID 168330135435.5953.3471584034284499194.stgit@oracle-102.nfsv4bat.org (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series siw on tunnel devices | expand

Checks

Context Check Description
netdev/series_format success Posting correctly formatted
netdev/tree_selection success Guessed tree name to be net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 10 this patch: 10
netdev/cc_maintainers fail 4 maintainers not CCed: kuba@kernel.org edumazet@google.com davem@davemloft.net pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Chuck Lever May 5, 2023, 3:42 p.m. UTC
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/loopback.c |    2 ++
 1 file changed, 2 insertions(+)

Comments

Stephen Hemminger May 5, 2023, 4:57 p.m. UTC | #1
On Fri, 05 May 2023 11:42:44 -0400
Chuck Lever <cel@kernel.org> wrote:

> 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/loopback.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
> index f6d53e63ef4e..1ce4f19d8065 100644
> --- a/drivers/net/loopback.c
> +++ b/drivers/net/loopback.c
> @@ -192,6 +192,8 @@ static void gen_lo_setup(struct net_device *dev,
>  	dev->needs_free_netdev	= true;
>  	dev->priv_destructor	= dev_destructor;
>  
> +	eth_hw_addr_random(dev);
> +
>  	netif_set_tso_max_size(dev, GSO_MAX_SIZE);
>  }
>  
> 
> 
> 

This enough of a change, it will probably break somebody.
If you need dummy endpoint (ie multiple loopback), a common way
is to use dummy devices for that.
diff mbox series

Patch

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index f6d53e63ef4e..1ce4f19d8065 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -192,6 +192,8 @@  static void gen_lo_setup(struct net_device *dev,
 	dev->needs_free_netdev	= true;
 	dev->priv_destructor	= dev_destructor;
 
+	eth_hw_addr_random(dev);
+
 	netif_set_tso_max_size(dev, GSO_MAX_SIZE);
 }