NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
defines.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #ifndef DOCA_GPU_PACKET_PROCESSING_DEF_H
27 #define DOCA_GPU_PACKET_PROCESSING_DEF_H
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <errno.h>
32 #include <fcntl.h>
33 #include <stdbool.h>
34 #include <stdint.h>
35 #include <string.h>
36 #include <sys/time.h>
37 #include <time.h>
38 #include <utils.h>
39 #include <signal.h>
40 
41 #include <cuda.h>
42 #include <cuda_runtime.h>
43 
44 #include <doca_version.h>
45 #include <doca_log.h>
46 #include <doca_error.h>
47 #include <doca_gpunetio.h>
48 #include <doca_dev.h>
49 #include <doca_eth_rxq.h>
50 #include <doca_eth_txq.h>
51 #include <doca_mmap.h>
52 #include <doca_argp.h>
53 #include <doca_dpdk.h>
54 #include <doca_flow.h>
55 #include <doca_pe.h>
56 
57 /* GPU page size */
58 #define GPU_PAGE_SIZE (1UL << 16)
59 #define WARP_SIZE 32
60 #define WARP_FULL_MASK 0xFFFFFFFF
61 #define MAX_PORT_STR_LEN 128 /* Maximal length of port name */
62 #define MAX_QUEUES 4
63 #define MAX_QUEUES_ICMP 1
64 #define MAX_PKT_NUM 65536
65 #define MAX_PKT_SIZE 8192
66 #define MAX_RX_NUM_PKTS 4096
67 #define MAX_RX_TIMEOUT_NS 1000000 /* 1ms */
68 #define MAX_PKT_NUM_ICMP 16384
69 #define MAX_PKT_SIZE_ICMP 512
70 #define MAX_RX_NUM_PKTS_ICMP 64
71 #define MAX_RX_TIMEOUT_NS_ICMP 50000 /* 50us */
72 #define MAX_RX_NUM_PKTS_HTTP 64
73 #define MAX_RX_TIMEOUT_NS_HTTP 50000 /* 50us */
74 #define MAX_SQ_DESCR_NUM 4096
75 #define SEMAPHORES_PER_QUEUE 1024
76 #define CUDA_THREADS 512
77 #define ETHER_ADDR_LEN 6
78 #define BYTE_SWAP16(v) ((((uint16_t)(v)&UINT16_C(0x00ff)) << 8) | (((uint16_t)(v)&UINT16_C(0xff00)) >> 8))
79 
80 #define BYTE_SWAP32(x) \
81  ((((x)&0xff000000) >> 24) | (((x)&0x00ff0000) >> 8) | (((x)&0x0000ff00) << 8) | (((x)&0x000000ff) << 24))
82 
83 /* Each thread in the HTTP server CUDA kernel warp has it's own subset of 32 buffers */
84 #define TX_BUF_NUM 1024 /* 32 x 32 */
85 #define TX_BUF_MAX_SZ 512
86 #define FLOW_NB_COUNTERS 524228 /* 1024 x 512 */
87 /* DPDK port to accept new TCP connections */
88 #define DPDK_DEFAULT_PORT 0
89 /* HTTP page type to send as response to HTTP GET request */
91  HTTP_GET_INDEX = 0, /* HTML index page */
92  HTTP_GET_CONTACTS, /* HTML contact page */
93  HTTP_GET_NOT_FOUND /* HTML not found page */
94 };
95 
96 #endif /* DOCA_GPU_PACKET_PROCESSING_DEF_H */
http_page_get
Definition: defines.h:90
@ HTTP_GET_INDEX
Definition: defines.h:91
@ HTTP_GET_NOT_FOUND
Definition: defines.h:93
@ HTTP_GET_CONTACTS
Definition: defines.h:92