doc: remove repeated repeated words
[dpdk.git] / doc / guides / sample_app_ug / service_cores.rst
index 36c1b3c..307a6c5 100644 (file)
@@ -1,32 +1,5 @@
-..  BSD LICENSE
-    Copyright(c) 2017 Intel Corporation. All rights reserved.
-    All rights reserved.
-
-    Redistribution and use in source and binary forms, with or without
-    modification, are permitted provided that the following conditions
-    are met:
-
-    * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-    * Neither the name of Intel Corporation nor the names of its
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
-    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+..  SPDX-License-Identifier: BSD-3-Clause
+    Copyright(c) 2017 Intel Corporation.
 
 Service Cores Sample Application
 ================================
@@ -47,26 +20,9 @@ is application specific, and not a part of the service cores API.
 Compiling the Application
 -------------------------
 
-#.  Go to the example directory:
+To compile the sample application see :doc:`compiling`.
 
-    .. code-block:: console
-
-        export RTE_SDK=/path/to/rte_sdk
-        cd ${RTE_SDK}/examples/service_cores
-
-#.  Set the target (a default target is used if not specified). For example:
-
-    .. code-block:: console
-
-        export RTE_TARGET=x86_64-native-linuxapp-gcc
-
-    See the *DPDK Getting Started* Guide for possible RTE_TARGET values.
-
-#.  Build the application:
-
-    .. code-block:: console
-
-        make
+The application is located in the ``service_cores`` sub-directory.
 
 Running the Application
 -----------------------
@@ -77,7 +33,7 @@ pass a service core-mask as an EAL argument at startup time.
 
 .. code-block:: console
 
-    $ ./build/service_cores
+    $ ./<build_dir>/examples/dpdk-service_cores
 
 
 Explanation
@@ -97,28 +53,11 @@ order to register services: ``rte_service_component.h``, in addition
 to the ordinary service cores header ``rte_service.h`` which provides
 the runtime functions to add, remove and remap service cores.
 
-.. code-block:: c
-
-        struct rte_service_spec service = {
-                .name = "service_name",
-        };
-        int ret = rte_service_component_register(services, &id);
-        if (ret)
-                return -1;
-
-        /* set the service itself to be ready to run. In the case of
-        * ethdev, eventdev etc PMDs, this will be set when the
-        * appropriate configure or setup function is called.
-        */
-        rte_service_component_runstate_set(id, 1);
-
-        /* Collect statistics for the service */
-        rte_service_set_stats_enable(id, 1);
-
-        /* The application sets the service to running state. Note that this
-         * function enables the service to run - while the 'component' version
-         * of this function (as above) marks the service itself as ready */
-        ret = rte_service_runstate_set(id, 1);
+.. literalinclude:: ../../../examples/service_cores/main.c
+    :language: c
+    :start-after: Register a service as an application. 8<
+    :end-before: >8 End of registering a service as an application.
+    :dedent: 2
 
 
 Controlling A Service Core
@@ -131,26 +70,11 @@ functions.
 
 These are the functions to start a service core, and have it run a service:
 
-.. code-block:: c
-
-        /* the lcore ID to use as a service core */
-        uint32_t service_core_id = 7;
-        ret = rte_service_lcore_add(service_core_id);
-        if(ret)
-                return -1;
-
-        /* service cores are in "stopped" state when added, so start it */
-        ret = rte_service_lcore_start(service_core_id);
-        if(ret)
-                return -1;
-
-        /* map a service to the service core, causing it to run the service */
-        uint32_t service_id; /* ID of a registered service */
-        uint32_t enable = 1; /* 1 maps the service, 0 unmaps */
-        ret = rte_service_map_lcore_set(service_id, service_core_id, enable);
-        if(ret)
-                return -1;
-
+.. literalinclude:: ../../../examples/service_cores/main.c
+    :language: c
+    :start-after: Register a service as an application. 8<
+    :end-before: >8 End of registering a service as an application.
+    :dedent: 2
 
 Removing A Service Core
 ~~~~~~~~~~~~~~~~~~~~~~~