Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ycai
simbricks
Commits
16113f39
"...composable_kernel.git" did not exist on "a3b4c5cbe3e0a2aea8fe505185cb2c6a9b7ab5c7"
Commit
16113f39
authored
Sep 16, 2020
by
Antoine Kaufmann
Browse files
i40e: support for multi-descriptor receives
parent
2756a0a9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
15 deletions
+29
-15
i40e_bm/i40e_bm.h
i40e_bm/i40e_bm.h
+2
-2
i40e_bm/i40e_lan.cc
i40e_bm/i40e_lan.cc
+26
-12
i40e_bm/i40e_queues.cc
i40e_bm/i40e_queues.cc
+1
-1
No files found.
i40e_bm/i40e_bm.h
View file @
16113f39
...
@@ -324,7 +324,7 @@ class lan_queue_base : public queue_base {
...
@@ -324,7 +324,7 @@ class lan_queue_base : public queue_base {
class
lan_queue_tx
:
public
lan_queue_base
{
class
lan_queue_tx
:
public
lan_queue_base
{
protected:
protected:
static
const
uint16_t
MTU
=
2048
;
static
const
uint16_t
MTU
=
9024
;
class
tx_desc_ctx
:
public
desc_ctx
{
class
tx_desc_ctx
:
public
desc_ctx
{
protected:
protected:
...
@@ -387,7 +387,7 @@ class lan_queue_rx : public lan_queue_base {
...
@@ -387,7 +387,7 @@ class lan_queue_rx : public lan_queue_base {
public:
public:
rx_desc_ctx
(
lan_queue_rx
&
queue_
);
rx_desc_ctx
(
lan_queue_rx
&
queue_
);
virtual
void
process
();
virtual
void
process
();
void
packet_received
(
const
void
*
data
,
size_t
len
);
void
packet_received
(
const
void
*
data
,
size_t
len
,
bool
last
);
};
};
uint16_t
dbuff_size
;
uint16_t
dbuff_size
;
...
...
i40e_bm/i40e_lan.cc
View file @
16113f39
...
@@ -258,22 +258,33 @@ queue_base::desc_ctx &lan_queue_rx::desc_ctx_create()
...
@@ -258,22 +258,33 @@ queue_base::desc_ctx &lan_queue_rx::desc_ctx_create()
void
lan_queue_rx
::
packet_received
(
const
void
*
data
,
size_t
pktlen
)
void
lan_queue_rx
::
packet_received
(
const
void
*
data
,
size_t
pktlen
)
{
{
if
(
dcache
.
empty
())
{
size_t
num_descs
=
(
pktlen
+
dbuff_size
-
1
)
/
dbuff_size
;
if
(
dcache
.
size
()
<
num_descs
)
{
#ifdef DEBUG_LAN
#ifdef DEBUG_LAN
log
<<
" empty, dropping packet"
<<
logger
::
endl
;
log
<<
" not enough rx descs ("
<<
num_descs
<<
", dropping packet"
<<
logger
::
endl
;
#endif
#endif
return
;
return
;
}
}
rx_desc_ctx
&
ctx
=
*
dcache
.
front
();
for
(
size_t
i
=
0
;
i
<
num_descs
;
i
++
)
{
rx_desc_ctx
&
ctx
=
*
dcache
.
front
();
#ifdef DEBUG_LAN
#ifdef DEBUG_LAN
log
<<
" packet received didx="
<<
ctx
.
index
<<
" cnt="
<<
log
<<
" packet
part="
<<
i
<<
"
received didx="
<<
ctx
.
index
<<
dcache
.
size
()
<<
logger
::
endl
;
" cnt="
<<
dcache
.
size
()
<<
logger
::
endl
;
#endif
#endif
dcache
.
pop_front
();
dcache
.
pop_front
();
ctx
.
packet_received
(
data
,
pktlen
);
const
uint8_t
*
buf
=
(
const
uint8_t
*
)
data
+
(
dbuff_size
*
i
);
if
(
i
==
num_descs
-
1
)
{
// last packet
ctx
.
packet_received
(
buf
,
pktlen
-
dbuff_size
*
i
,
true
);
}
else
{
ctx
.
packet_received
(
buf
,
dbuff_size
,
false
);
}
}
}
}
lan_queue_rx
::
rx_desc_ctx
::
rx_desc_ctx
(
lan_queue_rx
&
queue_
)
lan_queue_rx
::
rx_desc_ctx
::
rx_desc_ctx
(
lan_queue_rx
&
queue_
)
...
@@ -291,7 +302,8 @@ void lan_queue_rx::rx_desc_ctx::process()
...
@@ -291,7 +302,8 @@ void lan_queue_rx::rx_desc_ctx::process()
rq
.
dcache
.
push_back
(
this
);
rq
.
dcache
.
push_back
(
this
);
}
}
void
lan_queue_rx
::
rx_desc_ctx
::
packet_received
(
const
void
*
data
,
size_t
pktlen
)
void
lan_queue_rx
::
rx_desc_ctx
::
packet_received
(
const
void
*
data
,
size_t
pktlen
,
bool
last
)
{
{
union
i40e_32byte_rx_desc
*
rxd
=
reinterpret_cast
<
union
i40e_32byte_rx_desc
*
rxd
=
reinterpret_cast
<
union
i40e_32byte_rx_desc
*>
(
desc
);
union
i40e_32byte_rx_desc
*>
(
desc
);
...
@@ -300,11 +312,13 @@ void lan_queue_rx::rx_desc_ctx::packet_received(const void *data, size_t pktlen)
...
@@ -300,11 +312,13 @@ void lan_queue_rx::rx_desc_ctx::packet_received(const void *data, size_t pktlen)
memset
(
rxd
,
0
,
sizeof
(
*
rxd
));
memset
(
rxd
,
0
,
sizeof
(
*
rxd
));
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_DD_SHIFT
);
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_DD_SHIFT
);
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_EOF_SHIFT
);
// TODO: only if checksums are correct
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_L3L4P_SHIFT
);
rxd
->
wb
.
qword1
.
status_error_len
|=
(
pktlen
<<
I40E_RXD_QW1_LENGTH_PBUF_SHIFT
);
rxd
->
wb
.
qword1
.
status_error_len
|=
(
pktlen
<<
I40E_RXD_QW1_LENGTH_PBUF_SHIFT
);
if
(
last
)
{
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_EOF_SHIFT
);
// TODO: only if checksums are correct
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_L3L4P_SHIFT
);
}
data_write
(
addr
,
pktlen
,
data
);
data_write
(
addr
,
pktlen
,
data
);
}
}
...
...
i40e_bm/i40e_queues.cc
View file @
16113f39
...
@@ -290,7 +290,7 @@ void queue_base::desc_ctx::processed()
...
@@ -290,7 +290,7 @@ void queue_base::desc_ctx::processed()
state
=
DESC_PROCESSED
;
state
=
DESC_PROCESSED
;
}
}
#define MAX_DMA_SIZE ((size_t)
0x1000
)
#define MAX_DMA_SIZE ((size_t)
9024
)
void
queue_base
::
desc_ctx
::
data_fetch
(
uint64_t
addr
,
size_t
data_len
)
void
queue_base
::
desc_ctx
::
data_fetch
(
uint64_t
addr
,
size_t
data_len
)
{
{
...
...
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