From patchwork Mon Aug 5 13:49:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1142187 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 462JzV5F2Cz9sBF for ; Mon, 5 Aug 2019 23:49:38 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id E1C9FCE5; Mon, 5 Aug 2019 13:49:33 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E6EDAC90 for ; Mon, 5 Aug 2019 13:49:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6617C829 for ; Mon, 5 Aug 2019 13:49:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DF16B3058E0A for ; Mon, 5 Aug 2019 13:49:31 +0000 (UTC) Received: from nusiddiq.mac (dhcp35-112.lab.eng.blr.redhat.com [10.70.35.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16DA110027A8 for ; Mon, 5 Aug 2019 13:49:30 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Mon, 5 Aug 2019 19:19:25 +0530 Message-Id: <20190805134925.14056-1-nusiddiq@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 05 Aug 2019 13:49:31 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2 ovn] Encode the virtual port key in vport_bind action in network byte order X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique The commit [1] encoded the vport key using uint32_t and the test case "action parsing" is failing for s380 arch. This patch fixes this issue by encoding the vport key in the network byte order. [1] - 054f4c85c413("Add a new logical switch port type - 'virtual'") Fixes: 054f4c85c413("Add a new logical switch port type - 'virtual'") Signed-off-by: Numan Siddique Acked-by: Dumitru Ceara --- v1 -> v2 ======= * There was a sparse compilation error when I missed checking when submitting v1. Corrected it. controller/pinctrl.c | 11 ++++++----- lib/actions.c | 3 ++- tests/ovn.at | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/controller/pinctrl.c b/controller/pinctrl.c index f05579fcc..f27718f55 100644 --- a/controller/pinctrl.c +++ b/controller/pinctrl.c @@ -4489,16 +4489,17 @@ pinctrl_handle_bind_vport( uint32_t vport_parent_key = md->regs[MFF_LOG_INPORT - MFF_REG0]; /* Get the virtual port key from the userdata buffer. */ - uint32_t *vport_key = ofpbuf_try_pull(userdata, sizeof *vport_key); + ovs_be32 *vp_key = ofpbuf_try_pull(userdata, sizeof *vp_key); - if (!vport_key) { + if (!vp_key) { return; } - uint32_t hash = hash_2words(dp_key, *vport_key); + uint32_t vport_key = ntohl(*vp_key); + uint32_t hash = hash_2words(dp_key, vport_key); struct put_vport_binding *vpb - = pinctrl_find_put_vport_binding(dp_key, *vport_key, hash); + = pinctrl_find_put_vport_binding(dp_key, vport_key, hash); if (!vpb) { if (hmap_count(&put_vport_bindings) >= 1000) { COVERAGE_INC(pinctrl_drop_put_vport_binding); @@ -4510,7 +4511,7 @@ pinctrl_handle_bind_vport( } vpb->dp_key = dp_key; - vpb->vport_key = *vport_key; + vpb->vport_key = vport_key; vpb->vport_parent_key = vport_parent_key; notify_pinctrl_main(); diff --git a/lib/actions.c b/lib/actions.c index 66916a837..b0cb3490b 100644 --- a/lib/actions.c +++ b/lib/actions.c @@ -2645,7 +2645,8 @@ encode_BIND_VPORT(const struct ovnact_bind_vport *vp, size_t oc_offset = encode_start_controller_op(ACTION_OPCODE_BIND_VPORT, false, NX_CTLR_NO_METER, ofpacts); - ofpbuf_put(ofpacts, &vport_key, sizeof(uint32_t)); + ovs_be32 vp_key = htonl(vport_key); + ofpbuf_put(ofpacts, &vp_key, sizeof(ovs_be32)); encode_finish_controller_op(oc_offset, ofpacts); encode_restore_args(args, ARRAY_SIZE(args), ofpacts); } diff --git a/tests/ovn.at b/tests/ovn.at index e88cffa20..344efad26 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1371,7 +1371,7 @@ reg0[0] = check_pkt_larger(foo); # bind_vport # lsp1's port key is 0x11. bind_vport("lsp1", inport); - encodes as controller(userdata=00.00.00.11.00.00.00.00.11.00.00.00) + encodes as controller(userdata=00.00.00.11.00.00.00.00.00.00.00.11) # lsp2 doesn't exist. So it should be encoded as drop. bind_vport("lsp2", inport); encodes as drop