Skip to content

Commit deb3a15

Browse files
committed
code review comments
1 parent 55d4d6e commit deb3a15

File tree

2 files changed

+29
-21
lines changed

2 files changed

+29
-21
lines changed

dpd/p4/sidecar.p4

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1183,6 +1183,10 @@ control Router4 (
11831183
fwd.idx = 0;
11841184
fwd.slots = 0;
11851185
fwd.slot = 0;
1186+
// Our route selection table is 11 bits wide, and we need 5 bits
1187+
// of that for our "slot count" index. Thus, we only need 6
1188+
// bits of the 8-bit hash calculated here to complete the 11-bit
1189+
// index.
11861190
fwd.ecmp_hash = index_hash.get({
11871191
hdr.ipv4.dst_addr,
11881192
hdr.ipv4.src_addr,
@@ -1320,6 +1324,10 @@ control Router6 (
13201324
fwd.idx = 0;
13211325
fwd.slots = 0;
13221326
fwd.slot = 0;
1327+
// Our route selection table is 11 bits wide, and we need 5 bits
1328+
// of that for our "slot count" index. Thus, we only need 6
1329+
// bits of the 8-bit hash calculated here to complete the 11-bit
1330+
// index.
13231331
fwd.ecmp_hash = index_hash.get({
13241332
hdr.ipv6.dst_addr,
13251333
hdr.ipv6.src_addr,

dpd/src/table/route_ipv6.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ pub fn add_route_index(
6969
match s.table_entry_add(TableType::RouteIdxIpv6, &match_key, &action_data) {
7070
Ok(()) => {
7171
info!(s.log, "added ipv6 route index";
72-
"route" => %cidr,
73-
"index" => %idx,
74-
"slots" => %slots);
72+
"route" => %cidr,
73+
"index" => %idx,
74+
"slots" => %slots);
7575
Ok(())
7676
}
7777
Err(e) => {
7878
error!(s.log, "failed to add ipv6 route index";
79-
"route" => %cidr,
80-
"index" => %idx,
81-
"slots" => %slots,
82-
"error" => %e);
79+
"route" => %cidr,
80+
"index" => %idx,
81+
"slots" => %slots,
82+
"error" => %e);
8383
Err(e)
8484
}
8585
}
@@ -93,8 +93,8 @@ pub fn delete_route_index(s: &Switch, cidr: &Ipv6Net) -> DpdResult<()> {
9393
.map(|_| info!(s.log, "deleted ipv6 index"; "route" => %cidr))
9494
.map_err(|e| {
9595
error!(s.log, "failed to delete ipv6 index";
96-
"route" => %cidr,
97-
"error" => %e);
96+
"route" => %cidr,
97+
"error" => %e);
9898
e
9999
})
100100
}
@@ -123,18 +123,18 @@ pub fn add_route_target(
123123
match s.table_entry_add(TableType::RouteFwdIpv6, &match_key, &action_data) {
124124
Ok(()) => {
125125
info!(s.log, "added ipv6 route entry";
126-
"index" => idx,
127-
"port" => port,
128-
"nexthop" => %nexthop,
129-
"vlan_id" => ?vlan_id);
126+
"index" => idx,
127+
"port" => port,
128+
"nexthop" => %nexthop,
129+
"vlan_id" => ?vlan_id);
130130
Ok(())
131131
}
132132
Err(e) => {
133133
error!(s.log, "failed to add ipv6 route entry";
134-
"index" => idx,
135-
"port" => port,
136-
"nexthop" => %nexthop,
137-
"error" => %e);
134+
"index" => idx,
135+
"port" => port,
136+
"nexthop" => %nexthop,
137+
"error" => %e);
138138
Err(e)
139139
}
140140
}
@@ -148,8 +148,8 @@ pub fn delete_route_target(s: &Switch, idx: u16) -> DpdResult<()> {
148148
.map(|_| info!(s.log, "deleted ipv6 route entry"; "index" => %idx))
149149
.map_err(|e| {
150150
error!(s.log, "failed to delete ipv6 route entry";
151-
"index" => %idx,
152-
"error" => %e);
151+
"index" => %idx,
152+
"error" => %e);
153153
e
154154
})
155155
}
@@ -181,14 +181,14 @@ pub fn reset(s: &Switch) -> DpdResult<()> {
181181
.map(|_| info!(s.log, "reset ipv6 route-index table"))
182182
.map_err(|e| {
183183
error!(s.log, "failed to clear ipv6 route-index table";
184-
"error" => %e);
184+
"error" => %e);
185185
e
186186
})?;
187187
s.table_clear(TableType::RouteFwdIpv6)
188188
.map(|_| info!(s.log, "reset ipv6 route-data table"))
189189
.map_err(|e| {
190190
error!(s.log, "failed to clear ipv6 route-data table";
191-
"error" => %e);
191+
"error" => %e);
192192
e
193193
})
194194
}

0 commit comments

Comments
 (0)