(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.. _multi_process_app:
+
Multi-process Sample Application
================================
where different processes perform different tasks, yet co-operate to form a packet-processing system.)
The following diagram shows the data-flow through the application, using two processes.
-.. _figure_6:
+.. _figure_sym_multi_proc_app:
-**Figure 6. Example Data Flow in a Symmetric Multi-process Application**
+.. figure:: img/sym_multi_proc_app.*
-.. image9_png has been renamed
+ Example Data Flow in a Symmetric Multi-process Application
-|sym_multi_proc_app|
As the diagram shows, each process reads packets from each of the network ports in use.
RSS is used to distribute incoming packets on each port to different hardware RX queues.
for(i = 0; i < num_ports; i++){
if(proc_type == RTE_PROC_PRIMARY)
if (smp_port_init(ports[i], mp, (uint16_t)num_procs) < 0)
- rte_exit(EXIT_FAILURE, "Error initialising ports\n");
+ rte_exit(EXIT_FAILURE, "Error initializing ports\n");
}
In the secondary instance, rather than initializing the network ports, the port information exported by the primary process is used,
The following diagram shows the data-flow through the application, using two client processes.
-.. _figure_7:
+.. _figure_client_svr_sym_multi_proc_app:
-**Figure 7. Example Data Flow in a Client-Server Symmetric Multi-process Application**
+.. figure:: img/client_svr_sym_multi_proc_app.*
-.. image10_png has been renamed
+ Example Data Flow in a Client-Server Symmetric Multi-process Application
-|client_svr_sym_multi_proc_app|
Running the Application
^^^^^^^^^^^^^^^^^^^^^^^
This application performs the same functionality as the L2 Forwarding sample application,
therefore this chapter does not cover that part but describes functionality that is introduced in this multi-process example only.
-Please refer to Chapter 9, "L2 Forwarding Sample Application (in Real and Virtualized Environments)" for more information.
+Please refer to :doc:`l2_forward_real_virtual` for more information.
Unlike previous examples where all processes are started from the command line with input arguments, in this example,
only one process is spawned from the command line and that process creates other processes.
memory, CPU cores, driver, ports, and so on, as the other examples do.
Thereafter, it creates slave processes, as shown in the following figure.
-.. _figure_8:
+.. _figure_master_slave_proc:
-**Figure 8. Master-slave Process Workflow**
+.. figure:: img/master_slave_proc.*
-.. image11_png has been renamed
+ Master-slave Process Workflow
-|master_slave_proc|
The master process calls the rte_eal_mp_remote_launch() EAL function to launch an application function for each pinned thread through the pipe.
Then, it waits to check if any slave processes have exited.
#. Set up a notification mechanism for slave process exit cases. After the specific slave leaves,
the master should be notified and then help to create a new instance.
- This mechanism is provided in Section 15.1.5.1, "Master-slave Process Models".
+ This mechanism is provided in Section `Master-slave Process Models`_.
#. Use a synchronization mechanism among dependent processes.
The master should have the capability to stop or kill slave processes that have a dependency on the one that has exited.
The following diagram describes slave process recovery.
-.. _figure_9:
+.. _figure_slave_proc_recov:
-**Figure 9. Slave Process Recovery Process Flow**
+.. figure:: img/slave_proc_recov.*
-.. image12_png has been renamed
+ Slave Process Recovery Process Flow
-|slave_proc_recov|
Floating Process Support
^^^^^^^^^^^^^^^^^^^^^^^^
So, it needs to allocate a heap buffer using rte_zmalloc.
In addition, if the -f option is specified,
an array is needed to store the allocated core ID for the floating process so that the master can return it
-after a slave has exited accidently.
+after a slave has exited accidentally.
.. code-block:: c
}
return 0;
}
-
-.. |sym_multi_proc_app| image:: img/sym_multi_proc_app.png
-
-.. |client_svr_sym_multi_proc_app| image:: img/client_svr_sym_multi_proc_app.png
-
-.. |master_slave_proc| image:: img/master_slave_proc.png
-
-.. |slave_proc_recov| image:: img/slave_proc_recov.png