TAS
TCP Acceleration as an OS Service
internal.h
1 /*
2  * Copyright 2019 University of Washington, Max Planck Institute for
3  * Software Systems, and The University of Texas at Austin
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 #ifndef INTERNAL_H_
26 #define INTERNAL_H_
27 
28 #include <tas_ll.h>
29 #include <tas_memif.h>
30 #include <utils_circ.h>
31 
32 #define OPAQUE_PTR(x) ((void *) (uintptr_t) (x))
33 #define OPAQUE(x) ((uintptr_t) (x))
34 
35 /* ctx->flags of internal state: */
37 #define CTX_FLAG_POLL_CALLED 1
38 
39 #define CTX_FLAG_POLL_EVENTS 2
40 
42 #define CTX_FLAG_WANTWAIT 4
43 
44 #define CTX_FLAG_LASTWAIT 8
45 
46 #define CONN_FLAG_TXEOS 1
47 #define CONN_FLAG_TXEOS_ALLOC 2
48 #define CONN_FLAG_TXEOS_ACK 4
49 #define CONN_FLAG_RXEOS 8
50 
51 enum conn_state {
53  CONN_OPEN_REQUESTED,
54  CONN_ACCEPT_REQUESTED,
55  CONN_OPEN,
56  CONN_CLOSE_REQUESTED,
57 };
58 
59 extern void *flexnic_mem;
60 extern struct flexnic_info *flexnic_info;
61 extern int flexnic_evfd[FLEXTCP_MAX_FTCPCORES];
62 
63 int flextcp_kernel_connect(void);
64 int flextcp_kernel_newctx(struct flextcp_context *ctx);
65 void flextcp_kernel_kick(void);
66 
67 int flextcp_context_tx_alloc(struct flextcp_context *ctx,
68  struct flextcp_pl_atx **atx, uint16_t core);
69 void flextcp_context_tx_done(struct flextcp_context *ctx, uint16_t core);
70 
71 uint32_t flextcp_conn_txbuf_available(struct flextcp_connection *conn);
72 int flextcp_conn_pushtxeos(struct flextcp_context *ctx,
73  struct flextcp_connection *conn);
74 
75 #endif /* ndef INTERNAL_H_ */
Public low-level application interface for TAS.