[ovs-dev] [PATCH] ofproto-dpif-xlate: use xlate error enum for unsupported packet type
Zoltán Balogh
zoltan.balogh at ericsson.com
Mon Aug 21 08:34:41 UTC 2017
Instead of using the value 1 a new enum should be used for indicating
translation error which occurs because of unsupported packet type.
Signed-off-by: Zoltan Balogh <zoltan.balogh at ericsson.com>
Signed-off-by: Jan Scheurich <jan.scheurich at ericsson.com>
Co-authored-by: Jan Scheurich <jan.scheurich at ericsson.com>
Fixes: f839892a206a ("OF support and translation of generic encap and
decap")
CC: Jan Scheurich <jan.scheurich at ericsson.com>
---
ofproto/ofproto-dpif-xlate.c | 12 +++++++-----
ofproto/ofproto-dpif-xlate.h | 1 +
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 973e76054..d56a5de3a 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -424,6 +424,8 @@ const char *xlate_strerror(enum xlate_error error)
return "Too many MPLS labels";
case XLATE_INVALID_TUNNEL_METADATA:
return "Invalid tunnel metadata";
+ case XLATE_UNSUPPORTED_PACKET_TYPE:
+ return "Unsupported packet type";
}
return "Unknown error";
}
@@ -5798,7 +5800,7 @@ rewrite_flow_encap_ethernet(struct xlate_ctx *ctx,
xlate_report_debug(ctx, OFT_ACTION,
"Dropping packet as encap(ethernet) is not "
"supported for packet type ethernet.");
- ctx->error = 1;
+ ctx->error = XLATE_UNSUPPORTED_PACKET_TYPE;
}
}
@@ -5879,7 +5881,7 @@ rewrite_flow_encap_nsh(struct xlate_ctx *ctx,
"Dropping packet as encap(nsh) is not "
"supported for packet type (%d,0x%x)",
pt_ns(packet_type), pt_ns_type(packet_type));
- ctx->error = 1;
+ ctx->error = XLATE_UNSUPPORTED_PACKET_TYPE;
return buf;
}
/* Note that we have matched on packet_type! */
@@ -5963,7 +5965,7 @@ xlate_generic_decap_action(struct xlate_ctx *ctx,
/* Error handling: drop packet. */
xlate_report_debug(ctx, OFT_ACTION, "Dropping packet, cannot "
"decap Ethernet if VLAN is present.");
- ctx->error = 1;
+ ctx->error = XLATE_UNSUPPORTED_PACKET_TYPE;
} else {
/* Just change the packet_type.
* Delay generating pop_eth to the next commit. */
@@ -5994,7 +5996,7 @@ xlate_generic_decap_action(struct xlate_ctx *ctx,
xlate_report_debug(ctx, OFT_ACTION,
"Dropping packet as NSH next protocol %d "
"is not supported", flow->nsh.np);
- ctx->error = 1;
+ ctx->error = XLATE_UNSUPPORTED_PACKET_TYPE;
return false;
break;
}
@@ -6008,7 +6010,7 @@ xlate_generic_decap_action(struct xlate_ctx *ctx,
"Dropping packet as the decap() does not support "
"packet type (%d,0x%x)",
pt_ns(flow->packet_type), pt_ns_type(flow->packet_type));
- ctx->error = 1;
+ ctx->error = XLATE_UNSUPPORTED_PACKET_TYPE;
return false;
}
}
diff --git a/ofproto/ofproto-dpif-xlate.h b/ofproto/ofproto-dpif-xlate.h
index a299d109f..39542de2b 100644
--- a/ofproto/ofproto-dpif-xlate.h
+++ b/ofproto/ofproto-dpif-xlate.h
@@ -211,6 +211,7 @@ enum xlate_error {
XLATE_RECIRCULATION_CONFLICT,
XLATE_TOO_MANY_MPLS_LABELS,
XLATE_INVALID_TUNNEL_METADATA,
+ XLATE_UNSUPPORTED_PACKET_TYPE,
};
const char *xlate_strerror(enum xlate_error error);
--
2.11.0
More information about the dev
mailing list