diff options
| author | Toke Høiland-Jørgensen <[email protected]> | 2025-07-10 11:18:33 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-07-12 00:00:18 +0000 |
| commit | 54cb59cf81b02de847178c054eed7957170e9386 (patch) | |
| tree | d351084a6e79dc16a48e6c5b69a9519f95429563 /drivers/net/netdevsim/netdev.c | |
| parent | selftests: flip local/remote endpoints in iou-zcrx.py (diff) | |
| download | kernel-54cb59cf81b02de847178c054eed7957170e9386.tar.gz kernel-54cb59cf81b02de847178c054eed7957170e9386.zip | |
net: netdevsim: Support setting dev->perm_addr on port creation
Network management daemons that match on the device permanent address
currently have no virtual interface types to test against.
NetworkManager, in particular, has carried an out of tree patch to set
the permanent address on netdevsim devices to use in its CI for this
purpose.
To support this use case, support setting netdev->perm_addr when
creating a netdevsim port.
Reviewed-by: Simon Horman <[email protected]>
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
| -rw-r--r-- | drivers/net/netdevsim/netdev.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index e36d3e846c2d..f316e44130f7 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -998,8 +998,9 @@ static void nsim_exit_netdevsim(struct netdevsim *ns) mock_phc_destroy(ns->phc); } -struct netdevsim * -nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) +struct netdevsim *nsim_create(struct nsim_dev *nsim_dev, + struct nsim_dev_port *nsim_dev_port, + u8 perm_addr[ETH_ALEN]) { struct net_device *dev; struct netdevsim *ns; @@ -1010,6 +1011,9 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) if (!dev) return ERR_PTR(-ENOMEM); + if (perm_addr) + memcpy(dev->perm_addr, perm_addr, ETH_ALEN); + dev_net_set(dev, nsim_dev_net(nsim_dev)); ns = netdev_priv(dev); ns->netdev = dev; @@ -1031,7 +1035,6 @@ nsim_create(struct nsim_dev *nsim_dev, struct nsim_dev_port *nsim_dev_port) ns->qr_dfs = debugfs_create_file("queue_reset", 0200, nsim_dev_port->ddir, ns, &nsim_qreset_fops); - return ns; err_free_netdev: |
