From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id F41DB3796 for ; Fri, 5 Aug 2016 16:30:31 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 05 Aug 2016 07:30:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,474,1464678000"; d="scan'208";a="1030368240" Received: from silpixa00380299.ir.intel.com ([10.237.222.17]) by orsmga002.jf.intel.com with ESMTP; 05 Aug 2016 07:30:29 -0700 From: Mark Kavanagh To: dev@dpdk.org, diproiettod@vmware.com Cc: i.maximets@samsung.com Date: Fri, 5 Aug 2016 15:30:11 +0100 Message-Id: <1470407413-157932-5-git-send-email-mark.b.kavanagh@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1470407413-157932-1-git-send-email-mark.b.kavanagh@intel.com> References: <1470407413-157932-1-git-send-email-mark.b.kavanagh@intel.com> Subject: [dpdk-dev] [PATCH 5/7] tests: Add a new MTU test. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2016 14:30:33 -0000 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 -- 1.9.3