Displaying 20 results from an estimated 111 matches for "detach_buf_packed".
2018 Apr 17
2
[RFC v2] virtio: support packed ring
On Tue, Apr 17, 2018 at 10:11:58AM +0800, Jason Wang wrote:
> On 2018?04?13? 15:15, Tiwei Bie wrote:
> > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > On 2018?04?01? 22:12, Tiwei Bie wrote:
[...]
> > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > + void **ctx)
> > > > +{
> > > > + struct vring_packed_desc *desc;
> > > > + unsigned int i, j;
> > > > +
> > > > + /* Clear data ptr. */
> > > > + vq-&...
2018 Apr 17
2
[RFC v2] virtio: support packed ring
On Tue, Apr 17, 2018 at 10:11:58AM +0800, Jason Wang wrote:
> On 2018?04?13? 15:15, Tiwei Bie wrote:
> > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > On 2018?04?01? 22:12, Tiwei Bie wrote:
[...]
> > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > + void **ctx)
> > > > +{
> > > > + struct vring_packed_desc *desc;
> > > > + unsigned int i, j;
> > > > +
> > > > + /* Clear data ptr. */
> > > > + vq-&...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
> + vq->last_add_time)) > 100);
> + }
> + vq->last_add_time_valid = false;
> +#endif
> +
> + needs_kick = (flags != VRING_EVENT_F_DISABLE);
> + END_USE(vq);
> + return needs_kick;
> +}
> +
> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> + unsigned int id, void **ctx)
> +{
> + struct vring_packed_desc *desc;
> + unsigned int i, j;
> +
> + /* Clear data ptr. */
> + vq->desc_state[id].data = NULL;
> +
> + i = head;
> +
> + for (j = 0; j <...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
> + vq->last_add_time)) > 100);
> + }
> + vq->last_add_time_valid = false;
> +#endif
> +
> + needs_kick = (flags != VRING_EVENT_F_DISABLE);
> + END_USE(vq);
> + return needs_kick;
> +}
> +
> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> + unsigned int id, void **ctx)
> +{
> + struct vring_packed_desc *desc;
> + unsigned int i, j;
> +
> + /* Clear data ptr. */
> + vq->desc_state[id].data = NULL;
> +
> + i = head;
> +
> + for (j = 0; j <...
2018 May 29
2
[RFC v5 3/5] virtio_ring: add packed ring support
...WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
> + vq->last_add_time)) > 100);
> + }
> + vq->last_add_time_valid = false;
> +#endif
> +
> + needs_kick = (flags != VRING_EVENT_F_DISABLE);
> + END_USE(vq);
> + return needs_kick;
> +}
> +
> +static void detach_buf_packed(struct vring_virtqueue *vq,
> + unsigned int id, void **ctx)
> +{
> + struct vring_desc_state_packed *state;
> + struct vring_packed_desc *desc;
> + unsigned int i;
> + int *next;
> +
> + /* Clear data ptr. */
> + vq->desc_state_packed[id].data = NULL;
> +
&...
2018 May 29
2
[RFC v5 3/5] virtio_ring: add packed ring support
...WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
> + vq->last_add_time)) > 100);
> + }
> + vq->last_add_time_valid = false;
> +#endif
> +
> + needs_kick = (flags != VRING_EVENT_F_DISABLE);
> + END_USE(vq);
> + return needs_kick;
> +}
> +
> +static void detach_buf_packed(struct vring_virtqueue *vq,
> + unsigned int id, void **ctx)
> +{
> + struct vring_desc_state_packed *state;
> + struct vring_packed_desc *desc;
> + unsigned int i;
> + int *next;
> +
> + /* Clear data ptr. */
> + vq->desc_state_packed[id].data = NULL;
> +
&...
2018 Apr 17
2
[RFC v2] virtio: support packed ring
...2018 at 10:11:58AM +0800, Jason Wang wrote:
> > > On 2018?04?13? 15:15, Tiwei Bie wrote:
> > > > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > > > On 2018?04?01? 22:12, Tiwei Bie wrote:
> > [...]
> > > > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > > > + void **ctx)
> > > > > > +{
> > > > > > + struct vring_packed_desc *desc;
> > > > > > + unsigned int i, j;
> > > > > > +
> > > >...
2018 Apr 17
2
[RFC v2] virtio: support packed ring
...2018 at 10:11:58AM +0800, Jason Wang wrote:
> > > On 2018?04?13? 15:15, Tiwei Bie wrote:
> > > > On Fri, Apr 13, 2018 at 12:30:24PM +0800, Jason Wang wrote:
> > > > > On 2018?04?01? 22:12, Tiwei Bie wrote:
> > [...]
> > > > > > +static int detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
> > > > > > + void **ctx)
> > > > > > +{
> > > > > > + struct vring_packed_desc *desc;
> > > > > > + unsigned int i, j;
> > > > > > +
> > > >...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...ly, it should be quite easy
> to replace it with something else without changing other code.
> If it will really hurt the performance, I'll change it.
We may want to do some benchmarking/profiling to see.
>
>>> };
>>> };
> [...]
>>> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
>>> + unsigned int id, void **ctx)
>>> +{
>>> + struct vring_packed_desc *desc;
>>> + unsigned int i, j;
>>> +
>>> + /* Clear data ptr. */
>>> + vq->desc_state[id].data = NULL;
&...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...ly, it should be quite easy
> to replace it with something else without changing other code.
> If it will really hurt the performance, I'll change it.
We may want to do some benchmarking/profiling to see.
>
>>> };
>>> };
> [...]
>>> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
>>> + unsigned int id, void **ctx)
>>> +{
>>> + struct vring_packed_desc *desc;
>>> + unsigned int i, j;
>>> +
>>> + /* Clear data ptr. */
>>> + vq->desc_state[id].data = NULL;
&...
2019 Aug 10
1
[PATCH v3 2/2] virtio: decrement avail idx with buffer detach for packed ring
...3e2 100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -1537,6 +1537,12 @@ static void *virtqueue_detach_unused_buf_packed(struct virtqueue *_vq)
> /* detach_buf clears data, so grab it now. */
> buf = vq->packed.desc_state[i].data;
> detach_buf_packed(vq, i, NULL);
> + vq->packed.next_avail_idx--;
> + if (vq->packed.next_avail_idx < 0) {
> + vq->packed.next_avail_idx = vq->packed.vring.num - 1;
> + vq->packed.avail_wrap_counter ^= 1;
> + }
> +
> END_USE(vq);
> return buf;
> }
> --
&...
2019 Aug 12
1
[PATCH v3 2/2] virtio: decrement avail idx with buffer detach for packed ring
...100644
> --- a/drivers/virtio/virtio_ring.c
> +++ b/drivers/virtio/virtio_ring.c
> @@ -1537,6 +1537,12 @@ static void *virtqueue_detach_unused_buf_packed(struct virtqueue *_vq)
> /* detach_buf clears data, so grab it now. */
> buf = vq->packed.desc_state[i].data;
> detach_buf_packed(vq, i, NULL);
> + vq->packed.next_avail_idx--;
> + if (vq->packed.next_avail_idx < 0) {
> + vq->packed.next_avail_idx = vq->packed.vring.num - 1;
> + vq->packed.avail_wrap_counter ^= 1;
> + }
> +
> END_USE(vq);
> return buf;
> }
Acked...
2018 Apr 25
0
[RFC v3 3/5] virtio_ring: add packed ring support
...+
+#ifdef DEBUG
+ if (vq->last_add_time_valid) {
+ WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
+ vq->last_add_time)) > 100);
+ }
+ vq->last_add_time_valid = false;
+#endif
+
+ needs_kick = (flags != VRING_EVENT_F_DISABLE);
+ END_USE(vq);
+ return needs_kick;
+}
+
+static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
+ void **ctx)
+{
+ struct vring_packed_desc *desc;
+ unsigned int i, j;
+
+ /* Clear data ptr. */
+ vq->desc_state[head].data = NULL;
+
+ i = head;
+
+ for (j = 0; j < vq->desc_state[head].num; j++) {
+ desc = &vq->vring_packed...
2018 May 22
0
[RFC v5 3/5] virtio_ring: add packed ring support
...+
+#ifdef DEBUG
+ if (vq->last_add_time_valid) {
+ WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
+ vq->last_add_time)) > 100);
+ }
+ vq->last_add_time_valid = false;
+#endif
+
+ needs_kick = (flags != VRING_EVENT_F_DISABLE);
+ END_USE(vq);
+ return needs_kick;
+}
+
+static void detach_buf_packed(struct vring_virtqueue *vq,
+ unsigned int id, void **ctx)
+{
+ struct vring_desc_state_packed *state;
+ struct vring_packed_desc *desc;
+ unsigned int i;
+ int *next;
+
+ /* Clear data ptr. */
+ vq->desc_state_packed[id].data = NULL;
+
+ next = &id;
+ for (i = 0; i < vq->desc_...
2018 Jul 11
0
[PATCH net-next v2 3/5] virtio_ring: add packed ring support
...+
+#ifdef DEBUG
+ if (vq->last_add_time_valid) {
+ WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
+ vq->last_add_time)) > 100);
+ }
+ vq->last_add_time_valid = false;
+#endif
+
+ needs_kick = (flags != VRING_EVENT_F_DISABLE);
+ END_USE(vq);
+ return needs_kick;
+}
+
+static void detach_buf_packed(struct vring_virtqueue *vq,
+ unsigned int id, void **ctx)
+{
+ struct vring_desc_state_packed *state = NULL;
+ struct vring_packed_desc *desc;
+ unsigned int curr, i;
+
+ /* Clear data ptr. */
+ vq->desc_state_packed[id].data = NULL;
+
+ curr = id;
+ for (i = 0; i < vq->desc_state...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...g else without changing other code.
>>> If it will really hurt the performance, I'll change it.
>> We may want to do some benchmarking/profiling to see.
> Yeah!
>
>>>>> };
>>>>> };
>>> [...]
>>>>> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
>>>>> + unsigned int id, void **ctx)
>>>>> +{
>>>>> + struct vring_packed_desc *desc;
>>>>> + unsigned int i, j;
>>>>> +
>>>>> + /* Clear data ptr. */
>...
2018 May 16
2
[RFC v4 3/5] virtio_ring: add packed ring support
...g else without changing other code.
>>> If it will really hurt the performance, I'll change it.
>> We may want to do some benchmarking/profiling to see.
> Yeah!
>
>>>>> };
>>>>> };
>>> [...]
>>>>> +static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
>>>>> + unsigned int id, void **ctx)
>>>>> +{
>>>>> + struct vring_packed_desc *desc;
>>>>> + unsigned int i, j;
>>>>> +
>>>>> + /* Clear data ptr. */
>...
2018 May 16
0
[RFC v4 3/5] virtio_ring: add packed ring support
...+
+#ifdef DEBUG
+ if (vq->last_add_time_valid) {
+ WARN_ON(ktime_to_ms(ktime_sub(ktime_get(),
+ vq->last_add_time)) > 100);
+ }
+ vq->last_add_time_valid = false;
+#endif
+
+ needs_kick = (flags != VRING_EVENT_F_DISABLE);
+ END_USE(vq);
+ return needs_kick;
+}
+
+static void detach_buf_packed(struct vring_virtqueue *vq, unsigned int head,
+ unsigned int id, void **ctx)
+{
+ struct vring_packed_desc *desc;
+ unsigned int i, j;
+
+ /* Clear data ptr. */
+ vq->desc_state[id].data = NULL;
+
+ i = head;
+
+ for (j = 0; j < vq->desc_state[id].num; j++) {
+ desc = &vq->...
2019 Aug 09
5
[PATCH v3 0/2] virtio_console: fix replug of virtio console port
This patch series fixes the issue with unplug/replug of a port in virtio
console driver which fails with an error "Error allocating inbufs\n".
Patch 1 makes use of 'virtqueue_detach_unused_buf' function to detach
the unused buffers during port hotunplug time.
Patch 2 updates the next avail index for packed ring code.
Tested the packed ring code with the qemu virtio 1.1 device
2018 Mar 16
2
[PATCH RFC 2/2] virtio_ring: support packed ring
...ome buffers from the free list. */
> + vq->vq.num_free -= descs_used;
> +
> + /* Update free pointer */
> + if (indirect) {
> + n = head + 1;
> + if (n >= vq->vring_packed.num) {
> + n = 0;
> + vq->wrap_counter ^= 1;
> + }
> + vq->free_head = n;
detach_buf_packed() does not even touch free_head here, so need to
explain its meaning for packed ring.
> + } else
> + vq->free_head = i;
ID is only valid in the last descriptor in the list, so head + 1 should
be ok too?
> +
> + /* Store token and indirect buffer state. */
> + vq->desc_sta...