From patchwork Fri Oct 20 21:27:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13431194 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CAC52B74B for ; Fri, 20 Oct 2023 21:28:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Rvdfltn8" Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C097D73 for ; Fri, 20 Oct 2023 14:28:12 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id 41be03b00d2f7-577fff1cae6so964252a12.1 for ; Fri, 20 Oct 2023 14:28:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1697837292; x=1698442092; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=AUn6Gv2Mvm1SEyJDYH34HDT/kJsxCkTeewpUSCKfxYg=; b=Rvdfltn8wqR9p4YuPm+EOP6x4Oxr3Oi4mL+M8H8qJl+8ccWlZR1/IYNei+9cVy7Sxn 261cJghXZicrf8grYXQxRAn9/OdU7+9HdDLLuOImt4enxsHRaPEAe+Wo0RXjvCr07/HJ tLckIm7PGRJoteV7EyXp2FIv5vw/Va7WVoQMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697837292; x=1698442092; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AUn6Gv2Mvm1SEyJDYH34HDT/kJsxCkTeewpUSCKfxYg=; b=hFaivwBDolrUKlHnm0VFLA4XHQ4wzBq/GzkHwdCf7hYsXquRsKMgceumPWqixNimVJ 3AuURNgiKCuEEFdosYzvCj4Xj8oYhHJBEkwzsyZiSIPjvYzZ2NsfQ1kQjbmb9No0C+sI dhDZ5x2r9vviYRGTk2gtGL4pPvFQR/Cz1bSSWzqYncLTOFfZQW3I0IHDJQiWrk7dsGC6 6TYKsQjFKpzhQxRP4rWv/j02RzF7mPc44Mflhz4HDisyigfLwHDLNsoq/K/dqXlxv3re Zr2I+zkbrS1XbDzcTkvM/dgGV2G/suj96NI4dzFkB9eJmZkAFnIt3Qji0kgDutZFpQgQ DKwA== X-Gm-Message-State: AOJu0YxuGwz6wHSylqFfrFWRqKqzfqdJmsxmPpYkmt53vwnnymALg+RU +Mi3A7ekTomfCe8QqStN74+iyg== X-Google-Smtp-Source: AGHT+IGOgAtQ75WGFOOQ6QTgHTMO6XXymP2oHsw0Hehja/CMftJiV4piNnYhCY29LyuRlq18NxFOuQ== X-Received: by 2002:a17:90a:1943:b0:27d:63f1:2d24 with SMTP id 3-20020a17090a194300b0027d63f12d24mr4632821pjh.0.1697837291658; Fri, 20 Oct 2023 14:28:11 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id j13-20020a17090a7e8d00b0026d4100e0e8sm1843348pjl.10.2023.10.20.14.28.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Oct 2023 14:28:11 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, kalesh-anakkur.purayil@broadcom.com, Guenter Roeck , Kashyap Desai , Somnath Kotur Subject: [PATCH net-next 2/8] bnxt_en: Fix invoking hwmon_notify_event Date: Fri, 20 Oct 2023 14:27:51 -0700 Message-Id: <20231020212757.173551-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231020212757.173551-1-michael.chan@broadcom.com> References: <20231020212757.173551-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Kalesh AP FW sends the async event to the driver when the device temperature goes above or below the threshold values. Only notify hwmon if the temperature is increasing to the next alert level, not when it is decreasing. Cc: Guenter Roeck Reviewed-by: Kashyap Desai Reviewed-by: Somnath Kotur Signed-off-by: Kalesh AP Signed-off-by: Michael Chan Reviewed-by: Guenter Roeck --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7837e22f237b..65092150d451 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2166,6 +2166,7 @@ static bool bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2) case ASYNC_EVENT_CMPL_ERROR_REPORT_BASE_EVENT_DATA1_ERROR_TYPE_THERMAL_THRESHOLD: { u32 type = EVENT_DATA1_THERMAL_THRESHOLD_TYPE(data1); char *threshold_type; + bool notify = false; char *dir_str; switch (type) { @@ -2185,18 +2186,23 @@ static bool bnxt_event_error_report(struct bnxt *bp, u32 data1, u32 data2) netdev_err(bp->dev, "Unknown Thermal threshold type event\n"); return false; } - if (EVENT_DATA1_THERMAL_THRESHOLD_DIR_INCREASING(data1)) + if (EVENT_DATA1_THERMAL_THRESHOLD_DIR_INCREASING(data1)) { dir_str = "above"; - else + notify = true; + } else { dir_str = "below"; + } netdev_warn(bp->dev, "Chip temperature has gone %s the %s thermal threshold!\n", dir_str, threshold_type); netdev_warn(bp->dev, "Temperature (In Celsius), Current: %lu, threshold: %lu\n", BNXT_EVENT_THERMAL_CURRENT_TEMP(data2), BNXT_EVENT_THERMAL_THRESHOLD_TEMP(data2)); - bp->thermal_threshold_type = type; - set_bit(BNXT_THERMAL_THRESHOLD_SP_EVENT, &bp->sp_event); - return true; + if (notify) { + bp->thermal_threshold_type = type; + set_bit(BNXT_THERMAL_THRESHOLD_SP_EVENT, &bp->sp_event); + return true; + } + return false; } default: netdev_err(bp->dev, "FW reported unknown error type %u\n",