Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0508ad64 authored by Or Gerlitz's avatar Or Gerlitz Committed by David S. Miller
Browse files

net/mlx4_core: Don't give VFs MAC addresses which are derived from the PF MAC



If the user has not assigned a MAC address to a VM, then don't give it MAC which
is based on the PF one. The current derivation scheme is wrong and leads to VM
MAC collisions when the number of cards/hypervisors becomes big enough.

Instead, just give it zeros and let them figure out what to do with that.

Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 8a226b2c
Loading
Loading
Loading
Loading
+1 −10
Original line number Diff line number Diff line
@@ -845,16 +845,7 @@ int mlx4_QUERY_PORT_wrapper(struct mlx4_dev *dev, int slave,
			   MLX4_CMD_NATIVE);

	if (!err && dev->caps.function != slave) {
		/* if config MAC in DB use it */
		if (priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac)
		def_mac = priv->mfunc.master.vf_oper[slave].vport[vhcr->in_modifier].state.mac;
		else {
			/* set slave default_mac address */
			MLX4_GET(def_mac, outbox->buf, QUERY_PORT_MAC_OFFSET);
			def_mac += slave << 8;
			priv->mfunc.master.vf_admin[slave].vport[vhcr->in_modifier].mac = def_mac;
		}

		MLX4_PUT(outbox->buf, def_mac, QUERY_PORT_MAC_OFFSET);

		/* get port type - currently only eth is enabled */