Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
U
udpdk
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ywj
udpdk
Commits
131f65fb
Commit
131f65fb
authored
Nov 05, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
e9e0d67e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
udpdk/udpdk_init.c
udpdk/udpdk_init.c
+7
-3
udpdk/udpdk_poller.c
udpdk/udpdk_poller.c
+6
-3
No files found.
udpdk/udpdk_init.c
View file @
131f65fb
...
...
@@ -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
;
...
...
udpdk/udpdk_poller.c
View file @
131f65fb
...
...
@@ -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
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment