We let the specifics of the ring format seep through to vhost API callers - mostly because there was only one format so it was hard to imagine what an independent API would look like. Now that there's an alternative in form of the packed ring, it's easier to see the issues, and fixing them is perhaps the cleanest way to add support for more formats. This patchset does this by indtroducing two new structures: vhost_buf to represent a buffer and vhost_desc to represent a descriptor. Descriptors aren't normally of interest to devices but do occationally get exposed e.g. for logging. Perhaps surprisingly, the higher level API actually makes things a bit easier for callers, as well as allows more freedom for the vhost core. The end result is basically unchanged performance (based on preliminary testing) even though we are forced to go through a format conversion. The conversion also exposed (more) bugs in vhost scsi - which isn't really surprising, that driver needs a lot more love than it's getting. Very lightly tested. Would appreciate feedback and testing. Michael S. Tsirkin (13): vhost: option to fetch descriptors through an independent struct vhost: use batched version by default vhost: batching fetches vhost: cleanup fetch_buf return code handling vhost/net: pass net specific struct pointer vhost: reorder functions vhost: format-independent API for used buffers vhost/net: convert to new API: heads->bufs vhost/net: avoid iov length math vhost/test: convert to the buf API vhost/scsi: switch to buf APIs vhost/vsock: switch to the buf API vhost: drop head based APIs drivers/vhost/net.c | 173 +++++++++---------- drivers/vhost/scsi.c | 73 ++++---- drivers/vhost/test.c | 22 +-- drivers/vhost/vhost.c | 375 +++++++++++++++++++++++++++--------------- drivers/vhost/vhost.h | 46 ++++-- drivers/vhost/vsock.c | 30 ++-- 6 files changed, 436 insertions(+), 283 deletions(-) -- MST