From: Thomas Monjalon Date: Tue, 23 Jun 2015 13:29:59 +0000 (+0200) Subject: doc: move env/arch guidelines in design section X-Git-Tag: spdx-start~8996 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=753836b7a246032ebf914f0db87711a99eacabfb;p=dpdk.git doc: move env/arch guidelines in design section Move EAL subdirs guidelines from coding style to design section. Signed-off-by: Thomas Monjalon --- diff --git a/doc/guides/guidelines/coding_style.rst b/doc/guides/guidelines/coding_style.rst index 27ea53c10d..c27fef4140 100644 --- a/doc/guides/guidelines/coding_style.rst +++ b/doc/guides/guidelines/coding_style.rst @@ -1,5 +1,5 @@ Coding Style -============= +============ Description ----------- @@ -684,58 +684,6 @@ Control Statements /* NOTREACHED */ } -Environment or Architecture-specific Sources --------------------------------------------- - -In DPDK and DPDK applications, some code is specific to an architecture (i686, x86_64) or to an executive environment (bsdapp or linuxapp) and so on. -As far as is possible, all such instances of architecture or env-specific code should be provided via standard APIs in the EAL. - -By convention, a file is common if it is not located in a directory indicating that it is specific. -For instance, a file located in a subdir of "x86_64" directory is specific to this architecture. -A file located in a subdir of "linuxapp" is specific to this execution environment. - -.. note:: - - Code in DPDK libraries and applications should be generic. - The correct location for architecture or executive environment specific code is in the EAL. - -When absolutely necessary, there are several ways to handle specific code: - -* Use a ``#ifdef`` with the CONFIG option in the C code. - This can be done when the differences are small and they can be embedded in the same C file: - -.. code-block: console - - #ifdef RTE_ARCH_I686 - toto(); - #else - titi(); - #endif - -* Use the CONFIG option in the Makefile. This is done when the differences are more significant. - In this case, the code is split into two separate files that are architecture or environment specific. This should only apply inside the EAL library. - -.. note: - - As in the linux kernel, the "CONFIG_" prefix is not used in C code. - This is only needed in Makefiles or shell scripts. - -Per Architecture Sources -~~~~~~~~~~~~~~~~~~~~~~~~ - -The following config options can be used: - -* CONFIG_RTE_ARCH is a string that contains the name of the architecture. -* CONFIG_RTE_ARCH_I686, CONFIG_RTE_ARCH_X86_64, CONFIG_RTE_ARCH_X86_64_32 or CONFIG_RTE_ARCH_PPC_64 are defined only if we are building for those architectures. - -Per Execution Environment Sources -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The following config options can be used: - -* CONFIG_RTE_EXEC_ENV is a string that contains the name of the executive environment. -* CONFIG_RTE_EXEC_ENV_BSDAPP or CONFIG_RTE_EXEC_ENV_LINUXAPP are defined only if we are building for this execution environment. - Doxygen Documentation --------------------- diff --git a/doc/guides/guidelines/design.rst b/doc/guides/guidelines/design.rst new file mode 100644 index 0000000000..b4ae1d1e59 --- /dev/null +++ b/doc/guides/guidelines/design.rst @@ -0,0 +1,54 @@ +Design +====== + +Environment or Architecture-specific Sources +-------------------------------------------- + +In DPDK and DPDK applications, some code is specific to an architecture (i686, x86_64) or to an executive environment (bsdapp or linuxapp) and so on. +As far as is possible, all such instances of architecture or env-specific code should be provided via standard APIs in the EAL. + +By convention, a file is common if it is not located in a directory indicating that it is specific. +For instance, a file located in a subdir of "x86_64" directory is specific to this architecture. +A file located in a subdir of "linuxapp" is specific to this execution environment. + +.. note:: + + Code in DPDK libraries and applications should be generic. + The correct location for architecture or executive environment specific code is in the EAL. + +When absolutely necessary, there are several ways to handle specific code: + +* Use a ``#ifdef`` with the CONFIG option in the C code. + This can be done when the differences are small and they can be embedded in the same C file: + +.. code-block: console + + #ifdef RTE_ARCH_I686 + toto(); + #else + titi(); + #endif + +* Use the CONFIG option in the Makefile. This is done when the differences are more significant. + In this case, the code is split into two separate files that are architecture or environment specific. This should only apply inside the EAL library. + +.. note: + + As in the linux kernel, the "CONFIG_" prefix is not used in C code. + This is only needed in Makefiles or shell scripts. + +Per Architecture Sources +~~~~~~~~~~~~~~~~~~~~~~~~ + +The following config options can be used: + +* CONFIG_RTE_ARCH is a string that contains the name of the architecture. +* CONFIG_RTE_ARCH_I686, CONFIG_RTE_ARCH_X86_64, CONFIG_RTE_ARCH_X86_64_32 or CONFIG_RTE_ARCH_PPC_64 are defined only if we are building for those architectures. + +Per Execution Environment Sources +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The following config options can be used: + +* CONFIG_RTE_EXEC_ENV is a string that contains the name of the executive environment. +* CONFIG_RTE_EXEC_ENV_BSDAPP or CONFIG_RTE_EXEC_ENV_LINUXAPP are defined only if we are building for this execution environment. diff --git a/doc/guides/guidelines/index.rst b/doc/guides/guidelines/index.rst index b2b0a92276..0ee9ab3dba 100644 --- a/doc/guides/guidelines/index.rst +++ b/doc/guides/guidelines/index.rst @@ -6,3 +6,4 @@ Guidelines :numbered: coding_style + design