From patchwork Thu Sep 12 10:43:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Konieczny, TomaszX" X-Patchwork-Id: 1161526 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=intel.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 46Tb492Y64z9s00 for ; Thu, 12 Sep 2019 20:44:24 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5AE53CDD; Thu, 12 Sep 2019 10:44:21 +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 81434BDC for ; Thu, 12 Sep 2019 10:44:20 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 7B7D487D for ; Thu, 12 Sep 2019 10:44:19 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Sep 2019 03:44:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,495,1559545200"; d="scan'208";a="200718914" Received: from tkoniecx-mobl.ger.corp.intel.com ([10.103.104.52]) by fmsmga001.fm.intel.com with ESMTP; 12 Sep 2019 03:44:18 -0700 From: Tomasz Konieczny To: dev@openvswitch.org Date: Thu, 12 Sep 2019 12:43:20 +0200 Message-Id: <20190912104320.822-1-tomaszx.konieczny@intel.com> X-Mailer: git-send-email 2.23.0.windows.1 MIME-Version: 1.0 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: Tomasz Konieczny , Ilya Maximets Subject: [ovs-dev] [PATCH v3] netdev-dpdk: Fix flow control not configuring. 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 Currently OVS is unable to change flow control configuration in DPDK because new settings are being overwritten by current settings with rte_eth_dev_flow_ctrl_get(). The fix restores correct order of operations and at the same time does not trigger error on devices without flow control support when flow control not requested. Fixes: 7e1de65e8dfb ("netdev-dpdk: Fix failure to configure flow control at netdev-init.") Signed-off-by: Tomasz Konieczny Co-authored-by: Ilya Maximets Signed-off-by: Ilya Maximets --- lib/netdev-dpdk.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index bc20d68..62985c5 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -1771,6 +1771,7 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, { struct netdev_dpdk *dev = netdev_dpdk_cast(netdev); bool rx_fc_en, tx_fc_en, autoneg, lsc_interrupt_mode; + bool flow_control_requested = true; enum rte_eth_fc_mode fc_mode; static const enum rte_eth_fc_mode fc_mode_set[2][2] = { {RTE_FC_NONE, RTE_FC_TX_PAUSE}, @@ -1858,15 +1859,34 @@ netdev_dpdk_set_config(struct netdev *netdev, const struct smap *args, autoneg = smap_get_bool(args, "flow-ctrl-autoneg", false); fc_mode = fc_mode_set[tx_fc_en][rx_fc_en]; + + if (!smap_get(args, "rx-flow-ctrl") && !smap_get(args, "tx-flow-ctrl") + && !smap_get(args, "flow-ctrl-autoneg")) { + /* FIXME: User didn't ask for flow control configuration. + * For now we'll not print a warning if flow control is not + * supported by the DPDK port. */ + flow_control_requested = false; + } + + /* Get the Flow control configuration. */ + err = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf); + if (err) { + if (err == -ENOTSUP) { + if (flow_control_requested) { + VLOG_WARN("%s: Flow control is not supported.", + netdev_get_name(netdev)); + } + err = 0; /* Not fatal. */ + } else { + VLOG_WARN("%s: Cannot get flow control parameters: %s", + netdev_get_name(netdev), rte_strerror(-err)); + } + goto out; + } + if (dev->fc_conf.mode != fc_mode || autoneg != dev->fc_conf.autoneg) { dev->fc_conf.mode = fc_mode; dev->fc_conf.autoneg = autoneg; - /* Get the Flow control configuration for DPDK-ETH */ - err = rte_eth_dev_flow_ctrl_get(dev->port_id, &dev->fc_conf); - if (err) { - VLOG_WARN("Cannot get flow control parameters on port " - DPDK_PORT_ID_FMT", err=%d", dev->port_id, err); - } dpdk_eth_flow_ctrl_setup(dev); }