From patchwork Fri Nov 9 12:24:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 995482 X-Patchwork-Delegate: ian.stokes@intel.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rzqz6096z9sCX for ; Fri, 9 Nov 2018 23:25:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 054F072A; Fri, 9 Nov 2018 12:25:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 06950499 for ; Fri, 9 Nov 2018 12:25:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id A4B2B800 for ; Fri, 9 Nov 2018 12:24:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F0EC7308ED4B; Fri, 9 Nov 2018 12:24:58 +0000 (UTC) Received: from wsfd-netdev64.ntdv.lab.eng.bos.redhat.com (wsfd-netdev64.ntdv.lab.eng.bos.redhat.com [10.19.188.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id 450735D737; Fri, 9 Nov 2018 12:24:58 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Fri, 9 Nov 2018 07:24:55 -0500 Message-Id: <20181109122432.99492.11001.stgit@wsfd-netdev64.ntdv.lab.eng.bos.redhat.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 09 Nov 2018 12:24:59 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: i.maximets@samsung.com Subject: [ovs-dev] [PATCH v4] netdev-dpdk: Bring link down when NETDEV_UP is not set X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When the netdev link flags are changed, !NETDEV_UP, the DPDK ports are not actually going down. This is causing problems for people trying to bring down a bond member. The bond link is no longer being used to receive or transmit traffic, however, the other end keeps sending data as the link remains up. With OVS 2.6 the link was brought down, and this was changed with commit 3b1fb0779. In this commit, it's explicitly mentioned that the link down/up DPDK APIs are not called as not all PMD devices support it. However, this patch does call the appropriate DPDK APIs and ignoring errors due to the PMD not supporting it. PMDs not supporting this should be fixed in DPDK upstream. I verified this patch is working correctly using the ovs-appctl netdev-dpdk/set-admin-state {up|down} and ovs-ofctl mod-port {up|down} commands on a XL710 and 82599ES. Fixes: 3b1fb0779b87 ("netdev-dpdk: Don't call rte_dev_stop() in update_flags().") Signed-off-by: Eelco Chaudron Acked-by: Ilya Maximets --- * V4: - Use netdev_get_name() instead of dev->up.name directly * V3: - Update log message and changed the level to INFO * V2: - Only call link state change function if the upstate changed - Restore original flags on error - Log a message when the NIC does not support the link state API lib/netdev-dpdk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 7e0a593..00f5acc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -2942,6 +2942,24 @@ netdev_dpdk_update_flags__(struct netdev_dpdk *dev, } if (dev->type == DPDK_DEV_ETH) { + + if ((dev->flags ^ *old_flagsp) & NETDEV_UP) { + int err; + + if (dev->flags & NETDEV_UP) { + err = rte_eth_dev_set_link_up(dev->port_id); + } else { + err = rte_eth_dev_set_link_down(dev->port_id); + } + if (err == -ENOTSUP) { + VLOG_INFO("Interface %s does not support link state " + "configuration", netdev_get_name(&dev->up)); + } else if (err < 0) { + dev->flags = *old_flagsp; + return -err; + } + } + if (dev->flags & NETDEV_PROMISC) { rte_eth_promiscuous_enable(dev->port_id); }