From patchwork Tue Jul 12 02:26:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914470 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E38CCA47B for ; Tue, 12 Jul 2022 02:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230005AbiGLC0n (ORCPT ); Mon, 11 Jul 2022 22:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbiGLC0k (ORCPT ); Mon, 11 Jul 2022 22:26:40 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC7732ECF for ; Mon, 11 Jul 2022 19:26:38 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 73so6321508pgb.10 for ; Mon, 11 Jul 2022 19:26:38 -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=gaNcqhFMItPwOzeq7hJXrhcVLq/0CJ17yndwMXl7Ocs=; b=D1nNM/gIOy15tqeaADkzhqoSXJV0Q3H57o2jWriHvxCgAqK4wFw4mH3HrgwHkZZYLG CFTYcKTMjtdDeGqeFInB3KI6AZ6pwUOBM7TZW2NjdMu7FAQ/Tr576R06XUdbK/6AOXa0 KLhlAt4CLpBABEkcjf+Xiv2pq/7XHjp5EEsoQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gaNcqhFMItPwOzeq7hJXrhcVLq/0CJ17yndwMXl7Ocs=; b=K3tORV54V1lBc7qDgv1dHXJZqaTpefngjWw6FmZ04ocUL3RsFOHi1ceCYQ2BnM9Tnd EC7GBEhdm05f99Da+o5UTkonkgv6124ZdMi5Tp8h8D1xMM0PQ6yp5LsRms3tsLsEW9DR SvsLl8X4wf+OHHBAxbpsgh+b0P8m2OQCTID6FgZS3gUKLJz0Xif5YBbRGcnPS9Hv9Hlo ETOBV5j6nA6AXBYqnKepHIC0RsNUmmYRZg+GJTiDBX98WCeVYlT5XdpdU3CXOeeqRp2u P9aDuz3xxtCafvB86OhapQAvU7Q0ymrXNHVqQkExkQ3Rwef05XErgIsWnsDb56dxSgKv 8ZVw== X-Gm-Message-State: AJIora9GT+cQJUVo1puRglypni5XOH7agpifvLlAhiJrZBOJUTJwdamK yg4GtOtm20gB1WxPF+qQjPs6x06NryhX2lTj X-Google-Smtp-Source: AGRyM1sdhgWyaPb7wRDkZ/0K3RCAtLMzMweyDEwA8wWCxhk+khRsAojGwtiGH7o0kG8U8I0uZIoh4w== X-Received: by 2002:a63:ee10:0:b0:40d:7f37:77c4 with SMTP id e16-20020a63ee10000000b0040d7f3777c4mr17827689pgi.28.1657592797933; Mon, 11 Jul 2022 19:26:37 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:36 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Kashyap Desai Subject: [PATCH net 1/5] bnxt_en: reclaim max resources if sriov enable fails Date: Mon, 11 Jul 2022 22:26:14 -0400 Message-Id: <1657592778-12730-2-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Kashyap Desai If bnxt_sriov_enable() fails after some resources have been reserved for the VFs, the current code is not unwinding properly and the reserved resources become unavailable afterwards. Fix it by properly unwinding with a call to bnxt_hwrm_func_qcaps() to reset all maximum resources. Also, add the missing bnxt_ulp_sriov_cfg() call to let the RDMA driver know to abort. Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.") Signed-off-by: Kashyap Desai Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 56b46b8206a7..7ba181ccaac2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7790,7 +7790,7 @@ static void bnxt_hwrm_dbg_qcaps(struct bnxt *bp) static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp); -static int bnxt_hwrm_func_qcaps(struct bnxt *bp) +int bnxt_hwrm_func_qcaps(struct bnxt *bp) { int rc; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index a1dca8c58f54..075c6206325c 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2314,6 +2314,7 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset); int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp); int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); +int bnxt_hwrm_func_qcaps(struct bnxt *bp); int bnxt_hwrm_fw_set_time(struct bnxt *); int bnxt_open_nic(struct bnxt *, bool, bool); int bnxt_half_open_nic(struct bnxt *bp); diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c index ddf2f3963abe..a1a2c7a64fd5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c @@ -823,8 +823,10 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) goto err_out2; rc = pci_enable_sriov(bp->pdev, *num_vfs); - if (rc) + if (rc) { + bnxt_ulp_sriov_cfg(bp, 0); goto err_out2; + } return 0; @@ -832,6 +834,9 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) /* Free the resources reserved for various VF's */ bnxt_hwrm_func_vf_resource_free(bp, *num_vfs); + /* Restore the max resources */ + bnxt_hwrm_func_qcaps(bp); + err_out1: bnxt_free_vf_resources(bp); From patchwork Tue Jul 12 02:26:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914469 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F03BC43334 for ; Tue, 12 Jul 2022 02:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229909AbiGLC0l (ORCPT ); Mon, 11 Jul 2022 22:26:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229868AbiGLC0k (ORCPT ); Mon, 11 Jul 2022 22:26:40 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F027132D8C for ; Mon, 11 Jul 2022 19:26:39 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id i8-20020a17090a4b8800b001ef8a65bfbdso6607521pjh.1 for ; Mon, 11 Jul 2022 19:26:39 -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=zV1a814olpDnSbmo97nfIlwRNcemiuv9zZ0syJp1uHE=; b=KwX91G8WkeyFWJo6OLPWD/VS8DyWpu6dhmTjTyYRq7FyzjH65ti3DA2x9riaWVL5dy IE19C0X2Zz+ifodn3Q1ro/ZQSveeMV18u1TPcyq0H3/WMQHWzYUu6M/9v4iUZ7hph8/o hpFCqDRbR16Uh4uKPEZDd3qbtSM4IzwGEwFSc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=zV1a814olpDnSbmo97nfIlwRNcemiuv9zZ0syJp1uHE=; b=QdrfQYwArMXNW5pyme493vRBNcpXoSC17LRBy8rELkDBjzWCY9JqHja5yNBhMOKR6P vbf5oQH6VtjQetInzqgK9xKxbNGV7QP7mGde+Hj4MXxWQn+SXcVk+li9nzmqEqxtXmrh 9KTJJaDsI1Z+h4PwP2Eh7y9B1g3vTBnEQe7NMSoN2uJ4aim3Mvl+HVS4bRLhyZ7zCZS/ dXOIH1dQxy0x69ffw768fxQYHalecbqZScZeyvGDcTLzYlP2hk5TYC2oYwap2FK6xCI+ Fp+cfONtWQUvWP91IxMfz+MPWp3JaMRk0vpMRdeoB8N1YoFQ4TeCWufDKt4ukr2M3jxn P6/g== X-Gm-Message-State: AJIora9za6ZrUkY+2M0Hm5zsX0ZC0PlVHl1sA4J5Qy30883lamfCrz5s N9AyxxF56anqcbR2XNarNIxnWw== X-Google-Smtp-Source: AGRyM1uxmmaAZcuXYEbkxaqeVQjmhgV/BUUV7JsM5hgvav3yc0jnaGHIMPsTPPmIFkZQnRFYa5EYAA== X-Received: by 2002:a17:90b:1e4f:b0:1ef:aa42:f196 with SMTP id pi15-20020a17090b1e4f00b001efaa42f196mr1538306pjb.228.1657592799259; Mon, 11 Jul 2022 19:26:39 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:38 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 2/5] bnxt_en: Fix bnxt_reinit_after_abort() code path Date: Mon, 11 Jul 2022 22:26:15 -0400 Message-Id: <1657592778-12730-3-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org bnxt_reinit_after_abort() is called during ifup when a previous FW reset sequence has aborted or a previous ifup has failed after detecting FW reset. In all cases, it is safe to assume that a previous FW reset has completed and the driver may not have fully reinitialized. Prior to this patch, it is assumed that the FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE flag will always be set by the firmware in bnxt_hwrm_if_change(). This may not be true if the driver has already attempted to register with the firmware. The firmware may not set the RESET_DONE flag again after the driver has registered, assuming that the driver has seen the flag already. Fix it to always go through the FW reset initialization path if the BNXT_STATE_FW_RESET_DET flag is set. This flag is always set by the driver after successfully going through bnxt_reinit_after_abort(). Fixes: 6882c36cf82e ("bnxt_en: attempt to reinitialize after aborted reset") Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7ba181ccaac2..cf9b00576ed3 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -10065,7 +10065,8 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up) if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_RESC_CHANGE) resc_reinit = true; - if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE) + if (flags & FUNC_DRV_IF_CHANGE_RESP_FLAGS_HOT_FW_RESET_DONE || + test_bit(BNXT_STATE_FW_RESET_DET, &bp->state)) fw_reset = true; else bnxt_remap_fw_health_regs(bp); From patchwork Tue Jul 12 02:26:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914471 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46415C433EF for ; Tue, 12 Jul 2022 02:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230040AbiGLC0p (ORCPT ); Mon, 11 Jul 2022 22:26:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229926AbiGLC0l (ORCPT ); Mon, 11 Jul 2022 22:26:41 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F03CA32D8C for ; Mon, 11 Jul 2022 19:26:40 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id j3so6308506pfb.6 for ; Mon, 11 Jul 2022 19:26:40 -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=d80lBoqTD646qmPEFeNUy2KDmedKwGNs/biUYzcz2gk=; b=VyN1OVd+NsiyWFaGLy5hh8eUD0gyl/vo7oOPy3bCuv8aH5qUyrG0NR1PGrmHx/2vwU GvKioDJr4PvJp0ctgWghhPg3Qj31qG5QfDLTz0MYmyrr1KZ8jvNh8ACoL8GndS6IOCTx cVldxHWQKEYqGm5jHq6XYklBM5Xj/7vqa9sg4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=d80lBoqTD646qmPEFeNUy2KDmedKwGNs/biUYzcz2gk=; b=6HLNPsKF9nQONA2vC5jjyZYQruff/Vy9NJJwjb/5bSQipTm22qzhq1zvxntVbcbE2p Um4AKlPcC5wn5k6y1Z7rPL5S7o/a0hjRH8xn02PVUXFyskMjdOH1xjSZCp+UPrC2CtVq ZErj8ZDt8eCAi7h9tub0G1B/YkrqLfmCjZbFv8CD59JvotdtZ7jIJG8HYkq6qMpHhsxv Aa21DcDJFVtWqavcu3koS2i+NAFdaBZFOG0mQcZR8Jxpmi3skFagDevdeuKbBmoH/LFN 6qnwjgQaKhnBUncIvzp458NpeK66k+coAHYZiBAQtcxYaWeirzPBqv++8JN5VHIQrgQk oi/Q== X-Gm-Message-State: AJIora/KjtjC0c6qcuMKuxJRacY8HkB5mlb3vAJ766v2715BAgK0EmSR VFcrKRCv2r1orRPtUHz41oWexQ== X-Google-Smtp-Source: AGRyM1tx/qJWY5P0MLYrgKr2ELfBv4H3VjRvd+nbqPkorK81FpbHVSJb5TAyGvamQGFzaziK57xKbA== X-Received: by 2002:a63:6c81:0:b0:3fd:4be3:8ee9 with SMTP id h123-20020a636c81000000b003fd4be38ee9mr17870494pgc.188.1657592800411; Mon, 11 Jul 2022 19:26:40 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:39 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Vikas Gupta Subject: [PATCH net 3/5] bnxt_en: fix livepatch query Date: Mon, 11 Jul 2022 22:26:16 -0400 Message-Id: <1657592778-12730-4-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Vikas Gupta In the livepatch query fw_target BNXT_FW_SRT_PATCH is applicable for P5 chips only. Fixes: 3c4153394e2c ("bnxt_en: implement firmware live patching") Reviewed-by: Saravanan Vajravel Reviewed-by: Somnath Kotur Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c index 3528ce9849e6..6b3d4f4c2a75 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c @@ -979,9 +979,11 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req, if (rc) return rc; - rc = bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH); - if (rc) - return rc; + if (BNXT_CHIP_P5(bp)) { + rc = bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_SRT_PATCH); + if (rc) + return rc; + } return bnxt_dl_livepatch_info_put(bp, req, BNXT_FW_CRT_PATCH); } From patchwork Tue Jul 12 02:26:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914473 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3627C43334 for ; Tue, 12 Jul 2022 02:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiGLC0s (ORCPT ); Mon, 11 Jul 2022 22:26:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiGLC0n (ORCPT ); Mon, 11 Jul 2022 22:26:43 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4444507A for ; Mon, 11 Jul 2022 19:26:42 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id y9so6280925pff.12 for ; Mon, 11 Jul 2022 19:26:42 -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=5rOO7bG1oQf3dAfclpw+kv2pF1erzjKxw50DSNjDzW8=; b=dd75TGl9lff2Wt/BQBb8sNDz+jJpHETsYIEP7pykc/BOZH3DjEQRlmeLJKr17+nzoj Dn2/uyOuob10MTSnu4fdd8Qt7N99Uz+YzPYd/dbSdidL3KXWsL24Opw6XaThMCLSX55H GwpOSmmlkxXIIaHl6Q7JMsJRDkMVbj20gcKqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5rOO7bG1oQf3dAfclpw+kv2pF1erzjKxw50DSNjDzW8=; b=mqy8UBt3mvaBGb/6z1VQC6YzRrK64apFjffYWSKlOtbuQTiaYTymsWcz6EEU5q3qJu ClvrO6/lI9PCbxuxPBMyJzBQYUPzds7TF26dSsYlkt19DjPYYctHc9Y1c9bvLvSSga7b CR2ERM5x3p8AtLhVNXBMOGsbg6AdJpZ/T4MK0Iah87K9rGnRKfQFKZpMWPHNpqq4lPx7 tTj1THs/eLcnDwhNnAJJPxfrVEimUHcbAbC0cH3M/CE0Uva7jvVAD+RKj9zE7k/rqlWJ +l4uDleMZFzHPVumAWKdzutdfU2LyFo+NJQYH2H1oX8kDHJZsLRbFpScgEpaFKq84Ym3 l8qg== X-Gm-Message-State: AJIora95f0bFF+FGYLAsc4shJ4ylV8X57asd99tp2Ria/g6T2xYuE6OH Ev5JIDn5R4pI1sj/m4s5b8OUuA== X-Google-Smtp-Source: AGRyM1smLTLA06hTIcTtDZJKuFkbyXd2tNTR9XIjRHbgqRrLd1vZla8p9hDlfQ1PzrkeY84zuB3MxA== X-Received: by 2002:a05:6a00:4211:b0:52a:c86e:aba3 with SMTP id cd17-20020a056a00421100b0052ac86eaba3mr10937458pfb.41.1657592801561; Mon, 11 Jul 2022 19:26:41 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:41 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com Subject: [PATCH net 4/5] bnxt_en: Fix and simplify XDP transmit path Date: Mon, 11 Jul 2022 22:26:17 -0400 Message-Id: <1657592778-12730-5-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Fix the missing length hint in the TX BD for the XDP transmit path. The length hint is required on legacy chips. Also, simplify the code by eliminating the first_buf local variable. tx_buf contains the same value. The opaque value only needs to be set on the first BD. Fix this also for correctness. Fixes: a7559bc8c17c ("bnxt: support transmit and free of aggregation buffers") Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index f02fe906dedb..f53387ed0167 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -28,7 +28,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, struct xdp_buff *xdp) { struct skb_shared_info *sinfo; - struct bnxt_sw_tx_bd *tx_buf, *first_buf; + struct bnxt_sw_tx_bd *tx_buf; struct tx_bd *txbd; int num_frags = 0; u32 flags; @@ -43,13 +43,14 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, /* fill up the first buffer */ prod = txr->tx_prod; tx_buf = &txr->tx_buf_ring[prod]; - first_buf = tx_buf; tx_buf->nr_frags = num_frags; if (xdp) tx_buf->page = virt_to_head_page(xdp->data); txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)]; - flags = ((len) << TX_BD_LEN_SHIFT) | ((num_frags + 1) << TX_BD_FLAGS_BD_CNT_SHIFT); + flags = (len << TX_BD_LEN_SHIFT) | + ((num_frags + 1) << TX_BD_FLAGS_BD_CNT_SHIFT) | + bnxt_lhint_arr[len >> 9]; txbd->tx_bd_len_flags_type = cpu_to_le32(flags); txbd->tx_bd_opaque = prod; txbd->tx_bd_haddr = cpu_to_le64(mapping); @@ -82,7 +83,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, flags = frag_len << TX_BD_LEN_SHIFT; txbd->tx_bd_len_flags_type = cpu_to_le32(flags); - txbd->tx_bd_opaque = prod; txbd->tx_bd_haddr = cpu_to_le64(frag_mapping); len = frag_len; @@ -96,7 +96,7 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp, prod = NEXT_TX(prod); txr->tx_prod = prod; - return first_buf; + return tx_buf; } static void __bnxt_xmit_xdp(struct bnxt *bp, struct bnxt_tx_ring_info *txr, From patchwork Tue Jul 12 02:26:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 12914472 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F554C433EF for ; Tue, 12 Jul 2022 02:26:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbiGLC0r (ORCPT ); Mon, 11 Jul 2022 22:26:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229839AbiGLC0o (ORCPT ); Mon, 11 Jul 2022 22:26:44 -0400 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD63C6871E for ; Mon, 11 Jul 2022 19:26:43 -0700 (PDT) Received: by mail-pg1-x52c.google.com with SMTP id 145so6324592pga.12 for ; Mon, 11 Jul 2022 19:26:43 -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=dlQahWL1Yw8riOLjDvIwGRp3AwGQ4jHFvVWVNGK7Y0g=; b=cZQY50iZI1nYA0g6CRi2oe4EEhXUYk8PyqLW5/copiwBpKjeQz3ES2h6+/iGIOMK3u kjSIRyi6Cmd2FruUPDzDjgGB9Mr4WYBbfnUBsUFO0N4qTDLLGgwXbFjM4LRP+/qyDVvK y4EjzfDiJkawMfuHwag0AuHCI7FNP3GJXadGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=dlQahWL1Yw8riOLjDvIwGRp3AwGQ4jHFvVWVNGK7Y0g=; b=PgwiabGGMl9RiNRN0D7RIZOixQ7RE2FWJQLJFCPUJ/ePCQ6gpZ1Z8QaxqgONQvFU4Z Kvgh+LYqOD40WyH+gX0fHjCnClR1ZRgQuNroSwDdnp8/DFT1Q890YegvnczAqRxWkN+a b/vAKOE+C3M1gZVIS8EMfHdb85oxGxU+9dA/S1/1d3hawyAVeRtmL0rtzZuOCta+K3tl R1CF2vV6Tdir760kVN2s2IyP7xipB1NB+IC81jhQWeUDERqQIJHTqgLbmq7jSR78T+CQ 29/3RYnph3nzb5VIy/1GA5o3IoEUR1ToBUcr6B0Rz+TyvcUOgpOUmNAvQ4xmxEL0NlQp a2lg== X-Gm-Message-State: AJIora/oop87As0heGt5evD+JGEVIS3/GkT0I974tOmOteeqCZCytfx8 dlBf5En07/p0p2K+Y5vE+oqHJfJdEYJyOQow X-Google-Smtp-Source: AGRyM1ug92V3BWWgLFLV9AsdWvxwtxreC7EYl4mTHPDS2ZW+LAllXSi2D5Yya/84Z/CRHpNm28KINA== X-Received: by 2002:a63:4d26:0:b0:411:83dd:2c3 with SMTP id a38-20020a634d26000000b0041183dd02c3mr17924584pgb.508.1657592802849; Mon, 11 Jul 2022 19:26:42 -0700 (PDT) Received: from localhost.swdvt.lab.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p4-20020a62d004000000b0052878f66f8asm5443049pfg.132.2022.07.11.19.26.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Jul 2022 19:26:42 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, kuba@kernel.org, gospo@broadcom.com, Pavan Chebbi , Richard Cochran Subject: [PATCH net 5/5] bnxt_en: Fix bnxt_refclk_read() Date: Mon, 11 Jul 2022 22:26:18 -0400 Message-Id: <1657592778-12730-6-git-send-email-michael.chan@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> References: <1657592778-12730-1-git-send-email-michael.chan@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Pavan Chebbi The upper 32-bit PHC register is not latched when reading the lower 32-bit PHC register. Current code leaves a small window where we may not read correct higher order bits if the lower order bits are just about to wrap around. This patch fixes this by reading higher order bits twice and makes sure that final value is correctly paired with its lower 32 bits. Fixes: 30e96f487f64 ("bnxt_en: Do not read the PTP PHC during chip reset") Cc: Richard Cochran Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index 562f8f68a47d..7f3c0875b6f5 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -76,14 +76,23 @@ static int bnxt_refclk_read(struct bnxt *bp, struct ptp_system_timestamp *sts, u64 *ns) { struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; + u32 high_before, high_now, low; if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) return -EIO; + high_before = readl(bp->bar0 + ptp->refclk_mapped_regs[1]); ptp_read_system_prets(sts); - *ns = readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + low = readl(bp->bar0 + ptp->refclk_mapped_regs[0]); ptp_read_system_postts(sts); - *ns |= (u64)readl(bp->bar0 + ptp->refclk_mapped_regs[1]) << 32; + high_now = readl(bp->bar0 + ptp->refclk_mapped_regs[1]); + if (high_now != high_before) { + ptp_read_system_prets(sts); + low = readl(bp->bar0 + ptp->refclk_mapped_regs[0]); + ptp_read_system_postts(sts); + } + *ns = ((u64)high_now << 32) | low; + return 0; }