* [RFC 0/2] add unsafe API to get inflight packets
@ 2022-02-16 7:04 xuan.ding
2022-02-16 7:04 ` [RFC 1/2] vhost: add unsafe API to check " xuan.ding
2022-02-16 7:04 ` [RFC 2/2] examples/vhost: use " xuan.ding
0 siblings, 2 replies; 6+ messages in thread
From: xuan.ding @ 2022-02-16 7:04 UTC (permalink / raw)
To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, sunil.pai.g, Xuan Ding
From: Xuan Ding <xuan.ding@intel.com>
This patchset introduces an unsafe API to get the number of inflight
packets in DMA engine in some situations. Like vring state changes or
device is destroyed. Compared with rte_vhost_async_get_inflight(),
this is a lock free version.
Xuan Ding (2):
vhost: add unsafe API to check inflight packets
examples/vhost: use API to check inflight packets
doc/guides/prog_guide/vhost_lib.rst | 5 +++++
doc/guides/rel_notes/release_22_03.rst | 4 ++++
examples/vhost/main.c | 28 ++++++++++++++------------
examples/vhost/main.h | 1 -
lib/vhost/rte_vhost_async.h | 14 +++++++++++++
lib/vhost/version.map | 1 +
lib/vhost/vhost.c | 26 ++++++++++++++++++++++++
7 files changed, 65 insertions(+), 14 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC 1/2] vhost: add unsafe API to check inflight packets
2022-02-16 7:04 [RFC 0/2] add unsafe API to get inflight packets xuan.ding
@ 2022-02-16 7:04 ` xuan.ding
2022-03-28 15:05 ` Maxime Coquelin
2022-02-16 7:04 ` [RFC 2/2] examples/vhost: use " xuan.ding
1 sibling, 1 reply; 6+ messages in thread
From: xuan.ding @ 2022-02-16 7:04 UTC (permalink / raw)
To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, sunil.pai.g, Xuan Ding
From: Xuan Ding <xuan.ding@intel.com>
In async data path, when vring state changes or device is destroyed,
it is necessary to know the number of inflight packets in DMA engine.
This patch provides a thread unsafe API to return the number of
inflight packets for a vhost queue without using any lock.
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
---
doc/guides/prog_guide/vhost_lib.rst | 5 +++++
doc/guides/rel_notes/release_22_03.rst | 4 ++++
lib/vhost/rte_vhost_async.h | 14 ++++++++++++++
lib/vhost/version.map | 1 +
lib/vhost/vhost.c | 26 ++++++++++++++++++++++++++
5 files changed, 50 insertions(+)
diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst
index 886f8f5e72..f95288d128 100644
--- a/doc/guides/prog_guide/vhost_lib.rst
+++ b/doc/guides/prog_guide/vhost_lib.rst
@@ -271,6 +271,11 @@ The following is an overview of some key Vhost API functions:
This function returns the amount of in-flight packets for the vhost
queue using async acceleration.
+ * ``rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id)``
+
+ Get the number of inflight packets for a vhost queue without
+ performing any locking.
+
* ``rte_vhost_clear_queue_thread_unsafe(vid, queue_id, **pkts, count, dma_id, vchan_id)``
Clear inflight packets which are submitted to DMA engine in vhost async data
diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
index ff3095d742..37ef37bb20 100644
--- a/doc/guides/rel_notes/release_22_03.rst
+++ b/doc/guides/rel_notes/release_22_03.rst
@@ -149,6 +149,10 @@ New Features
* Called ``rte_ipv4/6_udptcp_cksum_mbuf()`` functions in testpmd csum mode
to support software UDP/TCP checksum over multiple segments.
+* **Added vhost API to get the number of inflight packets.**
+
+ Added an API which can get the number of inflight packets in
+ vhost async data path without using lock.
Removed Items
-------------
diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h
index 838c4778cc..06b0b0a579 100644
--- a/lib/vhost/rte_vhost_async.h
+++ b/lib/vhost/rte_vhost_async.h
@@ -135,6 +135,20 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
__rte_experimental
int rte_vhost_async_get_inflight(int vid, uint16_t queue_id);
+/**
+ * This function is lock-free version to return the amount of in-flight
+ * packets for the vhost queue which uses async channel acceleration.
+ *
+ * @param vid
+ * id of vhost device to enqueue data
+ * @param queue_id
+ * queue id to enqueue data
+ * @return
+ * the amount of in-flight packets on success; -1 on failure
+ */
+__rte_experimental
+int rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id);
+
/**
* This function checks async completion status and clear packets for
* a specific vhost device queue. Packets which are inflight will be
diff --git a/lib/vhost/version.map b/lib/vhost/version.map
index 1202ba9c1a..03b46cb10e 100644
--- a/lib/vhost/version.map
+++ b/lib/vhost/version.map
@@ -87,6 +87,7 @@ EXPERIMENTAL {
# added in 22.03
rte_vhost_async_dma_configure;
+ rte_vhost_async_get_inflight_thread_unsafe;
};
INTERNAL {
diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
index 6bcb716de0..33dca62c6c 100644
--- a/lib/vhost/vhost.c
+++ b/lib/vhost/vhost.c
@@ -1907,6 +1907,32 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
return ret;
}
+int
+rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id)
+{
+ struct vhost_virtqueue *vq;
+ struct virtio_net *dev = get_device(vid);
+ int ret = -1;
+
+ if (dev == NULL)
+ return ret;
+
+ if (queue_id >= VHOST_MAX_VRING)
+ return ret;
+
+ vq = dev->virtqueue[queue_id];
+
+ if (vq == NULL)
+ return ret;
+
+ if (!vq->async)
+ return ret;
+
+ ret = vq->async->pkts_inflight_n;
+
+ return ret;
+}
+
int
rte_vhost_get_monitor_addr(int vid, uint16_t queue_id,
struct rte_vhost_power_monitor_cond *pmc)
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [RFC 2/2] examples/vhost: use API to check inflight packets
2022-02-16 7:04 [RFC 0/2] add unsafe API to get inflight packets xuan.ding
2022-02-16 7:04 ` [RFC 1/2] vhost: add unsafe API to check " xuan.ding
@ 2022-02-16 7:04 ` xuan.ding
2022-03-28 15:19 ` Maxime Coquelin
1 sibling, 1 reply; 6+ messages in thread
From: xuan.ding @ 2022-02-16 7:04 UTC (permalink / raw)
To: maxime.coquelin, chenbo.xia; +Cc: dev, jiayu.hu, sunil.pai.g, Xuan Ding
From: Xuan Ding <xuan.ding@intel.com>
In async data path, call rte_vhost_async_get_inflight_thread_unsafe()
API to directly return the number of inflight packets instead of
maintaining a local variable.
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
---
examples/vhost/main.c | 28 +++++++++++++++-------------
examples/vhost/main.h | 1 -
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 3e784f5c6f..ba7ab23f4e 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -972,10 +972,8 @@ complete_async_pkts(struct vhost_dev *vdev)
complete_count = rte_vhost_poll_enqueue_completed(vdev->vid,
VIRTIO_RXQ, p_cpl, MAX_PKT_BURST, dma_id, 0);
- if (complete_count) {
+ if (complete_count)
free_pkts(p_cpl, complete_count);
- __atomic_sub_fetch(&vdev->pkts_inflight, complete_count, __ATOMIC_SEQ_CST);
- }
}
@@ -1017,7 +1015,6 @@ drain_vhost(struct vhost_dev *vdev)
complete_async_pkts(vdev);
ret = rte_vhost_submit_enqueue_burst(vdev->vid, VIRTIO_RXQ, m, nr_xmit, dma_id, 0);
- __atomic_add_fetch(&vdev->pkts_inflight, ret, __ATOMIC_SEQ_CST);
enqueue_fail = nr_xmit - ret;
if (enqueue_fail)
@@ -1346,7 +1343,6 @@ drain_eth_rx(struct vhost_dev *vdev)
complete_async_pkts(vdev);
enqueue_count = rte_vhost_submit_enqueue_burst(vdev->vid,
VIRTIO_RXQ, pkts, rx_count, dma_id, 0);
- __atomic_add_fetch(&vdev->pkts_inflight, enqueue_count, __ATOMIC_SEQ_CST);
enqueue_fail = rx_count - enqueue_count;
if (enqueue_fail)
@@ -1518,14 +1514,17 @@ destroy_device(int vid)
if (dma_bind[vid].dmas[VIRTIO_RXQ].async_enabled) {
uint16_t n_pkt = 0;
+ int pkts_inflight;
int16_t dma_id = dma_bind[vid].dmas[VIRTIO_RXQ].dev_id;
- struct rte_mbuf *m_cpl[vdev->pkts_inflight];
+ pkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid, VIRTIO_RXQ);
+ struct rte_mbuf *m_cpl[pkts_inflight];
- while (vdev->pkts_inflight) {
+ while (pkts_inflight) {
n_pkt = rte_vhost_clear_queue_thread_unsafe(vid, VIRTIO_RXQ,
- m_cpl, vdev->pkts_inflight, dma_id, 0);
+ m_cpl, pkts_inflight, dma_id, 0);
free_pkts(m_cpl, n_pkt);
- __atomic_sub_fetch(&vdev->pkts_inflight, n_pkt, __ATOMIC_SEQ_CST);
+ pkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid,
+ VIRTIO_RXQ);
}
rte_vhost_async_channel_unregister(vid, VIRTIO_RXQ);
@@ -1629,14 +1628,17 @@ vring_state_changed(int vid, uint16_t queue_id, int enable)
if (dma_bind[vid].dmas[queue_id].async_enabled) {
if (!enable) {
uint16_t n_pkt = 0;
+ int pkts_inflight;
+ pkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id);
int16_t dma_id = dma_bind[vid].dmas[VIRTIO_RXQ].dev_id;
- struct rte_mbuf *m_cpl[vdev->pkts_inflight];
+ struct rte_mbuf *m_cpl[pkts_inflight];
- while (vdev->pkts_inflight) {
+ while (pkts_inflight) {
n_pkt = rte_vhost_clear_queue_thread_unsafe(vid, queue_id,
- m_cpl, vdev->pkts_inflight, dma_id, 0);
+ m_cpl, pkts_inflight, dma_id, 0);
free_pkts(m_cpl, n_pkt);
- __atomic_sub_fetch(&vdev->pkts_inflight, n_pkt, __ATOMIC_SEQ_CST);
+ pkts_inflight = rte_vhost_async_get_inflight_thread_unsafe(vid,
+ queue_id);
}
}
}
diff --git a/examples/vhost/main.h b/examples/vhost/main.h
index b4a453e77e..e7f395c3c9 100644
--- a/examples/vhost/main.h
+++ b/examples/vhost/main.h
@@ -52,7 +52,6 @@ struct vhost_dev {
uint64_t features;
size_t hdr_len;
uint16_t nr_vrings;
- uint16_t pkts_inflight;
struct rte_vhost_memory *mem;
struct device_statistics stats;
TAILQ_ENTRY(vhost_dev) global_vdev_entry;
--
2.17.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC 1/2] vhost: add unsafe API to check inflight packets
2022-02-16 7:04 ` [RFC 1/2] vhost: add unsafe API to check " xuan.ding
@ 2022-03-28 15:05 ` Maxime Coquelin
2022-03-29 2:21 ` Ding, Xuan
0 siblings, 1 reply; 6+ messages in thread
From: Maxime Coquelin @ 2022-03-28 15:05 UTC (permalink / raw)
To: xuan.ding, chenbo.xia; +Cc: dev, jiayu.hu, sunil.pai.g
Hi Xuan,
On 2/16/22 08:04, xuan.ding@intel.com wrote:
> From: Xuan Ding <xuan.ding@intel.com>
>
> In async data path, when vring state changes or device is destroyed,
> it is necessary to know the number of inflight packets in DMA engine.
> This patch provides a thread unsafe API to return the number of
> inflight packets for a vhost queue without using any lock.
>
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> ---
> doc/guides/prog_guide/vhost_lib.rst | 5 +++++
> doc/guides/rel_notes/release_22_03.rst | 4 ++++
> lib/vhost/rte_vhost_async.h | 14 ++++++++++++++
> lib/vhost/version.map | 1 +
> lib/vhost/vhost.c | 26 ++++++++++++++++++++++++++
> 5 files changed, 50 insertions(+)
>
> diff --git a/doc/guides/prog_guide/vhost_lib.rst b/doc/guides/prog_guide/vhost_lib.rst
> index 886f8f5e72..f95288d128 100644
> --- a/doc/guides/prog_guide/vhost_lib.rst
> +++ b/doc/guides/prog_guide/vhost_lib.rst
> @@ -271,6 +271,11 @@ The following is an overview of some key Vhost API functions:
> This function returns the amount of in-flight packets for the vhost
> queue using async acceleration.
>
> + * ``rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id)``
> +
> + Get the number of inflight packets for a vhost queue without
> + performing any locking.
Here and below in the API doc, I would add that it should only be used
within the vhost ops, which already hold the lock.
> +
> * ``rte_vhost_clear_queue_thread_unsafe(vid, queue_id, **pkts, count, dma_id, vchan_id)``
>
> Clear inflight packets which are submitted to DMA engine in vhost async data
> diff --git a/doc/guides/rel_notes/release_22_03.rst b/doc/guides/rel_notes/release_22_03.rst
> index ff3095d742..37ef37bb20 100644
> --- a/doc/guides/rel_notes/release_22_03.rst
> +++ b/doc/guides/rel_notes/release_22_03.rst
> @@ -149,6 +149,10 @@ New Features
> * Called ``rte_ipv4/6_udptcp_cksum_mbuf()`` functions in testpmd csum mode
> to support software UDP/TCP checksum over multiple segments.
>
> +* **Added vhost API to get the number of inflight packets.**
> +
> + Added an API which can get the number of inflight packets in
> + vhost async data path without using lock.
>
> Removed Items
> -------------
> diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h
> index 838c4778cc..06b0b0a579 100644
> --- a/lib/vhost/rte_vhost_async.h
> +++ b/lib/vhost/rte_vhost_async.h
> @@ -135,6 +135,20 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
> __rte_experimental
> int rte_vhost_async_get_inflight(int vid, uint16_t queue_id);
>
> +/**
> + * This function is lock-free version to return the amount of in-flight
> + * packets for the vhost queue which uses async channel acceleration.
> + *
> + * @param vid
> + * id of vhost device to enqueue data
> + * @param queue_id
> + * queue id to enqueue data
> + * @return
> + * the amount of in-flight packets on success; -1 on failure
> + */
> +__rte_experimental
> +int rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id);
> +
> /**
> * This function checks async completion status and clear packets for
> * a specific vhost device queue. Packets which are inflight will be
> diff --git a/lib/vhost/version.map b/lib/vhost/version.map
> index 1202ba9c1a..03b46cb10e 100644
> --- a/lib/vhost/version.map
> +++ b/lib/vhost/version.map
> @@ -87,6 +87,7 @@ EXPERIMENTAL {
>
> # added in 22.03
> rte_vhost_async_dma_configure;
> + rte_vhost_async_get_inflight_thread_unsafe;
Don't forget to move it to "added in 22.07".
> };
>
> INTERNAL {
> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
> index 6bcb716de0..33dca62c6c 100644
> --- a/lib/vhost/vhost.c
> +++ b/lib/vhost/vhost.c
> @@ -1907,6 +1907,32 @@ rte_vhost_async_get_inflight(int vid, uint16_t queue_id)
> return ret;
> }
>
> +int
> +rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t queue_id)
> +{
> + struct vhost_virtqueue *vq;
> + struct virtio_net *dev = get_device(vid);
> + int ret = -1;
> +
> + if (dev == NULL)
> + return ret;
> +
> + if (queue_id >= VHOST_MAX_VRING)
> + return ret;
> +
> + vq = dev->virtqueue[queue_id];
> +
> + if (vq == NULL)
> + return ret;
> +
> + if (!vq->async)
> + return ret;
> +
> + ret = vq->async->pkts_inflight_n;
> +
> + return ret;
> +}
> +
> int
> rte_vhost_get_monitor_addr(int vid, uint16_t queue_id,
> struct rte_vhost_power_monitor_cond *pmc)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [RFC 2/2] examples/vhost: use API to check inflight packets
2022-02-16 7:04 ` [RFC 2/2] examples/vhost: use " xuan.ding
@ 2022-03-28 15:19 ` Maxime Coquelin
0 siblings, 0 replies; 6+ messages in thread
From: Maxime Coquelin @ 2022-03-28 15:19 UTC (permalink / raw)
To: xuan.ding, chenbo.xia; +Cc: dev, jiayu.hu, sunil.pai.g
Hi Xuan,
On 2/16/22 08:04, xuan.ding@intel.com wrote:
> From: Xuan Ding <xuan.ding@intel.com>
>
> In async data path, call rte_vhost_async_get_inflight_thread_unsafe()
> API to directly return the number of inflight packets instead of
> maintaining a local variable.
>
> Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> ---
> examples/vhost/main.c | 28 +++++++++++++++-------------
> examples/vhost/main.h | 1 -
> 2 files changed, 15 insertions(+), 14 deletions(-)
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [RFC 1/2] vhost: add unsafe API to check inflight packets
2022-03-28 15:05 ` Maxime Coquelin
@ 2022-03-29 2:21 ` Ding, Xuan
0 siblings, 0 replies; 6+ messages in thread
From: Ding, Xuan @ 2022-03-29 2:21 UTC (permalink / raw)
To: Maxime Coquelin, Xia, Chenbo; +Cc: dev, Hu, Jiayu, Pai G, Sunil
Hi Maxime,
> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Monday, March 28, 2022 11:05 PM
> To: Ding, Xuan <xuan.ding@intel.com>; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; Pai G, Sunil
> <sunil.pai.g@intel.com>
> Subject: Re: [RFC 1/2] vhost: add unsafe API to check inflight packets
>
> Hi Xuan,
>
> On 2/16/22 08:04, xuan.ding@intel.com wrote:
> > From: Xuan Ding <xuan.ding@intel.com>
> >
> > In async data path, when vring state changes or device is destroyed,
> > it is necessary to know the number of inflight packets in DMA engine.
> > This patch provides a thread unsafe API to return the number of
> > inflight packets for a vhost queue without using any lock.
> >
> > Signed-off-by: Xuan Ding <xuan.ding@intel.com>
> > ---
> > doc/guides/prog_guide/vhost_lib.rst | 5 +++++
> > doc/guides/rel_notes/release_22_03.rst | 4 ++++
> > lib/vhost/rte_vhost_async.h | 14 ++++++++++++++
> > lib/vhost/version.map | 1 +
> > lib/vhost/vhost.c | 26 ++++++++++++++++++++++++++
> > 5 files changed, 50 insertions(+)
> >
> > diff --git a/doc/guides/prog_guide/vhost_lib.rst
> > b/doc/guides/prog_guide/vhost_lib.rst
> > index 886f8f5e72..f95288d128 100644
> > --- a/doc/guides/prog_guide/vhost_lib.rst
> > +++ b/doc/guides/prog_guide/vhost_lib.rst
> > @@ -271,6 +271,11 @@ The following is an overview of some key Vhost
> API functions:
> > This function returns the amount of in-flight packets for the vhost
> > queue using async acceleration.
> >
> > + * ``rte_vhost_async_get_inflight_thread_unsafe(vid, queue_id)``
> > +
> > + Get the number of inflight packets for a vhost queue without
> > + performing any locking.
>
> Here and below in the API doc, I would add that it should only be used within
> the vhost ops, which already hold the lock.
Thanks for the revision on the doc.
>
> > +
> > * ``rte_vhost_clear_queue_thread_unsafe(vid, queue_id, **pkts,
> > count, dma_id, vchan_id)``
> >
> > Clear inflight packets which are submitted to DMA engine in vhost
> > async data diff --git a/doc/guides/rel_notes/release_22_03.rst
> > b/doc/guides/rel_notes/release_22_03.rst
> > index ff3095d742..37ef37bb20 100644
> > --- a/doc/guides/rel_notes/release_22_03.rst
> > +++ b/doc/guides/rel_notes/release_22_03.rst
> > @@ -149,6 +149,10 @@ New Features
> > * Called ``rte_ipv4/6_udptcp_cksum_mbuf()`` functions in testpmd csum
> mode
> > to support software UDP/TCP checksum over multiple segments.
> >
> > +* **Added vhost API to get the number of inflight packets.**
> > +
> > + Added an API which can get the number of inflight packets in vhost
> > + async data path without using lock.
> >
> > Removed Items
> > -------------
> > diff --git a/lib/vhost/rte_vhost_async.h b/lib/vhost/rte_vhost_async.h
> > index 838c4778cc..06b0b0a579 100644
> > --- a/lib/vhost/rte_vhost_async.h
> > +++ b/lib/vhost/rte_vhost_async.h
> > @@ -135,6 +135,20 @@ uint16_t rte_vhost_poll_enqueue_completed(int
> vid, uint16_t queue_id,
> > __rte_experimental
> > int rte_vhost_async_get_inflight(int vid, uint16_t queue_id);
> >
> > +/**
> > + * This function is lock-free version to return the amount of
> > +in-flight
> > + * packets for the vhost queue which uses async channel acceleration.
> > + *
> > + * @param vid
> > + * id of vhost device to enqueue data
> > + * @param queue_id
> > + * queue id to enqueue data
> > + * @return
> > + * the amount of in-flight packets on success; -1 on failure */
> > +__rte_experimental int rte_vhost_async_get_inflight_thread_unsafe(int
> > +vid, uint16_t queue_id);
> > +
> > /**
> > * This function checks async completion status and clear packets for
> > * a specific vhost device queue. Packets which are inflight will be
> > diff --git a/lib/vhost/version.map b/lib/vhost/version.map index
> > 1202ba9c1a..03b46cb10e 100644
> > --- a/lib/vhost/version.map
> > +++ b/lib/vhost/version.map
> > @@ -87,6 +87,7 @@ EXPERIMENTAL {
> >
> > # added in 22.03
> > rte_vhost_async_dma_configure;
> > + rte_vhost_async_get_inflight_thread_unsafe;
>
> Don't forget to move it to "added in 22.07".
Sure, I will send a v1 version in 22.07.
Thanks for your comments.
Regards,
Xuan
>
> > };
> >
> > INTERNAL {
> > diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c index
> > 6bcb716de0..33dca62c6c 100644
> > --- a/lib/vhost/vhost.c
> > +++ b/lib/vhost/vhost.c
> > @@ -1907,6 +1907,32 @@ rte_vhost_async_get_inflight(int vid, uint16_t
> queue_id)
> > return ret;
> > }
> >
> > +int
> > +rte_vhost_async_get_inflight_thread_unsafe(int vid, uint16_t
> > +queue_id) {
> > + struct vhost_virtqueue *vq;
> > + struct virtio_net *dev = get_device(vid);
> > + int ret = -1;
> > +
> > + if (dev == NULL)
> > + return ret;
> > +
> > + if (queue_id >= VHOST_MAX_VRING)
> > + return ret;
> > +
> > + vq = dev->virtqueue[queue_id];
> > +
> > + if (vq == NULL)
> > + return ret;
> > +
> > + if (!vq->async)
> > + return ret;
> > +
> > + ret = vq->async->pkts_inflight_n;
> > +
> > + return ret;
> > +}
> > +
> > int
> > rte_vhost_get_monitor_addr(int vid, uint16_t queue_id,
> > struct rte_vhost_power_monitor_cond *pmc)
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-29 2:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 7:04 [RFC 0/2] add unsafe API to get inflight packets xuan.ding
2022-02-16 7:04 ` [RFC 1/2] vhost: add unsafe API to check " xuan.ding
2022-03-28 15:05 ` Maxime Coquelin
2022-03-29 2:21 ` Ding, Xuan
2022-02-16 7:04 ` [RFC 2/2] examples/vhost: use " xuan.ding
2022-03-28 15:19 ` Maxime Coquelin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).