lkml.org 
[lkml]   [2022]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2] vDPA: rename get_vq_num_max to get_vq_size_max
Date
The get_vq_num_max of vdpa_config_ops is mean get the max size of vq,not
the max number of vq,it is kind of confused,rename it.
And get_vq_num_min rename to get_vq_size_min,
set_vq_num rename to set_vq_size,
rename implement of this ops also.

Signed-off-by: Angus Chen <angus.chen@jaguarmicro.com>
---
v2:
modify some log of git information,no code change.

drivers/vdpa/alibaba/eni_vdpa.c | 12 ++++++------
drivers/vdpa/ifcvf/ifcvf_main.c | 8 ++++----
drivers/vdpa/mlx5/net/mlx5_vnet.c | 8 ++++----
drivers/vdpa/vdpa.c | 12 ++++++------
drivers/vdpa/vdpa_sim/vdpa_sim.c | 12 ++++++------
drivers/vdpa/vdpa_user/vduse_dev.c | 8 ++++----
drivers/vdpa/virtio_pci/vp_vdpa.c | 8 ++++----
drivers/vhost/vdpa.c | 4 ++--
drivers/virtio/virtio_vdpa.c | 8 ++++----
include/linux/vdpa.h | 12 ++++++------
10 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/vdpa/alibaba/eni_vdpa.c b/drivers/vdpa/alibaba/eni_vdpa.c
index 5a09a09cca70..453331888cbb 100644
--- a/drivers/vdpa/alibaba/eni_vdpa.c
+++ b/drivers/vdpa/alibaba/eni_vdpa.c
@@ -240,14 +240,14 @@ static int eni_vdpa_reset(struct vdpa_device *vdpa)
return 0;
}

-static u16 eni_vdpa_get_vq_num_max(struct vdpa_device *vdpa)
+static u16 eni_vdpa_get_vq_size_max(struct vdpa_device *vdpa)
{
struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa);

return vp_legacy_get_queue_size(ldev, 0);
}

-static u16 eni_vdpa_get_vq_num_min(struct vdpa_device *vdpa)
+static u16 eni_vdpa_get_vq_size_min(struct vdpa_device *vdpa)
{
struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa);

@@ -306,7 +306,7 @@ static bool eni_vdpa_get_vq_ready(struct vdpa_device *vdpa, u16 qid)
return vp_legacy_get_queue_enable(ldev, qid);
}

