vhost: export the number of vrings
We used to use rte_vhost_get_queue_num() for telling how many vrings. However, the return value is the number of "queue pairs", which is very virtio-net specific. To make it generic, we should return the number of vrings instead, and let the driver do the proper translation. Say, virtio-net driver could turn it to the number of queue pairs by dividing 2. Meanwhile, mark rte_vhost_get_queue_num as deprecated. Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
This commit is contained in:
parent
ab4d7b9f1a
commit
b50a203986
doc/guides/rel_notes
drivers/net/vhost
lib/librte_vhost
@ -296,6 +296,9 @@ API Changes
|
||||
be per vhost-user socket file. Thus, it takes one more argument:
|
||||
``rte_vhost_driver_callback_register(path, ops)``.
|
||||
|
||||
* The vhost API ``rte_vhost_get_queue_num`` is deprecated, instead,
|
||||
``rte_vhost_get_vring_num`` should be used.
|
||||
|
||||
|
||||
ABI Changes
|
||||
-----------
|
||||
|
@ -595,7 +595,7 @@ new_device(int vid)
|
||||
vq->port = eth_dev->data->port_id;
|
||||
}
|
||||
|
||||
for (i = 0; i < rte_vhost_get_queue_num(vid) * VIRTIO_QNUM; i++)
|
||||
for (i = 0; i < rte_vhost_get_vring_num(vid); i++)
|
||||
rte_vhost_enable_guest_notification(vid, i, 0);
|
||||
|
||||
rte_vhost_get_mtu(vid, ð_dev->data->mtu);
|
||||
|
@ -39,6 +39,7 @@ DPDK_17.05 {
|
||||
rte_vhost_get_mtu;
|
||||
rte_vhost_get_negotiated_features;
|
||||
rte_vhost_get_vhost_vring;
|
||||
rte_vhost_get_vring_num;
|
||||
rte_vhost_gpa_to_vva;
|
||||
|
||||
} DPDK_16.07;
|
||||
|
@ -243,16 +243,33 @@ int rte_vhost_get_mtu(int vid, uint16_t *mtu);
|
||||
int rte_vhost_get_numa_node(int vid);
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* Get the number of queues the device supports.
|
||||
*
|
||||
* Note this function is deprecated, as it returns a queue pair number,
|
||||
* which is virtio-net specific. Instead, rte_vhost_get_vring_num should
|
||||
* be used.
|
||||
*
|
||||
* @param vid
|
||||
* virtio-net device ID
|
||||
*
|
||||
* @return
|
||||
* The number of queues, 0 on failure
|
||||
*/
|
||||
__rte_deprecated
|
||||
uint32_t rte_vhost_get_queue_num(int vid);
|
||||
|
||||
/**
|
||||
* Get the number of vrings the device supports.
|
||||
*
|
||||
* @param vid
|
||||
* vhost device ID
|
||||
*
|
||||
* @return
|
||||
* The number of vrings, 0 on failure
|
||||
*/
|
||||
uint16_t rte_vhost_get_vring_num(int vid);
|
||||
|
||||
/**
|
||||
* Get the virtio net device's ifname, which is the vhost-user socket
|
||||
* file path.
|
||||
|
@ -317,6 +317,17 @@ rte_vhost_get_queue_num(int vid)
|
||||
return dev->nr_vring / 2;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
rte_vhost_get_vring_num(int vid)
|
||||
{
|
||||
struct virtio_net *dev = get_device(vid);
|
||||
|
||||
if (dev == NULL)
|
||||
return 0;
|
||||
|
||||
return dev->nr_vring;
|
||||
}
|
||||
|
||||
int
|
||||
rte_vhost_get_ifname(int vid, char *buf, size_t len)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user