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
febc2a3a
Commit
febc2a3a
authored
Feb 12, 2021
by
Antoine Kaufmann
Browse files
sims: make cpplint happy
parent
f722a44f
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
40 deletions
+40
-40
sims/nic/i40e_bm/i40e_hmc.cc
sims/nic/i40e_bm/i40e_hmc.cc
+3
-4
sims/nic/i40e_bm/i40e_lan.cc
sims/nic/i40e_bm/i40e_lan.cc
+23
-21
sims/nic/i40e_bm/i40e_queues.cc
sims/nic/i40e_bm/i40e_queues.cc
+6
-7
sims/nic/i40e_bm/logger.cc
sims/nic/i40e_bm/logger.cc
+1
-1
sims/nic/i40e_bm/rss.cc
sims/nic/i40e_bm/rss.cc
+1
-1
sims/nic/i40e_bm/xsums.cc
sims/nic/i40e_bm/xsums.cc
+6
-6
No files found.
sims/nic/i40e_bm/i40e_hmc.cc
View file @
febc2a3a
...
...
@@ -27,9 +27,8 @@
#include <cassert>
#include <iostream>
#include "i40e_bm.h"
#include "i40e_base_wrapper.h"
#include "sims/nic/i40e_bm/i40e_bm.h"
#include "sims/nic/i40e_bm/i40e_base_wrapper.h"
using
namespace
i40e
;
...
...
@@ -116,7 +115,7 @@ void host_mem_cache::issue_mem_op(mem_op &op)
}
if
(
!
seg
->
valid
)
{
// TODO: errorinfo and data registers
// TODO
(antoinek)
: errorinfo and data registers
std
::
cerr
<<
"hmc issue_mem_op: segment invalid addr="
<<
addr
<<
std
::
endl
;
op
.
failed
=
true
;
...
...
sims/nic/i40e_bm/i40e_lan.cc
View file @
febc2a3a
...
...
@@ -28,10 +28,9 @@
#include <iostream>
#include <arpa/inet.h>
#include "i40e_bm.h"
#include "i40e_base_wrapper.h"
#include "headers.h"
#include "sims/nic/i40e_bm/i40e_bm.h"
#include "sims/nic/i40e_bm/i40e_base_wrapper.h"
#include "sims/nic/i40e_bm/headers.h"
using
namespace
i40e
;
...
...
@@ -102,19 +101,19 @@ bool lan::rss_steering(const void *data, size_t len, uint16_t &queue,
{
hash
=
0
;
const
headers
::
pkt_tcp
*
tcp
=
reinterpret_cast
<
const
headers
::
pkt_tcp
*>
(
data
);
const
headers
::
pkt_udp
*
udp
=
reinterpret_cast
<
const
headers
::
pkt_udp
*>
(
data
);
const
headers
::
pkt_tcp
*
tcp
=
reinterpret_cast
<
const
headers
::
pkt_tcp
*>
(
data
);
const
headers
::
pkt_udp
*
udp
=
reinterpret_cast
<
const
headers
::
pkt_udp
*>
(
data
);
// should actually determine packet type and mask with enabled packet types
// TODO: ipv6
// TODO
(antoinek)
: ipv6
if
(
tcp
->
eth
.
type
==
htons
(
ETH_TYPE_IP
)
&&
tcp
->
ip
.
proto
==
IP_PROTO_TCP
)
{
tcp
->
ip
.
proto
==
IP_PROTO_TCP
)
{
hash
=
rss_kc
.
hash_ipv4
(
ntohl
(
tcp
->
ip
.
src
),
ntohl
(
tcp
->
ip
.
dest
),
ntohs
(
tcp
->
tcp
.
src
),
ntohs
(
tcp
->
tcp
.
dest
));
}
else
if
(
udp
->
eth
.
type
==
htons
(
ETH_TYPE_IP
)
&&
udp
->
ip
.
proto
==
IP_PROTO_UDP
)
{
udp
->
ip
.
proto
==
IP_PROTO_UDP
)
{
hash
=
rss_kc
.
hash_ipv4
(
ntohl
(
udp
->
ip
.
src
),
ntohl
(
udp
->
ip
.
dest
),
ntohs
(
udp
->
udp
.
src
),
ntohs
(
udp
->
udp
.
dest
));
}
else
if
(
udp
->
eth
.
type
==
htons
(
ETH_TYPE_IP
))
{
...
...
@@ -205,7 +204,7 @@ void lan_queue_base::disable()
log
<<
" lan disabling queue "
<<
idx
<<
logger
::
endl
;
#endif
enabled
=
false
;
// TODO: write back
// TODO
(antoinek)
: write back
reg_ena
&=
~
I40E_QRX_ENA_QENA_STAT_MASK
;
}
...
...
@@ -242,7 +241,6 @@ void lan_queue_base::interrupt()
uint8_t
itr
=
(
qctl
&
I40E_QINT_TQCTL_ITR_INDX_MASK
)
>>
I40E_QINT_TQCTL_ITR_INDX_SHIFT
;
lanmgr
.
dev
.
signal_interrupt
(
msix_idx
,
itr
);
}
lan_queue_base
::
qctx_fetch
::
qctx_fetch
(
lan_queue_base
&
lq_
)
...
...
@@ -382,12 +380,14 @@ void lan_queue_rx::rx_desc_ctx::packet_received(const void *data,
memset
(
rxd
,
0
,
sizeof
(
*
rxd
));
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_DD_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
);
// TODO(antoinek): only if checksums are correct
rxd
->
wb
.
qword1
.
status_error_len
|=
(
1
<<
I40E_RX_DESC_STATUS_L3L4P_SHIFT
);
}
data_write
(
addr
,
pktlen
,
data
);
}
...
...
@@ -527,7 +527,8 @@ bool lan_queue_tx::trigger_tx_packet()
l4t
=
(
cmd
&
I40E_TX_DESC_CMD_L4T_EOFT_MASK
);
if
(
eop
)
{
uint32_t
off
=
(
d1
&
I40E_TXD_QW1_OFFSET_MASK
)
>>
I40E_TXD_QW1_OFFSET_SHIFT
;
uint32_t
off
=
(
d1
&
I40E_TXD_QW1_OFFSET_MASK
)
>>
I40E_TXD_QW1_OFFSET_SHIFT
;
maclen
=
((
off
&
I40E_TXD_QW1_MACLEN_MASK
)
>>
I40E_TX_DESC_LENGTH_MACLEN_SHIFT
)
*
2
;
iplen
=
((
off
&
I40E_TXD_QW1_IPLEN_MASK
)
>>
...
...
@@ -663,7 +664,7 @@ bool lan_queue_tx::trigger_tx_packet()
void
lan_queue_tx
::
trigger_tx
()
{
while
(
trigger_tx_packet
())
;
while
(
trigger_tx_packet
())
{}
}
lan_queue_tx
::
tx_desc_ctx
::
tx_desc_ctx
(
lan_queue_tx
&
queue_
)
...
...
@@ -697,15 +698,16 @@ void lan_queue_tx::tx_desc_ctx::prepare()
struct
i40e_tx_context_desc
*
ctxd
=
reinterpret_cast
<
struct
i40e_tx_context_desc
*>
(
d
);
queue
.
log
<<
" context descriptor: tp="
<<
ctxd
->
tunneling_params
<<
" l2t="
<<
ctxd
->
l2tag2
<<
" tctm="
<<
ctxd
->
type_cmd_tso_mss
<<
logger
::
endl
;
" l2t="
<<
ctxd
->
l2tag2
<<
" tctm="
<<
ctxd
->
type_cmd_tso_mss
<<
logger
::
endl
;
#endif
prepared
();
}
else
{
queue
.
log
<<
"txq: only support context & data descriptors"
<<
logger
::
endl
;
queue
.
log
<<
"txq: only support context & data descriptors"
<<
logger
::
endl
;
abort
();
}
}
void
lan_queue_tx
::
tx_desc_ctx
::
process
()
...
...
sims/nic/i40e_bm/i40e_queues.cc
View file @
febc2a3a
...
...
@@ -28,9 +28,8 @@
#include <iostream>
#include <algorithm>
#include "i40e_bm.h"
#include "i40e_base_wrapper.h"
#include "sims/nic/i40e_bm/i40e_bm.h"
#include "sims/nic/i40e_bm/i40e_base_wrapper.h"
using
namespace
i40e
;
...
...
@@ -38,8 +37,8 @@ extern nicbm::Runner *runner;
queue_base
::
queue_base
(
const
std
::
string
&
qname_
,
uint32_t
&
reg_head_
,
uint32_t
&
reg_tail_
)
:
qname
(
qname_
),
log
(
qname_
),
active_first_pos
(
0
),
active_first_idx
(
0
),
active_cnt
(
0
),
base
(
0
),
len
(
0
),
reg_head
(
reg_head_
),
reg_tail
(
reg_tail_
),
:
qname
(
qname_
),
log
(
qname_
),
active_first_pos
(
0
),
active_first_idx
(
0
),
active_cnt
(
0
),
base
(
0
),
len
(
0
),
reg_head
(
reg_head_
),
reg_tail
(
reg_tail_
),
enabled
(
false
),
desc_len
(
0
)
{
for
(
size_t
i
=
0
;
i
<
MAX_ACTIVE_DESCS
;
i
++
)
{
...
...
@@ -346,7 +345,6 @@ void queue_base::desc_ctx::data_fetch(uint64_t addr, size_t data_len)
queue
.
log
<<
" dma = "
<<
dma
<<
" data="
<<
data
<<
logger
::
endl
;
#endif
runner
->
issue_dma
(
*
dma
);
}
void
queue_base
::
desc_ctx
::
data_fetched
(
uint64_t
addr
,
size_t
len
)
...
...
@@ -427,7 +425,8 @@ void queue_base::dma_data_fetch::done()
if
(
part_offset
<
total_len
)
{
#ifdef DEBUG_QUEUES
ctx
.
queue
.
log
<<
" dma_fetch: next part of multi part dma"
<<
logger
::
endl
;
ctx
.
queue
.
log
<<
" dma_fetch: next part of multi part dma"
<<
logger
::
endl
;
#endif
len
=
std
::
min
(
total_len
-
part_offset
,
MAX_DMA_SIZE
);
runner
->
issue_dma
(
*
this
);
...
...
sims/nic/i40e_bm/logger.cc
View file @
febc2a3a
...
...
@@ -24,7 +24,7 @@
#include <iostream>
#include "i40e_bm.h"
#include "
sims/nic/i40e_bm/
i40e_bm.h"
using
namespace
i40e
;
...
...
sims/nic/i40e_bm/rss.cc
View file @
febc2a3a
...
...
@@ -22,7 +22,7 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "i40e_bm.h"
#include "
sims/nic/i40e_bm/
i40e_bm.h"
using
namespace
i40e
;
...
...
sims/nic/i40e_bm/xsums.cc
View file @
febc2a3a
...
...
@@ -12,7 +12,7 @@
#include <cassert>
#include <iostream>
#include "i40e_bm.h"
#include "
sims/nic/i40e_bm/
i40e_bm.h"
namespace
i40e
{
...
...
@@ -44,7 +44,8 @@ struct ipv4_hdr {
uint32_t
dst_addr
;
/**< destination address */
}
__attribute__
((
packed
));
static
inline
uint32_t
__rte_raw_cksum
(
const
void
*
buf
,
size_t
len
,
uint32_t
sum
)
static
inline
uint32_t
__rte_raw_cksum
(
const
void
*
buf
,
size_t
len
,
uint32_t
sum
)
{
/* workaround gcc strict-aliasing warning */
uintptr_t
ptr
=
(
uintptr_t
)
buf
;
...
...
@@ -115,8 +116,8 @@ void xsum_tcp(void *tcphdr, size_t l4_len)
{
struct
rte_tcp_hdr
*
tcph
=
reinterpret_cast
<
struct
rte_tcp_hdr
*>
(
tcphdr
);
uint32_t
cksum
=
rte_raw_cksum
(
tcphdr
,
l4_len
);
cksum
=
((
cksum
&
0xffff0000
)
>>
16
)
+
(
cksum
&
0xffff
);
cksum
=
(
~
cksum
)
&
0xffff
;
cksum
=
((
cksum
&
0xffff0000
)
>>
16
)
+
(
cksum
&
0xffff
);
cksum
=
(
~
cksum
)
&
0xffff
;
tcph
->
cksum
=
cksum
;
}
...
...
@@ -155,5 +156,4 @@ void tso_postupdate_header(void *iphdr, uint8_t iplen, uint8_t l4len,
ih
->
packet_id
=
htons
(
ntohs
(
ih
->
packet_id
)
+
1
);
}
}
}
// namespace i40e
Prev
1
2
Next
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