aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@mellanox.com>2015-03-03 04:23:32 -0500
committerDoug Ledford <dledford@redhat.com>2015-04-15 15:51:50 -0400
commitfb517a4f03041c5eaed394bd57ee518b44301f1a (patch)
treeaa2a5eb73abb70d1a364b50722f77fe3b05a3cb3
parent773af94e4e3984d4055c332602de5d0d2ee3d840 (diff)
net/mlx4_core: Set initial admin GUIDs for VFs
To have out of the box experience, the PF generates random GUIDs who serve as the initial admin values. Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/cmd.c1
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c15
-rw-r--r--include/linux/mlx4/device.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/cmd.c b/drivers/net/ethernet/mellanox/mlx4/cmd.c
index f0fbb4ade85d..50ce67d4abfc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx4/cmd.c
@@ -2350,6 +2350,7 @@ int mlx4_multi_func_init(struct mlx4_dev *dev)
2350 oper_vport->qos_vport = MLX4_VPP_DEFAULT_VPORT; 2350 oper_vport->qos_vport = MLX4_VPP_DEFAULT_VPORT;
2351 vf_oper->vport[port].vlan_idx = NO_INDX; 2351 vf_oper->vport[port].vlan_idx = NO_INDX;
2352 vf_oper->vport[port].mac_idx = NO_INDX; 2352 vf_oper->vport[port].mac_idx = NO_INDX;
2353 mlx4_set_random_admin_guid(dev, i, port);
2353 } 2354 }
2354 spin_lock_init(&s_state->lock); 2355 spin_lock_init(&s_state->lock);
2355 } 2356 }
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index 9162a6dd7823..ced5ecab5aa7 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -2276,6 +2276,21 @@ __be64 mlx4_get_admin_guid(struct mlx4_dev *dev, int entry, int port)
2276} 2276}
2277EXPORT_SYMBOL_GPL(mlx4_get_admin_guid); 2277EXPORT_SYMBOL_GPL(mlx4_get_admin_guid);
2278 2278
2279void mlx4_set_random_admin_guid(struct mlx4_dev *dev, int entry, int port)
2280{
2281 struct mlx4_priv *priv = mlx4_priv(dev);
2282 __be64 guid;
2283
2284 /* hw GUID */
2285 if (entry == 0)
2286 return;
2287
2288 get_random_bytes((char *)&guid, sizeof(guid));
2289 guid &= ~(cpu_to_be64(1ULL << 56));
2290 guid |= cpu_to_be64(1ULL << 57);
2291 priv->mfunc.master.vf_admin[entry].vport[port].guid = guid;
2292}
2293
2279static int mlx4_setup_hca(struct mlx4_dev *dev) 2294static int mlx4_setup_hca(struct mlx4_dev *dev)
2280{ 2295{
2281 struct mlx4_priv *priv = mlx4_priv(dev); 2296 struct mlx4_priv *priv = mlx4_priv(dev);
diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h
index 39a91b0c5d5c..83e80ab94500 100644
--- a/include/linux/mlx4/device.h
+++ b/include/linux/mlx4/device.h
@@ -1348,6 +1348,7 @@ void mlx4_counter_free(struct mlx4_dev *dev, u32 idx);
1348void mlx4_set_admin_guid(struct mlx4_dev *dev, __be64 guid, int entry, 1348void mlx4_set_admin_guid(struct mlx4_dev *dev, __be64 guid, int entry,
1349 int port); 1349 int port);
1350__be64 mlx4_get_admin_guid(struct mlx4_dev *dev, int entry, int port); 1350__be64 mlx4_get_admin_guid(struct mlx4_dev *dev, int entry, int port);
1351void mlx4_set_random_admin_guid(struct mlx4_dev *dev, int entry, int port);
1351int mlx4_flow_attach(struct mlx4_dev *dev, 1352int mlx4_flow_attach(struct mlx4_dev *dev,
1352 struct mlx4_net_trans_rule *rule, u64 *reg_id); 1353 struct mlx4_net_trans_rule *rule, u64 *reg_id);
1353int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id); 1354int mlx4_flow_detach(struct mlx4_dev *dev, u64 reg_id);