On Sun, Mar 29, 2015 at 04:51:27PM +0300, Or Gerlitz wrote:
> +void mlx4_set_random_admin_guid(struct mlx4_dev *dev, int entry, int port)
> +{
> + struct mlx4_priv *priv = mlx4_priv(dev);
> + u8 random_mac[6];
> + char *raw_gid;
> +
> + /* hw GUID */
> + if (entry == 0)
> + return;
> +
> + eth_random_addr(random_mac);
> + raw_gid = (char *)&priv->mfunc.master.vf_admin[entry].vport[port].guid;
raw_gid is actually a guid
> + raw_gid[0] = random_mac[0] ^ 2;
eth_random_addr already guarentees the ULA bit is set to one (local),
so this is wrong. IBA uses the EUI-64 system, not the IPv6
modification.
> + raw_gid[1] = random_mac[1];
> + raw_gid[2] = random_mac[2];
> + raw_gid[3] = 0xff;
> + raw_gid[4] = 0xfe;
This should be 0xff for mapping a MAC to a EUI-64
But, it doesn't really make sense to use eth_random_addr (which
doesn't have a special OUI) and not randomize every bit.
get_random_bytes(&guid, sizeof(guid));
guid &= ~(1ULL << 56);
guid |= 1ULL << 57;
I also don't think the kernel should be generating random GUIDs. Either
the SA should be consulted to do this, or the management stack should
generate a cloud wide unique number.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html