From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6BEDA057C; Thu, 26 Mar 2020 08:19:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 85E151C02A; Thu, 26 Mar 2020 08:19:54 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 4B2011BF73; Thu, 26 Mar 2020 08:19:52 +0100 (CET) IronPort-SDR: pbTLTGEeU6LyOt8GbvoNm0BExpRyG1QPEKPLHB0dPWnuxXAXMntOXdxaPKhPfTOy+SGapCz/lF HlbXPzjHJjgw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 00:19:51 -0700 IronPort-SDR: i/+EvxVn+JDPfZZ+2mE0NN3cjTqaUmdvh1Fny0ZtAOdBEWY4S44f5Jz4UFsXyV4wuyBiHm7urP +8T6z2c2OvCA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,307,1580803200"; d="scan'208";a="265781936" Received: from intel.sh.intel.com ([10.239.255.136]) by orsmga002.jf.intel.com with ESMTP; 26 Mar 2020 00:19:49 -0700 From: Junyu Jiang To: dev@dpdk.org Cc: Qi Zhang , Qiming Yang , Junyu Jiang , stable@dpdk.org Date: Thu, 26 Mar 2020 06:57:25 +0000 Message-Id: <20200326065725.21533-1-junyux.jiang@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319074825.16035-1-junyux.jiang@intel.com> References: <20200319074825.16035-1-junyux.jiang@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ice: fix RSS advanced rule invalid issue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" This patch added a restore function for RSS advanced rule to fix the rule invalid after running port stop and port start. Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS") Cc: stable@dpdk.org Signed-off-by: Junyu Jiang --- drivers/net/ice/ice_ethdev.c | 47 ++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 85ef83e92..c2ee37c59 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -47,6 +47,11 @@ struct proto_xtr_ol_flag { bool required; }; +struct ice_hash_flow_cfg { + bool simple_xor; + struct ice_rss_cfg rss_cfg; +}; + static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = { [PROTO_XTR_VLAN] = { .param = { .name = "ice_dynflag_proto_xtr_vlan" }, @@ -2464,6 +2469,45 @@ ice_dev_configure(struct rte_eth_dev *dev) return 0; } +static int +ice_rss_restore(struct rte_eth_dev *dev) +{ + struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct ice_vsi *vsi = pf->main_vsi; + struct rte_flow *p_flow; + struct ice_hash_flow_cfg *filter_ptr; + struct ice_flow_engine *engine; + uint32_t reg; + int ret; + + TAILQ_FOREACH(p_flow, &pf->flow_list, node) { + engine = p_flow->engine; + if (engine->type == ICE_FLOW_ENGINE_HASH) { + filter_ptr = (struct ice_hash_flow_cfg *)p_flow->rule; + /* Enable registers for simple_xor hash function. */ + if (filter_ptr->simple_xor == 1) { + reg = ICE_READ_REG(hw, + VSIQF_HASH_CTL(vsi->vsi_id)); + reg = (reg & (~VSIQF_HASH_CTL_HASH_SCHEME_M)) | + (2 << VSIQF_HASH_CTL_HASH_SCHEME_S); + ICE_WRITE_REG(hw, + VSIQF_HASH_CTL(vsi->vsi_id), reg); + } else { + ret = ice_add_rss_cfg(hw, vsi->idx, + filter_ptr->rss_cfg.hashed_flds, + filter_ptr->rss_cfg.packet_hdr, + filter_ptr->rss_cfg.symm); + if (ret) + PMD_DRV_LOG(ERR, + "%s restore rss fail %d", + __func__, ret); + } + } + } + return 0; +} + static int ice_init_rss(struct ice_pf *pf) { struct ice_hw *hw = ICE_PF_TO_HW(pf); @@ -2591,6 +2635,9 @@ static int ice_init_rss(struct ice_pf *pf) PMD_DRV_LOG(ERR, "%s PPPoE/PPPoD_SessionID rss flow fail %d", __func__, ret); + /* restore RSS configuration */ + ice_rss_restore(dev); + return 0; } -- 2.17.1