xref: /spdk/lib/nvmf/nvmf_internal.h (revision b58a5d73ef70b9458ef589f5858c2a72c1f8e47c)
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright (c) Intel Corporation.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Intel Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef __NVMF_INTERNAL_H__
35 #define __NVMF_INTERNAL_H__
36 
37 #include <stdbool.h>
38 #include <stdlib.h>
39 #include <string.h>
40 #include <stdio.h>
41 
42 #include "spdk/nvmf_spec.h"
43 #include "spdk/assert.h"
44 #include "spdk/queue.h"
45 #include "spdk/util.h"
46 
47 #define SPDK_NVMF_DEFAULT_NUM_SESSIONS_PER_LCORE 1
48 
49 struct spdk_nvmf_tgt {
50 	uint16_t				max_queue_depth;
51 	uint16_t				max_queues_per_session;
52 	uint32_t				in_capsule_data_size;
53 	uint32_t				max_io_size;
54 	uint64_t				discovery_genctr;
55 	TAILQ_HEAD(, spdk_nvmf_subsystem)	subsystems;
56 	struct spdk_nvmf_discovery_log_page	*discovery_log_page;
57 	size_t					discovery_log_page_size;
58 };
59 
60 extern struct spdk_nvmf_tgt g_nvmf_tgt;
61 
62 struct spdk_nvmf_listen_addr *spdk_nvmf_listen_addr_create(const char *trname, const char *traddr,
63 		const char *trsvcid);
64 void spdk_nvmf_listen_addr_destroy(struct spdk_nvmf_listen_addr *addr);
65 void spdk_nvmf_listen_addr_cleanup(struct spdk_nvmf_listen_addr *addr);
66 
67 #define OBJECT_NVMF_IO				0x30
68 
69 #define TRACE_GROUP_NVMF			0x3
70 #define TRACE_NVMF_IO_START			SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x0)
71 #define TRACE_RDMA_READ_START			SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x1)
72 #define TRACE_RDMA_WRITE_START			SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x2)
73 #define TRACE_RDMA_READ_COMPLETE      		SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x3)
74 #define TRACE_RDMA_WRITE_COMPLETE		SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x4)
75 #define TRACE_NVMF_LIB_READ_START		SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x5)
76 #define TRACE_NVMF_LIB_WRITE_START		SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x6)
77 #define TRACE_NVMF_LIB_COMPLETE			SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x7)
78 #define TRACE_NVMF_IO_COMPLETE			SPDK_TPOINT_ID(TRACE_GROUP_NVMF, 0x8)
79 
80 #endif /* __NVMF_INTERNAL_H__ */
81