search for: virtio_vsock_hdr

Displaying 20 results from an estimated 133 matches for "virtio_vsock_hdr".

2023 Aug 22
0
[PATCH net-next v6 2/4] vsock/virtio: support to send non-linear skb
...ret, in_sg = 0, out_sg = 0; > struct sk_buff *skb; > bool reply; > @@ -111,12 +113,39 @@ virtio_transport_send_pkt_work(struct work_struct *work) > > virtio_transport_deliver_tap_pkt(skb); > reply = virtio_vsock_skb_reply(skb); > + sg_init_one(&bufs[out_sg], virtio_vsock_hdr(skb), > + sizeof(*virtio_vsock_hdr(skb))); > + sgs[out_sg] = &bufs[out_sg]; > + out_sg++; > + > + if (!skb_is_nonlinear(skb)) { > + if (skb->len > 0) { > + sg_init_one(&bufs[out_sg], skb->data, skb->len); > + sgs[out_sg] = &bufs[out_s...
2023 Mar 06
0
[RFC PATCH v2 1/4] virtio/vsock: fix 'rx_bytes'/'fwd_cnt' calculation
...581c77cf84..2e2a773df5c1 100644 >--- a/net/vmw_vsock/virtio_transport_common.c >+++ b/net/vmw_vsock/virtio_transport_common.c >@@ -255,7 +255,7 @@ static void virtio_transport_dec_rx_pkt(struct virtio_vsock_sock *vvs, > { > int len; > >- len = skb_headroom(skb) - sizeof(struct virtio_vsock_hdr) - skb->len; >+ len = skb_headroom(skb) - sizeof(struct virtio_vsock_hdr); IIUC virtio_transport_dec_rx_pkt() is always called after skb_pull(), so skb_headroom() is returning the amount of space we removed. Looking at the other patches in this series, I think maybe we should change virtio_...
2023 Feb 16
0
[RFC PATCH v1 05/12] vsock/virtio: non-linear skb support
...) > int ret, in_sg = 0, out_sg = 0; > struct sk_buff *skb; > bool reply; >@@ -111,12 +112,30 @@ virtio_transport_send_pkt_work(struct work_struct *work) > > virtio_transport_deliver_tap_pkt(skb); > reply = virtio_vsock_skb_reply(skb); >+ sg_init_one(&bufs[0], virtio_vsock_hdr(skb), sizeof(*virtio_vsock_hdr(skb))); >+ sgs[out_sg++] = &bufs[0]; >+ >+ if (skb_is_nonlinear(skb)) { >+ int i; >+ >+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { >+ struct page *data_page = skb_shinfo(skb)->frags[i].bv_page; >+ >+ /* We wil...
2023 May 02
1
[Patch net] vsock: improve tap delivery accuracy
...07 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -109,9 +109,6 @@ virtio_transport_send_pkt_work(struct work_struct *work) if (!skb) break; - virtio_transport_deliver_tap_pkt(skb); - reply = virtio_vsock_skb_reply(skb); - sg_init_one(&hdr, virtio_vsock_hdr(skb), sizeof(*virtio_vsock_hdr(skb))); sgs[out_sg++] = &hdr; if (skb->len > 0) { @@ -128,6 +125,8 @@ virtio_transport_send_pkt_work(struct work_struct *work) break; } + virtio_transport_deliver_tap_pkt(skb); + reply = virtio_vsock_skb_reply(skb); if (reply) { struc...
2018 Dec 12
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...as_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 (likely(mergeable)) + vsock_hlen = sizeof(struct virtio_vsock_pkt); + else + vsock_hlen = sizeof(struct virtio_vsock_hdr); + /* Avoid further vmexits, we're already processing the virtqueue */ vhost_disable_notify(&vsock->dev, vq); for (;;) { struct virtio_vsock_pkt *pkt; struct iov_iter iov_iter; - unsigned out, in; + unsigned out = 0, in = 0; size_t nbytes; size_t len; - int head; +...
2018 Dec 12
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...as_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 (likely(mergeable)) + vsock_hlen = sizeof(struct virtio_vsock_pkt); + else + vsock_hlen = sizeof(struct virtio_vsock_hdr); + /* Avoid further vmexits, we're already processing the virtqueue */ vhost_disable_notify(&vsock->dev, vq); for (;;) { struct virtio_vsock_pkt *pkt; struct iov_iter iov_iter; - unsigned out, in; + unsigned out = 0, in = 0; size_t nbytes; size_t len; - int head; +...
2018 Nov 05
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...as_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 (likely(mergeable)) + vsock_hlen = sizeof(struct virtio_vsock_pkt); + else + vsock_hlen = sizeof(struct virtio_vsock_hdr); + /* Avoid further vmexits, we're already processing the virtqueue */ vhost_disable_notify(&vsock->dev, vq); for (;;) { struct virtio_vsock_pkt *pkt; struct iov_iter iov_iter; - unsigned out, in; + unsigned out = 0, in = 0; size_t nbytes; size_t len; - int head; +...
2018 Nov 05
2
[PATCH 2/5] VSOCK: support fill data to mergeable rx buffer in host
...as_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 (likely(mergeable)) + vsock_hlen = sizeof(struct virtio_vsock_pkt); + else + vsock_hlen = sizeof(struct virtio_vsock_hdr); + /* Avoid further vmexits, we're already processing the virtqueue */ vhost_disable_notify(&vsock->dev, vq); for (;;) { struct virtio_vsock_pkt *pkt; struct iov_iter iov_iter; - unsigned out, in; + unsigned out = 0, in = 0; size_t nbytes; size_t len; - int head; +...
2013 Jun 29
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...void > +virtio_transport_recv_dgram(struct sock *sk, > + struct virtio_vsock_pkt *pkt) ... > + memcpy(skb->data, pkt, sizeof(*pkt)); > + memcpy(skb->data + sizeof(*pkt), pkt->buf, pkt->len); Are you sure this is right? Shouldn't you be using "sizeof(struct virtio_vsock_hdr)" instead of "sizeof(*pkt)". 'pkt' is "struct virtio_vsock_pkt" and has all kinds of meta-data you probably don't mean to include in the SKB.
2013 Jun 29
1
[RFC 2/5] VSOCK: Introduce virtio-vsock-common.ko
...void > +virtio_transport_recv_dgram(struct sock *sk, > + struct virtio_vsock_pkt *pkt) ... > + memcpy(skb->data, pkt, sizeof(*pkt)); > + memcpy(skb->data + sizeof(*pkt), pkt->buf, pkt->len); Are you sure this is right? Shouldn't you be using "sizeof(struct virtio_vsock_hdr)" instead of "sizeof(*pkt)". 'pkt' is "struct virtio_vsock_pkt" and has all kinds of meta-data you probably don't mean to include in the SKB.
2018 Dec 13
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...est fill page for rx vq in mergeable case, so it will not >> + * allocate pkt structure, we should reserve size of pkt in advance. >> + */ >> + if (likely(mergeable)) >> + vsock_hlen = sizeof(struct virtio_vsock_pkt); >> + else >> + vsock_hlen = sizeof(struct virtio_vsock_hdr); >> + >> /* Avoid further vmexits, we're already processing the virtqueue */ >> vhost_disable_notify(&vsock->dev, vq); >> >> for (;;) { >> struct virtio_vsock_pkt *pkt; >> struct iov_iter iov_iter; >> - unsigned out, in; >&...
2018 Dec 13
4
[PATCH v2 2/5] VSOCK: support fill data to mergeable rx buffer in host
...est fill page for rx vq in mergeable case, so it will not >> + * allocate pkt structure, we should reserve size of pkt in advance. >> + */ >> + if (likely(mergeable)) >> + vsock_hlen = sizeof(struct virtio_vsock_pkt); >> + else >> + vsock_hlen = sizeof(struct virtio_vsock_hdr); >> + >> /* Avoid further vmexits, we're already processing the virtqueue */ >> vhost_disable_notify(&vsock->dev, vq); >> >> for (;;) { >> struct virtio_vsock_pkt *pkt; >> struct iov_iter iov_iter; >> - unsigned out, in; >&...
2017 Mar 02
2
[PATCH-v4-RESEND 1/4] vsock: track pkt owner vsock
...gt; 2 files changed, 9 insertions(+) > > diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h > index 9638bfe..193ad3a 100644 > --- a/include/linux/virtio_vsock.h > +++ b/include/linux/virtio_vsock.h > @@ -48,6 +48,7 @@ struct virtio_vsock_pkt { > struct virtio_vsock_hdr hdr; > struct work_struct work; > struct list_head list; > + void *cancel_token; /* only used for cancellation */ The type here is fixed, you only store vhost_sock object pointers here, so don't use "void *" please.
2017 Mar 02
2
[PATCH-v4-RESEND 1/4] vsock: track pkt owner vsock
...gt; 2 files changed, 9 insertions(+) > > diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h > index 9638bfe..193ad3a 100644 > --- a/include/linux/virtio_vsock.h > +++ b/include/linux/virtio_vsock.h > @@ -48,6 +48,7 @@ struct virtio_vsock_pkt { > struct virtio_vsock_hdr hdr; > struct work_struct work; > struct list_head list; > + void *cancel_token; /* only used for cancellation */ The type here is fixed, you only store vhost_sock object pointers here, so don't use "void *" please.
2018 Nov 05
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
.../ PAGE_SIZE) + 1) /* Virtio-vsock feature */ #define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */ @@ -48,6 +50,11 @@ struct virtio_vsock_sock { struct list_head rx_queue; }; +struct virtio_vsock_mrg_rxbuf { + void *buf; + u32 len; +}; + struct virtio_vsock_pkt { struct virtio_vsock_hdr hdr; struct virtio_vsock_mrg_rxbuf_hdr mrg_rxbuf_hdr; @@ -59,6 +66,8 @@ struct virtio_vsock_pkt { u32 len; u32 off; bool reply; + bool mergeable; + struct virtio_vsock_mrg_rxbuf mrg_rxbuf[VIRTIO_VSOCK_MAX_MRG_BUF_NUM]; }; struct virtio_vsock_pkt_info { diff --git a/net/vmw_vsock/virtio_t...
2018 Nov 05
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
.../ PAGE_SIZE) + 1) /* Virtio-vsock feature */ #define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */ @@ -48,6 +50,11 @@ struct virtio_vsock_sock { struct list_head rx_queue; }; +struct virtio_vsock_mrg_rxbuf { + void *buf; + u32 len; +}; + struct virtio_vsock_pkt { struct virtio_vsock_hdr hdr; struct virtio_vsock_mrg_rxbuf_hdr mrg_rxbuf_hdr; @@ -59,6 +66,8 @@ struct virtio_vsock_pkt { u32 len; u32 off; bool reply; + bool mergeable; + struct virtio_vsock_mrg_rxbuf mrg_rxbuf[VIRTIO_VSOCK_MAX_MRG_BUF_NUM]; }; struct virtio_vsock_pkt_info { diff --git a/net/vmw_vsock/virtio_t...
2018 Nov 15
7
[RFC] Discuss about an new idea "Vsock over Virtio-net"
...------------------Simple idea------------------------------ 1. The packet layout will become as follows: +---------------------------------+ | Virtio-net header | |(struct virtio_net_hdr_mrg_rxbuf)| +---------------------------------+ | Vsock header | | (struct virtio_vsock_hdr) | +---------------------------------+ | payload | | (until end of packet) | +---------------------------------+ 2. The Guest->Host basic code flow as follow: +------------+ | Client |...
2018 Nov 15
7
[RFC] Discuss about an new idea "Vsock over Virtio-net"
...------------------Simple idea------------------------------ 1. The packet layout will become as follows: +---------------------------------+ | Virtio-net header | |(struct virtio_net_hdr_mrg_rxbuf)| +---------------------------------+ | Vsock header | | (struct virtio_vsock_hdr) | +---------------------------------+ | payload | | (until end of packet) | +---------------------------------+ 2. The Guest->Host basic code flow as follow: +------------+ | Client |...
2018 Nov 06
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
...rs. */ >> @@ -48,6 +50,11 @@ struct virtio_vsock_sock { >> struct list_head rx_queue; >> }; >> >> +struct virtio_vsock_mrg_rxbuf { >> + void *buf; >> + u32 len; >> +}; >> + >> struct virtio_vsock_pkt { >> struct virtio_vsock_hdr hdr; >> struct virtio_vsock_mrg_rxbuf_hdr mrg_rxbuf_hdr; >> @@ -59,6 +66,8 @@ struct virtio_vsock_pkt { >> u32 len; >> u32 off; >> bool reply; >> + bool mergeable; >> + struct virtio_vsock_mrg_rxbuf mrg_rxbuf[VIRTIO_VSOCK_MA...
2018 Nov 06
2
[PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
...rs. */ >> @@ -48,6 +50,11 @@ struct virtio_vsock_sock { >> struct list_head rx_queue; >> }; >> >> +struct virtio_vsock_mrg_rxbuf { >> + void *buf; >> + u32 len; >> +}; >> + >> struct virtio_vsock_pkt { >> struct virtio_vsock_hdr hdr; >> struct virtio_vsock_mrg_rxbuf_hdr mrg_rxbuf_hdr; >> @@ -59,6 +66,8 @@ struct virtio_vsock_pkt { >> u32 len; >> u32 off; >> bool reply; >> + bool mergeable; >> + struct virtio_vsock_mrg_rxbuf mrg_rxbuf[VIRTIO_VSOCK_MA...