2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

Format tunnel IDs consistently.

Some code failed to convert tunnel IDs to host byte order for printing,
so this fixes that.  Some code printed tunnel IDs with a 0x prefix and
other code didn't, so this code uses the '#' flag consistently (which
prints 0x for nonzero values and omits it for zero).

This commit also stops always printing all 8 digits.  When tunnel IDs
are expanded to 64 bits, as they will be soon, printing 16 digits all the
time wastes too much space.

Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Ben Pfaff
2010-11-30 16:54:50 -08:00
parent 8e6c8ff5ae
commit 5b16f00916
3 changed files with 5 additions and 5 deletions

View File

@@ -42,8 +42,8 @@ odp_actions_add(struct odp_actions *actions, uint16_t type)
void
format_odp_flow_key(struct ds *ds, const struct odp_flow_key *key)
{
ds_put_format(ds, "tun_id0x%08x in_port%d tci(",
key->tun_id, key->in_port);
ds_put_format(ds, "tun_id%#"PRIx32" in_port%d tci(",
ntohl(key->tun_id), key->in_port);
if (key->dl_tci) {
ds_put_format(ds, "vlan%"PRIu16",pcp%d",
vlan_tci_to_vid(key->dl_tci),
@@ -70,7 +70,7 @@ format_odp_action(struct ds *ds, const union odp_action *a)
ds_put_format(ds, "ctl(%"PRIu32")", a->controller.arg);
break;
case ODPAT_SET_TUNNEL:
ds_put_format(ds, "set_tunnel(0x%08"PRIx32")", ntohl(a->tunnel.tun_id));
ds_put_format(ds, "set_tunnel(%#"PRIx32")", ntohl(a->tunnel.tun_id));
break;
case ODPAT_SET_DL_TCI:
ds_put_format(ds, "set_tci(vid=%"PRIu16",pcp=%d)",