From: wangxu <wangxu72@huawei.com>
To: <jasowang@redhat.com>, <mst@redhat.com>
Cc: <kvm@vger.kernel.org>,
<virtualization@lists.linux-foundation.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] vhost: It's better to use size_t for the 3rd parameter of vhost_exceeds_weight()
Date: Mon, 23 Sep 2019 15:46:41 +0800 [thread overview]
Message-ID: <1569224801-101248-1-git-send-email-wangxu72@huawei.com> (raw)
From: Wang Xu <wangxu72@huawei.com>
Caller of vhost_exceeds_weight(..., total_len) in drivers/vhost/net.c
usually pass size_t total_len, which may be affected by rx/tx package.
Signed-off-by: Wang Xu <wangxu72@huawei.com>
---
drivers/vhost/vhost.c | 4 ++--
drivers/vhost/vhost.h | 7 ++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
index 36ca2cf..159223a 100644
--- a/drivers/vhost/vhost.c
+++ b/drivers/vhost/vhost.c
@@ -412,7 +412,7 @@ static void vhost_dev_free_iovecs(struct vhost_dev *dev)
}
bool vhost_exceeds_weight(struct vhost_virtqueue *vq,
- int pkts, int total_len)
+ int pkts, size_t total_len)
{
struct vhost_dev *dev = vq->dev;
@@ -454,7 +454,7 @@ static size_t vhost_get_desc_size(struct vhost_virtqueue *vq,
void vhost_dev_init(struct vhost_dev *dev,
struct vhost_virtqueue **vqs, int nvqs,
- int iov_limit, int weight, int byte_weight)
+ int iov_limit, int weight, size_t byte_weight)
{
struct vhost_virtqueue *vq;
int i;
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
index e9ed272..8d80389d 100644
--- a/drivers/vhost/vhost.h
+++ b/drivers/vhost/vhost.h
@@ -172,12 +172,13 @@ struct vhost_dev {
wait_queue_head_t wait;
int iov_limit;
int weight;
- int byte_weight;
+ size_t byte_weight;
};
-bool vhost_exceeds_weight(struct vhost_virtqueue *vq, int pkts, int total_len);
+bool vhost_exceeds_weight(struct vhost_virtqueue *vq, int pkts,
+ size_t total_len);
void vhost_dev_init(struct vhost_dev *, struct vhost_virtqueue **vqs,
- int nvqs, int iov_limit, int weight, int byte_weight);
+ int nvqs, int iov_limit, int weight, size_t byte_weight);
long vhost_dev_set_owner(struct vhost_dev *dev);
bool vhost_dev_has_owner(struct vhost_dev *dev);
long vhost_dev_check_owner(struct vhost_dev *);
--
1.8.5.6
next reply other threads:[~2019-09-23 7:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-23 7:46 wangxu [this message]
2019-09-23 8:07 ` [PATCH] vhost: It's better to use size_t for the 3rd parameter of vhost_exceeds_weight() Michael S. Tsirkin
2019-09-23 9:12 ` wangxu (AE)
2019-09-25 3:59 ` Jason Wang
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=1569224801-101248-1-git-send-email-wangxu72@huawei.com \
--to=wangxu72@huawei.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
/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).