| .. | .. |
|---|
| 134 | 134 | if (!out) |
|---|
| 135 | 135 | return -ENOMEM; |
|---|
| 136 | 136 | |
|---|
| 137 | | - err = mlx5_core_query_vport_counter(mdev, true, vf, port, out, out_sz); |
|---|
| 137 | + err = mlx5_core_query_vport_counter(mdev, true, vf, port, out); |
|---|
| 138 | 138 | if (err) |
|---|
| 139 | 139 | goto ex; |
|---|
| 140 | 140 | |
|---|
| .. | .. |
|---|
| 164 | 164 | in->field_select = MLX5_HCA_VPORT_SEL_NODE_GUID; |
|---|
| 165 | 165 | in->node_guid = guid; |
|---|
| 166 | 166 | err = mlx5_core_modify_hca_vport_context(mdev, 1, 1, vf + 1, in); |
|---|
| 167 | | - if (!err) |
|---|
| 167 | + if (!err) { |
|---|
| 168 | 168 | vfs_ctx[vf].node_guid = guid; |
|---|
| 169 | + vfs_ctx[vf].node_guid_valid = 1; |
|---|
| 170 | + } |
|---|
| 169 | 171 | kfree(in); |
|---|
| 170 | 172 | return err; |
|---|
| 171 | 173 | } |
|---|
| .. | .. |
|---|
| 185 | 187 | in->field_select = MLX5_HCA_VPORT_SEL_PORT_GUID; |
|---|
| 186 | 188 | in->port_guid = guid; |
|---|
| 187 | 189 | err = mlx5_core_modify_hca_vport_context(mdev, 1, 1, vf + 1, in); |
|---|
| 188 | | - if (!err) |
|---|
| 190 | + if (!err) { |
|---|
| 189 | 191 | vfs_ctx[vf].port_guid = guid; |
|---|
| 192 | + vfs_ctx[vf].port_guid_valid = 1; |
|---|
| 193 | + } |
|---|
| 190 | 194 | kfree(in); |
|---|
| 191 | 195 | return err; |
|---|
| 192 | 196 | } |
|---|
| .. | .. |
|---|
| 201 | 205 | |
|---|
| 202 | 206 | return -EINVAL; |
|---|
| 203 | 207 | } |
|---|
| 208 | + |
|---|
| 209 | +int mlx5_ib_get_vf_guid(struct ib_device *device, int vf, u8 port, |
|---|
| 210 | + struct ifla_vf_guid *node_guid, |
|---|
| 211 | + struct ifla_vf_guid *port_guid) |
|---|
| 212 | +{ |
|---|
| 213 | + struct mlx5_ib_dev *dev = to_mdev(device); |
|---|
| 214 | + struct mlx5_core_dev *mdev = dev->mdev; |
|---|
| 215 | + struct mlx5_vf_context *vfs_ctx = mdev->priv.sriov.vfs_ctx; |
|---|
| 216 | + |
|---|
| 217 | + node_guid->guid = |
|---|
| 218 | + vfs_ctx[vf].node_guid_valid ? vfs_ctx[vf].node_guid : 0; |
|---|
| 219 | + port_guid->guid = |
|---|
| 220 | + vfs_ctx[vf].port_guid_valid ? vfs_ctx[vf].port_guid : 0; |
|---|
| 221 | + |
|---|
| 222 | + return 0; |
|---|
| 223 | +} |
|---|