* [PATCH RFC] virtio_ring: fix delayed enable cb implementation
@ 2011-05-19 17:12 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-05-19 17:12 UTC (permalink / raw)
To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved,
Tom Lendacky, borntraeger, avi
Cc: virtualization, netdev, linux-kernel
Fix some signed/assigned mistakes in virtqueue_enable_cb_delayed
by using u16 math all over.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
I'll put this on my v1 branch as well
@@ -398,7 +397,7 @@ EXPORT_SYMBOL_GPL(virtqueue_enable_cb);
bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);
- int bufs;
+ u16 bufs;
START_USE(vq);
@@ -412,7 +411,7 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
bufs = (vq->vring.avail->idx - vq->last_used_idx) * 3 / 4;
vring_used_event(&vq->vring) = vq->last_used_idx + bufs;
virtio_mb();
- if (unlikely(vq->vring.used->idx - vq->last_used_idx > bufs)) {
+ if (unlikely((u16)(vq->vring.used->idx - vq->last_used_idx) > bufs)) {
END_USE(vq);
return false;
}
--
1.7.5.53.gc233e
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RFC] virtio_ring: fix delayed enable cb implementation
@ 2011-05-19 17:12 ` Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-05-19 17:12 UTC (permalink / raw)
To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved,
Tom Lendacky <tahm@
Cc: virtualization, netdev, linux-kernel
Fix some signed/assigned mistakes in virtqueue_enable_cb_delayed
by using u16 math all over.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
I'll put this on my v1 branch as well
@@ -398,7 +397,7 @@ EXPORT_SYMBOL_GPL(virtqueue_enable_cb);
bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);
- int bufs;
+ u16 bufs;
START_USE(vq);
@@ -412,7 +411,7 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
bufs = (vq->vring.avail->idx - vq->last_used_idx) * 3 / 4;
vring_used_event(&vq->vring) = vq->last_used_idx + bufs;
virtio_mb();
- if (unlikely(vq->vring.used->idx - vq->last_used_idx > bufs)) {
+ if (unlikely((u16)(vq->vring.used->idx - vq->last_used_idx) > bufs)) {
END_USE(vq);
return false;
}
--
1.7.5.53.gc233e
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RFC] virtio_ring: fix delayed enable cb implementation
@ 2011-05-19 17:12 Michael S. Tsirkin
0 siblings, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2011-05-19 17:12 UTC (permalink / raw)
To: rusty, habanero, Shirley Ma, Krishna Kumar2, kvm, steved
Cc: netdev, linux-kernel, virtualization
Fix some signed/assigned mistakes in virtqueue_enable_cb_delayed
by using u16 math all over.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
I'll put this on my v1 branch as well
@@ -398,7 +397,7 @@ EXPORT_SYMBOL_GPL(virtqueue_enable_cb);
bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
{
struct vring_virtqueue *vq = to_vvq(_vq);
- int bufs;
+ u16 bufs;
START_USE(vq);
@@ -412,7 +411,7 @@ bool virtqueue_enable_cb_delayed(struct virtqueue *_vq)
bufs = (vq->vring.avail->idx - vq->last_used_idx) * 3 / 4;
vring_used_event(&vq->vring) = vq->last_used_idx + bufs;
virtio_mb();
- if (unlikely(vq->vring.used->idx - vq->last_used_idx > bufs)) {
+ if (unlikely((u16)(vq->vring.used->idx - vq->last_used_idx) > bufs)) {
END_USE(vq);
return false;
}
--
1.7.5.53.gc233e
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-05-19 17:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-19 17:12 [PATCH RFC] virtio_ring: fix delayed enable cb implementation Michael S. Tsirkin
2011-05-19 17:12 ` Michael S. Tsirkin
-- strict thread matches above, loose matches on Subject: below --
2011-05-19 17:12 Michael S. Tsirkin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.