ptr_ring: resize support
authorMichael S. Tsirkin <mst@redhat.com>
Mon, 13 Jun 2016 20:54:45 +0000 (23:54 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 Jun 2016 20:58:27 +0000 (13:58 -0700)
This adds ring resize support. Seems to be necessary as
users such as tun allow userspace control over queue size.

If resize is used, this costs us ability to peek at queue without
consumer lock - should not be a big deal as peek and consumer are
usually run on the same CPU.

If ring is made bigger, ring contents is preserved.  If ring is made
smaller, extra pointers are passed to an optional destructor callback.

Cleanup function also gains destructor callback such that
all pointers in queue can be cleaned up.

This changes some APIs but we don't have any users yet,
so it won't break bisect.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

No differences found