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 <stddef.h>
29 #include <stdint.h>
30 
31 #include <rte_config.h>
32 #include <rte_ether.h>
33 
34 #define BUFFER_SIZE 2048
35 
36 //#define FLEXNIC_TRACING
37 #ifdef FLEXNIC_TRACING
38 # include <tas_trace.h>
39 # define FLEXNIC_TRACE_RX
40 # define FLEXNIC_TRACE_TX
41 # define FLEXNIC_TRACE_DMA
42 # define FLEXNIC_TRACE_QMAN
43 # define FLEXNIC_TRACE_LEN (1024 * 1024 * 32)
44  int trace_thread_init(uint16_t id);
45  int trace_event(uint16_t type, uint16_t length, const void *buf);
46  int trace_event2(uint16_t type, uint16_t len_1, const void *buf_1,
47  uint16_t len_2, const void *buf_2);
48 #endif
49 //#define DATAPLANE_STATS
50 
51 extern int exited;
52 extern unsigned fp_cores_max;
53 extern volatile unsigned fp_cores_cur;
54 extern volatile unsigned fp_scale_to;
55 
56 
57 #include "dma.h"
58 #include "network.h"
59 
60 #define QMAN_SET_RATE (1 << 0)
61 #define QMAN_SET_MAXCHUNK (1 << 1)
62 #define QMAN_SET_AVAIL (1 << 3)
63 #define QMAN_ADD_AVAIL (1 << 4)
64 
65 int qman_thread_init(struct dataplane_context *ctx);
66 uint32_t qman_timestamp(uint64_t tsc);
67 int qman_poll(struct qman_thread *t, unsigned num, unsigned *q_ids,
68  uint16_t *q_bytes);
69 int qman_set(struct qman_thread *t, uint32_t id, uint32_t rate, uint32_t avail,
70  uint16_t max_chunk, uint8_t flags);
71 uint32_t qman_next_ts(struct qman_thread *t, uint32_t cur_ts);
72 
73 void *util_create_shmsiszed(const char *name, size_t size, void *addr);
74 
75 #endif /* ndef INTERNAL_H_ */