net/cnxk: add multi-segment Tx for CN10K
[dpdk.git] / doc / guides / sample_app_ug / l3_forward.rst
index 831a1e0..a117502 100644 (file)
@@ -11,7 +11,7 @@ The application performs L3 forwarding.
 Overview
 --------
 
-The application demonstrates the use of the hash and LPM libraries in the DPDK
+The application demonstrates the use of the hash, LPM and FIB libraries in DPDK
 to implement packet forwarding using poll or event mode PMDs for packet I/O.
 The initialization and run-time paths are very similar to those of the
 :doc:`l2_forward_real_virtual` and :doc:`l2_forward_event`.
@@ -22,7 +22,9 @@ decision is made based on information read from the input packet.
 Eventdev can optionally use S/W or H/W (if supported by platform) scheduler
 implementation for packet I/O based on run time parameters.
 
-The lookup method is either hash-based or LPM-based and is selected at run time. When the selected lookup method is hash-based,
+The lookup method is hash-based, LPM-based or FIB-based
+and is selected at run time.
+When the selected lookup method is hash-based,
 a hash object is used to emulate the flow classification stage.
 The hash object is used in correlation with a flow table to map each input packet to its flow at runtime.
 
@@ -30,14 +32,21 @@ The hash lookup key is represented by a DiffServ 5-tuple composed of the followi
 Source IP Address, Destination IP Address, Protocol, Source Port and Destination Port.
 The ID of the output interface for the input packet is read from the identified flow table entry.
 The set of flows used by the application is statically configured and loaded into the hash at initialization time.
-When the selected lookup method is LPM based, an LPM object is used to emulate the forwarding stage for IPv4 packets.
-The LPM object is used as the routing table to identify the next hop for each input packet at runtime.
-
-The LPM lookup key is represented by the Destination IP Address field read from the input packet.
-The ID of the output interface for the input packet is the next hop returned by the LPM lookup.
-The set of LPM rules used by the application is statically configured and loaded into the LPM object at initialization time.
-
-In the sample application, hash-based forwarding supports IPv4 and IPv6. LPM-based forwarding supports IPv4 only.
+When the selected lookup method is LPM or FIB based,
+an LPM or FIB object is used to emulate the forwarding stage for IPv4 packets.
+The LPM or FIB object is used as the routing table
+to identify the next hop for each input packet at runtime.
+
+The LPM and FIB lookup keys are represented by the destination IP address field
+read from the input packet.
+The ID of the output interface for the input packet is the next hop
+returned by the LPM or FIB lookup.
+The set of LPM and FIB rules used by the application is statically configured
+and loaded into the LPM or FIB object at initialization time.
+
+In the sample application, hash-based and FIB-based forwarding supports
+both IPv4 and IPv6.
+LPM-based forwarding supports IPv4 only.
 
 Compiling the Application
 -------------------------
@@ -300,6 +309,19 @@ The LPM object is created and loaded with the pre-configured entries read from a
     }
     #endif
 
+FIB Initialization
+~~~~~~~~~~~~~~~~~~
+
+The FIB object is created and loaded with the pre-configured entries
+read from a global array.
+The abridged code snippet below shows the FIB initialization for IPv4,
+the full setup function including the IPv6 setup can be seen in the app code.
+
+.. literalinclude:: ../../../examples/l3fwd/l3fwd_fib.c
+   :language: c
+   :start-after: Function to setup fib.
+   :end-before: Create the fib IPv6 table.
+
 Packet Forwarding for Hash-based Lookups
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
@@ -390,6 +412,16 @@ for LPM-based lookups is done by the get_ipv4_dst_port() function below:
         return ((rte_lpm_lookup(ipv4_l3fwd_lookup_struct, rte_be_to_cpu_32(ipv4_hdr->dst_addr), &next_hop) == 0)? next_hop : portid);
     }
 
+Packet Forwarding for FIB-based Lookups
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The FIB library was designed to process multiple packets at once,
+it does not have separate functions for single and bulk lookups.
+``rte_fib_lookup_bulk`` is used for IPv4 lookups
+and ``rte_fib6_lookup_bulk`` for IPv6.
+Various examples of these functions being used
+can be found in the sample app code.
+
 Eventdev Driver Initialization
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Eventdev driver initialization is same as L2 forwarding eventdev application.