diff options
author | Jiri Pirko <jiri@mellanox.com> | 2019-04-25 15:59:51 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-26 07:52:02 +0200 |
commit | 514cf64cc5353929fbfb82ed1bda24588acaf96a (patch) | |
tree | c78e85f2d5866a512c239fa140cee835a8f51de2 /drivers/net/netdevsim/netdev.c | |
parent | netdevsim: merge sdev into dev (diff) | |
download | linux-514cf64cc5353929fbfb82ed1bda24588acaf96a.tar.xz linux-514cf64cc5353929fbfb82ed1bda24588acaf96a.zip |
netdevsim: generate random switch id instead of using dev id
Current implementation of parent_id/switch_id does not follow the
original idea of being unique. The values are "0", "1", etc. Instead of
that, generate 32 random bytes.
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netdevsim/netdev.c')
-rw-r--r-- | drivers/net/netdevsim/netdev.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c index c5f4bbb9716f..9b4310e20129 100644 --- a/drivers/net/netdevsim/netdev.c +++ b/drivers/net/netdevsim/netdev.c @@ -32,8 +32,7 @@ static int nsim_get_port_parent_id(struct net_device *dev, { struct netdevsim *ns = netdev_priv(dev); - ppid->id_len = sizeof(ns->nsim_dev->nsim_bus_dev->dev.id); - memcpy(&ppid->id, &ns->nsim_dev->nsim_bus_dev->dev.id, ppid->id_len); + memcpy(ppid, &ns->nsim_dev->switch_id, sizeof(*ppid)); return 0; } |