search for: vsock_hlen

Displaying 20 results from an estimated 27 matches for "vsock_hlen".

Did you mean: sock_hlen
2018 Dec 12
4
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...truct virtio_vsock *vsock) return val < virtqueue_get_vring_size(vq); } +static struct virtio_vsock_pkt *receive_mergeable(struct virtqueue *vq, + struct virtio_vsock *vsock, unsigned int *total_len) +{ + struct virtio_vsock_pkt *pkt; + u16 num_buf; + void *buf; + unsigned int len; + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); + + buf = virtqueue_get_buf(vq, &len); + if (!buf) + return NULL; + + *total_len = len; + vsock->rx_buf_nr--; + + if (unlikely(len < vsock_hlen)) { + put_page(virt_to_head_page(buf)); + return NULL; + } + + pkt = buf; + num_buf = le16_to_cpu(pkt->m...
2018 Dec 12
4
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...truct virtio_vsock *vsock) return val < virtqueue_get_vring_size(vq); } +static struct virtio_vsock_pkt *receive_mergeable(struct virtqueue *vq, + struct virtio_vsock *vsock, unsigned int *total_len) +{ + struct virtio_vsock_pkt *pkt; + u16 num_buf; + void *buf; + unsigned int len; + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); + + buf = virtqueue_get_buf(vq, &len); + if (!buf) + return NULL; + + *total_len = len; + vsock->rx_buf_nr--; + + if (unlikely(len < vsock_hlen)) { + put_page(virt_to_head_page(buf)); + return NULL; + } + + pkt = buf; + num_buf = le16_to_cpu(pkt->m...
2018 Dec 12
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...ort_do_send_pkt(struct vhost_vsock *vsock, struct vhost_virtqueue *vq) @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) 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); if (!vq->private_data) goto out; + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); + /* + * Guest fill page for rx vq in mergeable case, so it will not + * allocate pkt structure, we should reserve size of pkt in advance. + */ + if (likel...
2018 Dec 12
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...ort_do_send_pkt(struct vhost_vsock *vsock, struct vhost_virtqueue *vq) @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) 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); if (!vq->private_data) goto out; + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); + /* + * Guest fill page for rx vq in mergeable case, so it will not + * allocate pkt structure, we should reserve size of pkt in advance. + */ + if (likel...
2018 Dec 13
2
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...t;> >> +static struct virtio_vsock_pkt *receive_mergeable(struct virtqueue *vq, >> + struct virtio_vsock *vsock, unsigned int *total_len) >> +{ >> + struct virtio_vsock_pkt *pkt; >> + u16 num_buf; >> + void *buf; >> + unsigned int len; >> + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); >> + >> + buf = virtqueue_get_buf(vq, &len); >> + if (!buf) >> + return NULL; >> + >> + *total_len = len; >> + vsock->rx_buf_nr--; >> + >> + if (unlikely(len < vsock_hlen)) { >> + put_page(vir...
2018 Dec 13
2
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...t;> >> +static struct virtio_vsock_pkt *receive_mergeable(struct virtqueue *vq, >> + struct virtio_vsock *vsock, unsigned int *total_len) >> +{ >> + struct virtio_vsock_pkt *pkt; >> + u16 num_buf; >> + void *buf; >> + unsigned int len; >> + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); >> + >> + buf = virtqueue_get_buf(vq, &len); >> + if (!buf) >> + return NULL; >> + >> + *total_len = len; >> + vsock->rx_buf_nr--; >> + >> + if (unlikely(len < vsock_hlen)) { >> + put_page(vir...
2018 Nov 05
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...ort_do_send_pkt(struct vhost_vsock *vsock, struct vhost_virtqueue *vq) @@ -87,22 +150,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) 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); if (!vq->private_data) goto out; + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); + /* + * Guest fill page for rx vq in mergeable case, so it will not + * allocate pkt structure, we should reserve size of pkt in advance. + */ + if (likel...
2018 Nov 05
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...ort_do_send_pkt(struct vhost_vsock *vsock, struct vhost_virtqueue *vq) @@ -87,22 +150,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) 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); if (!vq->private_data) goto out; + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); + /* + * Guest fill page for rx vq in mergeable case, so it will not + * allocate pkt structure, we should reserve size of pkt in advance. + */ + if (likel...
2018 Dec 13
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...uct vhost_virtqueue *vq) >> @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) >> 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); >> >> if (!vq->private_data) >> goto out; >> >> + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); >> + /* >> + * Guest fill page for rx vq in mergeable case, so it will not >> +...
2018 Dec 13
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...uct vhost_virtqueue *vq) >> @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) >> 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); >> >> if (!vq->private_data) >> goto out; >> >> + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); >> + /* >> + * Guest fill page for rx vq in mergeable case, so it will not >> +...
2018 Dec 12
0
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...ueue_get_vring_size(vq); > } > > +static struct virtio_vsock_pkt *receive_mergeable(struct virtqueue *vq, > + struct virtio_vsock *vsock, unsigned int *total_len) > +{ > + struct virtio_vsock_pkt *pkt; > + u16 num_buf; > + void *buf; > + unsigned int len; > + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); > + > + buf = virtqueue_get_buf(vq, &len); > + if (!buf) > + return NULL; > + > + *total_len = len; > + vsock->rx_buf_nr--; > + > + if (unlikely(len < vsock_hlen)) { > + put_page(virt_to_head_page(buf)); > + return NUL...
2018 Nov 05
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
...>mrg_rxbuf[i].len = len; + i++; + } + + return pkt; +err: + virtio_transport_free_pkt(pkt); + return NULL; +} + static void virtio_transport_rx_work(struct work_struct *work) { struct virtio_vsock *vsock = container_of(work, struct virtio_vsock, rx_work); struct virtqueue *vq; + size_t vsock_hlen = vsock->mergeable ? sizeof(struct virtio_vsock_pkt) : + sizeof(struct virtio_vsock_hdr); vq = vsock->vqs[VSOCK_VQ_RX]; @@ -383,21 +434,29 @@ static void virtio_transport_rx_work(struct work_struct *work) goto out; } - pkt = virtqueue_get_buf(vq, &len); - if (!pkt) { -...
2018 Nov 05
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
...>mrg_rxbuf[i].len = len; + i++; + } + + return pkt; +err: + virtio_transport_free_pkt(pkt); + return NULL; +} + static void virtio_transport_rx_work(struct work_struct *work) { struct virtio_vsock *vsock = container_of(work, struct virtio_vsock, rx_work); struct virtqueue *vq; + size_t vsock_hlen = vsock->mergeable ? sizeof(struct virtio_vsock_pkt) : + sizeof(struct virtio_vsock_hdr); vq = vsock->vqs[VSOCK_VQ_RX]; @@ -383,21 +434,29 @@ static void virtio_transport_rx_work(struct work_struct *work) goto out; } - pkt = virtqueue_get_buf(vq, &len); - if (!pkt) { -...
2018 Dec 12
0
[PATCH v2 4/5] VSOCK: increase send pkt len in mergeable mode to improve performance
...32 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->private_data) goto out; - mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); /* * Guest fill page for rx vq in mergeable case, so it will not * allocate pk...
2018 Dec 13
0
[PATCH v2 3/5] VSOCK: support receive mergeable rx buffer in guest
...io_vsock_pkt *receive_mergeable(struct virtqueue *vq, > >> + struct virtio_vsock *vsock, unsigned int *total_len) > >> +{ > >> + struct virtio_vsock_pkt *pkt; > >> + u16 num_buf; > >> + void *buf; > >> + unsigned int len; > >> + size_t vsock_hlen = sizeof(struct virtio_vsock_pkt); > >> + > >> + buf = virtqueue_get_buf(vq, &len); > >> + if (!buf) > >> + return NULL; > >> + > >> + *total_len = len; > >> + vsock->rx_buf_nr--; > >> + > >> + if (unlikely(len...
2018 Dec 12
0
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...*vsock, > struct vhost_virtqueue *vq) > @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) > 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); > > if (!vq->private_data) > goto out; > > + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); > + /* > + * Guest fill page for rx vq in mergeable case, so it will not > + * allocate pkt structure, we should...
2018 Dec 13
0
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...>> @@ -87,22 +151,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) > >> 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); > >> > >> if (!vq->private_data) > >> goto out; > >> > >> + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); > >> + /* > >> + * Guest fill page for rx vq...
2018 Nov 06
0
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...ck, > struct vhost_virtqueue *vq) > @@ -87,22 +150,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) > 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); > > if (!vq->private_data) > goto out; > > + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); > + /* > + * Guest fill page for rx vq in mergeable case, so it will not > + * allocate pkt structure, we should...
2018 Nov 06
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...e *vq) >> @@ -87,22 +150,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) >> 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); >> >> if (!vq->private_data) >> goto out; >> >> + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); >> + /* >> + * Guest fill page for rx vq in mergeable case, s...
2018 Nov 06
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...e *vq) >> @@ -87,22 +150,34 @@ static struct vhost_vsock *vhost_vsock_get(u32 guest_cid) >> 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); >> >> if (!vq->private_data) >> goto out; >> >> + mergeable = vhost_has_feature(vq, VIRTIO_VSOCK_F_MRG_RXBUF); >> + /* >> + * Guest fill page for rx vq in mergeable case, s...