Commit 725f9de3 authored by Jim Harris's avatar Jim Harris
Browse files

env_dpdk: add spdk_env_dpdk_external_init()



This function indicates whether DPDK was initialized
external to the SPDK env_dpdk library.

This can be used in cases where we need to implement
different behavior when DPDK is initialized outside
of SPDK - in that case certain flags that SPDK would
prefer may not have been specified.  This will
be used in the next patch.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I58d285bd4d9cda96b108624d65dedbec32164cfe

Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446458


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent d631b855
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,14 @@ extern "C" {
 */
int spdk_env_dpdk_post_init(void);

/**
 * Check if DPDK was initialized external to the SPDK env_dpdk library.
 *
 * \return true if DPDK was initialized external to the SPDK env_dpdk library.
 * \return false otherwise
 */
bool spdk_env_dpdk_external_init(void);

#ifdef __cplusplus
}
#endif
+9 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@

static char **g_eal_cmdline;
static int g_eal_cmdline_argcount;
static bool g_external_init = true;

static char *
_sprintf_alloc(const char *format, ...)
@@ -395,6 +396,8 @@ spdk_env_init(const struct spdk_env_opts *opts)
	int i, rc;
	int orig_optind;

	g_external_init = false;

	rc = spdk_build_eal_cmdline(opts);
	if (rc < 0) {
		fprintf(stderr, "Invalid arguments to initialize DPDK\n");
@@ -445,3 +448,9 @@ spdk_env_init(const struct spdk_env_opts *opts)

	return spdk_env_dpdk_post_init();
}

bool
spdk_env_dpdk_external_init(void)
{
	return g_external_init;
}