Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * VMware vSockets Driver
0004  *
0005  * Copyright (C) 2009-2013 VMware, Inc. All rights reserved.
0006  */
0007 
0008 #ifndef __VMCI_TRANSPORT_NOTIFY_H__
0009 #define __VMCI_TRANSPORT_NOTIFY_H__
0010 
0011 #include <linux/types.h>
0012 #include <linux/vmw_vmci_defs.h>
0013 #include <linux/vmw_vmci_api.h>
0014 
0015 #include "vmci_transport.h"
0016 
0017 /* Comment this out to compare with old protocol. */
0018 #define VSOCK_OPTIMIZATION_WAITING_NOTIFY 1
0019 #if defined(VSOCK_OPTIMIZATION_WAITING_NOTIFY)
0020 /* Comment this out to remove flow control for "new" protocol */
0021 #define VSOCK_OPTIMIZATION_FLOW_CONTROL 1
0022 #endif
0023 
0024 #define VMCI_TRANSPORT_MAX_DGRAM_RESENDS       10
0025 
0026 struct vmci_transport_recv_notify_data {
0027     u64 consume_head;
0028     u64 produce_tail;
0029     bool notify_on_block;
0030 };
0031 
0032 struct vmci_transport_send_notify_data {
0033     u64 consume_head;
0034     u64 produce_tail;
0035 };
0036 
0037 /* Socket notification callbacks. */
0038 struct vmci_transport_notify_ops {
0039     void (*socket_init) (struct sock *sk);
0040     void (*socket_destruct) (struct vsock_sock *vsk);
0041     int (*poll_in) (struct sock *sk, size_t target,
0042               bool *data_ready_now);
0043     int (*poll_out) (struct sock *sk, size_t target,
0044                bool *space_avail_now);
0045     void (*handle_notify_pkt) (struct sock *sk,
0046                    struct vmci_transport_packet *pkt,
0047                    bool bottom_half, struct sockaddr_vm *dst,
0048                    struct sockaddr_vm *src,
0049                    bool *pkt_processed);
0050     int (*recv_init) (struct sock *sk, size_t target,
0051               struct vmci_transport_recv_notify_data *data);
0052     int (*recv_pre_block) (struct sock *sk, size_t target,
0053                    struct vmci_transport_recv_notify_data *data);
0054     int (*recv_pre_dequeue) (struct sock *sk, size_t target,
0055                  struct vmci_transport_recv_notify_data *data);
0056     int (*recv_post_dequeue) (struct sock *sk, size_t target,
0057                   ssize_t copied, bool data_read,
0058                   struct vmci_transport_recv_notify_data *data);
0059     int (*send_init) (struct sock *sk,
0060               struct vmci_transport_send_notify_data *data);
0061     int (*send_pre_block) (struct sock *sk,
0062                    struct vmci_transport_send_notify_data *data);
0063     int (*send_pre_enqueue) (struct sock *sk,
0064                  struct vmci_transport_send_notify_data *data);
0065     int (*send_post_enqueue) (struct sock *sk, ssize_t written,
0066                   struct vmci_transport_send_notify_data *data);
0067     void (*process_request) (struct sock *sk);
0068     void (*process_negotiate) (struct sock *sk);
0069 };
0070 
0071 extern const struct vmci_transport_notify_ops vmci_transport_notify_pkt_ops;
0072 extern const
0073 struct vmci_transport_notify_ops vmci_transport_notify_pkt_q_state_ops;
0074 
0075 #endif /* __VMCI_TRANSPORT_NOTIFY_H__ */