diff options
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/resource_tracker.c')
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c index 1c3fdd4a1f7d..8f1254a79832 100644 --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | |||
@@ -3895,6 +3895,60 @@ static int add_eth_header(struct mlx4_dev *dev, int slave, | |||
3895 | 3895 | ||
3896 | } | 3896 | } |
3897 | 3897 | ||
3898 | #define MLX4_UPD_QP_PATH_MASK_SUPPORTED (1ULL << MLX4_UPD_QP_PATH_MASK_MAC_INDEX) | ||
3899 | int mlx4_UPDATE_QP_wrapper(struct mlx4_dev *dev, int slave, | ||
3900 | struct mlx4_vhcr *vhcr, | ||
3901 | struct mlx4_cmd_mailbox *inbox, | ||
3902 | struct mlx4_cmd_mailbox *outbox, | ||
3903 | struct mlx4_cmd_info *cmd_info) | ||
3904 | { | ||
3905 | int err; | ||
3906 | u32 qpn = vhcr->in_modifier & 0xffffff; | ||
3907 | struct res_qp *rqp; | ||
3908 | u64 mac; | ||
3909 | unsigned port; | ||
3910 | u64 pri_addr_path_mask; | ||
3911 | struct mlx4_update_qp_context *cmd; | ||
3912 | int smac_index; | ||
3913 | |||
3914 | cmd = (struct mlx4_update_qp_context *)inbox->buf; | ||
3915 | |||
3916 | pri_addr_path_mask = be64_to_cpu(cmd->primary_addr_path_mask); | ||
3917 | if (cmd->qp_mask || cmd->secondary_addr_path_mask || | ||
3918 | (pri_addr_path_mask & ~MLX4_UPD_QP_PATH_MASK_SUPPORTED)) | ||
3919 | return -EPERM; | ||
3920 | |||
3921 | /* Just change the smac for the QP */ | ||
3922 | err = get_res(dev, slave, qpn, RES_QP, &rqp); | ||
3923 | if (err) { | ||
3924 | mlx4_err(dev, "Updating qpn 0x%x for slave %d rejected\n", qpn, slave); | ||
3925 | return err; | ||
3926 | } | ||
3927 | |||
3928 | port = (rqp->sched_queue >> 6 & 1) + 1; | ||
3929 | smac_index = cmd->qp_context.pri_path.grh_mylmc; | ||
3930 | err = mac_find_smac_ix_in_slave(dev, slave, port, | ||
3931 | smac_index, &mac); | ||
3932 | if (err) { | ||
3933 | mlx4_err(dev, "Failed to update qpn 0x%x, MAC is invalid. smac_ix: %d\n", | ||
3934 | qpn, smac_index); | ||
3935 | goto err_mac; | ||
3936 | } | ||
3937 | |||
3938 | err = mlx4_cmd(dev, inbox->dma, | ||
3939 | vhcr->in_modifier, 0, | ||
3940 | MLX4_CMD_UPDATE_QP, MLX4_CMD_TIME_CLASS_A, | ||
3941 | MLX4_CMD_NATIVE); | ||
3942 | if (err) { | ||
3943 | mlx4_err(dev, "Failed to update qpn on qpn 0x%x, command failed\n", qpn); | ||
3944 | goto err_mac; | ||
3945 | } | ||
3946 | |||
3947 | err_mac: | ||
3948 | put_res(dev, slave, qpn, RES_QP); | ||
3949 | return err; | ||
3950 | } | ||
3951 | |||
3898 | int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, | 3952 | int mlx4_QP_FLOW_STEERING_ATTACH_wrapper(struct mlx4_dev *dev, int slave, |
3899 | struct mlx4_vhcr *vhcr, | 3953 | struct mlx4_vhcr *vhcr, |
3900 | struct mlx4_cmd_mailbox *inbox, | 3954 | struct mlx4_cmd_mailbox *inbox, |