Re: [PATCH vringh 2/2] caif_virtio: Introduce caif over virtio
From: Sjur Brændeland <hidden>
Date: 2013-02-13 12:50:44
Also in:
lkml, virtualization
Hi Rusty, On Wed, Feb 13, 2013 at 11:16 AM, Rusty Russell [off-list ref] wrote:
Sjur BRENDELAND [off-list ref] writes:quoted
quoted
quoted
+static inline void ctx_prep_iov(struct cfv_napi_context *ctx) +{ + if (ctx->riov.allocated) { + kfree(ctx->riov.iov); + ctx->riov.iov = NULL; + ctx->riov.allocated = false; + } + ctx->riov.iov = NULL; + ctx->riov.i = 0; + ctx->riov.max = 0; +}Hmm, we should probably make sure you don't have to do this: that if allocated once, you can simply reuse it by setting i = 0.Yes, I had problems getting the alloc/free of iov right. This is perhaps the least intuitively part of the API. I maybe it's just me, but I think some more helper functions and support from vringh in this area would be great.Yes, I've neatened my git tree, an in particular added a commit which covers this explicitly, and one for the -EPROTO when we get unexpected r/w bufs. I've appended them below.
Great, thanks. This helps a lot. I picked up your patch-sett yesterday so my V2 patch-set is using this already. ...
+static inline void vringh_iov_init(struct vringh_iov *iov,
+ struct iovec *iovec, unsigned num)
+{
+ iov->used = iov->i = 0;
+ iov->off = 0;
+ iov->max_num = num;
+ iov->iov = iovec;
+}How about supporting struct vringh_kiov and struct kvec as well? I currently get the following complaints with my V2 patch-set: drivers/net/caif/caif_virtio.c:486:2: warning: passing argument 1 of ‘vringh_iov_init’ from incompatible pointer type [enabled by default] ... Thanks, Sjur _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization