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
1635c937
Commit
1635c937
authored
Aug 13, 2021
by
Antoine Kaufmann
Browse files
sims/net/switch: only look up mac address once per packet
parent
43825889
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
sims/net/switch/net_switch.cc
sims/net/switch/net_switch.cc
+3
-2
No files found.
sims/net/switch/net_switch.cc
View file @
1635c937
...
...
@@ -409,8 +409,9 @@ static void switch_pkt(Port &port, size_t iport) {
mac_table
[
src
]
=
iport
;
}
// L2 forwarding
if
(
mac_table
.
count
(
dst
)
>
0
)
{
size_t
eport
=
mac_table
.
at
(
dst
);
auto
i
=
mac_table
.
find
(
dst
);
if
(
i
!=
mac_table
.
end
())
{
size_t
eport
=
i
->
second
;
forward_pkt
(
pkt_data
,
pkt_len
,
eport
);
}
else
{
// Broadcast
...
...
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