From patchwork Tue Aug 30 18:41:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniele Di Proietto X-Patchwork-Id: 664259 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 3sNy7T3gDFz9sDf for ; Wed, 31 Aug 2016 04:42:45 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id BF209106A7; Tue, 30 Aug 2016 11:42:40 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx3v3.cudamail.com (mx3.cudamail.com [64.34.241.5]) by archives.nicira.com (Postfix) with ESMTPS id 0A82C1069E for ; Tue, 30 Aug 2016 11:42:40 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 71FCA161019 for ; Tue, 30 Aug 2016 12:42:39 -0600 (MDT) X-ASG-Debug-ID: 1472582558-0b32370aeaaf260001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id E7FvuIvFsFfWF1xH (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 30 Aug 2016 12:42:38 -0600 (MDT) X-Barracuda-Envelope-From: diproiettod@vmware.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO EX13-EDG-OU-002.vmware.com) (208.91.0.190) by mx3-pf1.cudamail.com with ESMTPS (AES256-SHA encrypted); 30 Aug 2016 18:42:38 -0000 Received-SPF: error (mx3-pf1.cudamail.com: error in processing during lookup of vmware.com: DNS problem) Received: from sc9-mailhost3.vmware.com (10.113.161.73) by EX13-EDG-OU-002.vmware.com (10.113.208.156) with Microsoft SMTP Server id 15.0.1156.6; Tue, 30 Aug 2016 11:42:24 -0700 Received: from sc9-mailhost3.vmware.com (htb-1n-eng-dhcp84.eng.vmware.com [10.33.74.84]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id C940F408F1; Tue, 30 Aug 2016 11:42:37 -0700 (PDT) X-CudaMail-Envelope-Sender: diproiettod@vmware.com From: Daniele Di Proietto To: X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-V1-829040845 X-CudaMail-DTE: 083016 X-CudaMail-Originating-IP: 208.91.0.190 Date: Tue, 30 Aug 2016 11:41:15 -0700 X-ASG-Orig-Subj: [##CM-V1-829040845##][PATCH 2/2] ofproto: Always set MTU for new internal ports. Message-ID: <20160830184115.89303-2-diproiettod@vmware.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160830184115.89303-1-diproiettod@vmware.com> References: <20160830184115.89303-1-diproiettod@vmware.com> MIME-Version: 1.0 Received-SPF: None (EX13-EDG-OU-002.vmware.com: diproiettod@vmware.com does not designate permitted sender hosts) X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1472582558 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 2/2] ofproto: Always set MTU for new internal ports. 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" We only changed the MTU of new internal ports if it is bigger than the bridge minimum. But when the minimum MTU of the bridge is updated we change the MTU of all internal ports no matter what. The behavior is inconsistent, because now the internal ports MTU depends on the order in which the ports where added. This commit fixes the problem by _always_ setting the MTU of new internal ports to the bridge minimum. I'm not sure what was the logic behind only adjusting the mtu if it was too big. A testcase is improved to detect the problem. VMware-BZ: #1718776 Signed-off-by: Daniele Di Proietto Acked-by: Ben Pfaff --- ofproto/ofproto.c | 10 +++++----- tests/ofproto-dpif.at | 9 +++++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index da7372d..9d62b72 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -281,6 +281,8 @@ static void meter_insert_rule(struct rule *); /* unixctl. */ static void ofproto_unixctl_init(void); +static int find_min_mtu(struct ofproto *p); + /* All registered ofproto classes, in probe order. */ static const struct ofproto_class **ofproto_classes; static size_t n_ofproto_classes; @@ -514,7 +516,7 @@ ofproto_create(const char *datapath_name, const char *datapath_type, hmap_init(&ofproto->learned_cookies); ovs_list_init(&ofproto->expirable); ofproto->connmgr = connmgr_create(ofproto, datapath_name, datapath_name); - ofproto->min_mtu = INT_MAX; + ofproto->min_mtu = find_min_mtu(ofproto); cmap_init(&ofproto->groups); ovs_mutex_unlock(&ofproto_mutex); ofproto->ogf.types = 0xf; @@ -2750,10 +2752,8 @@ update_mtu(struct ofproto *p, struct ofport *port) return; } if (ofport_is_internal(p, port)) { - if (dev_mtu > p->min_mtu) { - if (!netdev_set_mtu(port->netdev, p->min_mtu)) { - dev_mtu = p->min_mtu; - } + if (!netdev_set_mtu(port->netdev, p->min_mtu)) { + dev_mtu = p->min_mtu; } port->mtu = dev_mtu; return; diff --git a/tests/ofproto-dpif.at b/tests/ofproto-dpif.at index d7705da..8e5fde6 100644 --- a/tests/ofproto-dpif.at +++ b/tests/ofproto-dpif.at @@ -8863,6 +8863,11 @@ AT_CLEANUP AT_SETUP([ofproto - set mtu]) OVS_VSWITCHD_START +# Check that initial MTU is 1500 for 'br0'. +AT_CHECK([ovs-vsctl get Interface br0 mtu], [0], [dnl +1500 +]) + add_of_ports br0 1 # Check that initial MTU is 1500 for 'br0' and 'p1'. @@ -8892,5 +8897,9 @@ AT_CHECK([ovs-vsctl add-port br0 p2 -- set int p2 type=dummy mtu_request=1600]) AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface p2 mtu=1600]) AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface br0 mtu=1600]) +# New internal port. The MTU should be updated even for a newly added port. +AT_CHECK([ovs-vsctl add-port br0 int1 -- set int int1 type=internal]) +AT_CHECK([ovs-vsctl --timeout=10 wait-until Interface int1 mtu=1600]) + OVS_VSWITCHD_STOP AT_CLEANUP