IB/mlx5: Restore IB guid/policy for virtual functions
Subsystems (4)
PATCH 1/1 IB/mlx5: Restore IB guid/policy for virtual functions
From: Bodong Wang <bodong-VPRAkNaXOzVWk0Htik3J/[email protected]>
When a user sets port_guid, node_guid or policy of an IB virtual function, save this information in "struct mlx5_vf_context".
This information will be restored later when pci_resume is called. To make sure this works, one can use aer-inject to generate PCI errors on mlx5 devices and verify if relevant fields are restored after PCI resume.
--- drivers/infiniband/hw/mlx5/ib_virt.c | 9 ++++++ drivers/net/ethernet/mellanox/mlx5/core/sriov.c | 42 +++++++++++++++++++++++++ include/linux/mlx5/driver.h | 17 +++++----- 3 files changed, 61 insertions(+), 7 deletions(-)
drivers/infiniband/hw/mlx5/ib_virt.c +9 -0
@@ -96,6 +96,7 @@ int mlx5_ib_set_vf_link_state(struct ib_device *device, int vf,struct mlx5_ib_dev *dev =to_mdev (device);struct mlx5_core_dev *mdev = dev->mdev;struct mlx5_hca_vport_context *in; +struct mlx5_vf_context *vfs_ctx = mdev->priv.sriov.vfs_ctx;int err; in =kzalloc (sizeof (*in),GFP_KERNEL );
@@ -109,6 +110,8 @@ int mlx5_ib_set_vf_link_state(struct ib_device *device, int vf, } in->field_select =MLX5_HCA_VPORT_SEL_STATE_POLICY ; err =mlx5_core_modify_hca_vport_context (mdev,1 ,1 , vf +1 , in); +if (!err) + vfs_ctx[vf].policy = in->policy; out:kfree (in);
@@ -151,6 +154,7 @@ static int set_vf_node_guid(struct ib_device *device, int vf, u8 port, u64 guid)struct mlx5_ib_dev *dev =to_mdev (device);struct mlx5_core_dev *mdev = dev->mdev;struct mlx5_hca_vport_context *in; +struct mlx5_vf_context *vfs_ctx = mdev->priv.sriov.vfs_ctx;int err; in =kzalloc (sizeof (*in),GFP_KERNEL );
@@ -160,6 +164,8 @@ static int set_vf_node_guid(struct ib_device *device, int vf, u8 port, u64 guid) in->field_select =MLX5_HCA_VPORT_SEL_NODE_GUID ; in->node_guid = guid; err =mlx5_core_modify_hca_vport_context (mdev,1 ,1 , vf +1 , in); +if (!err) + vfs_ctx[vf].node_guid = guid;kfree (in);return err; }
@@ -169,6 +175,7 @@ static int set_vf_port_guid(struct ib_device *device, int vf, u8 port, u64 guid)struct mlx5_ib_dev *dev =to_mdev (device);struct mlx5_core_dev *mdev = dev->mdev;struct mlx5_hca_vport_context *in; +struct mlx5_vf_context *vfs_ctx = mdev->priv.sriov.vfs_ctx;int err; in =kzalloc (sizeof (*in),GFP_KERNEL );
@@ -178,6 +185,8 @@ static int set_vf_port_guid(struct ib_device *device, int vf, u8 port, u64 guid) in->field_select =MLX5_HCA_VPORT_SEL_PORT_GUID ; in->port_guid = guid; err =mlx5_core_modify_hca_vport_context (mdev,1 ,1 , vf +1 , in); +if (!err) + vfs_ctx[vf].port_guid = guid;kfree (in);return err; }
drivers/net/ethernet/mellanox/mlx5/core/sriov.c +42 -0
60 lines not on this page · raw message
include/linux/mlx5/driver.h +10 -7
@@ -155,6 +155,13 @@ enum dbg_rsc_type { MLX5_DBG_RSC_CQ, }; +enum port_state_policy { +MLX5_POLICY_DOWN =0 , +MLX5_POLICY_UP =1 , +MLX5_POLICY_FOLLOW =2 , +MLX5_POLICY_INVALID =0xffffffff +}; +struct mlx5_field_desc {struct dentry *dent;int i;
@@ -518,6 +525,9 @@ struct mlx5_mkey_table {struct mlx5_vf_context {int enabled; +u64 port_guid; +u64 node_guid; +enum port_state_policy policy; };struct mlx5_core_sriov {
@@ -812,13 +822,6 @@ struct mlx5_pas {u8 log_sz; }; -enum port_state_policy { -MLX5_POLICY_DOWN =0 , -MLX5_POLICY_UP =1 , -MLX5_POLICY_FOLLOW =2 , -MLX5_POLICY_INVALID =0xffffffff -}; -enum phy_port_state {MLX5_AAA_111 };
--
2.12.2
--
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
A message that is not in the archive (sent off-list or not yet received): 20170530071824.8933-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Doug Ledford
AppliedQuoted 5 lines · Leon Romanovsky
From: Bodong Wang <bodong-VPRAkNaXOzVWk0Htik3J/[email protected]>
When a user sets
port_guid,node_guidor policy of an IB virtual function, save this information in "structmlx5_vf_context".
Quoted 8 lines
This information will be restored later when
pci_resumeis called. To make sure this works, one can use aer-inject to generate PCI errors on mlx5 devices and verify if relevant fields are restored after PCI resume.Signed-off-by Leon Romanovsky <[email protected]>
Thanks, applied.
Signature · 8 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- 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