TAS
TCP Acceleration as an OS Service
appif.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 APPIF_H_
26 #define APPIF_H_
27 
28 #include <stdbool.h>
29 #include <stdint.h>
30 
31 #include "internal.h"
32 #include <kernel_appif.h>
33 
34 struct app_doorbell {
35  uint32_t id;
36  /* only for freelist */
37  struct app_doorbell *next;
38 };
39 
40 struct app_context {
41  struct application *app;
42  struct packetmem_handle *kin_handle;
43  void *kin_base;
44  uint32_t kin_len;
45  uint32_t kin_pos;
46 
47  struct packetmem_handle *kout_handle;
48  void *kout_base;
49  uint32_t kout_len;
50  uint32_t kout_pos;
51 
52  struct app_doorbell *doorbell;
53 
54  int ready, evfd;
55  uint64_t last_ts;
56  struct app_context *next;
57 
58  struct {
59  struct packetmem_handle *rxq;
60  struct packetmem_handle *txq;
61  } handles[];
62 };
63 
64 struct application {
65  int fd;
66  struct nbqueue_el nqe;
67  size_t req_rx;
68  struct kernel_uxsock_request req;
69  size_t resp_sz;
70  struct kernel_uxsock_response *resp;
71 
72  struct app_context *contexts;
73  struct application *next;
74  struct app_context *need_reg_ctx;
75  struct app_context *need_reg_ctx_done;
76 
77  struct connection *conns;
78  struct listener *listeners;
79 
80  struct nicif_completion comp;
81 
82  uint16_t id;
83  volatile bool closed;
84 };
85 
92 unsigned appif_ctx_poll(struct application *app, struct app_context *ctx);
93 
94 #endif /* ndef APPIF_H_ */
unsigned appif_ctx_poll(struct application *app, struct app_context *ctx)
Definition: appif_ctx.c:222