.. | .. |
---|
7 | 7 | #include <net/sock.h> |
---|
8 | 8 | #include <net/af_vsock.h> |
---|
9 | 9 | |
---|
10 | | -#define VIRTIO_VSOCK_DEFAULT_MIN_BUF_SIZE 128 |
---|
11 | | -#define VIRTIO_VSOCK_DEFAULT_BUF_SIZE (1024 * 256) |
---|
12 | | -#define VIRTIO_VSOCK_DEFAULT_MAX_BUF_SIZE (1024 * 256) |
---|
13 | 10 | #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) |
---|
14 | 11 | #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL |
---|
15 | 12 | #define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE virtio_transport_max_vsock_pkt_buf_size |
---|
.. | .. |
---|
26 | 23 | struct virtio_vsock_sock { |
---|
27 | 24 | struct vsock_sock *vsk; |
---|
28 | 25 | |
---|
29 | | - /* Protected by lock_sock(sk_vsock(trans->vsk)) */ |
---|
30 | | - u32 buf_size; |
---|
31 | | - u32 buf_size_min; |
---|
32 | | - u32 buf_size_max; |
---|
33 | | - |
---|
34 | 26 | spinlock_t tx_lock; |
---|
35 | 27 | spinlock_t rx_lock; |
---|
36 | 28 | |
---|
37 | 29 | /* Protected by tx_lock */ |
---|
38 | 30 | u32 tx_cnt; |
---|
39 | | - u32 buf_alloc; |
---|
40 | 31 | u32 peer_fwd_cnt; |
---|
41 | 32 | u32 peer_buf_alloc; |
---|
42 | 33 | |
---|
43 | 34 | /* Protected by rx_lock */ |
---|
44 | 35 | u32 fwd_cnt; |
---|
| 36 | + u32 last_fwd_cnt; |
---|
45 | 37 | u32 rx_bytes; |
---|
| 38 | + u32 buf_alloc; |
---|
46 | 39 | struct list_head rx_queue; |
---|
47 | 40 | }; |
---|
48 | 41 | |
---|
49 | 42 | struct virtio_vsock_pkt { |
---|
50 | 43 | struct virtio_vsock_hdr hdr; |
---|
51 | | - struct work_struct work; |
---|
52 | 44 | struct list_head list; |
---|
53 | 45 | /* socket refcnt not held, only use for cancellation */ |
---|
54 | 46 | struct vsock_sock *vsk; |
---|
55 | 47 | void *buf; |
---|
| 48 | + u32 buf_len; |
---|
56 | 49 | u32 len; |
---|
57 | 50 | u32 off; |
---|
58 | 51 | bool reply; |
---|
| 52 | + bool tap_delivered; |
---|
59 | 53 | }; |
---|
60 | 54 | |
---|
61 | 55 | struct virtio_vsock_pkt_info { |
---|
.. | .. |
---|
92 | 86 | |
---|
93 | 87 | int virtio_transport_do_socket_init(struct vsock_sock *vsk, |
---|
94 | 88 | struct vsock_sock *psk); |
---|
95 | | -u64 virtio_transport_get_buffer_size(struct vsock_sock *vsk); |
---|
96 | | -u64 virtio_transport_get_min_buffer_size(struct vsock_sock *vsk); |
---|
97 | | -u64 virtio_transport_get_max_buffer_size(struct vsock_sock *vsk); |
---|
98 | | -void virtio_transport_set_buffer_size(struct vsock_sock *vsk, u64 val); |
---|
99 | | -void virtio_transport_set_min_buffer_size(struct vsock_sock *vsk, u64 val); |
---|
100 | | -void virtio_transport_set_max_buffer_size(struct vsock_sock *vs, u64 val); |
---|
101 | 89 | int |
---|
102 | 90 | virtio_transport_notify_poll_in(struct vsock_sock *vsk, |
---|
103 | 91 | size_t target, |
---|
.. | .. |
---|
124 | 112 | struct vsock_transport_send_notify_data *data); |
---|
125 | 113 | int virtio_transport_notify_send_post_enqueue(struct vsock_sock *vsk, |
---|
126 | 114 | ssize_t written, struct vsock_transport_send_notify_data *data); |
---|
| 115 | +void virtio_transport_notify_buffer_size(struct vsock_sock *vsk, u64 *val); |
---|
127 | 116 | |
---|
128 | 117 | u64 virtio_transport_stream_rcvhiwat(struct vsock_sock *vsk); |
---|
129 | 118 | bool virtio_transport_stream_is_active(struct vsock_sock *vsk); |
---|