The kernel now provides the entire flow key for a packet sent up to
userspace, but dpif_recv() would only log the in_port. This change makes
userspace log the entire flow key.
This would have made a bug that I recently looked at a bit easier to
investigate.
+/* Returns a string that represents 'type', for use in log messages. */
+const char *
+dpif_upcall_type_to_string(enum dpif_upcall_type type)
+{
+ switch (type) {
+ case DPIF_UC_MISS: return "miss";
+ case DPIF_UC_ACTION: return "action";
+ case DPIF_UC_SAMPLE: return "sample";
+ case DPIF_N_UC_TYPES: default: return "<unknown>";
+ }
+}
+
static bool OVS_UNUSED
is_valid_listen_mask(int listen_mask)
{
static bool OVS_UNUSED
is_valid_listen_mask(int listen_mask)
{
{
int error = dpif->dpif_class->recv(dpif, upcall);
if (!error && !VLOG_DROP_DBG(&dpmsg_rl)) {
{
int error = dpif->dpif_class->recv(dpif, upcall);
if (!error && !VLOG_DROP_DBG(&dpmsg_rl)) {
- struct flow flow;
- char *s;
-
- s = ofp_packet_to_string(upcall->packet->data,
- upcall->packet->size, upcall->packet->size);
- odp_flow_key_to_flow(upcall->key, upcall->key_len, &flow);
-
- VLOG_DBG("%s: %s upcall on port %"PRIu16": %s", dpif_name(dpif),
- (upcall->type == DPIF_UC_MISS ? "miss"
- : upcall->type == DPIF_UC_ACTION ? "action"
- : upcall->type == DPIF_UC_SAMPLE ? "sample"
- : "<unknown>"),
- flow.in_port, s);
- free(s);
+ struct ds flow;
+ char *packet;
+
+ packet = ofp_packet_to_string(upcall->packet->data,
+ upcall->packet->size,
+ upcall->packet->size);
+
+ ds_init(&flow);
+ odp_flow_key_format(upcall->key, upcall->key_len, &flow);
+
+ VLOG_DBG("%s: %s upcall:\n%s\n%s",
+ dpif_name(dpif), dpif_upcall_type_to_string(upcall->type),
+ ds_cstr(&flow), packet);
+
+ ds_destroy(&flow);
+ free(packet);
+const char *dpif_upcall_type_to_string(enum dpif_upcall_type);
+
/* A packet passed up from the datapath to userspace.
*
* If 'key' or 'actions' is nonnull, then it points into data owned by
/* A packet passed up from the datapath to userspace.
*
* If 'key' or 'actions' is nonnull, then it points into data owned by