From patchwork Sun Jan 31 10:47:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ding, Xuan" X-Patchwork-Id: 87573 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EFF72A0A0D; Sun, 31 Jan 2021 12:01:02 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C65DC40693; Sun, 31 Jan 2021 12:01:02 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id CF99540692 for ; Sun, 31 Jan 2021 12:01:00 +0100 (CET) IronPort-SDR: 46owqKiX+KzOhfMVdAge546JNqfnO3Fm8LjalkUO1jwMN39FcM6bySN2OkkJNm/PIcJSK0y8Je aHa7puFgtk/A== X-IronPort-AV: E=McAfee;i="6000,8403,9880"; a="180656716" X-IronPort-AV: E=Sophos;i="5.79,390,1602572400"; d="scan'208";a="180656716" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jan 2021 03:00:59 -0800 IronPort-SDR: A3M2zmWJ7jQkZudK6IPlSbh8lrSh2Sj9mGlHhw2m5YsSVIIXWH4xmMESPqPFvut0Rj1jHR2lay Atr41BO9o5CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,390,1602572400"; d="scan'208";a="431746746" Received: from dpdk-xuanding-dev2.sh.intel.com ([10.67.119.124]) by orsmga001.jf.intel.com with ESMTP; 31 Jan 2021 03:00:58 -0800 From: Xuan Ding To: qi.z.zhang@intel.com, jingjing.wu@intel.com, beilei.xing@intel.com Cc: dev@dpdk.org, Xuan Ding Date: Sun, 31 Jan 2021 10:47:24 +0000 Message-Id: <20210131104724.73202-1-xuan.ding@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/iavf: fix default RSS configuration X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add advanced RSS offloads check due to some legacy driver(kernel/DPDK PF) does not support virtual channel command VIRTCHNL_OP_RSS_HENA with hena = 0 and VIRTCHNL_OP_ADD_RSS_CFG. Fixes: 95f2f0e9fc2a6("net/iavf: improve default RSS") Signed-off-by: Xuan Ding Acked-by: Qi Zhang --- drivers/net/iavf/iavf_ethdev.c | 67 +++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c index 58a20b443f..d8735401d9 100644 --- a/drivers/net/iavf/iavf_ethdev.c +++ b/drivers/net/iavf/iavf_ethdev.c @@ -291,11 +291,13 @@ iavf_init_rss(struct iavf_adapter *adapter) if (ret) return ret; - /* Set RSS hash configuration based on rss_conf->rss_hf. */ - ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true); - if (ret) { - PMD_DRV_LOG(ERR, "fail to set default RSS"); - return ret; + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) { + /* Set RSS hash configuration based on rss_conf->rss_hf. */ + ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true); + if (ret) { + PMD_DRV_LOG(ERR, "fail to set default RSS"); + return ret; + } } return 0; @@ -1251,21 +1253,23 @@ iavf_dev_rss_hash_update(struct rte_eth_dev *dev, if (rss_conf->rss_hf == 0) return 0; - /* Clear existing RSS. */ - ret = iavf_set_hena(adapter, 0); + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) { + /* Clear existing RSS. */ + ret = iavf_set_hena(adapter, 0); - /* It is a workaround, temporarily allow error to be returned - * due to possible lack of PF handling for hena = 0. - */ - if (ret) - PMD_DRV_LOG(WARNING, "fail to clean existing RSS," - "lack PF support"); + /* It is a workaround, temporarily allow error to be returned + * due to possible lack of PF handling for hena = 0. + */ + if (ret) + PMD_DRV_LOG(WARNING, "fail to clean existing RSS," + "lack PF support"); - /* Set new RSS configuration. */ - ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true); - if (ret) { - PMD_DRV_LOG(ERR, "fail to set new RSS"); - return ret; + /* Set new RSS configuration. */ + ret = iavf_rss_hash_set(adapter, rss_conf->rss_hf, true); + if (ret) { + PMD_DRV_LOG(ERR, "fail to set new RSS"); + return ret; + } } return 0; @@ -2092,6 +2096,24 @@ iavf_dev_filter_ctrl(struct rte_eth_dev *dev, return ret; } +static void +iavf_default_rss_disable(struct iavf_adapter *adapter) +{ + struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(adapter); + int ret = 0; + + if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF) { + /* Set hena = 0 to ask PF to cleanup all existing RSS. */ + ret = iavf_set_hena(adapter, 0); + if (ret) + /* It is a workaround, temporarily allow error to be + * returned due to possible lack of PF handling for + * hena = 0. + */ + PMD_INIT_LOG(WARNING, "fail to disable default RSS," + "lack PF support"); + } +} static int iavf_dev_init(struct rte_eth_dev *eth_dev) @@ -2180,14 +2202,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev) return ret; } - /* Set hena = 0 to ask PF to cleanup all existing RSS. */ - ret = iavf_set_hena(adapter, 0); - if (ret) - /* It is a workaround, temporarily allow error to be returned - * due to possible lack of PF handling for hena = 0. - */ - PMD_DRV_LOG(WARNING, "fail to disable default RSS," - "lack PF support"); + iavf_default_rss_disable(adapter); return 0; }