1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * VMware vSockets Driver
5 * Copyright (C) 2009-2013 VMware, Inc. All rights reserved.
8 #ifndef __VMCI_TRANSPORT_NOTIFY_H__
9 #define __VMCI_TRANSPORT_NOTIFY_H__
11 #include <linux/types.h>
12 #include <linux/vmw_vmci_defs.h>
13 #include <linux/vmw_vmci_api.h>
15 #include "vmci_transport.h"
17 /* Comment this out to compare with old protocol. */
18 #define VSOCK_OPTIMIZATION_WAITING_NOTIFY 1
19 #if defined(VSOCK_OPTIMIZATION_WAITING_NOTIFY)
20 /* Comment this out to remove flow control for "new" protocol */
21 #define VSOCK_OPTIMIZATION_FLOW_CONTROL 1
24 #define VMCI_TRANSPORT_MAX_DGRAM_RESENDS 10
26 struct vmci_transport_recv_notify_data {
32 struct vmci_transport_send_notify_data {
37 /* Socket notification callbacks. */
38 struct vmci_transport_notify_ops {
39 void (*socket_init) (struct sock *sk);
40 void (*socket_destruct) (struct vsock_sock *vsk);
41 int (*poll_in) (struct sock *sk, size_t target,
42 bool *data_ready_now);
43 int (*poll_out) (struct sock *sk, size_t target,
44 bool *space_avail_now);
45 void (*handle_notify_pkt) (struct sock *sk,
46 struct vmci_transport_packet *pkt,
47 bool bottom_half, struct sockaddr_vm *dst,
48 struct sockaddr_vm *src,
50 int (*recv_init) (struct sock *sk, size_t target,
51 struct vmci_transport_recv_notify_data *data);
52 int (*recv_pre_block) (struct sock *sk, size_t target,
53 struct vmci_transport_recv_notify_data *data);
54 int (*recv_pre_dequeue) (struct sock *sk, size_t target,
55 struct vmci_transport_recv_notify_data *data);
56 int (*recv_post_dequeue) (struct sock *sk, size_t target,
57 ssize_t copied, bool data_read,
58 struct vmci_transport_recv_notify_data *data);
59 int (*send_init) (struct sock *sk,
60 struct vmci_transport_send_notify_data *data);
61 int (*send_pre_block) (struct sock *sk,
62 struct vmci_transport_send_notify_data *data);
63 int (*send_pre_enqueue) (struct sock *sk,
64 struct vmci_transport_send_notify_data *data);
65 int (*send_post_enqueue) (struct sock *sk, ssize_t written,
66 struct vmci_transport_send_notify_data *data);
67 void (*process_request) (struct sock *sk);
68 void (*process_negotiate) (struct sock *sk);
71 extern const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops;
73 struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops;
75 #endif /* __VMCI_TRANSPORT_NOTIFY_H__ */