DPDK patches and discussions
 help / color / mirror / Atom feed
From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>,
	Jens Freimann <jfreimann@redhat.com>,
	Tiwei Bie <tiwei.bie@intel.com>
Cc: dev@dpdk.org, Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 1/2] net/virtio: fix Tx cleanup functions to have same signature
Date: Wed, 15 Sep 2021 12:19:41 +0300	[thread overview]
Message-ID: <20210915091942.3604998-1-andrew.rybchenko@oktetlabs.ru> (raw)
In-Reply-To: <20210818141329.2842686-1-andrew.rybchenko@oktetlabs.ru>

From: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>

There is a family of cleanup from completed transmits functions.
Fix packed virtqueues cleanup functions to have the same signature
as split virtqueues have. This lets all functions of the family to
match the same callback prototype.

Fixes: 892dc798fa9 ("net/virtio: implement Tx path for packed queues")
Cc: stable@dpdk.org

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
---
 drivers/net/virtio/virtqueue.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h
index 03957b2bd0..d0c48ca415 100644
--- a/drivers/net/virtio/virtqueue.h
+++ b/drivers/net/virtio/virtqueue.h
@@ -803,25 +803,26 @@ vq_ring_free_id_packed(struct virtqueue *vq, uint16_t id)
 }
 
 static void
-virtio_xmit_cleanup_inorder_packed(struct virtqueue *vq, int num)
+virtio_xmit_cleanup_inorder_packed(struct virtqueue *vq, uint16_t num)
 {
 	uint16_t used_idx, id, curr_id, free_cnt = 0;
 	uint16_t size = vq->vq_nentries;
 	struct vring_packed_desc *desc = vq->vq_packed.ring.desc;
 	struct vq_desc_extra *dxp;
+	int nb = num;
 
 	used_idx = vq->vq_used_cons_idx;
 	/* desc_is_used has a load-acquire or rte_io_rmb inside
 	 * and wait for used desc in virtqueue.
 	 */
-	while (num > 0 && desc_is_used(&desc[used_idx], vq)) {
+	while (nb > 0 && desc_is_used(&desc[used_idx], vq)) {
 		id = desc[used_idx].id;
 		do {
 			curr_id = used_idx;
 			dxp = &vq->vq_descx[used_idx];
 			used_idx += dxp->ndescs;
 			free_cnt += dxp->ndescs;
-			num -= dxp->ndescs;
+			nb -= dxp->ndescs;
 			if (used_idx >= size) {
 				used_idx -= size;
 				vq->vq_packed.used_wrap_counter ^= 1;
@@ -837,7 +838,7 @@ virtio_xmit_cleanup_inorder_packed(struct virtqueue *vq, int num)
 }
 
 static void
-virtio_xmit_cleanup_normal_packed(struct virtqueue *vq, int num)
+virtio_xmit_cleanup_normal_packed(struct virtqueue *vq, uint16_t num)
 {
 	uint16_t used_idx, id;
 	uint16_t size = vq->vq_nentries;
@@ -867,7 +868,7 @@ virtio_xmit_cleanup_normal_packed(struct virtqueue *vq, int num)
 
 /* Cleanup from completed transmits. */
 static inline void
-virtio_xmit_cleanup_packed(struct virtqueue *vq, int num, int in_order)
+virtio_xmit_cleanup_packed(struct virtqueue *vq, uint16_t num, int in_order)
 {
 	if (in_order)
 		virtio_xmit_cleanup_inorder_packed(vq, num);
-- 
2.30.2


  parent reply	other threads:[~2021-09-15  9:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18 14:13 [dpdk-dev] [PATCH " Andrew Rybchenko
2021-08-18 14:13 ` [dpdk-dev] [PATCH 2/2] net/virtio: fix Tx completed mbufs leak on device stop Andrew Rybchenko
2021-09-13 15:41   ` Maxime Coquelin
2021-09-15  9:16     ` Andrew Rybchenko
2021-09-13 15:38 ` [dpdk-dev] [PATCH 1/2] net/virtio: fix Tx cleanup functions to have same signature Maxime Coquelin
2021-09-15  9:19 ` Andrew Rybchenko [this message]
2021-09-15  9:19   ` [dpdk-dev] [PATCH v2 2/2] net/virtio: fix Tx completed mbufs leak on device stop Andrew Rybchenko
2021-09-23 11:20     ` Maxime Coquelin
2021-09-28 15:30     ` Maxime Coquelin
2021-09-23 11:19   ` [dpdk-dev] [PATCH v2 1/2] net/virtio: fix Tx cleanup functions to have same signature Maxime Coquelin
2021-09-28 15:30   ` Maxime Coquelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210915091942.3604998-1-andrew.rybchenko@oktetlabs.ru \
    --to=andrew.rybchenko@oktetlabs.ru \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=ivan.ilchenko@oktetlabs.ru \
    --cc=jfreimann@redhat.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).