-static void eni_vdpa_set_vq_num(struct vdpa_device *vdpa, u16 qid,
+static void eni_vdpa_set_vq_size(struct vdpa_device *vdpa, u16 qid,
u32 num)
{
struct virtio_pci_legacy_device *ldev = vdpa_to_ldev(vdpa);
@@ -414,14 +414,14 @@ static const struct vdpa_config_ops eni_vdpa_ops = {
.get_status = eni_vdpa_get_status,
.set_status = eni_vdpa_set_status,
.reset = eni_vdpa_reset,
- .get_vq_num_max = eni_vdpa_get_vq_num_max,
- .get_vq_num_min = eni_vdpa_get_vq_num_min,
+ .get_vq_size_max = eni_vdpa_get_vq_size_max,
+ .get_vq_size_min = eni_vdpa_get_vq_size_min,
.get_vq_state = eni_vdpa_get_vq_state,
.set_vq_state = eni_vdpa_set_vq_state,
.set_vq_cb = eni_vdpa_set_vq_cb,
.set_vq_ready = eni_vdpa_set_vq_ready,
.get_vq_ready = eni_vdpa_get_vq_ready,
- .set_vq_num = eni_vdpa_set_vq_num,
+ .set_vq_size = eni_vdpa_set_vq_size,
.set_vq_address = eni_vdpa_set_vq_address,
.kick_vq = eni_vdpa_kick_vq,
.get_device_id = eni_vdpa_get_device_id,
diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index f9c0044c6442..c739e211ba97 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -519,7 +519,7 @@ static int ifcvf_vdpa_reset(struct vdpa_device *vdpa_dev)
return 0;
}

-static u16 ifcvf_vdpa_get_vq_num_max(struct vdpa_device *vdpa_dev)
+static u16 ifcvf_vdpa_get_vq_size_max(struct vdpa_device *vdpa_dev)
{
return IFCVF_QUEUE_MAX;
}
@@ -564,7 +564,7 @@ static bool ifcvf_vdpa_get_vq_ready(struct vdpa_device *vdpa_dev, u16 qid)
return vf->vring[qid].ready;
}

-static void ifcvf_vdpa_set_vq_num(struct vdpa_device *vdpa_dev, u16 qid,
+static void ifcvf_vdpa_set_vq_size(struct vdpa_device *vdpa_dev, u16 qid,
u32 num)
{
struct ifcvf_hw *vf = vdpa_to_vf(vdpa_dev);
@@ -695,13 +695,13 @@ static const struct vdpa_config_ops ifc_vdpa_ops = {
.get_status = ifcvf_vdpa_get_status,
.set_status = ifcvf_vdpa_set_status,
.reset = ifcvf_vdpa_reset,
- .get_vq_num_max = ifcvf_vdpa_get_vq_num_max,
+ .get_vq_size_max = ifcvf_vdpa_get_vq_size_max,
.get_vq_state = ifcvf_vdpa_get_vq_state,
.set_vq_state = ifcvf_vdpa_set_vq_state,
.set_vq_cb = ifcvf_vdpa_set_vq_cb,
.set_vq_ready = ifcvf_vdpa_set_vq_ready,
.get_vq_ready = ifcvf_vdpa_get_vq_ready,
- .set_vq_num = ifcvf_vdpa_set_vq_num,
+ .set_vq_size = ifcvf_vdpa_set_vq_size,
.set_vq_address = ifcvf_vdpa_set_vq_address,
.get_vq_irq = ifcvf_vdpa_get_vq_irq,
.kick_vq = ifcvf_vdpa_kick_vq,
diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c b/drivers/vdpa/mlx5/net/mlx5_vnet.c
index 90913365def4..3ec0b911781e 100644
--- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
+++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
@@ -1969,7 +1969,7 @@ static int mlx5_vdpa_set_vq_address(struct vdpa_device *vdev, u16 idx, u64 desc_
return 0;
}

-static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
+static void mlx5_vdpa_set_vq_size(struct vdpa_device *vdev, u16 idx, u32 num)
{
struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
@@ -2299,7 +2299,7 @@ static void mlx5_vdpa_set_config_cb(struct vdpa_device *vdev, struct vdpa_callba
}

#define MLX5_VDPA_MAX_VQ_ENTRIES 256
-static u16 mlx5_vdpa_get_vq_num_max(struct vdpa_device *vdev)
+static u16 mlx5_vdpa_get_vq_size_max(struct vdpa_device *vdev)
{
return MLX5_VDPA_MAX_VQ_ENTRIES;
}
@@ -2866,7 +2866,7 @@ static int mlx5_set_group_asid(struct vdpa_device *vdev, u32 group,

static const struct vdpa_config_ops mlx5_vdpa_ops = {
.set_vq_address = mlx5_vdpa_set_vq_address,
- .set_vq_num = mlx5_vdpa_set_vq_num,
+ .set_vq_size = mlx5_vdpa_set_vq_size,
.kick_vq = mlx5_vdpa_kick_vq,
.set_vq_cb = mlx5_vdpa_set_vq_cb,
.set_vq_ready = mlx5_vdpa_set_vq_ready,
@@ -2882,7 +2882,7 @@ static const struct vdpa_config_ops mlx5_vdpa_ops = {
.set_driver_features = mlx5_vdpa_set_driver_features,
.get_driver_features = mlx5_vdpa_get_driver_features,
.set_config_cb = mlx5_vdpa_set_config_cb,
- .get_vq_num_max = mlx5_vdpa_get_vq_num_max,
+ .get_vq_size_max = mlx5_vdpa_get_vq_size_max,
.get_device_id = mlx5_vdpa_get_device_id,
.get_vendor_id = mlx5_vdpa_get_vendor_id,
.get_status = mlx5_vdpa_get_status,
diff --git a/drivers/vdpa/vdpa.c b/drivers/vdpa/vdpa.c
index febdc99b51a7..7fa411ba5f89 100644
--- a/drivers/vdpa/vdpa.c
+++ b/drivers/vdpa/vdpa.c
@@ -39,9 +39,9 @@ static int vdpa_dev_probe(struct device *d)
u32 max_num, min_num = 1;
int ret = 0;

- max_num = ops->get_vq_num_max(vdev);
- if (ops->get_vq_num_min)
- min_num = ops->get_vq_num_min(vdev);
+ max_num = ops->get_vq_size_max(vdev);
+ if (ops->get_vq_size_min)
+ min_num = ops->get_vq_size_min(vdev);
if (max_num < min_num)
return -EINVAL;

@@ -690,9 +690,9 @@ vdpa_dev_fill(struct vdpa_device *vdev, struct sk_buff *msg, u32 portid, u32 seq

device_id = vdev->config->get_device_id(vdev);
vendor_id = vdev->config->get_vendor_id(vdev);
- max_vq_size = vdev->config->get_vq_num_max(vdev);
- if (vdev->config->get_vq_num_min)
- min_vq_size = vdev->config->get_vq_num_min(vdev);
+ max_vq_size = vdev->config->get_vq_size_max(vdev);
+ if (vdev->config->get_vq_size_min)
+ min_vq_size = vdev->config->get_vq_size_min(vdev);

err = -EMSGSIZE;
if (nla_put_string(msg, VDPA_ATTR_DEV_NAME, dev_name(&vdev->dev)))
diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c
index b071f0d842fb..59dd24cfe271 100644
--- a/drivers/vdpa/vdpa_sim/vdpa_sim.c
+++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c
@@ -344,7 +344,7 @@ static int vdpasim_set_vq_address(struct vdpa_device *vdpa, u16 idx,
return 0;
}

-static void vdpasim_set_vq_num(struct vdpa_device *vdpa, u16 idx, u32 num)
+static void vdpasim_set_vq_size(struct vdpa_device *vdpa, u16 idx, u32 num)
{
struct vdpasim *vdpasim = vdpa_to_sim(vdpa);
struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx];
@@ -466,7 +466,7 @@ static void vdpasim_set_config_cb(struct vdpa_device *vdpa,
/* We don't support config interrupt */
}

-static u16 vdpasim_get_vq_num_max(struct vdpa_device *vdpa)
+static u16 vdpasim_get_vq_size_max(struct vdpa_device *vdpa)
{
return VDPASIM_QUEUE_MAX;
}
@@ -697,7 +697,7 @@ static void vdpasim_free(struct vdpa_device *vdpa)

static const struct vdpa_config_ops vdpasim_config_ops = {
.set_vq_address = vdpasim_set_vq_address,
- .set_vq_num = vdpasim_set_vq_num,
+ .set_vq_size = vdpasim_set_vq_size,
.kick_vq = vdpasim_kick_vq,
.set_vq_cb = vdpasim_set_vq_cb,
.set_vq_ready = vdpasim_set_vq_ready,
@@ -710,7 +710,7 @@ static const struct vdpa_config_ops vdpasim_config_ops = {
.set_driver_features = vdpasim_set_driver_features,
.get_driver_features = vdpasim_get_driver_features,
.set_config_cb = vdpasim_set_config_cb,
- .get_vq_num_max = vdpasim_get_vq_num_max,
+ .get_vq_size_max = vdpasim_get_vq_size_max,
.get_device_id = vdpasim_get_device_id,
.get_vendor_id = vdpasim_get_vendor_id,
.get_status = vdpasim_get_status,
@@ -730,7 +730,7 @@ static const struct vdpa_config_ops vdpasim_config_ops = {

static const struct vdpa_config_ops vdpasim_batch_config_ops = {
.set_vq_address = vdpasim_set_vq_address,
- .set_vq_num = vdpasim_set_vq_num,
+ .set_vq_size = vdpasim_set_vq_size,
.kick_vq = vdpasim_kick_vq,
.set_vq_cb = vdpasim_set_vq_cb,
.set_vq_ready = vdpasim_set_vq_ready,
@@ -743,7 +743,7 @@ static const struct vdpa_config_ops vdpasim_batch_config_ops = {
.set_driver_features = vdpasim_set_driver_features,
.get_driver_features = vdpasim_get_driver_features,
.set_config_cb = vdpasim_set_config_cb,
- .get_vq_num_max = vdpasim_get_vq_num_max,
+ .get_vq_size_max = vdpasim_get_vq_size_max,
.get_device_id = vdpasim_get_device_id,
.get_vendor_id = vdpasim_get_vendor_id,
.get_status = vdpasim_get_status,
diff --git a/drivers/vdpa/vdpa_user/vduse_dev.c b/drivers/vdpa/vdpa_user/vduse_dev.c
index 35dceee3ed56..dd3e72f79e31 100644
--- a/drivers/vdpa/vdpa_user/vduse_dev.c
+++ b/drivers/vdpa/vdpa_user/vduse_dev.c
@@ -521,7 +521,7 @@ static void vduse_vdpa_set_vq_cb(struct vdpa_device *vdpa, u16 idx,
spin_unlock(&vq->irq_lock);
}

-static void vduse_vdpa_set_vq_num(struct vdpa_device *vdpa, u16 idx, u32 num)
+static void vduse_vdpa_set_vq_size(struct vdpa_device *vdpa, u16 idx, u32 num)
{
struct vduse_dev *dev = vdpa_to_vduse(vdpa);
struct vduse_virtqueue *vq = &dev->vqs[idx];
@@ -617,7 +617,7 @@ static void vduse_vdpa_set_config_cb(struct vdpa_device *vdpa,
spin_unlock(&dev->irq_lock);
}

-static u16 vduse_vdpa_get_vq_num_max(struct vdpa_device *vdpa)
+static u16 vduse_vdpa_get_vq_size_max(struct vdpa_device *vdpa)
{
struct vduse_dev *dev = vdpa_to_vduse(vdpa);
u16 num_max = 0;
@@ -739,7 +739,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = {
.set_vq_address = vduse_vdpa_set_vq_address,
.kick_vq = vduse_vdpa_kick_vq,
.set_vq_cb = vduse_vdpa_set_vq_cb,
- .set_vq_num = vduse_vdpa_set_vq_num,
+ .set_vq_size = vduse_vdpa_set_vq_size,
.set_vq_ready = vduse_vdpa_set_vq_ready,
.get_vq_ready = vduse_vdpa_get_vq_ready,
.set_vq_state = vduse_vdpa_set_vq_state,
@@ -749,7 +749,7 @@ static const struct vdpa_config_ops vduse_vdpa_config_ops = {
.set_driver_features = vduse_vdpa_set_driver_features,
.get_driver_features = vduse_vdpa_get_driver_features,
.set_config_cb = vduse_vdpa_set_config_cb,
- .get_vq_num_max = vduse_vdpa_get_vq_num_max,
+ .get_vq_size_max = vduse_vdpa_get_vq_size_max,
.get_device_id = vduse_vdpa_get_device_id,
.get_vendor_id = vduse_vdpa_get_vendor_id,
.get_status = vduse_vdpa_get_status,
diff --git a/drivers/vdpa/virtio_pci/vp_vdpa.c b/drivers/vdpa/virtio_pci/vp_vdpa.c
index d448db0c4de3..e224610d3240 100644
--- a/drivers/vdpa/virtio_pci/vp_vdpa.c
+++ b/drivers/vdpa/virtio_pci/vp_vdpa.c
@@ -236,7 +236,7 @@ static int vp_vdpa_reset(struct vdpa_device *vdpa)
return 0;
}

-static u16 vp_vdpa_get_vq_num_max(struct vdpa_device *vdpa)
+static u16 vp_vdpa_get_vq_size_max(struct vdpa_device *vdpa)
{
return VP_VDPA_QUEUE_MAX;
}
@@ -320,7 +320,7 @@ static bool vp_vdpa_get_vq_ready(struct vdpa_device *vdpa, u16 qid)
return vp_modern_get_queue_enable(mdev, qid);
}

-static void vp_vdpa_set_vq_num(struct vdpa_device *vdpa, u16 qid,
+static void vp_vdpa_set_vq_size(struct vdpa_device *vdpa, u16 qid,
u32 num)
{
struct virtio_pci_modern_device *mdev = vdpa_to_mdev(vdpa);
@@ -441,14 +441,14 @@ static const struct vdpa_config_ops vp_vdpa_ops = {
.get_status = vp_vdpa_get_status,
.set_status = vp_vdpa_set_status,
.reset = vp_vdpa_reset,
- .get_vq_num_max = vp_vdpa_get_vq_num_max,
+ .get_vq_size_max = vp_vdpa_get_vq_size_max,
.get_vq_state = vp_vdpa_get_vq_state,
.get_vq_notification = vp_vdpa_get_vq_notification,
.set_vq_state = vp_vdpa_set_vq_state,
.set_vq_cb = vp_vdpa_set_vq_cb,
.set_vq_ready = vp_vdpa_set_vq_ready,
.get_vq_ready = vp_vdpa_get_vq_ready,
- .set_vq_num = vp_vdpa_set_vq_num,
+ .set_vq_size = vp_vdpa_set_vq_size,
.set_vq_address = vp_vdpa_set_vq_address,
.kick_vq = vp_vdpa_kick_vq,
.get_generation = vp_vdpa_get_generation,
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 166044642fd5..47a68e878a2b 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -397,7 +397,7 @@ static long vhost_vdpa_get_vring_num(struct vhost_vdpa *v, u16 __user *argp)
const struct vdpa_config_ops *ops = vdpa->config;
u16 num;

- num = ops->get_vq_num_max(vdpa);
+ num = ops->get_vq_size_max(vdpa);

if (copy_to_user(argp, &num, sizeof(num)))
return -EFAULT;
@@ -581,7 +581,7 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
break;

case VHOST_SET_VRING_NUM:
- ops->set_vq_num(vdpa, idx, vq->num);
+ ops->set_vq_size(vdpa, idx, vq->num);
break;
}

diff --git a/drivers/virtio/virtio_vdpa.c b/drivers/virtio/virtio_vdpa.c
index 9670cc79371d..78aee39fd47a 100644
--- a/drivers/virtio/virtio_vdpa.c
+++ b/drivers/virtio/virtio_vdpa.c
@@ -162,14 +162,14 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
if (!info)
return ERR_PTR(-ENOMEM);

- max_num = ops->get_vq_num_max(vdpa);
+ max_num = ops->get_vq_size_max(vdpa);
if (max_num == 0) {
err = -ENOENT;
goto error_new_virtqueue;
}

- if (ops->get_vq_num_min)
- min_num = ops->get_vq_num_min(vdpa);
+ if (ops->get_vq_size_min)
+ min_num = ops->get_vq_size_min(vdpa);

may_reduce_num = (max_num == min_num) ? false : true;

@@ -189,7 +189,7 @@ virtio_vdpa_setup_vq(struct virtio_device *vdev, unsigned int index,
cb.callback = callback ? virtio_vdpa_virtqueue_cb : NULL;
cb.private = info;
ops->set_vq_cb(vdpa, index, &cb);
- ops->set_vq_num(vdpa, index, virtqueue_get_vring_size(vq));
+ ops->set_vq_size(vdpa, index, virtqueue_get_vring_size(vq));

desc_addr = virtqueue_get_desc_addr(vq);
driver_addr = virtqueue_get_avail_addr(vq);
diff --git a/include/linux/vdpa.h b/include/linux/vdpa.h
index 6d0f5e4e82c2..759ae1c255ee 100644
--- a/include/linux/vdpa.h
+++ b/include/linux/vdpa.h
@@ -136,7 +136,7 @@ struct vdpa_map_file {
* @driver_area: address of driver area
* @device_area: address of device area
* Returns integer: success (0) or error (< 0)
- * @set_vq_num: Set the size of virtqueue
+ * @set_vq_size: Set the size of virtqueue
* @vdev: vdpa device
* @idx: virtqueue index
* @num: the size of virtqueue
@@ -198,10 +198,10 @@ struct vdpa_map_file {
* @set_config_cb: Set the config interrupt callback
* @vdev: vdpa device
* @cb: virtio-vdev interrupt callback structure
- * @get_vq_num_max: Get the max size of virtqueue
+ * @get_vq_size_max: Get the max size of virtqueue
* @vdev: vdpa device
* Returns u16: max size of virtqueue
- * @get_vq_num_min: Get the min size of virtqueue (optional)
+ * @get_vq_size_min: Get the min size of virtqueue (optional)
* @vdev: vdpa device
* Returns u16: min size of virtqueue
* @get_device_id: Get virtio device id
@@ -290,7 +290,7 @@ struct vdpa_config_ops {
int (*set_vq_address)(struct vdpa_device *vdev,
u16 idx, u64 desc_area, u64 driver_area,
u64 device_area);
- void (*set_vq_num)(struct vdpa_device *vdev, u16 idx, u32 num);
+ void (*set_vq_size)(struct vdpa_device *vdev, u16 idx, u32 num);
void (*kick_vq)(struct vdpa_device *vdev, u16 idx);
void (*set_vq_cb)(struct vdpa_device *vdev, u16 idx,
struct vdpa_callback *cb);
@@ -316,8 +316,8 @@ struct vdpa_config_ops {
u64 (*get_driver_features)(struct vdpa_device *vdev);
void (*set_config_cb)(struct vdpa_device *vdev,
struct vdpa_callback *cb);
- u16 (*get_vq_num_max)(struct vdpa_device *vdev);
- u16 (*get_vq_num_min)(struct vdpa_device *vdev);
+ u16 (*get_vq_size_max)(struct vdpa_device *vdev);
+ u16 (*get_vq_size_min)(struct vdpa_device *vdev);
u32 (*get_device_id)(struct vdpa_device *vdev);
u32 (*get_vendor_id)(struct vdpa_device *vdev);
u8 (*get_status)(struct vdpa_device *vdev);
--
2.25.1
\
 
 \ /
  Last update: 2022-10-24 09:44    [W:0.048 / U:1.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site