From patchwork Fri Aug 23 03:16:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 269270 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id D665B2C0099 for ; Fri, 23 Aug 2013 13:15:15 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753963Ab3HWDPF (ORCPT ); Thu, 22 Aug 2013 23:15:05 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:36693 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753574Ab3HWDPD (ORCPT ); Thu, 22 Aug 2013 23:15:03 -0400 Received: from penelope.isobedori.kobe.vergenet.net (g1-27-253-175-90.bmobile.ne.jp [27.253.175.90]) by kirsty.vergenet.net (Postfix) with ESMTP id C449325C011; Fri, 23 Aug 2013 13:15:00 +1000 (EST) Received: by penelope.isobedori.kobe.vergenet.net (Postfix, from userid 7100) id CA1E37C01D0; Fri, 23 Aug 2013 13:16:57 +1000 (ChST) From: Simon Horman To: dev@openvswitch.org, netdev@vger.kernel.org Cc: Ravi K , Isaku Yamahata , Jesse Gross , Pravin B Shelar , Joe Stringer Subject: [PATCH v2.38 3/6] ofp-actions: Add OFPUTIL_OFPAT13_PUSH_MPLS Date: Fri, 23 Aug 2013 13:16:53 +1000 Message-Id: <1377227816-15303-4-git-send-email-horms@verge.net.au> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377227816-15303-1-git-send-email-horms@verge.net.au> References: <1377227816-15303-1-git-send-email-horms@verge.net.au> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Joe Stringer This patch adds a new compatibility enum for use with MPLS, so that the differing behaviour between OpenFlow 1.2 and 1.3 can be implemented in ofproto-dpif-xlate. Signed-off-by: Joe Stringer Signed-off-by: Simon Horman --- v2.36 - v2.38 * No change v2.35 * First post --- lib/ofp-actions.c | 5 ++++- lib/ofp-parse.c | 1 + lib/ofp-util.c | 3 +++ lib/ofp-util.h | 1 + 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index 61e2854..921aa27 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -322,6 +322,7 @@ ofpact_from_nxast(const union ofp_action *a, enum ofputil_action_code code, #define OFPAT10_ACTION(ENUM, STRUCT, NAME) case OFPUTIL_##ENUM: #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM: #include "ofp-util.def" + case OFPUTIL_OFPAT13_PUSH_MPLS: NOT_REACHED(); case OFPUTIL_NXAST_RESUBMIT: @@ -480,6 +481,7 @@ ofpact_from_openflow10(const union ofp_action *a, struct ofpbuf *out) case OFPUTIL_ACTION_INVALID: #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) case OFPUTIL_##ENUM: #include "ofp-util.def" + case OFPUTIL_OFPAT13_PUSH_MPLS: NOT_REACHED(); case OFPUTIL_OFPAT10_OUTPUT: @@ -842,7 +844,8 @@ ofpact_from_openflow11(const union ofp_action *a, struct ofpbuf *out) ofpact_put_DEC_MPLS_TTL(out); break; - case OFPUTIL_OFPAT11_PUSH_MPLS: { + case OFPUTIL_OFPAT11_PUSH_MPLS: + case OFPUTIL_OFPAT13_PUSH_MPLS: { struct ofp11_action_push *oap = (struct ofp11_action_push *)a; if (!eth_type_mpls(oap->ethertype)) { return OFPERR_OFPBAC_BAD_ARGUMENT; diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c index dd0738c..154bc6f 100644 --- a/lib/ofp-parse.c +++ b/lib/ofp-parse.c @@ -799,6 +799,7 @@ parse_named_action(enum ofputil_action_code code, break; case OFPUTIL_OFPAT11_PUSH_MPLS: + case OFPUTIL_OFPAT13_PUSH_MPLS: case OFPUTIL_NXAST_PUSH_MPLS: error = str_to_u16(arg, "push_mpls", ðertype); if (!error) { diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 62cfd2e..57783d3 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -4760,6 +4760,9 @@ ofputil_put_action(enum ofputil_action_code code, struct ofpbuf *buf) case OFPUTIL_ACTION_INVALID: NOT_REACHED(); + case OFPUTIL_OFPAT13_PUSH_MPLS: + return ofputil_put_OFPAT11_PUSH_MPLS(buf); + #define OFPAT10_ACTION(ENUM, STRUCT, NAME) \ case OFPUTIL_##ENUM: return ofputil_put_##ENUM(buf); #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) \ diff --git a/lib/ofp-util.h b/lib/ofp-util.h index f3348c0..b5f3506 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -751,6 +751,7 @@ enum OVS_PACKED_ENUM ofputil_action_code { #define OFPAT11_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM, #define NXAST_ACTION(ENUM, STRUCT, EXTENSIBLE, NAME) OFPUTIL_##ENUM, #include "ofp-util.def" + OFPUTIL_OFPAT13_PUSH_MPLS }; /* The number of values of "enum ofputil_action_code". */