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 CA42CA04DB; Thu, 10 Dec 2020 00:58:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 27B7BCA3E; Thu, 10 Dec 2020 00:54:19 +0100 (CET) Received: from mail-pf1-f194.google.com (mail-pf1-f194.google.com [209.85.210.194]) by dpdk.org (Postfix) with ESMTP id A7C52CA14; Thu, 10 Dec 2020 00:54:12 +0100 (CET) Received: by mail-pf1-f194.google.com with SMTP id 131so2283566pfb.9; Wed, 09 Dec 2020 15:54:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9PzNizc9U1DdhSspnLOvIwGQMtCcM4ukiufiC7APRkg=; b=KJXAeLgXYA9zz5UY0f5T11SSNwWDdYk8wHhkyPwj/2oe8+oMTnRXYSA158Famt+4+4 myPCedFBj7zHcjEs02CQL5N5LMiqQhd2KCfV4om7bjbjiTITjNalr/9EY5SJhnM26NEI LrNinKaCTiJQ1M8XTXu5mGdZ3O+1ITr/Y/qA31hJbv2QBvJsSj8ml+yAvkp17AGqlnhE H+8PC791vL+PUh+vpqEZZczkw+ZDuDGm/9Bp5gS00NldOuSnH/tpt6m3trHCKt9ifWQ4 kwUo1Xe6QoPpD5uaK4ydLYbf+tc5j5MIFtQCXUsNAwgVaVQw+mRZf0K8Ke1TP5t2Tq1a da6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9PzNizc9U1DdhSspnLOvIwGQMtCcM4ukiufiC7APRkg=; b=Lyc8fdF91X5rGOE3SH2ERmEK+wJCinX2tMTVDAHkDk2Z4LPCk174kdqQB4LIPKv9Qs ys1cOlKsnRh1U24Y/6G2in5jSgPN9zU95oz5HN/+UGe8rPJnDGlHGE80byBbQvP5Ycg8 L/xOo86sS+WCIflJmEVNTYgWkWNytz4i2Wc14V82ETK4g8UFpU15rh6eVOg4PVgSMAOn hOdBhVG8mucSajXK1KLoDnEQI5RC9zDZKW2Vs0jKqyIFXMVSCo1YmYWDh/L1x5skmuNt GgCUHqnc7f9NYhS+n0pr8eNeN40iZ7V6knOBxXN+WTPggLsvI2S7W9OkAjVWe8hYn66c 4s0Q== X-Gm-Message-State: AOAM532hjhkIXO//oNmfnZ+rBQKfeLf+iH3dzbSdGc79sju8TDvmMclx 6vbPeoxymSiLZrOejdnXEIm9PMgKqN+xYSZP X-Google-Smtp-Source: ABdhPJxeq/9/uVs/etvvjlYiAsLPiVbgV7aIATkSuzl125cpiBgDSgHMvGk9RUi+1/dFIc/Pm/LOeg== X-Received: by 2002:a17:90b:1b52:: with SMTP id nv18mr4507474pjb.172.1607558050660; Wed, 09 Dec 2020 15:54:10 -0800 (PST) Received: from localhost.localdomain ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id s7sm4047693pfh.207.2020.12.09.15.54.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Dec 2020 15:54:10 -0800 (PST) From: Ajit Khaparde X-Google-Original-From: Ajit Khaparde To: dev@dpdk.org Cc: Kalesh AP , stable@dpdk.org, Somnath Kotur Date: Wed, 9 Dec 2020 15:53:43 -0800 Message-Id: <20201209235347.16180-14-ajit.khaparde@broadcom.com> X-Mailer: git-send-email 2.21.1 (Apple Git-122.3) In-Reply-To: <20201209235347.16180-1-ajit.khaparde@broadcom.com> References: <20201209192233.6518-1-ajit.khaparde@broadcom.com> <20201209235347.16180-1-ajit.khaparde@broadcom.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 13/17] net/bnxt: fix vnic RSS configure function 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" From: Kalesh AP 1. moved invalid VNIC id check to the beginning of the function. 2. removed a duplicate check which avoids unnecessary code indentation. Fixes: 49d0709b257fc ("net/bnxt: delete and flush L2 filters cleanly") Cc: stable@dpdk.org Signed-off-by: Kalesh AP Reviewed-by: Somnath Kotur Reviewed-by: Ajit Khaparde --- drivers/net/bnxt/bnxt_hwrm.c | 42 +++++++++++++++++------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c index 6f5402070..cee2656c1 100644 --- a/drivers/net/bnxt/bnxt_hwrm.c +++ b/drivers/net/bnxt/bnxt_hwrm.c @@ -4896,37 +4896,35 @@ int bnxt_vnic_rss_configure(struct bnxt *bp, struct bnxt_vnic_info *vnic) { unsigned int rss_idx, fw_idx, i; + if (vnic->fw_vnic_id == INVALID_HW_RING_ID) + return 0; + if (!(vnic->rss_table && vnic->hash_type)) return 0; if (BNXT_CHIP_P5(bp)) return bnxt_vnic_rss_configure_p5(bp, vnic); - if (vnic->fw_vnic_id == INVALID_HW_RING_ID) - return 0; - - if (vnic->rss_table && vnic->hash_type) { - /* - * Fill the RSS hash & redirection table with - * ring group ids for all VNICs - */ - for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE; - rss_idx++, fw_idx++) { - for (i = 0; i < bp->rx_cp_nr_rings; i++) { - fw_idx %= bp->rx_cp_nr_rings; - if (vnic->fw_grp_ids[fw_idx] != - INVALID_HW_RING_ID) - break; - fw_idx++; - } - if (i == bp->rx_cp_nr_rings) - return 0; - vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx]; + /* + * Fill the RSS hash & redirection table with + * ring group ids for all VNICs + */ + for (rss_idx = 0, fw_idx = 0; rss_idx < HW_HASH_INDEX_SIZE; + rss_idx++, fw_idx++) { + for (i = 0; i < bp->rx_cp_nr_rings; i++) { + fw_idx %= bp->rx_cp_nr_rings; + if (vnic->fw_grp_ids[fw_idx] != INVALID_HW_RING_ID) + break; + fw_idx++; } - return bnxt_hwrm_vnic_rss_cfg(bp, vnic); + + if (i == bp->rx_cp_nr_rings) + return 0; + + vnic->rss_table[rss_idx] = vnic->fw_grp_ids[fw_idx]; } - return 0; + return bnxt_hwrm_vnic_rss_cfg(bp, vnic); } static void bnxt_hwrm_set_coal_params(struct bnxt_coal *hw_coal, -- 2.21.1 (Apple Git-122.3)