From patchwork Mon Aug 8 15:50:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Kavanagh X-Patchwork-Id: 656824 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 3s7MMG6M0Vz9syB for ; Tue, 9 Aug 2016 01:50:50 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id A09FB10918; Mon, 8 Aug 2016 08:50:31 -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 1F9BD10900 for ; Mon, 8 Aug 2016 08:50:30 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 8715742006E for ; Mon, 8 Aug 2016 09:50:29 -0600 (MDT) X-ASG-Debug-ID: 1470671428-09eadd4f140a8c0001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar5.cudamail.com with ESMTP id 9stmgUAyiRigOqoi (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 08 Aug 2016 09:50:28 -0600 (MDT) X-Barracuda-Envelope-From: mark.b.kavanagh@intel.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO mga03.intel.com) (134.134.136.65) by mx1-pf2.cudamail.com with SMTP; 8 Aug 2016 15:50:28 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at intel.com designates 134.134.136.65 as permitted sender) X-Barracuda-Apparent-Source-IP: 134.134.136.65 X-Barracuda-RBL-IP: 134.134.136.65 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 08 Aug 2016 08:50:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,490,1464678000"; d="scan'208";a="861734199" Received: from silpixa00380299.ir.intel.com ([10.237.222.17]) by orsmga003.jf.intel.com with ESMTP; 08 Aug 2016 08:50:26 -0700 X-CudaMail-Envelope-Sender: mark.b.kavanagh@intel.com From: Mark Kavanagh To: dev@openvswitch.org, diproiettod@vmware.com X-CudaMail-MID: CM-E2-807032203 X-CudaMail-DTE: 080816 X-CudaMail-Originating-IP: 134.134.136.65 Date: Mon, 8 Aug 2016 16:50:17 +0100 X-ASG-Orig-Subj: [##CM-E2-807032203##][ovs-dev][PATCH V4 5/7] tests: Add a new MTU test. Message-Id: <1470671419-178796-5-git-send-email-mark.b.kavanagh@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1470671419-178796-1-git-send-email-mark.b.kavanagh@intel.com> References: <1470671419-178796-1-git-send-email-mark.b.kavanagh@intel.com> X-GBUdb-Analysis: 0, 134.134.136.65, Ugly c=0.271956 p=0 Source Normal X-MessageSniffer-Rules: 0-0-0-5057-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1470671428 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 1.10 X-Barracuda-Spam-Status: No, SCORE=1.10 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=4.0 tests=BSF_SC1_TG070, BSF_SC5_MJ1963, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.31840 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC1_TG070 Custom Rule TG070 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: i.maximets@samsung.com Subject: [ovs-dev] [PATCH V4 5/7] tests: Add a new MTU test. 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: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" From: Daniele Di Proietto Also, netdev-dummy needs to call netdev_change_seq_changed() in set_mtu(). Signed-off-by: Daniele Di Proietto --- lib/netdev-dummy.c | 5 ++++- tests/ofproto-dpif.at | 30 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index 92af15f..c8f82b7 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -1155,7 +1155,10 @@ netdev_dummy_set_mtu(const struct netdev *netdev, int mtu) struct netdev_dummy *dev = netdev_dummy_cast(netdev); ovs_mutex_lock(&dev->mutex); - dev->mtu = mtu; + if (dev->mtu != mtu) { + dev->mtu = mtu; + netdev_change_seq_changed(netdev); + } ovs_mutex_unlock(&dev->mutex); return 0; diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index a46fc81..3638063 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -8859,3 +8859,33 @@ n_packets=0 OVS_VSWITCHD_STOP AT_CLEANUP + +AT_SETUP([ofproto - set mtu]) +OVS_VSWITCHD_START + +add_of_ports br0 1 + +# Check that initial MTU is 1500 for 'br0' and 'p1'. +AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl +1500 +]) +AT_CHECK([ovs-vsctl get Interface p1 mtu], [0], [dnl +1500 +]) + +# Request new MTU for 'p1' +AT_CHECK([ovs-vsctl set Interface p1 mtu_request=1600]) + +# Check that the new MTU is applied +AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p1 mtu=1600]) +# The internal port 'br0' should have the same MTU value as p1, becase it's +# the new bridge minimum. +AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600]) + +AT_CHECK([ovs-vsctl del-port br0 p1]) + +# When 'p1' is deleted, the internal port should return to the default MTU +AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1500]) + +OVS_VSWITCHD_STOP +AT_CLEANUP