From patchwork Fri Apr 19 18:34:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13636733 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D1CE10A03 for ; Fri, 19 Apr 2024 18:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713551705; cv=none; b=Df1vpf93P+RCyhpH9aO+gO1iJU2wsOZNd9Z+wGwkU77n46PnjltQKBQAtX3EGdBjKDvOLQW3v9L0Fr1wHSYKWEX2GUaGMyAdQkw8yFTbcnlyL3Fxf9h3zJXLQC+pBmLT5ztVnGb2sLNfHgaP1lmxvRXm9trlrf3gYZjpgaWSCJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713551705; c=relaxed/simple; bh=tNSpeayRP9hMqeH9ufxKp8Sll7GtVqm4Y9biatZr8xM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=b17L3cUVWDI7jLyAu1p+3P4/46lSmP5cNCsT4BesMXLgbe6uRNV6BpKLvwoZ/LSBWDa94GT2Xc3H13jopsxPoWTnrlGiHWnPKqhitdM0EFRmhb4Qf6lzwZum8SjqC5moKsO4Xi+YBfDHniOp0uaWaZ5UMAE2QuBSjMIT6JK05kc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Zy8Mk4WK; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Zy8Mk4WK" Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-61587aa956eso26091267b3.1 for ; Fri, 19 Apr 2024 11:35:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1713551703; x=1714156503; 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=7htb1aplR6vt9S5Qo8TMFQ/MfY1/e58bVBq6OlDUAes=; b=Zy8Mk4WKCZ+gxdFJ/E/nBgJGCTJSp+MuodqB748oG1qYXfdSck9TjXHeb5Knc4R7w1 PiMmbiILpY3P5Rpv8pp3Td2dMlRqxXKq6K2TfdDGo+4JwLltcwXnV+oJaMSMjf9XTl0R GX49kzMWke8BE2jcZrVRW+qstYHzw5k7er3BE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713551703; x=1714156503; 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=7htb1aplR6vt9S5Qo8TMFQ/MfY1/e58bVBq6OlDUAes=; b=g/lRh4P6RkG3IS8Maqh8vjvUp8VV+8SgW5lJiZtlzA143tNFT+7QisUZuuMj9wuwpy IUVenU0ObTQvRpJpCv7y1dtVA3bpXNzMqmJdFV8tmOAnnViK6YDjQz99uNP1412Cx2/k rg2ulNbHawraOUzQs8v5pYHH+I7xykmVwE6/pDxuDQPlFSLh2LSeipVu1b+aOVU4v9mP tbeD0P+/QPFK73lsgGvXc0pzxACyxOYgGWjXGp6MYXoSRPxkdruAvP2pVXz6RRz7BjZz eWZ/ccGW3VTyy871oIBC0BocwbR/suR2fi/5XhjPe4buks4rd/eVjoHdQZC0+ZZ1VFst X/Zw== X-Gm-Message-State: AOJu0YxPze0RTbrBb5nW1wtHGVnd8xYJib7KptFiFabJTBtXwNDE6sy1 knyjh0Iu//opeoZRzs3T3AbyKHP68sBCvQ5ieypFnXBW6HQUv7scbhzWE3IepA== X-Google-Smtp-Source: AGHT+IEuQlkNeNohQH3JHpVkifGRwfR/v946GaY/EW51WY02mTd9i6Hn45bdBdV2qfYqIcrqve8tLQ== X-Received: by 2002:a05:690c:3513:b0:61a:fe34:18b6 with SMTP id fq19-20020a05690c351300b0061afe3418b6mr3410080ywb.21.1713551702464; Fri, 19 Apr 2024 11:35:02 -0700 (PDT) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id d12-20020ac851cc000000b00438527a4eb5sm547940qtn.10.2024.04.19.11.35.00 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Apr 2024 11:35:01 -0700 (PDT) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew.gospodarek@broadcom.com, Vikas Gupta Subject: [PATCH net 1/3] bnxt_en: refactor reset close code Date: Fri, 19 Apr 2024 11:34:47 -0700 Message-Id: <20240419183449.234327-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240419183449.234327-1-michael.chan@broadcom.com> References: <20240419183449.234327-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: Vikas Gupta Introduce bnxt_fw_fatal_close() API which can be used to stop data path and disable device when firmware is in fatal state. Signed-off-by: Vikas Gupta Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 57e61f963167..c852f87c842f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13037,6 +13037,16 @@ static void bnxt_rx_ring_reset(struct bnxt *bp) bnxt_rtnl_unlock_sp(bp); } +static void bnxt_fw_fatal_close(struct bnxt *bp) +{ + bnxt_tx_disable(bp); + bnxt_disable_napi(bp); + bnxt_disable_int_sync(bp); + bnxt_free_irq(bp); + bnxt_clear_int_mode(bp); + pci_disable_device(bp->pdev); +} + static void bnxt_fw_reset_close(struct bnxt *bp) { bnxt_ulp_stop(bp); @@ -13050,12 +13060,7 @@ static void bnxt_fw_reset_close(struct bnxt *bp) pci_read_config_word(bp->pdev, PCI_SUBSYSTEM_ID, &val); if (val == 0xffff) bp->fw_reset_min_dsecs = 0; - bnxt_tx_disable(bp); - bnxt_disable_napi(bp); - bnxt_disable_int_sync(bp); - bnxt_free_irq(bp); - bnxt_clear_int_mode(bp); - pci_disable_device(bp->pdev); + bnxt_fw_fatal_close(bp); } __bnxt_close_nic(bp, true, false); bnxt_vf_reps_free(bp);