search for: virtio_transport_put_credit

Displaying 20 results from an estimated 42 matches for "virtio_transport_put_credit".

2023 Mar 22
0
[RFC PATCH v4] virtio/vsock: allocate multiple skbuffs on tx
...Return error only if failed to sent first > skbuff. > > v2 -> v3: > - Handle case when transport callback returns unexpected value which > is not equal to 'skb->len'. Break loop. > - Don't check for zero value of 'rest_len' before calling > 'virtio_transport_put_credit()'. Decided to add this check directly > to 'virtio_transport_put_credit()' in separate patch. > > v3 -> v4: > - Use WARN_ONCE() to handle case when transport callback returns > unexpected value. > - Remove useless 'ret = -EFAULT;' assignment for case ab...
2023 Mar 21
0
[RFC PATCH v3] virtio/vsock: allocate multiple skbuffs on tx
...Return error only if failed to sent first > skbuff. > > v2 -> v3: > - Handle case when transport callback returns unexpected value which > is not equal to 'skb->len'. Break loop. > - Don't check for zero value of 'rest_len' before calling > 'virtio_transport_put_credit()'. Decided to add this check directly > to 'virtio_transport_put_credit()' in separate patch. > > net/vmw_vsock/virtio_transport_common.c | 59 +++++++++++++++++++------ > 1 file changed, 45 insertions(+), 14 deletions(-) > >diff --git a/net/vmw_vsock/virtio_transpor...
2023 Mar 21
0
[RFC PATCH v2] virtio/vsock: allocate multiple skbuffs on tx
...== VIRTIO_VSOCK_OP_RW) >>> ??????? return pkt_len; >>> >>> -??? skb = virtio_transport_alloc_skb(info, pkt_len, >>> -???????????????????? src_cid, src_port, >>> -???????????????????? dst_cid, dst_port); >>> -??? if (!skb) { >>> -??????? virtio_transport_put_credit(vvs, pkt_len); >>> -??????? return -ENOMEM; >>> -??? } >>> +??? ret = 0; >>> +??? rest_len = pkt_len; >>> + >>> +??? do { >>> +??????? struct sk_buff *skb; >>> +??????? size_t skb_len; >>> + >>> +??????? skb_l...
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...88d..ff6850a 100644 > --- a/include/linux/virtio_vsock.h > +++ b/include/linux/virtio_vsock.h > @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs > u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); > void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); > > +static inline const struct virtio_transport *virtio_transport_get_ops(void) > +{ > + const struct vsock_transport *t = vsock_core_get_transport(); > + > + return container_of(t, struct virtio_transport, transport); > +} > +...
2016 Dec 08
1
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...88d..ff6850a 100644 > --- a/include/linux/virtio_vsock.h > +++ b/include/linux/virtio_vsock.h > @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs > u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); > void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); > > +static inline const struct virtio_transport *virtio_transport_get_ops(void) > +{ > + const struct vsock_transport *t = vsock_core_get_transport(); > + > + return container_of(t, struct virtio_transport, transport); > +} > +...
2016 Dec 07
0
[PATCH 4/4] vsock: cancel packets when failing to connect
...virtio_vsock.h index b92e88d..ff6850a 100644 --- a/include/linux/virtio_vsock.h +++ b/include/linux/virtio_vsock.h @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); +static inline const struct virtio_transport *virtio_transport_get_ops(void) +{ + const struct vsock_transport *t = vsock_core_get_transport(); + + return container_of(t, struct virtio_transport, transport); +} + #endif /* _LINUX_VIRTIO_VSOCK_H */ diff...
2023 Mar 23
0
[RFC PATCH v5 2/2] virtio/vsock: check argument to avoid no effect call
...; { > u32 ret; > >+ if (!credit) >+ return 0; >+ > spin_lock_bh(&vvs->tx_lock); > ret = vvs->peer_buf_alloc - (vvs->tx_cnt - vvs->peer_fwd_cnt); > if (ret > credit) >@@ -315,6 +318,9 @@ EXPORT_SYMBOL_GPL(virtio_transport_get_credit); > > void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit) > { >+ if (!credit) >+ return; >+ > spin_lock_bh(&vvs->tx_lock); > vvs->tx_cnt -= credit; > spin_unlock_bh(&vvs->tx_lock); >-- >2.25.1 >
2016 Dec 07
0
[PATCH v2 4/4] vsock: cancel packets when failing to connect
...virtio_vsock.h index b92e88d..ff6850a 100644 --- a/include/linux/virtio_vsock.h +++ b/include/linux/virtio_vsock.h @@ -156,4 +156,11 @@ void virtio_transport_inc_tx_pkt(struct virtio_vsock_sock *vvs, struct virtio_vs u32 virtio_transport_get_credit(struct virtio_vsock_sock *vvs, u32 wanted); void virtio_transport_put_credit(struct virtio_vsock_sock *vvs, u32 credit); +static inline const struct virtio_transport *virtio_transport_get_ops(void) +{ + const struct vsock_transport *t = vsock_core_get_transport(); + + return container_of(t, struct virtio_transport, transport); +} + #endif /* _LINUX_VIRTIO_VSOCK_H */ diff...
2016 Dec 07
8
[PATCH v2 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2016 Dec 07
8
[PATCH v2 0/4] vsock: cancel connect packets when failing to connect
Currently, if a connect call fails on a signal or timeout (e.g., guest is still in the process of starting up), we'll just return to caller and leave the connect packet queued and they are sent even though the connection is considered a failure, which can confuse applications with unwanted false connect attempt. The patchset enables vsock (both host and guest) to cancel queued packets when a
2015 Dec 09
0
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...irtio_vsock_pkt *pkt); +void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); +void virtio_transport_inc_tx_pkt(struct virtio_vsock_pkt *pkt); +void virtio_transport_dec_tx_pkt(struct virtio_vsock_pkt *pkt); +u32 virtio_transport_get_credit(struct virtio_transport *trans, u32 wanted); +void virtio_transport_put_credit(struct virtio_transport *trans, u32 credit); +#endif /* _LINUX_VIRTIO_VSOCK_H */ diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 77925f5..16dcf5d 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@ -39,6 +39,7 @@ #define VIRTIO...
2015 Dec 09
9
[PATCH v3 0/4] Add virtio transport for AF_VSOCK
Note: the virtio-vsock device specification is currently under review but not yet finalized. Please review this code but don't merge until I send an update when the spec is finalized. Thanks! v3: * Remove unnecessary 3-way handshake, just do REQUEST/RESPONSE instead of REQUEST/RESPONSE/ACK * Remove SOCK_DGRAM support and focus on SOCK_STREAM first (also drop v2 Patch 1, it's
2015 Dec 09
9
[PATCH v3 0/4] Add virtio transport for AF_VSOCK
Note: the virtio-vsock device specification is currently under review but not yet finalized. Please review this code but don't merge until I send an update when the spec is finalized. Thanks! v3: * Remove unnecessary 3-way handshake, just do REQUEST/RESPONSE instead of REQUEST/RESPONSE/ACK * Remove SOCK_DGRAM support and focus on SOCK_STREAM first (also drop v2 Patch 1, it's
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...t; +void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); > +void virtio_transport_inc_tx_pkt(struct virtio_vsock_pkt *pkt); > +void virtio_transport_dec_tx_pkt(struct virtio_vsock_pkt *pkt); > +u32 virtio_transport_get_credit(struct virtio_transport *trans, u32 wanted); > +void virtio_transport_put_credit(struct virtio_transport *trans, u32 credit); > +#endif /* _LINUX_VIRTIO_VSOCK_H */ > diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h > index 77925f5..16dcf5d 100644 > --- a/include/uapi/linux/virtio_ids.h > +++ b/include/uapi/linux/virtio_ids.h > @@...
2015 Dec 10
1
[PATCH v3 1/4] VSOCK: Introduce virtio-vsock-common.ko
...t; +void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); > +void virtio_transport_inc_tx_pkt(struct virtio_vsock_pkt *pkt); > +void virtio_transport_dec_tx_pkt(struct virtio_vsock_pkt *pkt); > +u32 virtio_transport_get_credit(struct virtio_transport *trans, u32 wanted); > +void virtio_transport_put_credit(struct virtio_transport *trans, u32 credit); > +#endif /* _LINUX_VIRTIO_VSOCK_H */ > diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h > index 77925f5..16dcf5d 100644 > --- a/include/uapi/linux/virtio_ids.h > +++ b/include/uapi/linux/virtio_ids.h > @@...
2023 Feb 16
0
[RFC PATCH v1 07/12] vsock/virtio: MGS_ZEROCOPY flag support
...(info->reply) >@@ -266,7 +442,8 @@ static int virtio_transport_send_pkt_info(struct vsock_sock *vsk, > > skb = virtio_transport_alloc_skb(info, pkt_len, > src_cid, src_port, >- dst_cid, dst_port); >+ dst_cid, dst_port, >+ vsk); > if (!skb) { > virtio_transport_put_credit(vvs, pkt_len); > return -ENOMEM; >@@ -842,6 +1019,7 @@ virtio_transport_stream_enqueue(struct vsock_sock *vsk, > .msg = msg, > .pkt_len = len, > .vsk = vsk, >+ .flags = msg->msg_flags, > }; > > return virtio_transport_send_pkt_info(vsk, &info); >@@ -8...
2014 Jul 05
0
[RFC V2 3/7] VSOCK: Introduce virtio-vsock-common.ko
...irtio_vsock_pkt *pkt); +void virtio_transport_free_pkt(struct virtio_vsock_pkt *pkt); +void virtio_transport_inc_tx_pkt(struct virtio_vsock_pkt *pkt); +void virtio_transport_dec_tx_pkt(struct virtio_vsock_pkt *pkt); +u32 virtio_transport_get_credit(struct virtio_transport *trans, u32 wanted); +void virtio_transport_put_credit(struct virtio_transport *trans, u32 credit); +#endif /* _LINUX_VIRTIO_VSOCK_H */ diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h index 284fc3a..8a27609 100644 --- a/include/uapi/linux/virtio_ids.h +++ b/include/uapi/linux/virtio_ids.h @@ -39,5 +39,6 @@ #define VIRTIO...
2015 Dec 09
1
[PATCH v2] Revert "Merge branch 'vsock-virtio'"
...->total_tx_buf += pkt_len; - mutex_unlock(&vq->mutex); - - pkt = virtio_transport_alloc_pkt(vsk, info, pkt_len, - src_cid, src_port, - dst_cid, dst_port); - if (!pkt) { - mutex_lock(&vq->mutex); - vsock->total_tx_buf -= pkt_len; - mutex_unlock(&vq->mutex); - virtio_transport_put_credit(trans, pkt_len); - return -ENOMEM; - } - - pr_debug("%s:info->pkt_len= %d\n", __func__, pkt_len); - /* Released in vhost_transport_do_send_pkt */ - sock_hold(&trans->vsk->sk); - virtio_transport_inc_tx_pkt(pkt); - - /* Queue it up in vhost work */ - mutex_lock(&vq->mu...
2015 Dec 09
1
[PATCH v2] Revert "Merge branch 'vsock-virtio'"
...->total_tx_buf += pkt_len; - mutex_unlock(&vq->mutex); - - pkt = virtio_transport_alloc_pkt(vsk, info, pkt_len, - src_cid, src_port, - dst_cid, dst_port); - if (!pkt) { - mutex_lock(&vq->mutex); - vsock->total_tx_buf -= pkt_len; - mutex_unlock(&vq->mutex); - virtio_transport_put_credit(trans, pkt_len); - return -ENOMEM; - } - - pr_debug("%s:info->pkt_len= %d\n", __func__, pkt_len); - /* Released in vhost_transport_do_send_pkt */ - sock_hold(&trans->vsk->sk); - virtio_transport_inc_tx_pkt(pkt); - - /* Queue it up in vhost work */ - mutex_lock(&vq->mu...
2015 Dec 08
8
[PATCH 0/6] VSOCK: revert virtio-vsock until device spec is finalized
The virtio-vsock device specification is not finalized yet. Michael Tsirkin voiced concerned about merging this code when the hardware interface (and possibly the userspace interface) could still change. Please revert for now. I am working to finalize the virtio-vsock device specification and at that point the interfaces will be stable. Stefan Hajnoczi (6): Revert "VSOCK: fix