From patchwork Tue Nov 1 14:53:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Blakey X-Patchwork-Id: 689941 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 3t7Z4b4WXcz9s65 for ; Wed, 2 Nov 2016 01:54:07 +1100 (AEDT) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 7291A10663; Tue, 1 Nov 2016 07:53:43 -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 7B3C310628 for ; Tue, 1 Nov 2016 07:53:42 -0700 (PDT) Received: from bar5.cudamail.com (localhost [127.0.0.1]) by mx1e3.cudamail.com (Postfix) with ESMTPS id 10E204200A8 for ; Tue, 1 Nov 2016 08:53:42 -0600 (MDT) X-ASG-Debug-ID: 1478012021-09eadd0f984f7f90001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar5.cudamail.com with ESMTP id DYRcASU6fdMrndHm (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Tue, 01 Nov 2016 08:53:41 -0600 (MDT) X-Barracuda-Envelope-From: paulb@mellanox.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mellanox.co.il) (193.47.165.129) by mx1-pf1.cudamail.com with SMTP; 1 Nov 2016 14:53:40 -0000 Received-SPF: pass (mx1-pf1.cudamail.com: SPF record at _mtablock1.salesforce.com designates 193.47.165.129 as permitted sender) X-Barracuda-Apparent-Source-IP: 193.47.165.129 X-Barracuda-RBL-IP: 193.47.165.129 Received: from Internal Mail-Server by MTLPINE1 (envelope-from paulb@mellanox.com) with ESMTPS (AES256-SHA encrypted); 1 Nov 2016 16:53:33 +0200 Received: from r-vnc04.mtr.labs.mlnx (r-vnc04.mtr.labs.mlnx [10.208.0.116]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id uA1ErVfi000482; Tue, 1 Nov 2016 16:53:32 +0200 X-CudaMail-Envelope-Sender: paulb@mellanox.com From: Paul Blakey To: dev@openvswitch.org X-CudaMail-MID: CM-E1-1031028583 X-CudaMail-DTE: 110116 X-CudaMail-Originating-IP: 193.47.165.129 Date: Tue, 1 Nov 2016 16:53:27 +0200 X-ASG-Orig-Subj: [##CM-E1-1031028583##][PATCH ovs V1 6/9] dpif-hw-acc: using port maps on init and changes Message-Id: <1478012010-32494-7-git-send-email-paulb@mellanox.com> X-Mailer: git-send-email 1.7.8.2 In-Reply-To: <1478012010-32494-1-git-send-email-paulb@mellanox.com> References: <1478012010-32494-1-git-send-email-paulb@mellanox.com> X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1478012021 X-Barracuda-Encrypted: ECDHE-RSA-AES256-GCM-SHA384 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_SC0_MV0713, BSF_SC5_MJ1963, RDNS_NONE, UNPARSEABLE_RELAY X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.34192 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC0_MV0713 Custom rule MV0713 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 Cc: Shahar Klein , Simon Horman , Rony Efraim , Jiri Pirko , Marcelo Ricardo Leitner , Or Gerlitz , Hadar Har-Zion , Andy Gospodarek Subject: [ovs-dev] [PATCH ovs V1 6/9] dpif-hw-acc: using port maps on init and changes 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" updating the port maps on dpif init and when add/removing a port. Signed-off-by: Paul Blakey Signed-off-by: Shahar Klein --- lib/dpif-hw-acc.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/lib/dpif-hw-acc.c b/lib/dpif-hw-acc.c index bf91d95..52f5dd1 100644 --- a/lib/dpif-hw-acc.c +++ b/lib/dpif-hw-acc.c @@ -579,6 +579,31 @@ dpif_hw_acc_open(const struct dpif_class *class OVS_UNUSED, *dpifp = &dpif->dpif; + if (!create) { + VLOG_DBG + ("%s %d %s(%p) requesting existing port dump, from dpif-netlink only.\n", + __FILE__, __LINE__, __func__, dpif); + DPIF_PORT_FOR_EACH(&dpif_port, &dump, dpif->lp_dpif_netlink) { + VLOG_DBG("%s %d %s(%p) port: %s, type: %s\n", __FILE__, __LINE__, + __func__, dpif, dpif_port.name, dpif_port.type); + if (dpif_port.type && !strcmp(dpif_port.type, "internal")) { + if (!strcmp(dpif_port.name, "skip_hw")) { + tc_set_skip_hw(true); + } + continue; + } + if (!netdev_open(dpif_port.name, dpif_port.type, &netdev)) { + VLOG_DBG + ("%s %d %s(%p) opened a new netdev: %s, type: %s, ifindex: %d\n", + __FILE__, __LINE__, __func__, dpif, netdev->name, + netdev->netdev_class->type, netdev_get_ifindex(netdev)); + port_add(dpif, dpif_port.port_no, netdev); + } + } + } + VLOG_DBG("%s %d %s(%p) port dump end.\n", __FILE__, __LINE__, __func__, + dpif); + return 0; } @@ -620,19 +645,35 @@ static int dpif_hw_acc_port_add(struct dpif *dpif_, struct netdev *netdev, odp_port_t * port_nop) { + int error; struct dpif_hw_acc *dpif = dpif_hw_acc_cast(dpif_); - return dpif->lp_dpif_netlink->dpif_class->port_add(dpif->lp_dpif_netlink, - netdev, port_nop); + VLOG_DBG("%s %d %s (%p): request to add netdev: %s\n", __FILE__, __LINE__, + __func__, dpif, netdev->name); + error = + dpif->lp_dpif_netlink->dpif_class->port_add(dpif->lp_dpif_netlink, + netdev, port_nop); + if (!error) + port_add(dpif, *port_nop, netdev); + else + VLOG_ERR("%s %d %s (%p): failed to add port\n", __FILE__, __LINE__, + __func__, dpif); + + return error; } static int dpif_hw_acc_port_del(struct dpif *dpif_, odp_port_t port_no) { + int error; struct dpif_hw_acc *dpif = dpif_hw_acc_cast(dpif_); - return dpif->lp_dpif_netlink->dpif_class->port_del(dpif->lp_dpif_netlink, - port_no); + error = + dpif->lp_dpif_netlink->dpif_class->port_del(dpif->lp_dpif_netlink, + port_no); + if (!error) + port_del(dpif, port_no); + return error; } static int