From patchwork Wed Aug 26 05:08:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 261927 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEBBEC433DF for ; Wed, 26 Aug 2020 05:09:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8BF1C2076C for ; Wed, 26 Aug 2020 05:09:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="NhQyDYOb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgHZFJL (ORCPT ); Wed, 26 Aug 2020 01:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726190AbgHZFJG (ORCPT ); Wed, 26 Aug 2020 01:09:06 -0400 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9EF9C061756 for ; Tue, 25 Aug 2020 22:09:05 -0700 (PDT) Received: by mail-wm1-x341.google.com with SMTP id o21so454014wmc.0 for ; Tue, 25 Aug 2020 22:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rq5s7AmaiVsv85ejYXRh3zzJymvPxUYH4FKSzZrzbL8=; b=NhQyDYObK5+PDnWwN7tqxDbtlmdDFRFawEf29sXY7KMtmKXJKlfrdcWrrhJ3tx71i6 L75C0ISinNqitfFXdD//qEnvuw7+/46Y0yxj16gyKeCd0emnelsqijuA0m68lpb+VvUI AXkWahN5rcqlPvvEVRAm29U8wMW2htmlfI6GY= 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; bh=rq5s7AmaiVsv85ejYXRh3zzJymvPxUYH4FKSzZrzbL8=; b=T4g+rUmwSWHFcmU1aqjTxVCJyqONl8y2MuOqZOB/dA+XbJsHBXEpa1VkwORVtELWr4 UVB2P5tD0qA9kMvC90Lu+d29pZkPd1Q3xdR0g6Yh9t77BbzS9uVakkb/Qdx1yNzS6rge RohiuoEKEwNUp6I/tnKcKUBl2AiVFSSnvkoely9HVh99nr5aydtKRU6/CK4Q7eKUfD76 7ZgItoz0KaFvZTKJbjizmUJMN3vw/H/2ZhFItgmdmMrtyqsHZksX5OqKUPQI6wppPSGM evnp8DQV+FvwetOwFxc/5QFtU/DtHJrmctI673RTgM6WQWHy4nFTySAlaudXWvvSA+4p 3e2g== X-Gm-Message-State: AOAM5303MiRBKboxHyCtuTAQYATu6gaR/Q9RhNizrBUKOO3lMEZF8GPn 8tLQWoEu0J+xyUFCJsRjVgF+0w== X-Google-Smtp-Source: ABdhPJy9ss8eLLKQJu69zriACbLVpdp3ppRFQKH05/xbaHSAy82VyvqBAqQ3IqPV1jTiNb9uaQ2Zyw== X-Received: by 2002:a05:600c:214e:: with SMTP id v14mr5199273wml.118.1598418544301; Tue, 25 Aug 2020 22:09:04 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q12sm2825832wrm.39.2020.08.25.22.09.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2020 22:09:03 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, Vasundhara Volam Subject: [PATCH net 2/8] bnxt_en: Check for zero dir entries in NVRAM. Date: Wed, 26 Aug 2020 01:08:33 -0400 Message-Id: <1598418519-20168-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> References: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Vasundhara Volam If firmware goes into unstable state, HWRM_NVM_GET_DIR_INFO firmware command may return zero dir entries. Return error in such case to avoid zero length dma buffer request. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 3890c1a..5d1a0cd 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -2323,6 +2323,9 @@ static int bnxt_get_nvram_directory(struct net_device *dev, u32 len, u8 *data) if (rc != 0) return rc; + if (!dir_entries || !entry_length) + return -EIO; + /* Insert 2 bytes of directory info (count and size of entries) */ if (len < 2) return -EINVAL; From patchwork Wed Aug 26 05:08:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 261930 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6200CC433E1 for ; Wed, 26 Aug 2020 05:09:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4255B2076C for ; Wed, 26 Aug 2020 05:09:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="gKO3czjf" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726779AbgHZFJP (ORCPT ); Wed, 26 Aug 2020 01:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725764AbgHZFJI (ORCPT ); Wed, 26 Aug 2020 01:09:08 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8630C061757 for ; Tue, 25 Aug 2020 22:09:07 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id u18so448247wmc.3 for ; Tue, 25 Aug 2020 22:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H/dopKxvhfi6bFovgPH6TA4CbFSDphMxDNj9s6UVnO4=; b=gKO3czjfXTiDVw8Q3urP4vBkpw8bnBWx+m97TNWiUdNRtbZyh1TPbNP74SFbGKjaaJ DpkxJayOlTXDmvmZy9xKZXlqT3ngUWjwusvdv11oHfNLt3j+a/eAPNiOSQbM4kAv48Ag hvS2czx8jlOSGKlEVYTts0lEmSAtRr/scXxG8= 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; bh=H/dopKxvhfi6bFovgPH6TA4CbFSDphMxDNj9s6UVnO4=; b=m5x+PrWMY5kdzhT1wbZEMuxmv33vM9o8w1JaH5q49dMmjNUOSpdpHa9wKAgRl7IDFa knjt65gVryZgUUs+vU/ShlfNBHG4f9WRRc82Dy867BAzXH6uOYs+i4LYRSARlnbsVhJW fdzyO1+beP/UjQOx8Tz9MGETjo3G5roNAulZ1y1R+3ADLLL0i/hlCVESPEnqiEOeUgj0 8k/NNfuF9LmQfm+i6/6WAt/awpX6DXiZYbnKmMkcVY4GGmwKyHo4tbCWaZvinhd3slvN TWTS/f2ClTXw494eRSAcAiK9UzGIiRAFlabetEAnkDnsN+ijerHN/c4mVPdRlhwX0RlB tpeQ== X-Gm-Message-State: AOAM5325SNmxXx4fvIERgfXP2dyIgIRN5jMt6yZMd0jnOYMuK6ZqCLl/ HnkTKN9RWEbGtDwa4xy838a/JYikb+Nb1g== X-Google-Smtp-Source: ABdhPJyzvIexkdpAXqcdGRporOWEdchtkw2upZuR/ULu33U2AikchNMyeQtn9mp7xbcno/TXXu5Q5A== X-Received: by 2002:a7b:c941:: with SMTP id i1mr5048809wml.73.1598418546091; Tue, 25 Aug 2020 22:09:06 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q12sm2825832wrm.39.2020.08.25.22.09.04 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2020 22:09:05 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net 3/8] bnxt_en: Fix ethtool -S statitics with XDP or TCs enabled. Date: Wed, 26 Aug 2020 01:08:34 -0400 Message-Id: <1598418519-20168-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> References: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We are returning the wrong count for ETH_SS_STATS in get_sset_count() when XDP or TCs are enabled. In a recent commit, we got rid of irrelevant counters when the ring is RX only or TX only, but we did not make the proper adjustments for the count. As a result, when we have XDP or TCs enabled, we are returning an excess count because some of the rings are TX only. This causes ethtool -S to display extra counters with no counter names. Fix bnxt_get_num_ring_stats() by not assuming that all rings will always have RX and TX counters in combined mode. Fixes: 125592fbf467 ("bnxt_en: show only relevant ethtool stats for a TX or RX ring") Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index 5d1a0cd..1bc5130 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -472,20 +472,13 @@ static int bnxt_get_num_tpa_ring_stats(struct bnxt *bp) static int bnxt_get_num_ring_stats(struct bnxt *bp) { int rx, tx, cmn; - bool sh = false; - - if (bp->flags & BNXT_FLAG_SHARED_RINGS) - sh = true; rx = NUM_RING_RX_HW_STATS + NUM_RING_RX_SW_STATS + bnxt_get_num_tpa_ring_stats(bp); tx = NUM_RING_TX_HW_STATS; cmn = NUM_RING_CMN_SW_STATS; - if (sh) - return (rx + tx + cmn) * bp->cp_nr_rings; - else - return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + - cmn * bp->cp_nr_rings; + return rx * bp->rx_nr_rings + tx * bp->tx_nr_rings + + cmn * bp->cp_nr_rings; } static int bnxt_get_num_stats(struct bnxt *bp) From patchwork Wed Aug 26 05:08:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 261928 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32256C433DF for ; Wed, 26 Aug 2020 05:09:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0979A2076C for ; Wed, 26 Aug 2020 05:09:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="YiPte4kl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726826AbgHZFJY (ORCPT ); Wed, 26 Aug 2020 01:09:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726759AbgHZFJM (ORCPT ); Wed, 26 Aug 2020 01:09:12 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC7BC061574 for ; Tue, 25 Aug 2020 22:09:11 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id w13so428901wrk.5 for ; Tue, 25 Aug 2020 22:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XHaGhsqTt5ZjagXMlpNlu3cCee8flkdStPbXbpx2+yI=; b=YiPte4klZ9UIaYO6nJEX2vN3HMIEjj73J1TuCvX+9R2vJE9/tbsi3WBrxPGIvu/X3B T576ZA4atgHIZV2BMBAoafOzPT8bCdAMpnf9KFiOHwv1hsX1DgfdmDi1EnteLCVo5Caf ixC9GjqjMsSFfHUHj/cUp6oZVmA53UANK0Mc0= 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; bh=XHaGhsqTt5ZjagXMlpNlu3cCee8flkdStPbXbpx2+yI=; b=S7uAHI94d6SQ+Mz2w7nC3IjPB88rMX5qtqn5V/JvinxQM0PHylC7A7PM4C0OCfi67j m6FbDbC3SP7uswN8Y8LfLXPWZoWd/M4BbBhf+NWyFqK/6gnWh1cKCWXildQGSP64wdfM q4qo3xaAjgFaD2rr8KhMUrbAyKgwR6mvXKiPBwt9Utb3/XIDc/ZmJwMiTTdcPQTiD94m pkaPo1hjjjkw9+n0S/N6WUmnzWxENWWg5hCtIc8BRs4AlDxK/Ne72bMvBrQ2tzeMB8eG 9NiERUf8qt9yRqs6ZLaRswNmv2dhIHanYW+D0oK/stPcNm/sKTNQdqUtn6fjUUBH4yZU 8qTg== X-Gm-Message-State: AOAM533vQDq7zqoZk8RSNrU9uO1rFOz5UeL0gtCL8cMFBPbEj66xD/ug RZ43V2fmzW+xM+pl8HahauyRiQ== X-Google-Smtp-Source: ABdhPJxsYpS/nDg2xPEInyUUN+OPc7ONDzMVE8kVg2/08ratQD2iPMxbEZ4T1cFFq78qB+VIQ4Ppag== X-Received: by 2002:a5d:6a83:: with SMTP id s3mr13245899wru.125.1598418549835; Tue, 25 Aug 2020 22:09:09 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q12sm2825832wrm.39.2020.08.25.22.09.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2020 22:09:09 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org Subject: [PATCH net 5/8] bnxt_en: Fix possible crash in bnxt_fw_reset_task(). Date: Wed, 26 Aug 2020 01:08:36 -0400 Message-Id: <1598418519-20168-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> References: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org bnxt_fw_reset_task() is run from a delayed workqueue. The current code is not cancelling the workqueue in the driver's .remove() method and it can potentially crash if the device is removed with the workqueue still pending. The fix is to clear the BNXT_STATE_IN_FW_RESET flag and then cancel the delayed workqueue in bnxt_remove_one(). bnxt_queue_fw_reset_work() also needs to check that this flag is set before scheduling. This will guarantee that no rescheduling will be done after it is cancelled. Fixes: 230d1f0de754 ("bnxt_en: Handle firmware reset.") Reviewed-by: Vasundhara Volam Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 4389a74..d6f3592 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -1141,6 +1141,9 @@ static int bnxt_discard_rx(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, static void bnxt_queue_fw_reset_work(struct bnxt *bp, unsigned long delay) { + if (!(test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))) + return; + if (BNXT_PF(bp)) queue_delayed_work(bnxt_pf_wq, &bp->fw_reset_task, delay); else @@ -1157,10 +1160,12 @@ static void bnxt_queue_sp_work(struct bnxt *bp) static void bnxt_cancel_sp_work(struct bnxt *bp) { - if (BNXT_PF(bp)) + if (BNXT_PF(bp)) { flush_workqueue(bnxt_pf_wq); - else + } else { cancel_work_sync(&bp->sp_task); + cancel_delayed_work_sync(&bp->fw_reset_task); + } } static void bnxt_sched_reset(struct bnxt *bp, struct bnxt_rx_ring_info *rxr) @@ -11761,6 +11766,7 @@ static void bnxt_remove_one(struct pci_dev *pdev) unregister_netdev(dev); bnxt_dl_unregister(bp); bnxt_shutdown_tc(bp); + clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); bnxt_cancel_sp_work(bp); bp->sp_event = 0; From patchwork Wed Aug 26 05:08:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 261929 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09306C433E1 for ; Wed, 26 Aug 2020 05:09:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DA7EE2076C for ; Wed, 26 Aug 2020 05:09:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="cWAmYvwD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726804AbgHZFJT (ORCPT ); Wed, 26 Aug 2020 01:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726784AbgHZFJP (ORCPT ); Wed, 26 Aug 2020 01:09:15 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E883C061757 for ; Tue, 25 Aug 2020 22:09:15 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id k20so440279wmi.5 for ; Tue, 25 Aug 2020 22:09:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lOpnUP/X5SAuRQuOVQxnAT/SG03qBwE9UaU5AK0x0Sw=; b=cWAmYvwD7wOgu4/ozQ7YIeSEKhAkIy8BcZY+xyfo88aarGWZdYB57RvQqZfnNejsdt jilGyfTjQGcax1fKvI/sDyro9AFMNVj78YBnPhlWyfldlNnfa3y8j36gas8Lmo1hFXt+ yDtLbpq/BaaMj2djVdvDek79A8SP7HqhRiyQI= 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; bh=lOpnUP/X5SAuRQuOVQxnAT/SG03qBwE9UaU5AK0x0Sw=; b=mVy2e3DY7MGmYdtxegQ4XuLiDgYUIBV5QSBBQ1s0Bi4keKzPVMXfhP0hV0Jg3wDMqg XdFefCG1mf13FQsnz8j6NX6UQxh81uExH2HFb2qLtKhur6wV+/xJPJdvujp+KLIAvK/v keUOrXA43dB5kWRikL03bg+m0uK3qM2tTyrs7ydzLe513DyN/60OHf4x3tL+PZYfgz4i myNjEOWaZBLwS2PSjS58UJ5JqBqVn2judKfzPQxSK6pcqJ9XJlQBmBNBEdC2EpkDZ8BK z8qKZyVQZpmAbwTpJsj+AE/q6BSfRZv5XStlvR73ae1Wwkq1Pigl9/kfS6osOVJChdK9 tLkg== X-Gm-Message-State: AOAM531AsQWEmPp4oOweiFCFc6ZZFJO2mbS/U4pk1mLIwxeHX3wocB0q sCoOIA08Yu2dJuvDiFimvIwVvA== X-Google-Smtp-Source: ABdhPJyyBpM7sYs57pM8QEKNKykLLte7XdbJONc57G1ZbkyUvzytPMgzXbGnq6oo0iGbDsVsnXhcsA== X-Received: by 2002:a1c:2dcc:: with SMTP id t195mr4810956wmt.166.1598418553865; Tue, 25 Aug 2020 22:09:13 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.com ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id q12sm2825832wrm.39.2020.08.25.22.09.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Aug 2020 22:09:13 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, Edwin Peer Subject: [PATCH net 7/8] bnxt_en: init RSS table for Minimal-Static VF reservation Date: Wed, 26 Aug 2020 01:08:38 -0400 Message-Id: <1598418519-20168-8-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> References: <1598418519-20168-1-git-send-email-michael.chan@broadcom.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Edwin Peer There are no VF rings available during probe when the device is configured using the Minimal-Static reservation strategy. In this case, the RSS indirection table can only be initialized later, during bnxt_open_nic(). However, this was not happening because the rings will already have been reserved via bnxt_init_dflt_ring_mode(), causing bnxt_need_reserve_rings() to return false in bnxt_reserve_rings() and bypass the RSS table init. Solve this by pushing the call to bnxt_set_dflt_rss_indir_tbl() into __bnxt_reserve_rings(), which is common to both paths and is called whenever ring configuration is changed. After doing this, the RSS table init that must be called from bnxt_init_one() happens implicitly via bnxt_set_default_rings(), necessitating doing the allocation earlier in order to avoid a null pointer dereference. Fixes: bd3191b5d87d ("bnxt_en: Implement ethtool -X to set indirection table.") Signed-off-by: Edwin Peer Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index a23ccb0..27df572 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6219,6 +6219,9 @@ static int __bnxt_reserve_rings(struct bnxt *bp) if (!tx || !rx || !cp || !grp || !vnic || !stat) return -ENOMEM; + if (!netif_is_rxfh_configured(bp->dev)) + bnxt_set_dflt_rss_indir_tbl(bp); + return rc; } @@ -8500,9 +8503,6 @@ int bnxt_reserve_rings(struct bnxt *bp, bool irq_re_init) rc = bnxt_init_int_mode(bp); bnxt_ulp_irq_restart(bp, rc); } - if (!netif_is_rxfh_configured(bp->dev)) - bnxt_set_dflt_rss_indir_tbl(bp); - if (rc) { netdev_err(bp->dev, "ring reservation/IRQ init failure rc: %d\n", rc); return rc; @@ -12209,6 +12209,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) if (BNXT_CHIP_P5(bp)) bp->flags |= BNXT_FLAG_CHIP_P5; + rc = bnxt_alloc_rss_indir_tbl(bp); + if (rc) + goto init_err_pci_clean; + rc = bnxt_fw_init_one_p2(bp); if (rc) goto init_err_pci_clean; @@ -12313,11 +12317,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) */ bp->tx_nr_rings_per_tc = bp->tx_nr_rings; - rc = bnxt_alloc_rss_indir_tbl(bp); - if (rc) - goto init_err_pci_clean; - bnxt_set_dflt_rss_indir_tbl(bp); - if (BNXT_PF(bp)) { if (!bnxt_pf_wq) { bnxt_pf_wq =