Commit 131f65fb authored by Leonardo Lai's avatar Leonardo Lai

cleanup

parent e9e0d67e
......@@ -2,6 +2,7 @@
// Created by leoll2 on 9/25/20.
// Copyright (c) 2020 Leonardo Lai. All rights reserved.
//
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -47,6 +48,7 @@ extern char *primary_argv[MAX_ARGC];
extern char *secondary_argv[MAX_ARGC];
static pid_t poller_pid;
/* Get the name of the rings of exchange slots */
static inline const char * get_exch_ring_name(unsigned id, enum exch_ring_func func)
{
......@@ -226,10 +228,9 @@ static int destroy_udp_bind_table(void)
return rte_memzone_free(mz);
}
/* Initialize slots to exchange packets between the application and the poller */
/* Initialize (statically) the slots to exchange packets between the application and the poller */
static int init_exchange_slots(void)
{
// TODO allocate slots dynamically in udpdk_socket() instead of pre-allocating all them statically
unsigned i;
unsigned socket_id;
const char *q_name;
......@@ -262,7 +263,7 @@ int udpdk_init(int argc, char *argv[])
{
int retval;
// Initialize UDPDK
// Parse and initialize the arguments
if (udpdk_parse_args(argc, argv) < 0) { // initializes primary and secondary argc argv
RTE_LOG(ERR, INIT, "Invalid arguments for UDPDK\n");
return -1;
......@@ -336,12 +337,14 @@ int udpdk_init(int argc, char *argv[])
return 0;
}
/* Signal UDPDK poller to stop */
void udpdk_interrupt(int signum)
{
RTE_LOG(INFO, INTR, "Killing the poller process (%d)...\n", poller_pid);
interrupted = 1;
}
/* Close all the open sockets */
static void udpdk_close_all_sockets(void)
{
for (int s = 0; s < NUM_SOCKETS_MAX; s++) {
......@@ -352,6 +355,7 @@ static void udpdk_close_all_sockets(void)
}
}
/* Release all the memory and data structures used by UDPDK */
void udpdk_cleanup(void)
{
uint16_t port_id;
......
......@@ -114,7 +114,7 @@ static int setup_queues(void)
frag_cycles = (rte_get_tsc_hz() + MS_PER_S - 1) / MS_PER_S * MAX_FLOW_TTL;
// Pool of mbufs for RX
// TODO actually unused because pool is needed only to initialize a queue, which is done in 'application' anyway
// NOTE actually unused because pool is needed only to initialize a queue, which is done in 'application' anyway
qconf->rx_queue.pool = rte_mempool_lookup(PKTMBUF_POOL_RX_NAME);
if (qconf->rx_queue.pool == NULL) {
RTE_LOG(ERR, POLLINIT, "Cannot retrieve pool of mbufs for RX\n");
......@@ -147,6 +147,7 @@ static int setup_queues(void)
return 0;
}
/* Setup the data structures needed to exchange packets with the app */
static int setup_exch_zone(void)
{
uint16_t i;
......@@ -186,6 +187,7 @@ static int setup_exch_zone(void)
return 0;
}
/* Retrieve the L4 switching table (initialized by the primary) */
static int setup_udp_table(void)
{
const struct rte_memzone *sock_bind_table_mz;
......@@ -200,7 +202,7 @@ static int setup_udp_table(void)
return 0;
}
/* Initialize UDPDK packet poller (runs in a separate process) */
/* Initialize UDPDK packet poller (which runs in a separate process w.r.t. app) */
int poller_init(int argc, char *argv[])
{
int retval;
......@@ -288,6 +290,7 @@ static inline unsigned long get_ipv4_dst_addr(struct rte_ipv4_hdr *ip_hdr)
return ip_hdr->dst_addr;
}
// TODO reassemble() is given too much responsibility: decompose into multiple functions
static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queue,
struct lcore_queue_conf *qconf, uint64_t tms)
{
......@@ -487,7 +490,7 @@ void poller_body(void)
tx_count = 0;
}
// Receive packets from DPDK port 0 (queue 0) TODO use more queues
// Receive packets from DPDK port 0 (queue 0) TODO use more queues (RSS)
rx_count = rte_eth_rx_burst(PORT_RX, QUEUE_RX, rx_mbuf_table, RX_MBUF_TABLE_SIZE);
if (likely(rx_count > 0)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment