libxcoder 5.8.0
Loading...
Searching...
No Matches
ni_rsrc_namespace.c
Go to the documentation of this file.
1/*******************************************************************************
2 *
3 * Copyright (C) 2022 NETINT Technologies
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18 * SOFTWARE.
19 *
20 ******************************************************************************/
21
22/*!*****************************************************************************
23 * \file ni_rsrc_namespace.c
24 *
25 * \brief This utility aims to set the NVMe namespace number for a Quadra NVMe
26 * block device. It can operate on physical devices (PCIe physical
27 * function) or virtual devices (PCIe virtual function). Before setting
28 * namespace number, use SR-IOV to create the PCIe virtual function.
29 * Note that only block device name is accepted for this utility.
30 *
31 * To effect the name space change, reload the NVMe driver:
32 * sudo modprobe -r nvme
33 * sudo modprobe nvme
34 * sudo nvme list #check the result with nvme list
35 ******************************************************************************/
36
37#include "ni_device_api.h"
38#include "ni_nvme.h"
39#include "ni_util.h"
40#ifdef _WIN32
41#include "ni_getopt.h"
42#else
43#include <sys/stat.h>
44#include <unistd.h>
45#include <string.h>
46#include <getopt.h>
47#endif
48
49#define NI_NAMESPACE_SZ 32
50
51typedef struct {
53 float allowance;
55
56static void usage(void)
57{
58 printf("usage: ni_rsrc_namespace [OPTION]\n"
59 "Provides NETINT QUADRA NVMe block device namespace IO operations.\n"
60 " -v show version.\n"
61 " -d the nvme block namespace. Only PF with nsid 1 allowed\n"
62 " -D the nvme block namespace for target over provision setting\n"
63 " -n the nvme block namespace count.\n"
64 " Default: 0\n"
65 " -p overprovision percent. Use exclusive of -n and -s and -q\n"
66 " -q namespace QoS setting. Use exclusive of -n and -s and -p\n"
67 " Default: 0 disabled.\n"
68 " 1 enable qos\n"
69 " 2 enable qos with overprovision\n"
70 " -a <allowance> Set allowance for specific namespace (0.0-100.0) Requires -D <target_ns_device>\n"
71 " -s Index of virtual PCIe functions in SR-IOV tied to the \n"
72 " physical PCIe function. '0' to select physical PCIe \n"
73 " function.\n"
74 " Eg. '1' to select the first virtual SR-IOV device tied \n"
75 " to the physical block device defined by '-d' option.\n"
76 " Default: 0\n"
77 " -c Persist the configuration of the namespace\n"
78 " -h help info.\n");
79}
80
81int send_config_ns_command(char* dev, int ns, int sr)
82{
83 ni_device_handle_t handle = ni_device_open2(dev, NI_DEVICE_READ_WRITE);
84 ni_retcode_t retval;
85 char errmsg[NI_ERRNO_LEN] = {0};
86 if (handle == NI_INVALID_DEVICE_HANDLE)
87 {
89 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", dev,
90 errmsg);
91 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
92 } else
93 {
94 printf("Succeed to open block namespace %s\n", dev);
95 }
96
97 retval = ni_device_config_namespace_num(handle, ns, sr);
98 if (retval != NI_RETCODE_SUCCESS)
99 {
101 (void)fprintf(stderr, "ERROR: Config setting failure for %s\n",
102 errmsg);
103 }
104 ni_device_close(handle);
105 return retval;
106}
107
108int send_config_qos_mode(char *dev, int value)
109{
110 ni_device_handle_t handle = ni_device_open2(dev, NI_DEVICE_READ_WRITE);
111 ni_retcode_t retval;
112 char errmsg[NI_ERRNO_LEN] = {0};
113 if (handle == NI_INVALID_DEVICE_HANDLE)
114 {
116 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", dev,
117 errmsg);
118 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
119 } else
120 {
121 printf("Succeed to open block namespace %s\n", dev);
122 }
123
124 retval = ni_device_config_qos(handle, value);
125 if (retval != NI_RETCODE_SUCCESS)
126 {
128 (void)fprintf(stderr, "ERROR: Config setting failure for %s\n",
129 errmsg);
130 }
131 ni_device_close(handle);
132 return retval;
133}
134
135int send_config_qos_op(char *dev, char *devt, int op)
136{
137 ni_retcode_t retval;
138 ni_device_handle_t handle = ni_device_open2(dev, NI_DEVICE_READ_WRITE);
139 char errmsg[NI_ERRNO_LEN] = {0};
140 if (handle == NI_INVALID_DEVICE_HANDLE)
141 {
143 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", dev,
144 errmsg);
145 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
146 } else
147 {
148 printf("Succeed to open block namespace %s\n", dev);
149 }
150 ni_device_handle_t handle_t = ni_device_open2(devt, NI_DEVICE_READ_WRITE);
151 if (handle_t == NI_INVALID_DEVICE_HANDLE)
152 {
154 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", devt,
155 errmsg);
156 ni_device_close(handle);
157 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
158 } else
159 {
160 printf("Succeed to open block namespace %s\n", devt);
161 }
162
163 retval = ni_device_config_qos_op(handle, handle_t, op);
164 if (retval != NI_RETCODE_SUCCESS)
165 {
167 (void)fprintf(stderr, "ERROR: Config setting failure for %s\n",
168 errmsg);
169 }
170 ni_device_close(handle);
171 ni_device_close(handle_t);
172 return retval;
173}
174int send_config_qos_allowance(char *dev, char *devt, int allowance)
175{
176 ni_retcode_t retval;
177 ni_device_handle_t handle = ni_device_open2(dev, NI_DEVICE_READ_WRITE);
178 char errmsg[NI_ERRNO_LEN] = {0};
179 if (handle == NI_INVALID_DEVICE_HANDLE)
180 {
182 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", dev,
183 errmsg);
184 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
185 } else
186 {
187 printf("Succeed to open block namespace %s\n", dev);
188 }
189 ni_device_handle_t handle_t = ni_device_open2(devt, NI_DEVICE_READ_WRITE);
190 if (handle_t == NI_INVALID_DEVICE_HANDLE)
191 {
193 (void)fprintf(stderr, "ERROR: open %s failure for %s\n", devt,
194 errmsg);
195 ni_device_close(handle);
196 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
197 } else
198 {
199 printf("Succeed to open block namespace %s\n", devt);
200 }
201
202 retval = ni_device_config_qos_allowance(handle, handle_t, allowance);
203 if (retval != NI_RETCODE_SUCCESS)
204 {
206 (void)fprintf(stderr, "ERROR: Config setting failure for %s\n",
207 errmsg);
208 }
209 ni_device_close(handle);
210 ni_device_close(handle_t);
211 return retval;
212}
213
214static int get_ns_id_from_path(const char *path)
215{
216 const char *n_pos = strrchr(path, 'n');
217 if (!n_pos || n_pos[1] == '\0')
218 return -1;
219 int32_t id;
220 if (ni_strtoi(n_pos + 1, &id) != NI_RETCODE_SUCCESS)
221 {
222 ni_log(NI_LOG_ERROR, "ERROR: %s(): invalid value '%s'\n",
223 __func__, n_pos + 1);
224 return -1;
225 }
226 return (id >= 1 && id <= NI_NAMESPACE_MAX_NUM) ? id : -1;
227}
228
229int main(int argc, char *argv[])
230{
231 ni_retcode_t retval;
232 int opt;
233 char device_namespace[NI_NAMESPACE_SZ] = {'\0'};
234 char device_namespace_OP[NI_NAMESPACE_SZ] = {'\0'};
235 int namespace_num = 1;
236 float over_provision_percent = -1;
237 int i32_over_provision_percent = 0;
238 int sriov_index = 0;
239 int qos_mode = -1;
240 int persistence = 0;
241#ifdef __linux__
242 struct stat sb;
243#endif
244 namespace_allowance_t allowances = {0};
245 int allowance_count = 0;
246 float pending_allowance = -1.0f;
247 int i32_allowance = 0;
248 float allowance = 0;
249 int ns_id;
250 int current_qos_mode = -1;
251 bool has_zero_allowance = false;
252 int32_t tmp_val;
253 float total_all_namespaces = 0.0f;
254 ni_qos_header_info_log_page_t qos_header = {0};
255
256 while ((opt = getopt(argc, argv, "d:D:n:p:q:s:a:chv")) != EOF) // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
257 {
258 switch (opt)
259 {
260 case 'h':
261 usage();
262 exit(0); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
263 case 'v':
264 printf("Release ver: %s\n"
265 "API ver: %s\n"
266 "Date: %s\n"
267 "ID: %s\n",
270 exit(0); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
271 case 'd':
272 ni_strcpy(device_namespace, NI_NAMESPACE_SZ, optarg);
273#ifdef __linux__
274 if (lstat(device_namespace, &sb) != 0 ||
275 (sb.st_mode & S_IFMT) != S_IFBLK)
276 {
277 (void)fprintf(stderr, "ERROR: Only block device is supported! "
278 "%s is not block device!\n", device_namespace);
279 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
280 }
281#endif
282 break;
283 case 'D':
284 ni_strcpy(device_namespace_OP, NI_NAMESPACE_SZ, optarg);
285 if (pending_allowance >= 0.0f)
286 {
287 ns_id = get_ns_id_from_path(device_namespace_OP);
288 if (ns_id < 1)
289 {
290 (void)fprintf(stderr, "ERROR: Cannot get namespace ID from -D path %s\n", device_namespace_OP);
291 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
292 }
293 allowances.namespace_id = ns_id;
294 allowances.allowance = pending_allowance;
295 allowance_count = 1;
296 pending_allowance = -1.0f;
297 }
298 break;
299 case 'n':
300 // A maximum of 64 namespaces are supported for firmware
301 if (ni_strtoi(optarg, &tmp_val) != NI_RETCODE_SUCCESS)
302 {
304 "ERROR: %s(): invalid value '%s' for -n\n",
305 __func__, optarg);
306 return -1;
307 }
308 namespace_num = (int)tmp_val;
309 if (namespace_num < 0 || namespace_num > NI_NAMESPACE_MAX_NUM)
310 {
311 (void)fprintf(stderr, "ERROR: The number of namespace cannot "
312 "exceed %d\n", NI_NAMESPACE_MAX_NUM);
313 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
314 }
315 break;
316 case 'p':
317 {
318 // set overprovision %
319 double tmp_overprov;
320 if (ni_strtod_val(optarg, &tmp_overprov) != NI_RETCODE_SUCCESS)
321 {
322 ni_log(NI_LOG_ERROR, "%s: invalid overprovision value '%s'\n",
323 __func__, optarg);
324 return -1;
325 }
326 over_provision_percent = (float)tmp_overprov;
327 if (over_provision_percent > 100 || over_provision_percent < 0)
328 {
329 (void)fprintf(stderr, "ERROR: Overprovision percent cannot "
330 "exceed 100%% or become negative\n");
331 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
332 }
333 break;
334 }
335 case 'q':
336 // 0 disabled, 1 enabled - no idle sharing
337 if (ni_strtoi(optarg, &tmp_val) != NI_RETCODE_SUCCESS)
338 {
340 "ERROR: %s(): invalid value '%s' for -q\n",
341 __func__, optarg);
342 return -1;
343 }
344 qos_mode = (int)tmp_val;
345 if (qos_mode < QOS_MODE_DISABLED ||
346 qos_mode > QOS_MODE_ENABLED_SHARE)
347 {
348 (void)fprintf(stderr,
349 "ERROR: QoS mode %d not supported\n",
350 qos_mode);
351 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
352 }
353 break;
354 case 's':
355 if (ni_strtoi(optarg, &tmp_val) != NI_RETCODE_SUCCESS)
356 {
358 "ERROR: %s(): invalid value '%s' for -s\n",
359 __func__, optarg);
360 return -1;
361 }
362 sriov_index = (int)tmp_val;
363 if (sriov_index < 0)
364 {
365 (void)fprintf(stderr, "ERROR: Invalid SR-IOV device index: %d\n",
366 sriov_index);
367 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
368 }
369 break;
370 case 'c':
371 persistence = 1;
372 break;
373 case 'a':
374 {
375 double tmp_allowance;
376 if (ni_strtod_val(optarg, &tmp_allowance) != NI_RETCODE_SUCCESS)
377 {
378 ni_log(NI_LOG_ERROR, "%s: invalid allowance value '%s'\n",
379 __func__, optarg);
380 return -1;
381 }
382 allowance = (float)tmp_allowance;
383 if (allowance < 0.0f || allowance > 100.0f)
384 {
385 (void)fprintf(stderr, "ERROR: Allowance %.2f out of range [0-100]\n", allowance);
386 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
387 }
388 if (device_namespace_OP[0] != '\0')
389 {
390 ns_id = get_ns_id_from_path(device_namespace_OP);
391 if (ns_id < 1)
392 {
393 (void)fprintf(stderr, "ERROR: Cannot get namespace ID from -D path %s\n", device_namespace_OP);
394 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
395 }
396 allowances.namespace_id = ns_id;
397 allowances.allowance = allowance;
398 allowance_count = 1;
399 }
400 else
401 pending_allowance = allowance;
402 break;
403 }
404 default:
405 (void)fprintf(stderr, "ERROR: Invalid option: %c\n", opt);
406 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
407 }
408 }
409
410 if (pending_allowance >= 0.0f)
411 {
412 (void)fprintf(stderr, "ERROR: -a requires -D (e.g. -d /dev/nvme0n1 -a 80 -D /dev/nvme0n2)\n");
413 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
414 }
415
416 if (allowance_count > 0)
417 {
418 if (allowances.allowance == 0.0f)
419 has_zero_allowance = true;
420
421 ni_device_handle_t ns_handle = ni_device_open2(device_namespace_OP, NI_DEVICE_READ_ONLY);
422 if (ns_handle == NI_INVALID_DEVICE_HANDLE)
423 {
424 (void)fprintf(stderr, "ERROR: Failed to open device %s\n", device_namespace_OP);
425 return NI_RETCODE_FAILURE;
426 }
427
428 ni_device_capability_t device_capability = {0};
429 if (ni_device_capability_query2(ns_handle, &device_capability, false) != NI_RETCODE_SUCCESS)
430 {
431 ni_device_close(ns_handle);
432 (void)fprintf(stderr, "ERROR: Failed to query device capability for %s\n", device_namespace_OP);
433 return NI_RETCODE_FAILURE;
434 }
435
436 if (ni_query_qos_info(ns_handle, &qos_header, device_capability.fw_rev) != NI_RETCODE_SUCCESS)
437 {
438 ni_device_close(ns_handle);
439 (void)fprintf(stderr, "ERROR: Failed to query QoS info for %s\n", device_namespace_OP);
440 return NI_RETCODE_FAILURE;
441 }
442
443 if (has_zero_allowance)
444 {
445 current_qos_mode = (uint8_t)(qos_header.ui16QosState & 0xFF);
446 if (current_qos_mode != QOS_MODE_ENABLED_SHARE)
447 {
448 ni_device_close(ns_handle);
449 (void)fprintf(stderr, "ERROR: 0%% allowance only allowed with QoS mode 2 (current mode: %d)\n",
450 current_qos_mode);
451 return NI_RETCODE_FAILURE;
452 }
453 }
454
455 total_all_namespaces = qos_header.fTotalAllowance;
456
457 ni_qos_namespace_info_log_page_t qos_ns_info = {0};
458 if (ni_query_qos_namespace_info(ns_handle, &qos_ns_info, device_capability.fw_rev) != NI_RETCODE_SUCCESS)
459 {
460 ni_device_close(ns_handle);
461 (void)fprintf(stderr, "ERROR: Failed to query QoS namespace info for %s\n", device_namespace_OP);
462 return NI_RETCODE_FAILURE;
463 }
464 ni_device_close(ns_handle);
465
466 total_all_namespaces = total_all_namespaces - qos_ns_info.fAllowance + allowances.allowance;
467
468 if (total_all_namespaces > 100.0f)
469 {
470 (void)fprintf(stderr, "ERROR: Total allowance will be %.2f%% (exceeds 100%%)\n", total_all_namespaces);
471 return NI_RETCODE_FAILURE;
472 }
473 if (total_all_namespaces < 100.0f)
474 (void)fprintf(stderr, "INFO: Total allowance will be %.2f%% (under 100%%)\n", total_all_namespaces);
475
476 memcpy(&i32_allowance, &allowances.allowance, sizeof(int32_t));
477 retval = send_config_qos_allowance(device_namespace, device_namespace_OP, i32_allowance);
478 if (retval != NI_RETCODE_SUCCESS)
479 {
480 (void)fprintf(stderr, "ERROR: Failed to set allowance for namespace %d\n", allowances.namespace_id);
481 return NI_RETCODE_FAILURE;
482 }
483 printf("Set namespace %d allowance to %.2f%%\n",
484 allowances.namespace_id, allowances.allowance);
485 printf("Total allowance across all namespaces: %.2f%%\n", total_all_namespaces);
486 return NI_RETCODE_SUCCESS;
487 }
488
489 if (device_namespace[0] == '\0')
490 {
491 (void)fprintf(stderr, "ERROR: missing argument for -d\n");
492 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
493 }
494 if (strlen(device_namespace) < 3 ||
495 strcmp(device_namespace + strlen(device_namespace) - 2, "n1") != 0)
496 {
497 (void)fprintf(stderr, "ERROR: Invalid device name %s, need n1, no vf\n", device_namespace);
498 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
499 }
500
501 if (qos_mode != -1)
502 {
503 if (namespace_num != 1 || sriov_index || over_provision_percent != -1)
504 {
505 (void)fprintf(stderr,
506 "ERROR: QoS mode -q mutually exclusive of namespace and "
507 "SR-IOV\n");
508 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
509 }
510 retval = send_config_qos_mode(device_namespace, qos_mode);
511 if (retval == NI_RETCODE_SUCCESS)
512 {
513 printf("QoS mode setting succeed with number of %d\n", qos_mode);
514 }
515 return retval;
516 }
517
518 if (over_provision_percent != -1)
519 {
520 if (device_namespace_OP[0] == '\0')
521 {
522 (void)fprintf(stderr, "ERROR: missing argument for -D\n");
523 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
524 }
525 if (namespace_num != 1 || sriov_index || qos_mode != -1)
526 {
527 (void)fprintf(stderr,
528 "ERROR: Overprovision percent -p mutually exclusive of "
529 "namespace and SR-IOV and QOS mode\n");
530 exit(-1); // NOLINT(concurrency-mt-unsafe) - single-threaded CLI tool
531 }
532 memcpy(&i32_over_provision_percent, &over_provision_percent, sizeof(int32_t));
533 retval = send_config_qos_op(device_namespace, device_namespace_OP,
534 i32_over_provision_percent);
535 if (retval == NI_RETCODE_SUCCESS)
536 {
537 printf("Overprovision percent setting succeed with number of %f\n",
538 over_provision_percent);
539 }
540 return retval;
541 }
542
543 if (persistence) namespace_num += 256;
544 retval = send_config_ns_command(device_namespace, namespace_num, sriov_index);
545 if (retval == NI_RETCODE_SUCCESS)
546 {
547 printf("Namespace setting succeed with number of %d and SR-IOV "
548 "index %d\n",
549 namespace_num, sriov_index);
550 }
551 return retval;
552}
int main()
Definition client.cpp:51
#define NI_XCODER_REVISION
Definition ni_defs.h:98
#define LIBXCODER_API_VERSION
Definition ni_defs.h:115
#define NI_ERRNO
Definition ni_defs.h:229
ni_retcode_t
Definition ni_defs.h:447
@ NI_RETCODE_FAILURE
Definition ni_defs.h:449
@ NI_RETCODE_SUCCESS
Definition ni_defs.h:448
ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t over_provision)
Send qos over provisioning mode to target namespace with specified logic block address.
ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t allowance)
Set QoS allowance for a specific namespace.
ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle, ni_device_capability_t *p_cap, bool device_in_ctxt)
Query device and return device capability structure This function had replaced ni_device_capability_q...
void ni_device_close(ni_device_handle_t device_handle)
Close device and release resources.
ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle, ni_qos_header_info_log_page_t *p_dev_qos_header, uint8_t fw_rev[])
Query QoS information for the device.
ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle, uint32_t namespace_num, uint32_t sriov_index)
Send namespace num and SRIOv index to the device with specified logic block address.
ni_device_handle_t ni_device_open2(const char *p_dev, ni_device_mode_t mode)
Open device and return device device_handle if successful.
ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle, ni_qos_namespace_info_log_page_t *p_dev_qos_ns, uint8_t fw_rev[])
Query QoS information for a specific namespace.
ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle, uint32_t mode)
Send qos mode to the device with specified logic block address.
Public definitions for operating NETINT video processing devices for video processing.
@ QOS_MODE_DISABLED
@ QOS_MODE_ENABLED_SHARE
@ NI_DEVICE_READ_ONLY
@ NI_DEVICE_READ_WRITE
#define NI_NAMESPACE_MAX_NUM
int getopt(int argc, char *argv[], const char *optstring)
Definition ni_getopt.c:38
char * optarg
Definition ni_getopt.c:33
Implementation of getopt() and getopt_long() for Windows environment.
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
Definition ni_log.c:183
#define NI_ERRNO_LEN
Definition ni_log.h:51
@ NI_LOG_ERROR
Definition ni_log.h:62
Private definitions for interfacing with NETINT video processing devices over NVMe.
#define NI_SW_RELEASE_ID
#define NI_SW_RELEASE_TIME
#define NI_NAMESPACE_SZ
int send_config_qos_allowance(char *dev, char *devt, int allowance)
int send_config_qos_op(char *dev, char *devt, int op)
int send_config_qos_mode(char *dev, int value)
int send_config_ns_command(char *dev, int ns, int sr)
ni_retcode_t ni_strtod_val(const char *str, double *out_val)
Safely convert a decimal string to a double with full validation. Trailing whitespace is tolerated.
Definition ni_util.c:2612
ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum)
Definition ni_util.c:663
ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src)
Definition ni_util.c:460
ni_retcode_t ni_strtoi(const char *str, int32_t *out_val)
Safely convert a decimal string to a 32-bit integer with full validation. Trailing whitespace is tole...
Definition ni_util.c:2577
Utility definitions.
device capability type