From patchwork Tue Aug 9 12:03:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Kavanagh X-Patchwork-Id: 657237 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 3s7tGR1M9Xz9sR9 for ; Tue, 9 Aug 2016 22:03:27 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 6ED681071E; Tue, 9 Aug 2016 05:03:24 -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 144DF1069A for ; Tue, 9 Aug 2016 05:03:23 -0700 (PDT) Received: from bar6.cudamail.com (localhost [127.0.0.1]) by mx3v3.cudamail.com (Postfix) with ESMTPS id 7F0701616B2 for ; Tue, 9 Aug 2016 06:03:22 -0600 (MDT) X-ASG-Debug-ID: 1470744200-0b323721d659d8c0001-byXFYA Received: from mx3-pf1.cudamail.com ([192.168.14.2]) by bar6.cudamail.com with ESMTP id aOSHBkHDk9UYPBY2 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 09 Aug 2016 06:03:20 -0600 (MDT) X-Barracuda-Envelope-From: mark.b.kavanagh@intel.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.14.2 Received: from unknown (HELO mga11.intel.com) (192.55.52.93) by mx3-pf1.cudamail.com with SMTP; 9 Aug 2016 12:03:20 -0000 Received-SPF: pass (mx3-pf1.cudamail.com: SPF record at intel.com designates 192.55.52.93 as permitted sender) X-Barracuda-Apparent-Source-IP: 192.55.52.93 X-Barracuda-RBL-IP: 192.55.52.93 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP; 09 Aug 2016 05:03:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.28,494,1464678000"; d="scan'208"; a="1032370466" Received: from silpixa00380299.ir.intel.com ([10.237.222.17]) by orsmga002.jf.intel.com with ESMTP; 09 Aug 2016 05:03:18 -0700 X-CudaMail-Envelope-Sender: mark.b.kavanagh@intel.com From: Mark Kavanagh To: dev@openvswitch.org, diproiettod@vmware.com X-CudaMail-MID: CM-V1-808006137 X-CudaMail-DTE: 080916 X-CudaMail-Originating-IP: 192.55.52.93 Date: Tue, 9 Aug 2016 13:03:07 +0100 X-ASG-Orig-Subj: [##CM-V1-808006137##][ovs-dev][PATCH V5 1/7] ofproto: Consider datapath_type when looking for internal ports. Message-Id: <1470744193-221385-1-git-send-email-mark.b.kavanagh@intel.com> X-Mailer: git-send-email 1.9.3 X-GBUdb-Analysis: 0, 192.55.52.93, Ugly c=0 p=0 Source New X-MessageSniffer-Rules: 0-0-0-6998-c X-Barracuda-Connect: UNKNOWN[192.168.14.2] X-Barracuda-Start-Time: 1470744200 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-ASG-Whitelist: EmailCat (corporate) Cc: i.maximets@samsung.com Subject: [ovs-dev] [PATCH V5 1/7] ofproto: Consider datapath_type when looking for 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: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" From: Daniele Di Proietto Interfaces with type "internal" end up having a netdev with type "tap" in the dpif-netdev datapath, so a strcmp will fail to match internal interfaces. We can translate the types with ofproto_port_open_type() before calling strcmp to fix this. This fixes a minor issue where internal interfaces are considered non-internal in the userspace datapath for the purpose of adjusting the MTU. Signed-off-by: Daniele Di Proietto --- ofproto/ofproto.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 8e59c69..088f91a 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -220,7 +220,8 @@ static void learned_cookies_flush(struct ofproto *, struct ovs_list *dead_cookie /* ofport. */ static void ofport_destroy__(struct ofport *) OVS_EXCLUDED(ofproto_mutex); static void ofport_destroy(struct ofport *, bool del); -static inline bool ofport_is_internal(const struct ofport *); +static inline bool ofport_is_internal(const struct ofproto *, + const struct ofport *); static int update_port(struct ofproto *, const char *devname); static int init_ports(struct ofproto *); @@ -2465,7 +2466,7 @@ static void ofport_remove(struct ofport *ofport) { struct ofproto *p = ofport->ofproto; - bool is_internal = ofport_is_internal(ofport); + bool is_internal = ofport_is_internal(p, ofport); connmgr_send_port_status(ofport->ofproto->connmgr, NULL, &ofport->pp, OFPPR_DELETE); @@ -2751,9 +2752,10 @@ init_ports(struct ofproto *p) } static inline bool -ofport_is_internal(const struct ofport *port) +ofport_is_internal(const struct ofproto *p, const struct ofport *port) { - return !strcmp(netdev_get_type(port->netdev), "internal"); + return !strcmp(netdev_get_type(port->netdev), + ofproto_port_open_type(p->type, "internal")); } /* Find the minimum MTU of all non-datapath devices attached to 'p'. @@ -2770,7 +2772,7 @@ find_min_mtu(struct ofproto *p) /* Skip any internal ports, since that's what we're trying to * set. */ - if (ofport_is_internal(ofport)) { + if (ofport_is_internal(p, ofport)) { continue; } @@ -2797,7 +2799,7 @@ update_mtu(struct ofproto *p, struct ofport *port) port->mtu = 0; return; } - if (ofport_is_internal(port)) { + 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; @@ -2827,7 +2829,7 @@ update_mtu_ofproto(struct ofproto *p) HMAP_FOR_EACH (ofport, hmap_node, &p->ports) { struct netdev *netdev = ofport->netdev; - if (ofport_is_internal(ofport)) { + if (ofport_is_internal(p, ofport)) { if (!netdev_set_mtu(netdev, p->min_mtu)) { ofport->mtu = p->min_mtu; }