summaryrefslogtreecommitdiff
path: root/examples/server_node_efd
diff options
context:
space:
mode:
authorConor Fogarty <[email protected]>2021-07-16 13:57:52 +0000
committerThomas Monjalon <[email protected]>2021-07-31 15:42:43 +0200
commit9a212dc06c7aaf09b146d9c3dcfd584d741634c1 (patch)
treee349ce037d409524b2465f8dc96057ff859ddd5e /examples/server_node_efd
parentb5886e64fc3a597771d4b6cfd0c9326b895bb22b (diff)
doc: use code snippets in sample app guides
Currently the sample app user guides use hard coded code snippets, this patch changes these to use literalinclude which will dynamically update the snippets as changes are made to the code. This was introduced in commit 413c75c33c40 ("doc: show how to include code in guides"). Comments within the sample apps were updated to accommodate this as part of this patch. This will help to ensure that the code within the sample app user guides is up to date and not out of sync with the actual code. Signed-off-by: Conor Fogarty <[email protected]> Signed-off-by: Conor Walsh <[email protected]> Acked-by: John McNamara <[email protected]>
Diffstat (limited to 'examples/server_node_efd')
-rw-r--r--examples/server_node_efd/node/node.c7
-rw-r--r--examples/server_node_efd/server/init.c3
-rw-r--r--examples/server_node_efd/server/main.c11
3 files changed, 20 insertions, 1 deletions
diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c
index e68606e0ca..4580a44e3e 100644
--- a/examples/server_node_efd/node/node.c
+++ b/examples/server_node_efd/node/node.c
@@ -189,6 +189,8 @@ configure_output_ports(const struct shared_info *info)
* the node will handle, which will be used to decide if packet
* is transmitted or dropped.
*/
+
+/* Creation of hash table. 8< */
static struct rte_hash *
create_hash_table(const struct shared_info *info)
{
@@ -243,6 +245,7 @@ populate_hash_table(const struct rte_hash *h, const struct shared_info *info)
printf("Hash table: Adding 0x%x keys\n", num_flows_node);
}
+/* >8 End of creation of hash table. */
/*
* This function performs routing of packets
@@ -263,6 +266,7 @@ transmit_packet(struct rte_mbuf *buf)
}
+/* Packets dequeued from the shared ring. 8< */
static inline void
handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets)
{
@@ -293,6 +297,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets)
}
}
}
+/* >8 End of packets dequeueing. */
/*
* Application main function - loops through
@@ -323,6 +328,7 @@ main(int argc, char *argv[])
if (rte_eth_dev_count_avail() == 0)
rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n");
+ /* Attaching to the server process memory. 8< */
rx_ring = rte_ring_lookup(get_rx_queue_name(node_id));
if (rx_ring == NULL)
rte_exit(EXIT_FAILURE, "Cannot get RX ring - "
@@ -338,6 +344,7 @@ main(int argc, char *argv[])
info = mz->addr;
tx_stats = &(info->tx_stats[node_id]);
filter_stats = &(info->filter_stats[node_id]);
+ /* >8 End of attaching to the server process memory. */
configure_output_ports(info);
diff --git a/examples/server_node_efd/server/init.c b/examples/server_node_efd/server/init.c
index 347737cb98..9ebd88bac2 100644
--- a/examples/server_node_efd/server/init.c
+++ b/examples/server_node_efd/server/init.c
@@ -200,6 +200,8 @@ init_shm_rings(void)
* Create EFD table which will contain all the flows
* that will be distributed among the nodes
*/
+
+/* Create EFD table. 8< */
static void
create_efd_table(void)
{
@@ -236,6 +238,7 @@ populate_efd_table(void)
printf("EFD table: Adding 0x%x keys\n", num_flows);
}
+/* >8 End of creation EFD table. */
/* Check the link status of all ports in up to 9s, and print them finally */
static void
diff --git a/examples/server_node_efd/server/main.c b/examples/server_node_efd/server/main.c
index 39b7b6370f..7d07131dbf 100644
--- a/examples/server_node_efd/server/main.c
+++ b/examples/server_node_efd/server/main.c
@@ -99,6 +99,8 @@ get_printable_mac_addr(uint16_t port)
* thread in the server process, when the process is run with more
* than one lcore enabled.
*/
+
+/* Display recorded statistics. 8< */
static void
do_stats_display(void)
{
@@ -166,6 +168,7 @@ do_stats_display(void)
printf("\n");
}
+/* >8 End of displaying the recorded statistics. */
/*
* The function called from each non-main lcore used by the process.
@@ -212,6 +215,8 @@ clear_stats(void)
* send a burst of traffic to a node, assuming there are packets
* available to be sent to this node
*/
+
+/* Flush rx queue. 8< */
static void
flush_rx_queue(uint16_t node)
{
@@ -232,6 +237,7 @@ flush_rx_queue(uint16_t node)
cl_rx_buf[node].count = 0;
}
+/* >8 End of sending a burst of traffic to a node. */
/*
* marks a packet down to be sent to a particular node process
@@ -245,8 +251,10 @@ enqueue_rx_packet(uint8_t node, struct rte_mbuf *buf)
/*
* This function takes a group of packets and routes them
* individually to the node process. Very simply round-robins the packets
- * without checking any of the packet contents.
+ * without checking any of the packet contents. 8<
*/
+
+/* Processing packets. 8< */
static void
process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[],
uint16_t rx_count, unsigned int socket_id)
@@ -288,6 +296,7 @@ process_packets(uint32_t port_num __rte_unused, struct rte_mbuf *pkts[],
for (i = 0; i < num_nodes; i++)
flush_rx_queue(i);
}
+/* >8 End of process_packets. */
/*
* Function called by the main lcore of the DPDK process.