From patchwork Fri Jul 15 15:32:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 648876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (archives.nicira.com [96.126.127.54]) by ozlabs.org (Postfix) with ESMTP id 3rrc5G1MrQz9s5Q for ; Sat, 16 Jul 2016 01:32:34 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A226110CDF; Fri, 15 Jul 2016 08:32:32 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e3.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id D259F10C27 for ; Fri, 15 Jul 2016 08:32:30 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 6C74F4209C7 for ; Fri, 15 Jul 2016 09:32:30 -0600 (MDT) X-ASG-Debug-ID: 1468596748-09eadd71ab14b80001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id N8XGQqi9nd57bIXI (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 15 Jul 2016 09:32:28 -0600 (MDT) X-Barracuda-Envelope-From: nusiddiq@redhat.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mx1.redhat.com) (209.132.183.28) by mx1-pf2.cudamail.com with ESMTPS (DHE-RSA-AES256-SHA encrypted); 15 Jul 2016 15:32:28 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) X-Barracuda-Apparent-Source-IP: 209.132.183.28 X-Barracuda-RBL-IP: 209.132.183.28 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2845B381026 for ; Fri, 15 Jul 2016 15:32:27 +0000 (UTC) Received: from nusiddiq.blr.redhat.com (dhcp-0-130.blr.redhat.com [10.70.1.130]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6FFWPhW015108 for ; Fri, 15 Jul 2016 11:32:26 -0400 X-CudaMail-Envelope-Sender: nusiddiq@redhat.com From: Numan Siddique X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E2-714028683 X-CudaMail-DTE: 071516 X-CudaMail-Originating-IP: 209.132.183.28 To: ovs dev X-ASG-Orig-Subj: [##CM-E2-714028683##][PATCH v2] ovn: Add 128-bit support for ct_label Organization: Red Hat Message-ID: Date: Fri, 15 Jul 2016 21:02:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 15 Jul 2016 15:32:27 +0000 (UTC) X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1468596748 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Subject: [ovs-dev] [PATCH v2] ovn: Add 128-bit support for ct_label X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" To support 128-bits in ct_label, the value of the ct_label is expected as a hex string in the 'ct_commit' action. Added a new accessor in the 'mf_subvalue' struct to access ovs_be128 values. Signed-Off-by: Numan Siddique Acked-by: Ryan Moats --- include/openvswitch/meta-flow.h | 4 ++++ ovn/TODO | 6 ------ ovn/lib/actions.c | 15 +++++++-------- ovn/ovn-sb.xml | 5 ++--- tests/ovn.at | 5 +++++ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/include/openvswitch/meta-flow.h b/include/openvswitch/meta-flow.h index e2e9220..196868a 100644 --- a/include/openvswitch/meta-flow.h +++ b/include/openvswitch/meta-flow.h @@ -2006,6 +2006,10 @@ union mf_subvalue { ovs_be64 integer; }; struct { + ovs_be128 dummy_be128[7]; + ovs_be128 be128_int; + }; + struct { uint8_t dummy_mac[122]; struct eth_addr mac; }; diff --git a/ovn/TODO b/ovn/TODO index 4f134a4..0a6225d 100644 --- a/ovn/TODO +++ b/ovn/TODO @@ -38,12 +38,6 @@ ovn-sb.xml includes a tentative specification for this action. IPv6 will probably need an action or actions for ND that is similar to the "arp" action, and an action for generating -*** ct_label 128-bit support. - -We only support 64-bits for the ct_label argument to ct_commit(), but ct_label -is a 128-bit field. The OVN lexer only supports parsing 64-bit integers, but -we can use parse_int_string() to support larger integers. - ** IPv6 *** ND versus ARP diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c index 3d10d61..8179c0b 100644 --- a/ovn/lib/actions.c +++ b/ovn/lib/actions.c @@ -879,16 +879,15 @@ parse_ct_commit_arg(struct action_context *ctx, action_error(ctx, "Expected '=' after argument to ct_commit"); return false; } + + /* ct_label is a 128-bit field. The lexer supports 128-bit + * integers if its a hex string. The ct_label value should be specified + * in hex string if > 64-bits are to be used */ if (ctx->lexer->token.type == LEX_T_INTEGER) { - label_value->be64.lo = ctx->lexer->token.value.integer; + *label_value = ctx->lexer->token.value.be128_int; } else if (ctx->lexer->token.type == LEX_T_MASKED_INTEGER) { - /* XXX Technically, ct_label is a 128-bit field. The lexer - * only supports 64-bit integers, so that's all we support - * here. More work is needed to use parse_int_string() - * to support the full 128-bits. */ - label_value->be64.lo = ctx->lexer->token.value.integer; - label_mask->be64.hi = 0; - label_mask->be64.lo = ctx->lexer->token.mask.integer; + *label_value = ctx->lexer->token.value.be128_int; + *label_mask = ctx->lexer->token.mask.be128_int; } else { action_error(ctx, "Expected integer after 'ct_label='"); return false; diff --git a/ovn/ovn-sb.xml b/ovn/ovn-sb.xml index 7b45bbb..fa24969 100644 --- a/ovn/ovn-sb.xml +++ b/ovn/ovn-sb.xml @@ -982,9 +982,8 @@ ct_mark and/or ct_label will be set to the values indicated by value[/mask] on the connection tracking entry. ct_mark is a 32-bit field. - ct_label is technically a 128-bit field, though OVN - currently only supports 64-bits and will later be extended to - support the full 128-bits. + ct_label is a 128-bit field. The value[/mask] + should be specified in hex string if > 64-bits are to be used.

diff --git a/tests/ovn.at b/tests/ovn.at index 12de125..452c148 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -585,6 +585,11 @@ ct_commit(ct_mark=1); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_fie ct_commit(ct_mark=1/1); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1/0x1->ct_mark)), prereqs=ip ct_commit(ct_label=1); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1->ct_label)), prereqs=ip ct_commit(ct_label=1/1); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1/0x1->ct_label)), prereqs=ip +ct_commit(ct_label=0x01020304050607080910111213141516); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1020304050607080910111213141516->ct_label)), prereqs=ip +ct_commit(ct_label=0x181716151413121110090807060504030201); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x16151413121110090807060504030201->ct_label)), prereqs=ip +ct_commit(ct_label=0x01000000000000000000000000000000/0x01000000000000000000000000000000); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1000000000000000000000000000000/0x1000000000000000000000000000000->ct_label)), prereqs=ip +ct_commit(ct_label=18446744073709551615); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0xffffffffffffffff->ct_label)), prereqs=ip +ct_commit(ct_label=18446744073709551616); => Decimal constants must be less than 2**64. ct_commit(ct_mark=1, ct_label=2); => actions=ct(commit,zone=NXM_NX_REG13[0..15],exec(set_field:0x1->ct_mark,set_field:0x2->ct_label)), prereqs=ip # dnat