NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
nvme_emulation.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 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 #include "spdk/stdinc.h"
27 
28 #include "spdk/env.h"
29 #include "spdk/event.h"
30 
31 #include <doca_log.h>
32 
38 static void nvmf_tgt_started(void *cookie)
39 {
40  (void)cookie;
41 }
42 
43 /*
44  * NVMe emulation application main function
45  *
46  * @argc [in]: command line arguments size
47  * @argv [in]: array of command line arguments
48  * @return: EXIT_SUCCESS on success and EXIT_FAILURE otherwise
49  */
50 int main(int argc, char **argv)
51 {
52  struct doca_log_backend *sdk_log;
53  struct spdk_app_opts opts = {};
54  int rc;
56 
57  /* Register a logger backend */
59  if (result != DOCA_SUCCESS)
60  return EXIT_FAILURE;
61 
63  if (result != DOCA_SUCCESS)
64  return EXIT_FAILURE;
65 
66  /* Register a logger backend for internal SDK errors and warnings */
68  if (result != DOCA_SUCCESS)
69  return EXIT_FAILURE;
71  if (result != DOCA_SUCCESS)
72  return EXIT_FAILURE;
73 
74  /* default value in opts */
75  spdk_app_opts_init(&opts, sizeof(opts));
76  opts.name = "nvmf";
77  if ((rc = spdk_app_parse_args(argc, argv, &opts, "", NULL, NULL, NULL)) != SPDK_APP_PARSE_ARGS_SUCCESS) {
78  exit(rc);
79  }
80 
81  /* Blocks until the application is exiting */
82  rc = spdk_app_start(&opts, nvmf_tgt_started, NULL);
83  spdk_app_fini();
84 
85  if (rc != 0)
86  return EXIT_FAILURE;
87 
88  return EXIT_SUCCESS;
89 }
#define NULL
Definition: __stddef_null.h:26
int32_t result
uint64_t cookie
enum doca_error doca_error_t
DOCA API return codes.
@ DOCA_SUCCESS
Definition: doca_error.h:38
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_standard(void)
Create default, non configurable backend for application messages.
DOCA_EXPERIMENTAL doca_error_t doca_log_level_set_global_sdk_limit(uint32_t level)
Set the log level of ALL logging backends for SDK messages.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_create_with_file_sdk(FILE *fptr, struct doca_log_backend **backend)
Create a logging backend with a FILE* stream for SDK messages.
DOCA_EXPERIMENTAL doca_error_t doca_log_backend_set_sdk_level(struct doca_log_backend *backend, uint32_t level)
Set the log level limit for SDK logging backends.
@ DOCA_LOG_LEVEL_ERROR
Definition: doca_log.h:46
int main(int argc, char **argv)
static void nvmf_tgt_started(void *cookie)