search for: get_rx_bufs

Displaying 20 results from an estimated 191 matches for "get_rx_bufs".

2018 May 02
1
[RFC V3 PATCH 1/8] vhost: move get_rx_bufs to vhost.c
On Mon, Apr 23, 2018 at 01:34:53PM +0800, Jason Wang wrote: > Move get_rx_bufs() to vhost.c and rename it to > vhost_get_rx_bufs(). This helps to hide vring internal layout from A small typo. Based on the code change in this patch, it seems that this function is renamed to vhost_get_bufs(). Thanks > specific device implementation. Packed ring implementation will &gt...
2018 Nov 05
0
[PATCH 5/5] VSOCK: batch sending rx buffer to increase bandwidth
...uawei.com> --- drivers/vhost/vsock.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 648be39..a587ddc 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -148,10 +148,12 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, struct vhost_virtqueue *vq) { struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX]; - bool added = false; bool restart_tx = false; int mergeable; size_t vsock_hlen; + int batch_count = 0; + +#define VHOST_VSOCK_BATCH 16 mutex_lock(&vq-&...
2018 Jul 04
1
[PATCH net-next 1/8] vhost: move get_rx_bufs to vhost.c
...st/20180703-154751 HEAD 01b902f1126212ea2597e6d09802bd9c4431bf82 builds fine. It only hurts bisectibility. All errors (new ones prefixed by >>): drivers//vhost/net.c: In function 'handle_rx': >> drivers//vhost/net.c:738:15: error: implicit declaration of function 'get_rx_bufs' [-Werror=implicit-function-declaration] headcount = get_rx_bufs(vq, vq->heads + nvq->done_idx, ^~~~~~~~~~~ cc1: some warnings being treated as errors vim +/get_rx_bufs +738 drivers//vhost/net.c 030881372 Jason Wang 2016-03-04 687 3a4d5c94e Michael...
2018 Apr 23
0
[RFC V3 PATCH 1/8] vhost: move get_rx_bufs to vhost.c
Move get_rx_bufs() to vhost.c and rename it to vhost_get_rx_bufs(). This helps to hide vring internal layout from specific device implementation. Packed ring implementation will benefit from this. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/net.c | 83 ++---------------------------...
2018 Dec 12
2
[PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
...huawei.com> --- drivers/vhost/vsock.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 9600133..a4bf0a1 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -151,9 +151,11 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, struct vhost_virtqueue *vq) { struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX]; - bool added = false; bool restart_tx = false; size_t vsock_hlen; + int batch_count = 0; + +#define VHOST_VSOCK_BATCH 16 mutex_lock(&vq->mutex); @@ -1...
2018 Dec 12
2
[PATCH v2 5/5] VSOCK: batch sending rx buffer to increase bandwidth
...huawei.com> --- drivers/vhost/vsock.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index 9600133..a4bf0a1 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -151,9 +151,11 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, struct vhost_virtqueue *vq) { struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX]; - bool added = false; bool restart_tx = false; size_t vsock_hlen; + int batch_count = 0; + +#define VHOST_VSOCK_BATCH 16 mutex_lock(&vq->mutex); @@ -1...
2018 Jul 03
0
[PATCH net-next 1/8] vhost: move get_rx_bufs to vhost.c
Move get_rx_bufs() to vhost.c and rename it to vhost_get_bufs(). This helps to hide vring internal layout from specific device implementation. Packed ring implementation will benefit from this. Signed-off-by: Jason Wang <jasowang at redhat.com> --- drivers/vhost/net.c | 77 --------------------------------...
2018 Dec 12
0
[PATCH v2 4/5] VSOCK: increase send pkt len in mergeable mode to improve performance
...c b/drivers/vhost/vsock.c index c7ab0dd..9600133 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -44,6 +44,8 @@ struct vhost_vsock { atomic_t queued_replies; u32 guest_cid; + + bool mergeable; }; static u32 vhost_transport_get_local_cid(void) @@ -151,7 +153,6 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX]; bool added = false; bool restart_tx = false; - int mergeable; size_t vsock_hlen; mutex_lock(&vq->mutex); @@ -159,12 +160,11 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, if (!vq-...
2014 Mar 27
1
[PATCH net] vhost: fix total length when packets are too short
When mergeable buffers are disabled, and the incoming packet is too large for the rx buffer, get_rx_bufs returns success. This was intentional in order for make recvmsg truncate the packet and then handle_rx would detect err != sock_len and drop it. Unfortunately we pass the original sock_len to recvmsg - which means we use parts of iov not fully validated. Fix this up by detecting this overrun and...
2014 Mar 27
1
[PATCH net] vhost: fix total length when packets are too short
When mergeable buffers are disabled, and the incoming packet is too large for the rx buffer, get_rx_bufs returns success. This was intentional in order for make recvmsg truncate the packet and then handle_rx would detect err != sock_len and drop it. Unfortunately we pass the original sock_len to recvmsg - which means we use parts of iov not fully validated. Fix this up by detecting this overrun and...
2020 Jun 03
1
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...@log_num - log offset > - * @quota - headcount quota, 1 for big buffer > - * returns number of buffer heads allocated, negative on error > + * @quota - bufcount quota, 1 for big buffer > + * returns number of buffers allocated, negative on error > */ > static int get_rx_bufs(struct vhost_virtqueue *vq, > - struct vring_used_elem *heads, > + struct vhost_buf *bufs, > int datalen, > unsigned *iovcount, > struct vhost_log *log, > @@ -1035,30 +1052,24 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, &g...
2014 Nov 30
2
[PATCH v7 36/46] vhost/net: suppress compiler warning
...ff-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -501,7 +501,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, int headcount = 0; unsigned d; int r, nlogs = 0; - u32 len; + u32 uninitialized_var(len); while (datalen > 0 && headcount < quota) { if (unlikely(seg >= UIO_MAXIOV)) { -- MST
2014 Nov 30
2
[PATCH v7 36/46] vhost/net: suppress compiler warning
...ff-by: Michael S. Tsirkin <mst at redhat.com> --- drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 984242e..54ffbb0 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c @@ -501,7 +501,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, int headcount = 0; unsigned d; int r, nlogs = 0; - u32 len; + u32 uninitialized_var(len); while (datalen > 0 && headcount < quota) { if (unlikely(seg >= UIO_MAXIOV)) { -- MST
2014 Mar 27
1
[PATCHv2 net] vhost: fix total length when packets are too short
When mergeable buffers are disabled, and the incoming packet is too large for the rx buffer, get_rx_bufs returns success. This was intentional in order for make recvmsg truncate the packet and then handle_rx would detect err != sock_len and drop it. Unfortunately we pass the original sock_len to recvmsg - which means we use parts of iov not fully validated. Fix this up by detecting this overrun and...
2014 Mar 27
1
[PATCHv2 net] vhost: fix total length when packets are too short
When mergeable buffers are disabled, and the incoming packet is too large for the rx buffer, get_rx_bufs returns success. This was intentional in order for make recvmsg truncate the packet and then handle_rx would detect err != sock_len and drop it. Unfortunately we pass the original sock_len to recvmsg - which means we use parts of iov not fully validated. Fix this up by detecting this overrun and...
2014 Dec 01
2
[PATCH v7 36/46] vhost/net: suppress compiler warning
.../net.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > > index 984242e..54ffbb0 100644 > > --- a/drivers/vhost/net.c > > +++ b/drivers/vhost/net.c > > @@ -501,7 +501,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, > > int headcount = 0; > > unsigned d; > > int r, nlogs = 0; > > - u32 len; > > + u32 uninitialized_var(len); > > > > while (datalen > 0 && headcount < quota) { > > if (unlikely(seg >= UIO_MAXIO...
2014 Dec 01
2
[PATCH v7 36/46] vhost/net: suppress compiler warning
.../net.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > > index 984242e..54ffbb0 100644 > > --- a/drivers/vhost/net.c > > +++ b/drivers/vhost/net.c > > @@ -501,7 +501,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, > > int headcount = 0; > > unsigned d; > > int r, nlogs = 0; > > - u32 len; > > + u32 uninitialized_var(len); > > > > while (datalen > 0 && headcount < quota) { > > if (unlikely(seg >= UIO_MAXIO...
2020 Jun 02
0
[PATCH RFC 08/13] vhost/net: convert to new API: heads->bufs
...e fill * @log - vhost log * @log_num - log offset - * @quota - headcount quota, 1 for big buffer - * returns number of buffer heads allocated, negative on error + * @quota - bufcount quota, 1 for big buffer + * returns number of buffers allocated, negative on error */ static int get_rx_bufs(struct vhost_virtqueue *vq, - struct vring_used_elem *heads, + struct vhost_buf *bufs, int datalen, unsigned *iovcount, struct vhost_log *log, @@ -1035,30 +1052,24 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, { unsigned int out, in; int se...
2018 May 29
2
[PATCH net] vhost_net: flush batched heads before trying to busy polling
...size_t vhost_hlen, sock_hlen; size_t vhost_len, sock_len; struct socket *sock; @@ -790,8 +806,8 @@ static void handle_rx(struct vhost_net *net) while ((sock_len = vhost_net_rx_peek_head_len(net, sock->sk))) { sock_len += sock_hlen; vhost_len = sock_len + vhost_hlen; - headcount = get_rx_bufs(vq, vq->heads + nheads, vhost_len, - &in, vq_log, &log, + headcount = get_rx_bufs(vq, vq->heads + nvq->done_idx, + vhost_len, &in, vq_log, &log, likely(mergeable) ? UIO_MAXIOV : 1); /* On error, stop handling until the next kick. */ if (unlikely(headcou...
2018 Nov 05
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...SOCK_FEATURES = VHOST_FEATURES, + VHOST_VSOCK_FEATURES = VHOST_FEATURES | + (1ULL << VIRTIO_VSOCK_F_MRG_RXBUF), }; /* Used to track all the vhost_vsock instances on the system. */ @@ -80,6 +81,68 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) return vsock; } +static int get_rx_bufs(struct vhost_virtqueue *vq, + struct vring_used_elem *heads, int datalen, + unsigned *iovcount, unsigned int quota) +{ + unsigned int out, in; + int seg = 0; + int headcount = 0; + unsigned d; + int ret; + /* + * len is always initialized before use since we are always called with + * datalen &...