Skip to content

Commit de2cd39

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Introduce error logging function
mlx5_vdpa_err() was missing. This patch adds it and uses it in the necessary places. Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Tested-by: Lei Yang <[email protected]>
1 parent 7d62713 commit de2cd39

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
135135
int mlx5_vdpa_create_dma_mr(struct mlx5_vdpa_dev *mvdev);
136136
int mlx5_vdpa_reset_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
137137

138+
#define mlx5_vdpa_err(__dev, format, ...) \
139+
dev_err((__dev)->mdev->device, "%s:%d:(pid %d) error: " format, __func__, __LINE__, \
140+
current->pid, ##__VA_ARGS__)
141+
142+
138143
#define mlx5_vdpa_warn(__dev, format, ...) \
139144
dev_warn((__dev)->mdev->device, "%s:%d:(pid %d) warning: " format, __func__, __LINE__, \
140145
current->pid, ##__VA_ARGS__)

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,13 +1538,13 @@ static int suspend_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mv
15381538

15391539
err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_SUSPEND);
15401540
if (err) {
1541-
mlx5_vdpa_warn(&ndev->mvdev, "modify to suspend failed, err: %d\n", err);
1541+
mlx5_vdpa_err(&ndev->mvdev, "modify to suspend failed, err: %d\n", err);
15421542
return err;
15431543
}
15441544

15451545
err = query_virtqueue(ndev, mvq, &attr);
15461546
if (err) {
1547-
mlx5_vdpa_warn(&ndev->mvdev, "failed to query virtqueue, err: %d\n", err);
1547+
mlx5_vdpa_err(&ndev->mvdev, "failed to query virtqueue, err: %d\n", err);
15481548
return err;
15491549
}
15501550

@@ -1585,7 +1585,7 @@ static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq
15851585
*/
15861586
err = modify_virtqueue(ndev, mvq, 0);
15871587
if (err) {
1588-
mlx5_vdpa_warn(&ndev->mvdev,
1588+
mlx5_vdpa_err(&ndev->mvdev,
15891589
"modify vq properties failed for vq %u, err: %d\n",
15901590
mvq->index, err);
15911591
return err;
@@ -1600,15 +1600,15 @@ static int resume_vq(struct mlx5_vdpa_net *ndev, struct mlx5_vdpa_virtqueue *mvq
16001600
case MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY:
16011601
return 0;
16021602
default:
1603-
mlx5_vdpa_warn(&ndev->mvdev, "resume vq %u called from bad state %d\n",
1603+
mlx5_vdpa_err(&ndev->mvdev, "resume vq %u called from bad state %d\n",
16041604
mvq->index, mvq->fw_state);
16051605
return -EINVAL;
16061606
}
16071607

16081608
err = modify_virtqueue_state(ndev, mvq, MLX5_VIRTIO_NET_Q_OBJECT_STATE_RDY);
16091609
if (err)
1610-
mlx5_vdpa_warn(&ndev->mvdev, "modify to resume failed for vq %u, err: %d\n",
1611-
mvq->index, err);
1610+
mlx5_vdpa_err(&ndev->mvdev, "modify to resume failed for vq %u, err: %d\n",
1611+
mvq->index, err);
16121612

16131613
return err;
16141614
}
@@ -2002,13 +2002,13 @@ static int setup_steering(struct mlx5_vdpa_net *ndev)
20022002

20032003
ns = mlx5_get_flow_namespace(ndev->mvdev.mdev, MLX5_FLOW_NAMESPACE_BYPASS);
20042004
if (!ns) {
2005-
mlx5_vdpa_warn(&ndev->mvdev, "failed to get flow namespace\n");
2005+
mlx5_vdpa_err(&ndev->mvdev, "failed to get flow namespace\n");
20062006
return -EOPNOTSUPP;
20072007
}
20082008

20092009
ndev->rxft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
20102010
if (IS_ERR(ndev->rxft)) {
2011-
mlx5_vdpa_warn(&ndev->mvdev, "failed to create flow table\n");
2011+
mlx5_vdpa_err(&ndev->mvdev, "failed to create flow table\n");
20122012
return PTR_ERR(ndev->rxft);
20132013
}
20142014
mlx5_vdpa_add_rx_flow_table(ndev);
@@ -2530,7 +2530,7 @@ static int mlx5_vdpa_get_vq_state(struct vdpa_device *vdev, u16 idx, struct vdpa
25302530

25312531
err = query_virtqueue(ndev, mvq, &attr);
25322532
if (err) {
2533-
mlx5_vdpa_warn(mvdev, "failed to query virtqueue\n");
2533+
mlx5_vdpa_err(mvdev, "failed to query virtqueue\n");
25342534
return err;
25352535
}
25362536
state->split.avail_index = attr.used_index;
@@ -3189,7 +3189,7 @@ static int mlx5_vdpa_compat_reset(struct vdpa_device *vdev, u32 flags)
31893189
if ((flags & VDPA_RESET_F_CLEAN_MAP) &&
31903190
MLX5_CAP_GEN(mvdev->mdev, umem_uid_0)) {
31913191
if (mlx5_vdpa_create_dma_mr(mvdev))
3192-
mlx5_vdpa_warn(mvdev, "create MR failed\n");
3192+
mlx5_vdpa_err(mvdev, "create MR failed\n");
31933193
}
31943194
if (vq_reset)
31953195
setup_vq_resources(ndev, false);
@@ -3244,7 +3244,7 @@ static int set_map_data(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
32443244
new_mr = mlx5_vdpa_create_mr(mvdev, iotlb);
32453245
if (IS_ERR(new_mr)) {
32463246
err = PTR_ERR(new_mr);
3247-
mlx5_vdpa_warn(mvdev, "create map failed(%d)\n", err);
3247+
mlx5_vdpa_err(mvdev, "create map failed(%d)\n", err);
32483248
return err;
32493249
}
32503250
} else {
@@ -3257,7 +3257,7 @@ static int set_map_data(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
32573257
} else {
32583258
err = mlx5_vdpa_change_map(mvdev, new_mr, asid);
32593259
if (err) {
3260-
mlx5_vdpa_warn(mvdev, "change map failed(%d)\n", err);
3260+
mlx5_vdpa_err(mvdev, "change map failed(%d)\n", err);
32613261
goto out_err;
32623262
}
32633263
}

0 commit comments

Comments
 (0)