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
5868864a
Commit
5868864a
authored
Apr 28, 2021
by
Leonardo Lai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check port validity at init time
parent
6235bedc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
9 deletions
+21
-9
udpdk/udpdk_init.c
udpdk/udpdk_init.c
+21
-9
No files found.
udpdk/udpdk_init.c
View file @
5868864a
...
...
@@ -110,9 +110,28 @@ static int init_mbuf_pools(void)
static
int
init_port
(
uint16_t
port_num
)
{
struct
rte_eth_dev_info
dev_info
;
// TODO add RSS support
const
uint16_t
rx_rings
=
1
;
const
uint16_t
tx_rings
=
1
;
uint16_t
rx_ring_size
=
NUM_RX_DESC_DEFAULT
;
uint16_t
tx_ring_size
=
NUM_TX_DESC_DEFAULT
;
uint16_t
q
;
int
retval
;
// Check port validity
if
(
!
rte_eth_dev_is_valid_port
(
port_num
))
{
RTE_LOG
(
ERR
,
INIT
,
"Port %d is invalid (out of range or not attached)
\n
"
,
port_num
);
return
-
1
;
}
// Retrieve port info
retval
=
rte_eth_dev_info_get
(
port_num
,
&
dev_info
);
if
(
retval
!=
0
)
{
RTE_LOG
(
ERR
,
INIT
,
"Error during getting device (port %u) info: %s
\n
"
,
port_num
,
strerror
(
-
retval
));
return
retval
;
}
rte_eth_dev_info_get
(
port_num
,
&
dev_info
);
const
struct
rte_eth_conf
port_conf
=
{
.
rxmode
=
{
.
mq_mode
=
ETH_MQ_RX_RSS
,
...
...
@@ -126,13 +145,6 @@ static int init_port(uint16_t port_num)
.
offloads
=
DEV_TX_OFFLOAD_MULTI_SEGS
,
}
};
// TODO add RSS support
const
uint16_t
rx_rings
=
1
;
const
uint16_t
tx_rings
=
1
;
uint16_t
rx_ring_size
=
NUM_RX_DESC_DEFAULT
;
uint16_t
tx_ring_size
=
NUM_TX_DESC_DEFAULT
;
uint16_t
q
;
int
retval
;
// Configure mode and number of rings
retval
=
rte_eth_dev_configure
(
port_num
,
rx_rings
,
tx_rings
,
&
port_conf
);
...
...
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