From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2DF70A034E for ; Mon, 21 Feb 2022 16:38:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25EE74013F; Mon, 21 Feb 2022 16:38:31 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 501B740E5A for ; Mon, 21 Feb 2022 16:38:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1645457909; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i5oS1QHQXpsYA4b0FSlbvwOxg/mJw7bMybPbemycg7Q=; b=W9zw5O77wzowm5iVNoJkPaYRGSB3tM2yPMbf13THxZ2XbcqR1bfvbxJzM645COVAKXqrV/ +NS2ZWu64DLzY85SwKVo+tnAZECrErrRNvb1C+oC1pWGy2AckiILOZ2fpGaY0Xa29G2jPp iIlGdmgratwj9/ltSLANfIxpP+f8gH0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-411-w4av3sKFONWdXEsEpEjrOA-1; Mon, 21 Feb 2022 10:38:25 -0500 X-MC-Unique: w4av3sKFONWdXEsEpEjrOA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D073100C660; Mon, 21 Feb 2022 15:38:24 +0000 (UTC) Received: from rh.Home (unknown [10.39.195.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFFD37E133; Mon, 21 Feb 2022 15:38:22 +0000 (UTC) From: Kevin Traynor To: Kalesh AP Cc: Ajit Khaparde , Somnath Kotur , dpdk stable Subject: patch 'net/bnxt: restore RSS configuration after reset recovery' has been queued to stable release 21.11.1 Date: Mon, 21 Feb 2022 15:34:02 +0000 Message-Id: <20220221153625.152324-53-ktraynor@redhat.com> In-Reply-To: <20220221153625.152324-1-ktraynor@redhat.com> References: <20220221153625.152324-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 21.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/26/22. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable/commit/56f92b77e7ec19822fa861a6e7a47ada6ff2a33a Thanks. Kevin --- >From 56f92b77e7ec19822fa861a6e7a47ada6ff2a33a Mon Sep 17 00:00:00 2001 From: Kalesh AP Date: Tue, 4 Jan 2022 14:08:10 +0530 Subject: [PATCH] net/bnxt: restore RSS configuration after reset recovery [ upstream commit 9b4353bec3d17d241e511f7d6917417fd395c462 ] During reset recovery, driver is not restoring the VNIC rss hash key. It's generating a new random hash key which results in unexpected RSS behavior after recovery. Fixed this by storing the VNIC RSS configuration to a local struct and then applying the cached value during the recovery. Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW") Signed-off-by: Kalesh AP Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur --- drivers/net/bnxt/bnxt.h | 2 ++ drivers/net/bnxt/bnxt_ethdev.c | 35 ++++++++++++++++++++++++++++++---- drivers/net/bnxt/bnxt_rxq.c | 2 +- drivers/net/bnxt/bnxt_vnic.c | 9 +++++++-- drivers/net/bnxt/bnxt_vnic.h | 2 +- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 521fcb7af3..614ea57d87 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -897,4 +897,6 @@ struct bnxt { rte_iova_t mc_list_dma_addr; uint32_t nb_mc_addr; + + struct rte_eth_rss_conf rss_conf; /* RSS configuration. */ }; diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c index bac96001a4..dcf2839215 100644 --- a/drivers/net/bnxt/bnxt_ethdev.c +++ b/drivers/net/bnxt/bnxt_ethdev.c @@ -369,5 +369,5 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig) goto alloc_mem_err; - rc = bnxt_alloc_vnic_attributes(bp); + rc = bnxt_alloc_vnic_attributes(bp, reconfig); if (rc) goto alloc_mem_err; @@ -1068,4 +1068,5 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) struct bnxt *bp = eth_dev->data->dev_private; uint64_t rx_offloads = eth_dev->data->dev_conf.rxmode.offloads; + struct rte_eth_rss_conf *rss_conf = ð_dev->data->dev_conf.rx_adv_conf.rss_conf; int rc; @@ -1142,4 +1143,15 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev) eth_dev->data->dev_conf.rxmode.offloads = rx_offloads; + /* application provides the hash key to program */ + if (rss_conf->rss_key != NULL) { + if (rss_conf->rss_key_len != HW_HASH_KEY_SIZE) + PMD_DRV_LOG(WARNING, "port %u RSS key len must be %d bytes long", + eth_dev->data->port_id, HW_HASH_KEY_SIZE); + else + memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE); + } + bp->rss_conf.rss_key_len = HW_HASH_KEY_SIZE; + bp->rss_conf.rss_hf = rss_conf->rss_hf; + bnxt_mtu_set_op(eth_dev, eth_dev->data->mtu); @@ -2127,7 +2139,4 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, bp->flags |= BNXT_FLAG_UPDATE_HASH; - memcpy(ð_dev->data->dev_conf.rx_adv_conf.rss_conf, - rss_conf, - sizeof(*rss_conf)); /* Update the default RSS VNIC(s) */ @@ -2138,4 +2147,7 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, RTE_ETH_RSS_LEVEL(rss_conf->rss_hf)); + /* Cache the hash function */ + bp->rss_conf.rss_hf = rss_conf->rss_hf; + /* * If hashkey is not specified, use the previously configured @@ -2153,4 +2165,7 @@ static int bnxt_rss_hash_update_op(struct rte_eth_dev *eth_dev, memcpy(vnic->rss_hash_key, rss_conf->rss_key, rss_conf->rss_key_len); + /* Cache the hash key */ + memcpy(bp->rss_conf.rss_key, rss_conf->rss_key, HW_HASH_KEY_SIZE); + rss_config: rc = bnxt_hwrm_vnic_rss_cfg(bp, vnic); @@ -5305,4 +5320,14 @@ static int bnxt_init_resources(struct bnxt *bp, bool reconfig_dev) } + if (!reconfig_dev) { + bp->rss_conf.rss_key = rte_zmalloc("bnxt_rss_key", + HW_HASH_KEY_SIZE, 0); + if (bp->rss_conf.rss_key == NULL) { + PMD_DRV_LOG(ERR, "port %u cannot allocate RSS hash key memory", + bp->eth_dev->data->port_id); + return -ENOMEM; + } + } + rc = bnxt_alloc_mem(bp, reconfig_dev); if (rc) @@ -5951,4 +5976,6 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev) rte_free(bp->mcast_addr_list); bp->mcast_addr_list = NULL; + rte_free(bp->rss_conf.rss_key); + bp->rss_conf.rss_key = NULL; } diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c index c9d99039ad..9f1d1d4dba 100644 --- a/drivers/net/bnxt/bnxt_rxq.c +++ b/drivers/net/bnxt/bnxt_rxq.c @@ -149,5 +149,5 @@ skip_filter_allocation: if (dev_conf->rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { - struct rte_eth_rss_conf *rss = &dev_conf->rx_adv_conf.rss_conf; + struct rte_eth_rss_conf *rss = &bp->rss_conf; if (bp->flags & BNXT_FLAG_UPDATE_HASH) diff --git a/drivers/net/bnxt/bnxt_vnic.c b/drivers/net/bnxt/bnxt_vnic.c index e05dc241dc..09d67ef885 100644 --- a/drivers/net/bnxt/bnxt_vnic.c +++ b/drivers/net/bnxt/bnxt_vnic.c @@ -115,5 +115,5 @@ void bnxt_free_vnic_attributes(struct bnxt *bp) } -int bnxt_alloc_vnic_attributes(struct bnxt *bp) +int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig) { struct bnxt_vnic_info *vnic; @@ -169,5 +169,10 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) vnic->rss_hash_key_dma_addr = vnic->rss_table_dma_addr + rss_table_size; - bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); + if (!reconfig) { + bnxt_prandom_bytes(vnic->rss_hash_key, HW_HASH_KEY_SIZE); + memcpy(bp->rss_conf.rss_key, vnic->rss_hash_key, HW_HASH_KEY_SIZE); + } else { + memcpy(vnic->rss_hash_key, bp->rss_conf.rss_key, HW_HASH_KEY_SIZE); + } } diff --git a/drivers/net/bnxt/bnxt_vnic.h b/drivers/net/bnxt/bnxt_vnic.h index af3a2dd779..25481fcbdd 100644 --- a/drivers/net/bnxt/bnxt_vnic.h +++ b/drivers/net/bnxt/bnxt_vnic.h @@ -61,5 +61,5 @@ struct bnxt_vnic_info *bnxt_alloc_vnic(struct bnxt *bp); void bnxt_free_all_vnics(struct bnxt *bp); void bnxt_free_vnic_attributes(struct bnxt *bp); -int bnxt_alloc_vnic_attributes(struct bnxt *bp); +int bnxt_alloc_vnic_attributes(struct bnxt *bp, bool reconfig); void bnxt_free_vnic_mem(struct bnxt *bp); int bnxt_alloc_vnic_mem(struct bnxt *bp); -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-21 15:22:45.806520568 +0000 +++ 0053-net-bnxt-restore-RSS-configuration-after-reset-recov.patch 2022-02-21 15:22:44.120704191 +0000 @@ -1 +1 @@ -From 9b4353bec3d17d241e511f7d6917417fd395c462 Mon Sep 17 00:00:00 2001 +From 56f92b77e7ec19822fa861a6e7a47ada6ff2a33a Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 9b4353bec3d17d241e511f7d6917417fd395c462 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org