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
16e9f20e
Commit
16e9f20e
authored
Oct 02, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l4 switching of received packets
small improvements to logging
parent
fe0b1a39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
udpdk/udpdk_poller.c
udpdk/udpdk_poller.c
+14
-10
udpdk/udpdk_syscall.c
udpdk/udpdk_syscall.c
+1
-1
No files found.
udpdk/udpdk_poller.c
View file @
16e9f20e
...
@@ -28,7 +28,9 @@
...
@@ -28,7 +28,9 @@
#include "udpdk_lookup_table.h"
#include "udpdk_lookup_table.h"
#include "udpdk_types.h"
#include "udpdk_types.h"
#define RTE_LOGTYPE_POLLBODY RTE_LOGTYPE_USER1
#define RTE_LOGTYPE_POLLINIT RTE_LOGTYPE_USER1
#define RTE_LOGTYPE_POLLINIT RTE_LOGTYPE_USER1
#define RTE_LOGTYPE_POLLINTR RTE_LOGTYPE_USER1
static
volatile
int
poller_alive
=
1
;
static
volatile
int
poller_alive
=
1
;
...
@@ -55,7 +57,7 @@ static struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
...
@@ -55,7 +57,7 @@ static struct lcore_queue_conf lcore_queue_conf[RTE_MAX_LCORE];
/* Poller signal handler */
/* Poller signal handler */
static
void
poller_sighandler
(
int
sig
)
static
void
poller_sighandler
(
int
sig
)
{
{
printf
(
"Poller: r
eceived request to stop
\n
"
);
RTE_LOG
(
INFO
,
POLLINTR
,
"R
eceived request to stop
\n
"
);
poller_alive
=
0
;
poller_alive
=
0
;
}
}
...
@@ -154,6 +156,7 @@ static int setup_udp_table(void)
...
@@ -154,6 +156,7 @@ static int setup_udp_table(void)
return
-
1
;
return
-
1
;
}
}
udp_port_table
=
udp_port_table_mz
->
addr
;
udp_port_table
=
udp_port_table_mz
->
addr
;
return
0
;
return
0
;
}
}
...
@@ -258,7 +261,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
...
@@ -258,7 +261,7 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
struct
rx_queue
*
rxq
;
struct
rx_queue
*
rxq
;
uint16_t
udp_dst_port
;
uint16_t
udp_dst_port
;
uint32_t
ip_dst
;
uint32_t
ip_dst
;
static
int
foo
=
0
;
// TODO dummy
int
sock_id
;
rxq
=
&
qconf
->
rx_queue
;
rxq
=
&
qconf
->
rx_queue
;
...
@@ -292,12 +295,12 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
...
@@ -292,12 +295,12 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
}
}
}
}
}
else
{
}
else
{
printf
(
"[WARN]
Received non-IPv4 packet.
\n
"
);
RTE_LOG
(
WARNING
,
POLLBODY
,
"
Received non-IPv4 packet.
\n
"
);
return
;
return
;
}
}
if
(
!
is_udp_pkt
(
ip_hdr
))
{
if
(
!
is_udp_pkt
(
ip_hdr
))
{
printf
(
"[WARN]
Received non-UDP packet.
\n
"
);
RTE_LOG
(
WARNING
,
POLLBODY
,
"
Received non-UDP packet.
\n
"
);
return
;
return
;
}
}
udp_dst_port
=
get_udp_dst_port
(
udp_dst_port
=
get_udp_dst_port
(
...
@@ -309,13 +312,14 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
...
@@ -309,13 +312,14 @@ static inline void reassemble(struct rte_mbuf *m, uint16_t portid, uint32_t queu
printf
(
"[DBG] UDP dest port: %d
\n
"
,
udp_dst_port
);
// TODO DEBUG
printf
(
"[DBG] UDP dest port: %d
\n
"
,
udp_dst_port
);
// TODO DEBUG
printf
(
"[DBG] IP dest addr: %s
\n
"
,
ip_str
);
// TODO DEBUG
printf
(
"[DBG] IP dest addr: %s
\n
"
,
ip_str
);
// TODO DEBUG
//
TODO based on UDP, find the appropriate exchange buffer
//
Find the sock_id corresponding to the UDP dst port (L4 switching) and enqueue the packet to its queue
// TODO here enqueuing is a dummy round-robin, not based on actual port!
sock_id
=
htable_lookup
(
udp_port_table
,
udp_dst_port
);
if
(
foo
&
1
)
{
if
(
sock_id
<
0
||
sock_id
>=
NUM_SOCKETS_MAX
)
{
e
nqueue_rx_packet
(
1
,
m
)
;
e
rrno
=
EINVAL
;
}
else
{
RTE_LOG
(
ERR
,
POLLBODY
,
"Invalid L4 port mapping: port %d maps to sock_id %d
\n
"
,
udp_dst_port
,
sock_id
);
enqueue_rx_packet
(
0
,
m
)
;
return
;
}
}
enqueue_rx_packet
(
sock_id
,
m
);
}
}
/* Packet polling routine */
/* Packet polling routine */
...
...
udpdk/udpdk_syscall.c
View file @
16e9f20e
...
@@ -126,6 +126,7 @@ int udpdk_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
...
@@ -126,6 +126,7 @@ int udpdk_bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
// Insert in the hashtable (port, sock_id)
// Insert in the hashtable (port, sock_id)
htable_insert
(
udp_port_table
,
(
int
)
port
,
sockfd
);
htable_insert
(
udp_port_table
,
(
int
)
port
,
sockfd
);
RTE_LOG
(
INFO
,
SYSCALL
,
"Binding port %d to sock_id %d
\n
"
,
port
,
sockfd
);
return
0
;
return
0
;
}
}
...
@@ -217,7 +218,6 @@ ssize_t udpdk_recvfrom(int sockfd, void *buf, size_t len, int flags,
...
@@ -217,7 +218,6 @@ ssize_t udpdk_recvfrom(int sockfd, void *buf, size_t len, int flags,
struct
rte_udp_hdr
*
udp_hdr
;
struct
rte_udp_hdr
*
udp_hdr
;
void
*
udp_data
;
void
*
udp_data
;
printf
(
"Inside recvfrom
\n
"
);
// Validate the arguments
// Validate the arguments
if
(
recvfrom_validate_args
(
sockfd
,
buf
,
len
,
flags
,
src_addr
,
addrlen
)
<
0
)
{
if
(
recvfrom_validate_args
(
sockfd
,
buf
,
len
,
flags
,
src_addr
,
addrlen
)
<
0
)
{
return
-
1
;
return
-
1
;
...
...
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