Andy King | d021c34 | 2013-02-06 14:23:56 +0000 | [diff] [blame] | 1 | /* |
| 2 | * VMware vSockets Driver |
| 3 | * |
| 4 | * Copyright (C) 2009-2013 VMware, Inc. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the Free |
| 8 | * Software Foundation version 2 and no later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 13 | * more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef __VMCI_TRANSPORT_NOTIFY_H__ |
| 17 | #define __VMCI_TRANSPORT_NOTIFY_H__ |
| 18 | |
| 19 | #include <linux/types.h> |
| 20 | #include <linux/vmw_vmci_defs.h> |
| 21 | #include <linux/vmw_vmci_api.h> |
| 22 | #include <linux/vm_sockets.h> |
| 23 | |
| 24 | #include "vmci_transport.h" |
| 25 | |
| 26 | /* Comment this out to compare with old protocol. */ |
| 27 | #define VSOCK_OPTIMIZATION_WAITING_NOTIFY 1 |
| 28 | #if defined(VSOCK_OPTIMIZATION_WAITING_NOTIFY) |
| 29 | /* Comment this out to remove flow control for "new" protocol */ |
| 30 | #define VSOCK_OPTIMIZATION_FLOW_CONTROL 1 |
| 31 | #endif |
| 32 | |
| 33 | #define VMCI_TRANSPORT_MAX_DGRAM_RESENDS 10 |
| 34 | |
| 35 | struct vmci_transport_recv_notify_data { |
| 36 | u64 consume_head; |
| 37 | u64 produce_tail; |
| 38 | bool notify_on_block; |
| 39 | }; |
| 40 | |
| 41 | struct vmci_transport_send_notify_data { |
| 42 | u64 consume_head; |
| 43 | u64 produce_tail; |
| 44 | }; |
| 45 | |
| 46 | /* Socket notification callbacks. */ |
| 47 | struct vmci_transport_notify_ops { |
| 48 | void (*socket_init) (struct sock *sk); |
| 49 | void (*socket_destruct) (struct vsock_sock *vsk); |
| 50 | int (*poll_in) (struct sock *sk, size_t target, |
| 51 | bool *data_ready_now); |
| 52 | int (*poll_out) (struct sock *sk, size_t target, |
| 53 | bool *space_avail_now); |
| 54 | void (*handle_notify_pkt) (struct sock *sk, |
| 55 | struct vmci_transport_packet *pkt, |
| 56 | bool bottom_half, struct sockaddr_vm *dst, |
| 57 | struct sockaddr_vm *src, |
| 58 | bool *pkt_processed); |
| 59 | int (*recv_init) (struct sock *sk, size_t target, |
| 60 | struct vmci_transport_recv_notify_data *data); |
| 61 | int (*recv_pre_block) (struct sock *sk, size_t target, |
| 62 | struct vmci_transport_recv_notify_data *data); |
| 63 | int (*recv_pre_dequeue) (struct sock *sk, size_t target, |
| 64 | struct vmci_transport_recv_notify_data *data); |
| 65 | int (*recv_post_dequeue) (struct sock *sk, size_t target, |
| 66 | ssize_t copied, bool data_read, |
| 67 | struct vmci_transport_recv_notify_data *data); |
| 68 | int (*send_init) (struct sock *sk, |
| 69 | struct vmci_transport_send_notify_data *data); |
| 70 | int (*send_pre_block) (struct sock *sk, |
| 71 | struct vmci_transport_send_notify_data *data); |
| 72 | int (*send_pre_enqueue) (struct sock *sk, |
| 73 | struct vmci_transport_send_notify_data *data); |
| 74 | int (*send_post_enqueue) (struct sock *sk, ssize_t written, |
| 75 | struct vmci_transport_send_notify_data *data); |
| 76 | void (*process_request) (struct sock *sk); |
| 77 | void (*process_negotiate) (struct sock *sk); |
| 78 | }; |
| 79 | |
Julia Lawall | 3b22dae | 2015-11-21 18:39:17 +0100 | [diff] [blame] | 80 | extern const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops; |
| 81 | extern const |
| 82 | struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops; |
Andy King | d021c34 | 2013-02-06 14:23:56 +0000 | [diff] [blame] | 83 | |
| 84 | #endif /* __VMCI_TRANSPORT_NOTIFY_H__ */ |