diff mbox

[ovs-dev,2/2] dpif: Log packet metadata on execute.

Message ID 1492127256-124251-2-git-send-email-jarno@ovn.org
State Accepted
Headers show

Commit Message

Jarno Rajahalme April 13, 2017, 11:47 p.m. UTC
Debug log output for execute operations is missing the packet
metadata, which can be instrumental in tracing what the datapath
should be executing.  No reason to have the metadata on the debug
output, so add it there.

Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
---
 lib/dpif.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Ben Pfaff April 15, 2017, 3:54 a.m. UTC | #1
On Thu, Apr 13, 2017 at 04:47:36PM -0700, Jarno Rajahalme wrote:
> Debug log output for execute operations is missing the packet
> metadata, which can be instrumental in tracing what the datapath
> should be executing.  No reason to have the metadata on the debug
> output, so add it there.
> 
> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>

This does seem like an important oversight.

Acked-by: Ben Pfaff <blp@ovn.org>
Jarno Rajahalme April 17, 2017, 7:37 p.m. UTC | #2
> On Apr 14, 2017, at 8:54 PM, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Thu, Apr 13, 2017 at 04:47:36PM -0700, Jarno Rajahalme wrote:
>> Debug log output for execute operations is missing the packet
>> metadata, which can be instrumental in tracing what the datapath
>> should be executing.  No reason to have the metadata on the debug
>> output, so add it there.
>> 
>> Signed-off-by: Jarno Rajahalme <jarno@ovn.org>
> 
> This does seem like an important oversight.
> 
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks for the review, pushed to master, and branches 2.5, 2.6, and 2.7. Cherry-pick on branch-2.4 was not clean, and I did not bother to resolve it for now.

  Jarno
diff mbox

Patch

diff --git a/lib/dpif.c b/lib/dpif.c
index 1760de8..4066f9c 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -1760,9 +1760,13 @@  log_execute_message(struct dpif *dpif, const struct dpif_execute *execute,
         && !execute->probe) {
         struct ds ds = DS_EMPTY_INITIALIZER;
         char *packet;
+        uint64_t stub[1024 / 8];
+        struct ofpbuf md = OFPBUF_STUB_INITIALIZER(stub);
 
         packet = ofp_packet_to_string(dp_packet_data(execute->packet),
                                       dp_packet_size(execute->packet));
+        odp_key_from_pkt_metadata(&md, &execute->packet->md);
+
         ds_put_format(&ds, "%s: %sexecute ",
                       dpif_name(dpif),
                       (subexecute ? "sub-"
@@ -1773,10 +1777,13 @@  log_execute_message(struct dpif *dpif, const struct dpif_execute *execute,
             ds_put_format(&ds, " failed (%s)", ovs_strerror(error));
         }
         ds_put_format(&ds, " on packet %s", packet);
+        ds_put_format(&ds, " with metadata ");
+        odp_flow_format(md.data, md.size, NULL, 0, NULL, &ds, true);
         ds_put_format(&ds, " mtu %d", execute->mtu);
         vlog(&this_module, error ? VLL_WARN : VLL_DBG, "%s", ds_cstr(&ds));
         ds_destroy(&ds);
         free(packet);
+        ofpbuf_uninit(&md);
     }
 }