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
e14a8f93
Commit
e14a8f93
authored
Nov 05, 2020
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup memory
parent
ef89d0c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
6 deletions
+42
-6
udpdk/list/udpdk_list_init.c
udpdk/list/udpdk_list_init.c
+0
-5
udpdk/udpdk_bind_table.c
udpdk/udpdk_bind_table.c
+6
-0
udpdk/udpdk_init.c
udpdk/udpdk_init.c
+28
-0
udpdk/udpdk_poller.c
udpdk/udpdk_poller.c
+8
-1
No files found.
udpdk/list/udpdk_list_init.c
View file @
e14a8f93
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
extern
const
void
*
list_t_alloc
;
extern
const
void
*
list_t_alloc
;
extern
const
void
*
list_node_t_alloc
;
extern
const
void
*
list_node_t_alloc
;
extern
const
void
*
list_iterator_t_alloc
;
extern
const
void
*
list_iterator_t_alloc
;
extern
const
void
*
bind_info_alloc
;
void
udpdk_list_init
(
void
)
void
udpdk_list_init
(
void
)
{
{
...
@@ -27,10 +26,6 @@ int udpdk_list_reinit(void)
...
@@ -27,10 +26,6 @@ int udpdk_list_reinit(void)
if
(
list_iterator_t_alloc
==
NULL
)
{
if
(
list_iterator_t_alloc
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
bind_info_alloc
=
udpdk_retrieve_allocator
(
"bind_info_alloc"
);
if
(
bind_info_alloc
==
NULL
)
{
return
-
1
;
}
return
0
;
return
0
;
}
}
...
...
udpdk/udpdk_bind_table.c
View file @
e14a8f93
...
@@ -151,3 +151,9 @@ void btable_del_binding(int s, int port) {
...
@@ -151,3 +151,9 @@ void btable_del_binding(int s, int port) {
list_t
*
btable_get_bindings
(
int
port
)
{
list_t
*
btable_get_bindings
(
int
port
)
{
return
sock_bind_table
[
port
];
return
sock_bind_table
[
port
];
}
}
/* Destroy the bindings table */
void
btable_destroy
(
void
)
{
udpdk_destroy_allocator
(
bind_info_alloc
);
}
udpdk/udpdk_init.c
View file @
e14a8f93
...
@@ -253,6 +253,17 @@ static int init_udp_bind_table(void)
...
@@ -253,6 +253,17 @@ static int init_udp_bind_table(void)
return
0
;
return
0
;
}
}
/* Destroy table for UDP port switching */
static
int
destroy_udp_bind_table
(
void
)
{
const
struct
rte_memzone
*
mz
;
btable_destroy
();
mz
=
rte_memzone_lookup
(
UDP_BIND_TABLE_NAME
);
return
rte_memzone_free
(
mz
);
}
/* Initialize slots to exchange packets between the application and the poller */
/* Initialize slots to exchange packets between the application and the poller */
static
int
init_exchange_slots
(
void
)
static
int
init_exchange_slots
(
void
)
{
{
...
@@ -369,6 +380,16 @@ void udpdk_interrupt(int signum)
...
@@ -369,6 +380,16 @@ void udpdk_interrupt(int signum)
interrupted
=
1
;
interrupted
=
1
;
}
}
static
void
udpdk_close_all_sockets
(
void
)
{
for
(
int
s
=
0
;
s
<
NUM_SOCKETS_MAX
;
s
++
)
{
if
(
exch_zone_desc
->
slots
[
s
].
bound
)
{
RTE_LOG
(
INFO
,
CLOSE
,
"Closing socket %d that was left open
\n
"
,
s
);
udpdk_close
(
s
);
}
}
}
void
udpdk_cleanup
(
void
)
void
udpdk_cleanup
(
void
)
{
{
uint16_t
port_id
;
uint16_t
port_id
;
...
@@ -390,5 +411,12 @@ void udpdk_cleanup(void)
...
@@ -390,5 +411,12 @@ void udpdk_cleanup(void)
rte_eth_dev_close
(
port_id
);
rte_eth_dev_close
(
port_id
);
}
}
// Close all open sockets
udpdk_close_all_sockets
();
// Free the bindings table
destroy_udp_bind_table
();
// Release linked-list memory allocators
udpdk_list_deinit
();
udpdk_list_deinit
();
}
}
udpdk/udpdk_poller.c
View file @
e14a8f93
...
@@ -38,6 +38,7 @@ static volatile int poller_alive = 1;
...
@@ -38,6 +38,7 @@ static volatile int poller_alive = 1;
extern
struct
exch_zone_info
*
exch_zone_desc
;
extern
struct
exch_zone_info
*
exch_zone_desc
;
extern
struct
exch_slot
*
exch_slots
;
extern
struct
exch_slot
*
exch_slots
;
extern
list_t
**
sock_bind_table
;
extern
list_t
**
sock_bind_table
;
extern
const
void
*
bind_info_alloc
;
/* Descriptor of a RX queue */
/* Descriptor of a RX queue */
struct
rx_queue
{
struct
rx_queue
{
...
@@ -86,8 +87,14 @@ static inline const char * get_exch_ring_name(unsigned id, enum exch_ring_func f
...
@@ -86,8 +87,14 @@ static inline const char * get_exch_ring_name(unsigned id, enum exch_ring_func f
/* Initialize the allocators */
/* Initialize the allocators */
static
int
setup_allocators
(
void
)
static
int
setup_allocators
(
void
)
{
{
bind_info_alloc
=
udpdk_retrieve_allocator
(
"bind_info_alloc"
);
if
(
bind_info_alloc
==
NULL
)
{
RTE_LOG
(
ERR
,
POLLINIT
,
"Cannot retrieve bind_info shmem allocator
\n
"
);
return
-
1
;
}
if
(
udpdk_list_reinit
()
<
0
)
{
if
(
udpdk_list_reinit
()
<
0
)
{
RTE_LOG
(
ERR
,
POLLINIT
,
"Cannot retrieve shmem allocators
\n
"
);
RTE_LOG
(
ERR
,
POLLINIT
,
"Cannot retrieve
list
shmem allocators
\n
"
);
return
-
1
;
return
-
1
;
}
}
return
0
;
return
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