Message ID | AM2PR07MB1042BCA89E7A4FB6FF029A118AC40@AM2PR07MB1042.eurprd07.prod.outlook.com |
---|---|
State | Superseded |
Headers | show |
On Mon, Jun 19, 2017 at 04:11:01PM +0000, Zoltán Balogh wrote: > Hi Ben, > > I've been testing L2/L3 tunneling and ptap ports receiving/transmitting L2 and L3 packets. > I observed, that 'ovs-appctl dpctl/dump-flows' prints out packet_type 'id' in decimal format. > For instance, in case of receiving a L3 MPLS packet on a ptap port results in: > > tunnel(src=20.0.0.1,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(7),packet_type(ns=1,id=34887),eth_type(0x8847), packets:24, bytes:2112, used:0.064s, actions:drop > > Would not it be more readable, to use hex format if the 'id' is not zero? > > By applying this diff: > > diff --git a/lib/odp-util.c b/lib/odp-util.c > index ef8651247..72f4f2324 100644 > --- a/lib/odp-util.c > +++ b/lib/odp-util.c > @@ -2992,7 +2992,10 @@ format_odp_key_attr(const struct nlattr *a, const struct nlattr *ma, > > ovs_be16 ns_type = pt_ns_type_be(value); > ovs_be16 ns_type_mask = pt_ns_type_be(mask); > - format_be16(ds, "id", ns_type, &ns_type_mask, verbose); > + if (ns_type) > + format_be16x(ds, "id", ns_type, &ns_type_mask, verbose); > + else > + format_be16(ds, "id", ns_type, &ns_type_mask, verbose); > > ds_chomp(ds, ','); > break; > > ... we can get printouts like this: > > recirc_id(0),in_port(4),packet_type(ns=0,id=0),eth_type(0x0800),ipv4(frag=no), packets:0, bytes:0, used:never, actions:9 > tunnel(src=20.0.0.1,dst=20.0.0.2,flags(-df-csum)),recirc_id(0),in_port(7),packet_type(ns=1,id=0x8847),eth_type(0x8847), packets:0, bytes:0, used:never, actions:drop Sure, that's a good idea. I think we can make it unconditionally hex, though. There are only a few packet_types defined, and I think it's OK to show all of them with hex as the ns_type. I'll fold this into the next version.
diff --git a/lib/odp-util.c b/lib/odp-util.c index ef8651247..72f4f2324 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -2992,7 +2992,10 @@ format_odp_key_attr(const struct nlattr *a, const struct nlattr *ma, ovs_be16 ns_type = pt_ns_type_be(value); ovs_be16 ns_type_mask = pt_ns_type_be(mask); - format_be16(ds, "id", ns_type, &ns_type_mask, verbose); + if (ns_type) + format_be16x(ds, "id", ns_type, &ns_type_mask, verbose); + else + format_be16(ds, "id", ns_type, &ns_type_mask, verbose); ds_chomp(ds, ','); break;