[ovs-dev] [multipath 5/7] nx-match: Use [] in format_nxm_field_bits where possible.
Ben Pfaff
blp at nicira.com
Thu Dec 16 22:42:29 UTC 2010
This just makes formatting a bit more readable.
---
lib/nx-match.c | 8 +++++---
tests/ovs-ofctl.at | 2 +-
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/nx-match.c b/lib/nx-match.c
index 04c75b8..7d7abb2 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -950,10 +950,12 @@ static void
format_nxm_field_bits(struct ds *s, uint32_t header, int ofs, int n_bits)
{
format_nxm_field_name(s, header);
- if (n_bits != 1) {
- ds_put_format(s, "[%d..%d]", ofs, ofs + n_bits - 1);
- } else {
+ if (ofs == 0 && n_bits == nxm_field_bits(header)) {
+ ds_put_cstr(s, "[]");
+ } else if (n_bits == 1) {
ds_put_format(s, "[%d]", ofs);
+ } else {
+ ds_put_format(s, "[%d..%d]", ofs, ofs + n_bits - 1);
}
}
diff --git a/tests/ovs-ofctl.at b/tests/ovs-ofctl.at
index 94013e7..563a7c6 100644
--- a/tests/ovs-ofctl.at
+++ b/tests/ovs-ofctl.at
@@ -105,7 +105,7 @@ NXT_FLOW_MOD: ADD <any> cookie:0x123456789abcdef hard:10 pri:60000 actions=CONTR
NXT_FLOW_MOD: ADD <any> actions=note:41.42.43.00.00.00,note:00.01.02.03.04.05.06.07.00.00.00.00.00.00,note:00.00.00.00.00.00
NXT_FLOW_MOD: ADD NXM_NX_TUN_ID(0000000000001234) cookie:0x5678 actions=FLOOD
NXT_FLOW_MOD: ADD <any> actions=drop
-NXT_FLOW_MOD: ADD NXM_NX_REG0(0000007b) actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:55->NXM_NX_REG2[0..31],move:NXM_NX_REG0[0..31]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[0..15]
+NXT_FLOW_MOD: ADD NXM_NX_REG0(0000007b) actions=move:NXM_NX_REG0[0..5]->NXM_NX_REG1[26..31],load:55->NXM_NX_REG2[],move:NXM_NX_REG0[]->NXM_NX_TUN_ID[0..31],move:NXM_NX_REG0[0..15]->NXM_OF_VLAN_TCI[]
]])
AT_CLEANUP
--
1.7.1
More information about the dev
mailing list