DPDK patches and discussions
 help / color / mirror / Atom feed
From: Sean Morrissey <sean.morrissey@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>,
	Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>
Cc: dev@dpdk.org, Sean Morrissey <sean.morrissey@intel.com>
Subject: [PATCH v1] docs: update l3fwd sample app docs
Date: Fri,  3 Jun 2022 11:11:03 +0000	[thread overview]
Message-ID: <20220603111103.2661619-1-sean.morrissey@intel.com> (raw)

The L3FWD sample app doc contains outdated static code
snippets and references to functions which no longer
exist. This patch updates this doc to use up to date
references.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
---
 doc/guides/sample_app_ug/l3_forward.rst | 87 +++++++------------------
 examples/l3fwd/l3fwd_em_hlm_sse.h       |  2 +
 examples/l3fwd/l3fwd_lpm.c              |  2 +
 3 files changed, 28 insertions(+), 63 deletions(-)

diff --git a/doc/guides/sample_app_ug/l3_forward.rst b/doc/guides/sample_app_ug/l3_forward.rst
index 01d86db95d..50720f0e42 100644
--- a/doc/guides/sample_app_ug/l3_forward.rst
+++ b/doc/guides/sample_app_ug/l3_forward.rst
@@ -190,7 +190,7 @@ In this command:
 
 *   The --mode option defines PMD to be used for packet I/O.
 
-*   The --eventq-sched option enables synchronization menthod of event queue so that packets will be scheduled accordingly.
+*   The --eventq-sched option enables synchronization method of event queue so that packets will be scheduled accordingly.
 
 If application uses S/W scheduler, it uses following DPDK services:
 
@@ -290,36 +290,20 @@ for the convenience to execute hash performance test on 4M/8M/16M flows.
     which is used to specify the total hash entry number for all used ports in hash performance test,
     can be specified with --hash-entry-num VALUE in command line, being its default value 4.
 
-.. code-block:: c
-
-    #if (APP_LOOKUP_METHOD == APP_LOOKUP_EXACT_MATCH)
-
-        static void
-        setup_hash(int socketid)
-        {
-            // ...
-
-            if (ipv6 == 0) {
-                /* populate the ipv4 hash */
-                populate_ipv4_flow_into_table(
-                    ipv4_l3fwd_em_lookup_struct[socketid]);
-            } else {
-                /* populate the ipv6 hash */
-                populate_ipv6_flow_into_table(
-                    ipv6_l3fwd_em_lookup_struct[socketid]);
-            }
-        }
-    #endif
+.. literalinclude:: ../../../examples/l3fwd/l3fwd_em.c
+    :language: c
+    :start-after: Initialize exact match (hash) parameters. 8<
+    :end-before: >8 End of initialization of hash parameters.
 
 LPM Initialization
 ~~~~~~~~~~~~~~~~~~
 
 The LPM object is created and loaded with the pre-configured entries read from a global array.
 
-.. literalinclude:: ../../../examples/l3fwd/l3fwd_em.c
+.. literalinclude:: ../../../examples/l3fwd/l3fwd_lpm.c
     :language: c
-    :start-after: Initialize exact match (hash) parameters. 8<
-    :end-before: >8 End of initialization of hash parameters.
+    :start-after: Initialize lpm (longest prefix match) parameters. 8<
+    :end-before: >8 End of initialization of lpm parameters.
 
 FIB Initialization
 ~~~~~~~~~~~~~~~~~~
@@ -337,62 +321,39 @@ the full setup function including the IPv6 setup can be seen in the app code.
 Packet Forwarding for Hash-based Lookups
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-For each input packet, the packet forwarding operation is done by the l3fwd_simple_forward()
-or simple_ipv4_fwd_4pkts() function for IPv4 packets or the simple_ipv6_fwd_4pkts() function for IPv6 packets.
-The l3fwd_simple_forward() function provides the basic functionality for both IPv4 and IPv6 packet forwarding
+For each input packet, the packet forwarding operation is done by the l3fwd_em_simple_forward()
+where the l3fwd_em_handle_ipv4() function handles IPv4 packets and the l3fwd_em_handle_ipv6() function handles IPv6 packets.
+The l3fwd_em_simple_forward() function provides the basic functionality for both IPv4 and IPv6 packet forwarding
 for any number of burst packets received,
 and the packet forwarding decision (that is, the identification of the output interface for the packet)
-for hash-based lookups is done by the  get_ipv4_dst_port() or get_ipv6_dst_port() function.
-The get_ipv4_dst_port() function is shown below:
+for hash-based lookups is done by the  em_get_ipv4_dst_port() or em_get_ipv6_dst_port() function.
+The em_get_ipv4_dst_port() function is shown below:
 
 .. literalinclude:: ../../../examples/l3fwd/l3fwd_em.c
    :language: c
    :start-after: Performing hash-based lookups. 8<
    :end-before: >8 End of performing hash-based lookups.
 
-The get_ipv6_dst_port() function is similar to the get_ipv4_dst_port() function.
-
-The simple_ipv4_fwd_4pkts() and simple_ipv6_fwd_4pkts() function are optimized for continuous 4 valid ipv4 and ipv6 packets,
-they leverage the multiple buffer optimization to boost the performance of forwarding packets with the exact match on hash table.
-The key code snippet of simple_ipv4_fwd_4pkts() is shown below:
-
-.. code-block:: c
-
-    static inline void
-    simple_ipv4_fwd_4pkts(struct rte_mbuf* m[4], uint16_t portid, struct lcore_conf *qconf)
-    {
-        // ...
-
-        data[0] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[0], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live)));
-        data[1] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[1], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live)));
-        data[2] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[2], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live)));
-        data[3] = _mm_loadu_si128(( m128i*)(rte_pktmbuf_mtod(m[3], unsigned char *) + sizeof(struct rte_ether_hdr) + offsetof(struct rte_ipv4_hdr, time_to_live)));
+The em_get_ipv6_dst_port() function is similar to the em_get_ipv4_dst_port() function.
 
-        key[0].xmm = _mm_and_si128(data[0], mask0);
-        key[1].xmm = _mm_and_si128(data[1], mask0);
-        key[2].xmm = _mm_and_si128(data[2], mask0);
-        key[3].xmm = _mm_and_si128(data[3], mask0);
+The get_ipv4_5tuple() and get_ipv6_5tuple() function are optimized for continuous valid ipv4 and ipv6 packets,
+along with em_get_dst_port_ipv4xN() and em_get_dst_port_ipv6xN() they leverage the multiple buffer
+optimization to boost the performance of forwarding packets with the exact match on hash table.
+The key code snippet of get_ipv4_5tuple() is shown below:
 
-        const void *key_array[4] = {&key[0], &key[1], &key[2],&key[3]};
-
-        rte_hash_lookup_bulk(qconf->ipv4_lookup_struct, &key_array[0], 4, ret);
-
-        dst_port[0] = (ret[0] < 0)? portid:ipv4_l3fwd_out_if[ret[0]];
-        dst_port[1] = (ret[1] < 0)? portid:ipv4_l3fwd_out_if[ret[1]];
-        dst_port[2] = (ret[2] < 0)? portid:ipv4_l3fwd_out_if[ret[2]];
-        dst_port[3] = (ret[3] < 0)? portid:ipv4_l3fwd_out_if[ret[3]];
-
-        // ...
-    }
+.. literalinclude:: ../../../examples/l3fwd/l3fwd_em_hlm_sse.h
+   :language: c
+   :start-after: Optimized IPv4 tuple acquire. 8<
+   :end-before: >8 End of optimized IPv4 tuple acquire.
 
-The simple_ipv6_fwd_4pkts() function is similar to the simple_ipv4_fwd_4pkts() function.
+The get_ipv6_5tuple() function is similar to the get_ipv4_5tuple() function.
 
 Known issue: IP packets with extensions or IP packets which are not TCP/UDP cannot work well at this mode.
 
 Packet Forwarding for LPM-based Lookups
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-For each input packet, the packet forwarding operation is done by the l3fwd_simple_forward() function,
+For each input packet, the packet forwarding operation is done by the l3fwd_lpm_simple_forward() function,
 but the packet forwarding decision (that is, the identification of the output interface for the packet)
 for LPM-based lookups is done by the get_ipv4_dst_port() function below:
 
diff --git a/examples/l3fwd/l3fwd_em_hlm_sse.h b/examples/l3fwd/l3fwd_em_hlm_sse.h
index 7964a92771..47bee6ad93 100644
--- a/examples/l3fwd/l3fwd_em_hlm_sse.h
+++ b/examples/l3fwd/l3fwd_em_hlm_sse.h
@@ -7,6 +7,7 @@
 
 #include "l3fwd_sse.h"
 
+/* Optimized IPv4 tuple acquire. 8< */
 static __rte_always_inline void
 get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0,
 		union ipv4_5tuple_host *key)
@@ -18,6 +19,7 @@ get_ipv4_5tuple(struct rte_mbuf *m0, __m128i mask0,
 
 	key->xmm = _mm_and_si128(tmpdata0, mask0);
 }
+/* >8 End of optimized IPv4 tuple acquire. */
 
 static inline void
 get_ipv6_5tuple(struct rte_mbuf *m0, __m128i mask0,
diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
index d1b850dd5b..47437b453d 100644
--- a/examples/l3fwd/l3fwd_lpm.c
+++ b/examples/l3fwd/l3fwd_lpm.c
@@ -548,6 +548,7 @@ lpm_event_main_loop_tx_q_burst_vector(__rte_unused void *dummy)
 	return 0;
 }
 
+/* Initialize lpm (longest prefix match) parameters. 8< */
 void
 setup_lpm(const int socketid)
 {
@@ -645,6 +646,7 @@ setup_lpm(const int socketid)
 		       route_base_v6[i].if_out, dev_info.device->name);
 	}
 }
+/* >8 End of initialization of lpm parameters. */
 
 int
 lpm_check_ptype(int portid)
-- 
2.25.1


             reply	other threads:[~2022-06-03 11:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 11:11 Sean Morrissey [this message]
2022-07-11 21:18 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220603111103.2661619-1-sean.morrissey@intel.com \
    --to=sean.morrissey@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.v.ananyev@yandex.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).