2 * Copyright (c) 2009-2012,2016 Microsoft Corp.
3 * Copyright (c) 2012 NetApp Inc.
4 * Copyright (c) 2012 Citrix Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice unmodified, this list of conditions, and the following
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #ifndef _VMBUS_BRVAR_H_
32 #define _VMBUS_BRVAR_H_
34 #include <sys/param.h>
36 #include <sys/mutex.h>
37 #include <sys/_iovec.h>
40 struct vmbus_bufring *vbr;
41 uint32_t vbr_dsize; /* total data size */
44 #define vbr_windex vbr->br_windex
45 #define vbr_rindex vbr->br_rindex
46 #define vbr_imask vbr->br_imask
47 #define vbr_data vbr->br_data
54 #define rxbr_windex rxbr.vbr_windex
55 #define rxbr_rindex rxbr.vbr_rindex
56 #define rxbr_imask rxbr.vbr_imask
57 #define rxbr_data rxbr.vbr_data
58 #define rxbr_dsize rxbr.vbr_dsize
65 #define txbr_windex txbr.vbr_windex
66 #define txbr_rindex txbr.vbr_rindex
67 #define txbr_imask txbr.vbr_imask
68 #define txbr_data txbr.vbr_data
69 #define txbr_dsize txbr.vbr_dsize
71 struct sysctl_ctx_list;
74 void vmbus_br_sysctl_create(struct sysctl_ctx_list *ctx,
75 struct sysctl_oid *br_tree, struct vmbus_br *br,
78 void vmbus_rxbr_init(struct vmbus_rxbr *rbr);
79 void vmbus_rxbr_deinit(struct vmbus_rxbr *rbr);
80 void vmbus_rxbr_setup(struct vmbus_rxbr *rbr, void *buf, int blen);
81 int vmbus_rxbr_peek(struct vmbus_rxbr *rbr, void *data, int dlen);
82 int vmbus_rxbr_read(struct vmbus_rxbr *rbr, void *data, int dlen,
84 void vmbus_rxbr_intr_mask(struct vmbus_rxbr *rbr);
85 uint32_t vmbus_rxbr_intr_unmask(struct vmbus_rxbr *rbr);
87 void vmbus_txbr_init(struct vmbus_txbr *tbr);
88 void vmbus_txbr_deinit(struct vmbus_txbr *tbr);
89 void vmbus_txbr_setup(struct vmbus_txbr *tbr, void *buf, int blen);
90 int vmbus_txbr_write(struct vmbus_txbr *tbr,
91 const struct iovec iov[], int iovlen, boolean_t *need_sig);
93 #endif /* _VMBUS_BRVAR_H_ */