Commit 1b86fa3b authored by Petr Machata's avatar Petr Machata Committed by David S. Miller

selftests: forwarding: multipath_eval(): Improve style

- Change the indentation of the function body from 7 spaces to one tab.
- Move initialization of weights_ratio up so that it can be referenced
  from the error message about packet difference being zero.
- Move |'s consistently to continuation line, which reindent.
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b2c47872
...@@ -568,6 +568,14 @@ multipath_eval() ...@@ -568,6 +568,14 @@ multipath_eval()
RET=0 RET=0
if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
weights_ratio=$(echo "scale=2; $weight_rp12 / $weight_rp13" \
| bc -l)
else
weights_ratio=$(echo "scale=2; $weight_rp13 / $weight_rp12" \
| bc -l)
fi
if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then if [[ "$packets_rp12" -eq "0" || "$packets_rp13" -eq "0" ]]; then
check_err 1 "Packet difference is 0" check_err 1 "Packet difference is 0"
log_test "Multipath" log_test "Multipath"
...@@ -576,15 +584,11 @@ multipath_eval() ...@@ -576,15 +584,11 @@ multipath_eval()
fi fi
if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then if [[ "$weight_rp12" -gt "$weight_rp13" ]]; then
weights_ratio=$(echo "scale=2; $weight_rp12 / $weight_rp13" \
| bc -l)
packets_ratio=$(echo "scale=2; $packets_rp12 / $packets_rp13" \ packets_ratio=$(echo "scale=2; $packets_rp12 / $packets_rp13" \
| bc -l) | bc -l)
else else
weights_ratio=$(echo "scale=2; $weight_rp13 / $weight_rp12" | \ packets_ratio=$(echo "scale=2; $packets_rp13 / $packets_rp12" \
bc -l) | bc -l)
packets_ratio=$(echo "scale=2; $packets_rp13 / $packets_rp12" | \
bc -l)
fi fi
diff=$(echo $weights_ratio - $packets_ratio | bc -l) diff=$(echo $weights_ratio - $packets_ratio | bc -l)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment