From patchwork Fri Feb 2 19:59:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 196024 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp682618dyc; Fri, 2 Feb 2024 12:29:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IEc9CqwpX5g4GvWWhGarU5+ycJWV0MP5iFRCFLXwM1iiqheHLisT5jLNkd4uo8kaOHcRXxl X-Received: by 2002:a05:6a20:6f88:b0:19c:9f66:8c14 with SMTP id gv8-20020a056a206f8800b0019c9f668c14mr3843014pzb.57.1706905769390; Fri, 02 Feb 2024 12:29:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWOq8CCUcDi/c8Pux98BG57RomWSA9JKq0qA5GWfv/c5135Q0qQlqPCUZwTcTe5tBDm76aUVhRqsKhypRychpGMECimeA== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i12-20020a63220c000000b005dbdd60e432si2128566pgi.461.2024.02.02.12.29.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:29:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ykheOFpj; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-50517-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50517-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0A118B29809 for ; Fri, 2 Feb 2024 20:02:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E114612C811; Fri, 2 Feb 2024 19:59:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ykheOFpj" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2062.outbound.protection.outlook.com [40.107.212.62]) (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 7AB8C12C7E3; Fri, 2 Feb 2024 19:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903970; cv=fail; b=rm5Nmysln74bpH9M+itVAWMzdrXI9D6B4JlVATuzaUmGsp0UjAcYkRedy7Ajhb1sbTnxngaGnK0UV2IPxGdP9mTIul0olQBEAbU3d1VcPx3KsPcLTqXqNZ8qMZiBaoold5YmyP1R1PwysS3/pcojOvXehvA2RtwdRc1FjiidQbs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903970; c=relaxed/simple; bh=Eoj/9Mx5vMMhgEI7x3x7jva4l7J/bdvL48HUa8UbLNY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j9VD/0ApFy5/1SNutBDn7VYEutmqghj3jiGTFQ7z1dwR5T/6LMyk8XsbzGgqvl6celgCbihzb8dQMBNW5dbZ5GtKi7ab2ASq1oBeSzYTla/10s6M3pMIbHZ+hoppIOMep5qp3ntKLGbFva/9gzaPi+phMD0hSrFE97G2nqDCimc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=ykheOFpj; arc=fail smtp.client-ip=40.107.212.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WLb8B8qc5RoRxYkmeCBwmNSCafmhFIKkjocJ8qhVU9AHFe0l7xxioT3Nok8wEF/ANMbrTPYy3VHsUvmncOr/3zt8pomaePZe2L+hogK6mhOMjbymNajQmy5Jv4bOYsafz+6DCyGTF5Ax/tzrBC7hdS04T0QjHUpMiH5SGzkV7RzXpuz/fnbDpJXRGVfPR4RuS71jgThh7Z0NA0hUPnRPsE9ZKknyFtg+cvSVaPMS+gzZJZmqcVxWuU7FtCt2d5SjRMsABOnxomoEmhNHK/gg2FsRZTIA7YyaHydwlDyKxRoMSr6XsKcRRRRhFyO+Pf1VdHfVhr1RGpMBiXZatBQibw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ybQE2AD8Jiz5wxvemGlQ5FEgHVq6cisqumIo/nA1XWw=; b=SClA99u54lZJaADMdxXf3AmWAZmCBj81bKMCny7t8nS3+X6zEv42VF9jnkN90PyOQDR21dHWh/ewUUIJ8dysh6P0lnEiWLzzo0uTi2sPtPCSK93O9IHUTFbDfDuq3ENepTXkzjDRivMP7igqmvOHWi/32ztCySQH1Z/Nn/6PW3YwgSajN7DuPtpwnGmyCcy4pxseWzSW9R0mzns4nBepS6e0pNwc4SXR2HtSQvh1rRSLSZDsz2f8cigMu30BFMZGqghMTf3rZg6duo9HJKtWrKtAgv/9zMzhJtJoF6DoO46nyiDpgfBO7MdH/AOvQelrRBfqYymx1SIVBDdhhB3qgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ybQE2AD8Jiz5wxvemGlQ5FEgHVq6cisqumIo/nA1XWw=; b=ykheOFpjQoW2CU9429F3wowTXLI6HwqxGx3MrgdwTVlldGsh0sicCr+ai9nWOxpkFRAkNezExZGMScHep9dEB9TApq80ZC+vXqHXDgoOvUT4rgerY0lTnMaSL0uaapxzCgOrzfg8p12V9CnUVFyyEt0x+6scDW1lXDEJ7Lx+8Ik= Received: from BYAPR04CA0010.namprd04.prod.outlook.com (2603:10b6:a03:40::23) by BL1PR12MB5754.namprd12.prod.outlook.com (2603:10b6:208:391::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24; Fri, 2 Feb 2024 19:59:25 +0000 Received: from SJ5PEPF000001D3.namprd05.prod.outlook.com (2603:10b6:a03:40:cafe::60) by BYAPR04CA0010.outlook.office365.com (2603:10b6:a03:40::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.24 via Frontend Transport; Fri, 2 Feb 2024 19:59:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D3.mail.protection.outlook.com (10.167.242.55) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Fri, 2 Feb 2024 19:59:25 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 2 Feb 2024 13:59:23 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 1/4] pds_core: Don't assign interrupt index/bound_intr to notifyq Date: Fri, 2 Feb 2024 11:59:08 -0800 Message-ID: <20240202195911.65338-2-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240202195911.65338-1-brett.creeley@amd.com> References: <20240202195911.65338-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D3:EE_|BL1PR12MB5754:EE_ X-MS-Office365-Filtering-Correlation-Id: 844aea47-c7cd-4212-c5ae-08dc24297506 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mYMZ5Yn9vPVRMlQyhODqRvP7tvE40GMkmDxcvgm31Hi1FLqpdtmHrS1Xa7An/9HhQF/qkIgNmlOu8+Duk4usRx0lgC+UBGBF4mSQjDU3MatFUYFjbu56GLiyrBpP9uHYY5+/7M/JYfNLxmn0YcmAVvjJZcsoMYRAdjP4IlPnc2PvXCG9zu0wAqWKqRfMS8PsZfInwCUb3SPEx0LUeruT1fsEkIHSnHLU+Tz52Fp9P0c9KJHexoeR4tOc1m0JQqsN24yOvsCrpQSCBUQMQEvZcnTPqz/DZwHwyOgNQC3HsIsQTynl099rS7Ov3DhKVqBhera7pDwYlArW88wOaFbIEJzJCeVXMfKR+9TY7nVVrFYtVWSsB2R9rrbUmDhn+10hmPZOom+QX9YpYxAWhvGriQcyCiQxEIJ8eCwGReyKEhza0WLQVt454i9YIQVLfsij749J0PuuMchDn9NicHgbWjsJfwo43vDdXLzQ02Gc89HH+zuye+cP5AD44I0IQWeRHqXc3aHk/hvvI+LI9XU3LVFJD2l5fb2XeD0QitqPYzqrxUmjfiq1XsN12oMw01597FtvDSsC6vkQCtpHgIz5lCwMhC+MFVMuasbZNT0h8xmvJp063YVb93yN/ER6/QloaMKce6ayksRpsN0XdefEDvHCL+ufBQLarJOP4/pCHm835Sm8kvpXdcZf/89rbcMBNytL66kU7i/yLYaKSB0eRfysrR9CtTHsRsdEa2bq+0ZC56fzG872MyTBUXO3VNYscPYsqQFukpWjem2ocu6FMw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(396003)(376002)(39860400002)(136003)(230922051799003)(451199024)(1800799012)(186009)(82310400011)(64100799003)(36840700001)(40470700004)(46966006)(83380400001)(47076005)(41300700001)(81166007)(426003)(336012)(16526019)(2616005)(26005)(36860700001)(82740400003)(5660300002)(8676002)(1076003)(4326008)(110136005)(8936002)(44832011)(70206006)(316002)(2906002)(54906003)(6666004)(70586007)(478600001)(356005)(36756003)(86362001)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2024 19:59:25.3217 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 844aea47-c7cd-4212-c5ae-08dc24297506 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D3.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5754 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789820423847756580 X-GMAIL-MSGID: 1789820423847756580 The notifyq rides on the adminq's interrupt, so there's no need to setup and/or access the notifyq's interrupt index or bound_intr. The driver sets the bound_intr using qcq->intx = -1 for the notifyq, but luckily nothing accesses that field for notifyq. Instead of expecting that remains the case, just clean up the notifyq's interrupt index and bound_intr fields. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/amd/pds_core/core.c | 5 +---- drivers/net/ethernet/amd/pds_core/debugfs.c | 3 ++- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 7658a7286767..41507ade3570 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -129,6 +129,7 @@ static int pdsc_qcq_intr_alloc(struct pdsc *pdsc, struct pdsc_qcq *qcq) if (index < 0) return index; qcq->intx = index; + qcq->cq.bound_intr = &pdsc->intr_info[index]; return 0; } @@ -222,7 +223,6 @@ int pdsc_qcq_alloc(struct pdsc *pdsc, unsigned int type, unsigned int index, goto err_out_free_irq; } - qcq->cq.bound_intr = &pdsc->intr_info[qcq->intx]; qcq->cq.num_descs = num_descs; qcq->cq.desc_size = cq_desc_size; qcq->cq.tail_idx = 0; @@ -430,9 +430,6 @@ int pdsc_setup(struct pdsc *pdsc, bool init) if (err) goto err_out_teardown; - /* NotifyQ rides on the AdminQ interrupt */ - pdsc->notifyqcq.intx = pdsc->adminqcq.intx; - /* Set up the Core with the AdminQ and NotifyQ info */ err = pdsc_core_init(pdsc); if (err) diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c index 4e8579ca1c8c..ba592dbeef14 100644 --- a/drivers/net/ethernet/amd/pds_core/debugfs.c +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c @@ -109,7 +109,6 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) struct dentry *qcq_dentry, *q_dentry, *cq_dentry; struct dentry *intr_dentry; struct debugfs_regset32 *intr_ctrl_regset; - struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx]; struct pdsc_queue *q = &qcq->q; struct pdsc_cq *cq = &qcq->cq; @@ -147,6 +146,8 @@ void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) debugfs_create_u16("tail", 0400, cq_dentry, &cq->tail_idx); if (qcq->flags & PDS_CORE_QCQ_F_INTR) { + struct pdsc_intr_info *intr = &pdsc->intr_info[qcq->intx]; + intr_dentry = debugfs_create_dir("intr", qcq->dentry); if (IS_ERR_OR_NULL(intr_dentry)) return; From patchwork Fri Feb 2 19:59:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 196019 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp669578dyc; Fri, 2 Feb 2024 12:02:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFjpzs879I1J4KqcGa7KhjK8UG0yg2QFDcd3M0UdxezuED2e00TBGH658gxD2pIHGr0Q2uw X-Received: by 2002:a67:fb8f:0:b0:46c:f6d6:880 with SMTP id n15-20020a67fb8f000000b0046cf6d60880mr4378495vsr.20.1706904171518; Fri, 02 Feb 2024 12:02:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVckfHn5u0AR3ZOFXpgkQnfMjRBERdPNDD2x2GsvR+Xv0g1i8wzYkGBT+VLQeIaR2x7fVYwcQYf/UYNhTiEk0Tl1A+8IQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h22-20020a0561023d9600b0046ca514dd4dsi489788vsv.396.2024.02.02.12.02.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:02:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50518-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=m8o4Yiic; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-50518-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50518-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 218941C24AE7 for ; Fri, 2 Feb 2024 20:02:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A4D112F380; Fri, 2 Feb 2024 19:59:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="m8o4Yiic" Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2047.outbound.protection.outlook.com [40.107.243.47]) (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 5C30E81727; Fri, 2 Feb 2024 19:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903973; cv=fail; b=dhbyO/tmHnA8xpLjzEqnzToG/Xc874R9I3v8Am7gdLhEo2I3etn7cPf/HrCavK0+dEO/8HTDVKynAb4A/ScgUMbmd556PyEzVHENwmrslmbKQsqqDLc733dcVU6+35AfkPEHdRrnvd/uChz/7HJcIHIDwtL45oYvmTGsho/ZNlM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903973; c=relaxed/simple; bh=U6xPfMRjJEuLVn/pfcA4LRFtqgl6iM5I1JOTTyqSCzM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fwMzqM9OOBTsaXAdZWMFcNX07yFxXyH9LVJyj+Nf44f3CVXwVPfh+x5/MSkJK7xdGVGrbPf7xkc88RrWqOljbOtG1yg+ubZREf3AcXLZEKr48L1k439Se+aKFI/Ev86PSQZc+HUZA/BhAhSVTqmulPowzdt8vrhj6R7L40BXcek= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=m8o4Yiic; arc=fail smtp.client-ip=40.107.243.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l7LeiRyX/Qah/Em+fIOsX19+jdK/MHTwSiEvMvx96T25+KcHqnYiPsrORnXD0WNrmKtqRNfrXZW6TBpSmV2Tl6jW/aJ79iyXLeQxkM+Lq2WpcushAvekIooQQDwA92i8Taywwp36CxlzpHy4XEFKswLlEN7NEWChdR5wvfEql1yzu+L5+54V+WcO6N/ZK3BIk67WkCwRNIUbIGMp4M83eQUHp7YQDjCp+H/YuYVCn1exqE7yzb+/WfgA3IpinQlED/Pmxb2S96KohzvKRTgfCIYUeqDEvE2yDxsavTFwIvdikre60DuLEP+ak0dxI/Ca9IUY7Zi9bRYrGFsO9AXw8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T2Z2QMGoaFhEwOf6ddByjZdN3SIzdKkrE8cQnwvgOZk=; b=WcA5rnqg5/1lp1CetlDJEctmPHPfo6mp/kty6XP62Sp0XauRqkSuZc+dO2/+3hvwXd0zo9mOEe5FgPPLgi5MDzWZXKDZwmnWZBAjh/gbKlPUEeS0+ba1ExD/8xdnUutlgBoKlWeS7Oc5jDyhpxE0SVUuZlPMa1QfETlPov3NZatr5lEw31J6mDpjuWLzqWf4FCGAUNVNqk5iPJ7t0fDUnAOSla1hqUboL2Xx31Xqc+NOpANnuDfudr+yh8b29fb8rHq36LxYIBC9f68REZf8unnwm87ekgqIOXh4HuttWSqUTNN6+2yn3+Me7Hh55KAISqXnlQGSEm9Q2rYW2+qmaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T2Z2QMGoaFhEwOf6ddByjZdN3SIzdKkrE8cQnwvgOZk=; b=m8o4Yiic2Ooq+wR4oDKYlEXboTTRXVaEWXt00mhQvG0al5Xg42dNGO/wvAGJ8v1JxWi0s6EHEGGfixqr4AuBQvbXilK2bd2HwslS1EUJ3RFydIeYRLb3b91y9T7kJ1un/IstYddzwCbQfnXiGkWaQz5h8LIyWKKuEXoEdWTQfLQ= Received: from SJ0PR03CA0191.namprd03.prod.outlook.com (2603:10b6:a03:2ef::16) by DS0PR12MB8416.namprd12.prod.outlook.com (2603:10b6:8:ff::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.9; Fri, 2 Feb 2024 19:59:27 +0000 Received: from SJ5PEPF000001D7.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::2b) by SJ0PR03CA0191.outlook.office365.com (2603:10b6:a03:2ef::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.26 via Frontend Transport; Fri, 2 Feb 2024 19:59:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D7.mail.protection.outlook.com (10.167.242.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 2 Feb 2024 19:59:26 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 2 Feb 2024 13:59:24 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 2/4] pds_core: Unmask adminq interrupt in work thread Date: Fri, 2 Feb 2024 11:59:09 -0800 Message-ID: <20240202195911.65338-3-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240202195911.65338-1-brett.creeley@amd.com> References: <20240202195911.65338-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D7:EE_|DS0PR12MB8416:EE_ X-MS-Office365-Filtering-Correlation-Id: 4d651956-6e48-4cb6-7aa6-08dc242975bd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zVAC2EA6CKlMDZzHmI/MEViI3ldchARaidasMyfTdl56EEgyE8dsw7d37CzNqCb/GP7DOca8tNwvYjoOdCd0yr3zclYUcgwHkRzcZyhGZAacXZjszn5p9ta6Yf/ZBltlur3rnrNVal60rNbnN6E4J4T0gMaqykzhlhatkNkujwrdYjNwgBrliVIKQSIcZpqLZZlxEIF6CGu5rRg5jAJlQZaRv5/RY/iwdWoyYwpTEQqbb/hYFuRknQ3v9cs4DjoijKriERdQE6OM1v9+6cVqhWdFp1Ks2LbMTbJKvKkULaIKSrcesoOpn/YOFFoqYIbF08Ny6EY7GPdW2357pslhivvlUphsOVUKSJ19ulLK91V3xSN43YQoF3b57B16Y+m1sv6pWTz+RwXqgrsnqZHlbi8WV1BDFuzV0BpxrWPSKwqcM9nQnETJSgex4Jtu3Q0CzkOy5vIerSgTKWwvNe/EIUtMrIB6UWMN9ApA5vk8GGYX0apPvIdCbzPOT0U+lBd7V+olQV7wUXJ1L1W84eyYpiYlVDGe/rSB0IWvjUwYZaNu3hr86x6GAwlf3Q+GdGIThgIheUk54XjQd1KiPUX5Xph7VYT1weXYX2697/HPXQp2EPMSmOkT4tk91kJcsPOx4Ne6sc6LlmV4nSu2HQcMxk0dZhKqAjKUoQZCWyTfwLyzp0jV2ye6fDpsrLmABLz7TD9xWThESArnAhBJ4fjFumbdNEcdtZMLeFE1osy7PUXiGCFD8WvqJxSas51+OlHf3uz7ZbAHHmmPv82e6zR3+Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(346002)(376002)(136003)(230922051799003)(451199024)(186009)(64100799003)(82310400011)(1800799012)(36840700001)(46966006)(40470700004)(54906003)(44832011)(2906002)(5660300002)(6666004)(82740400003)(356005)(41300700001)(86362001)(36756003)(478600001)(2616005)(1076003)(16526019)(81166007)(336012)(83380400001)(426003)(36860700001)(26005)(316002)(4326008)(8936002)(47076005)(8676002)(70206006)(70586007)(110136005)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2024 19:59:26.6128 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d651956-6e48-4cb6-7aa6-08dc242975bd X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8416 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789818748303356059 X-GMAIL-MSGID: 1789818748303356059 Unmasking the interrupt during the pdsc_adminq_isr is a bit early and could cause unnecessary interrupts. Instead always unmask after processing the adminq and notifyq in pdsc_work_thread()->pdsc_process_adminq(). Also, since we are always unmasking, there's no need for the local credits variable in pdsc_process_adminq(). Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson Reviewed-by: Przemek Kitszel --- drivers/net/ethernet/amd/pds_core/adminq.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/adminq.c b/drivers/net/ethernet/amd/pds_core/adminq.c index ea773cfa0af6..c83a0a80d533 100644 --- a/drivers/net/ethernet/amd/pds_core/adminq.c +++ b/drivers/net/ethernet/amd/pds_core/adminq.c @@ -82,7 +82,6 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) unsigned long irqflags; int nq_work = 0; int aq_work = 0; - int credits; /* Don't process AdminQ when it's not up */ if (!pdsc_adminq_inc_if_up(pdsc)) { @@ -128,11 +127,9 @@ void pdsc_process_adminq(struct pdsc_qcq *qcq) credits: /* Return the interrupt credits, one for each completion */ - credits = nq_work + aq_work; - if (credits) - pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx], - credits, - PDS_CORE_INTR_CRED_REARM); + pds_core_intr_credits(&pdsc->intr_ctrl[qcq->intx], + nq_work + aq_work, + PDS_CORE_INTR_CRED_REARM); refcount_dec(&pdsc->adminq_refcnt); } @@ -157,7 +154,6 @@ irqreturn_t pdsc_adminq_isr(int irq, void *data) qcq = &pdsc->adminqcq; queue_work(pdsc->wq, &qcq->work); - pds_core_intr_mask(&pdsc->intr_ctrl[qcq->intx], PDS_CORE_INTR_MASK_CLEAR); refcount_dec(&pdsc->adminq_refcnt); return IRQ_HANDLED; From patchwork Fri Feb 2 19:59:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 196025 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp683364dyc; Fri, 2 Feb 2024 12:30:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IE5vp9WSYWB0BSQTZqXwB4kB7SuEXneAqEjQgxlctbuC9h03K/++mfujqn3kZor5gToj9Ay X-Received: by 2002:a92:c5b2:0:b0:363:b5eb:cc84 with SMTP id r18-20020a92c5b2000000b00363b5ebcc84mr2371587ilt.24.1706905851877; Fri, 02 Feb 2024 12:30:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWVTXHi9XC+ZwenzD2HFPx1Vj9vabF/sIG3rmcPpnRDLKn6LdgDFrCVPX5vfcSsmGhDszffpYUAhkp8ia/bJ1SwR355NQ== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l192-20020a6391c9000000b005cf9e5947fbsi2013067pge.270.2024.02.02.12.30.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:30:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50519-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=oALRjsg+; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-50519-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50519-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4B748B2A38F for ; Fri, 2 Feb 2024 20:03:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 529CD1308CB; Fri, 2 Feb 2024 19:59:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="oALRjsg+" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2087.outbound.protection.outlook.com [40.107.94.87]) (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 2E94685942; Fri, 2 Feb 2024 19:59:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.87 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903974; cv=fail; b=UsgwzEKDjZesOTkw4jpbQ/+A+KmI1zoXhfsT6O16jd0Xulh26krvXINQGaPWVhtEyv2QVkS4ilkpuuTTo73A/x53bBSO5I3Tbv9eOyVKD6BVLNGEczp/BhPX9vs8tr6/GsVACuO5kxtSlPPSyDIhi9SQZjV9rrQGmWwxI/K8NSw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903974; c=relaxed/simple; bh=uGo35Whx6Y4+ut5sS6NbQ8rgo9dS2a6eXkK1ucEqr0Y=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=j2dI1ebuEpH96FqGRUpiQ+IU04p39pULrsLd2f4uz3DxAbRm7Jby+EVhtmEpz1fhBVzL+O/ESngSKGVbtp/XqVLQeTOCk1maoT3pqPghPQgx46uX5WTjkKxBuEfWzgq++981A9WTicsOi1BrlU1EsXCp7UKoal7KLv03/JBDU5c= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=oALRjsg+; arc=fail smtp.client-ip=40.107.94.87 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kzAbbIJjS+ZmkOxJpayoqX8Gmsav3Db+b7862ZJ+dHYprRdur5msIoQxAB2U5s4ZJLKNTiMxNfD4EShUEA3eP2NPP1e39MUavObK/1pYul6+0f1r/kpGWh4jEcC65jY0CvlRb7oqIOdPpNT9VuScWIFDt579YcYJSpktStzwUhXihEkt1FCezs2wum3s+HFHaBR+c6eftH6xGRLG3jl3ddJP2xzOk3iPeimiysM6wvQdREf1hn0hj7L0UcFgMXg05oQqjqgjDcXXRpDkbSpdptwm7xTdds7+fdrP8x/N2EJLeGBUe71Wil+cm84x7KlrW/BdGhnwMgzCEVlwjgNvKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2HyysoQlDt+oUOFQoVqvcCTWHWt1i7m9VvNPB7D7Ack=; b=jzgrIziqJuhRAEK9Gh6x3XHrTIiu6KD0BssGwmDWf5DKBjk5syqsKksdsEiMEbkJdVdSs5ibG9xF8cT3zcRYquBkPzRdVz2Mj6Q2LAaWtt2TbK7NxG11rgUhNKAhP4t+XKB7SCWNJ8kxQ1x69tgwJLit6HAUW6kR+RWBaVlHsViX5l44Dg/bDvC1DEy4MeXgdLrzDZDwZBCo0vateApD3DqGHGsNljn4ZrBEIa1YWvTHAhzJMZnJNI1/rzRThTaBizP6MEwmQL6Fx24Pqd+UmiBBJ1eRGimIxptzi+QbfVzKQ5sxkjWZXmP22Qud7LS3wkPsgKDgt3V4u+QvCXlIpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2HyysoQlDt+oUOFQoVqvcCTWHWt1i7m9VvNPB7D7Ack=; b=oALRjsg+KDzO5s//1DYEbwtiFqvbIdsaGaBMGCh5W1Qmrvn/fzzxWwqE9ZZ0epM+DSRJSQOvGL5nVyHPc7sPiaakMHv0YwzV+FKf+XNiYr80suOB7upiuXeIrQQS58xkb4abPPffbwMsIqdumbQ9pNeOdhG3cmchk8fMphDbcro= Received: from SJ0PR03CA0204.namprd03.prod.outlook.com (2603:10b6:a03:2ef::29) by BL1PR12MB5780.namprd12.prod.outlook.com (2603:10b6:208:393::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.12; Fri, 2 Feb 2024 19:59:29 +0000 Received: from SJ5PEPF000001D7.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::a0) by SJ0PR03CA0204.outlook.office365.com (2603:10b6:a03:2ef::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.29 via Frontend Transport; Fri, 2 Feb 2024 19:59:28 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D7.mail.protection.outlook.com (10.167.242.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 2 Feb 2024 19:59:28 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 2 Feb 2024 13:59:26 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 3/4] pds_core: Fix up some minor issues Date: Fri, 2 Feb 2024 11:59:10 -0800 Message-ID: <20240202195911.65338-4-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240202195911.65338-1-brett.creeley@amd.com> References: <20240202195911.65338-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D7:EE_|BL1PR12MB5780:EE_ X-MS-Office365-Filtering-Correlation-Id: 84bd7920-05e1-49c1-bcb6-08dc242976e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F1trIFfBF8mICSpIAoivJNHp+P9uiEzNsQM9a9zmgJX+P9nXy9enUJEeGVh3+vn0M62ukDNZZ19+tOdHPI0x8dAzvxLf7bHHL/GKgHx2mQoanVP+py9pcfRKzlvvR9k2W0TpZw7qdyWhlckLVTr/H0xKhLWALUK6FX5AJR2b0dhwnZPrBxBm1yFQIfwMVcT6748KN5v0Ll7aQMzIb5rXV2tDD06fEdVfXVGZQBQlyUmHYBQaaU0b11Pb9exMEXbmGiHPhQj7LIyfkuVW4TMq5g9/167h8/RdXobAFtJD0e0gYz0zBilcdl77R/69lDZS9K40MKzgVrWtp1Jj8f5qTkk01FEzcSFBN9j98Dmd9q+x3nxAXYf7soWelXAMsEKmsqoMQOmr/6YEIi5f5t3x8k0H+m8H9NvhtdR/p5IGJdCHi/bh8jUG+lhhQtlivQgTSAEOzfBTg530GNoua74tezk6u2mSSEZlLWtWcTo++HZmTQ2hPr0gwZJF3H8aTAH4U7hJGr49Tkc3JUVkyNiobhWtkC38EWOpq8DMHqwRgi0R7/MpwMvPnzLhm44qcRWvXEnmXvUtwh6BPqPVqUrJ6ZR4FNwrP3uUbipGm8cJ4E2jnpiRBOPByW6sQfaaGYMKfHHWrIrPMU+SMRM5XVack7xzo5VPJXh9u404ntYAeNmVvfhngmH2ZPvbRM/18S7Snk3AJjrBZBUMzYyCTBnovDS8xlgDUQdRMWp9rjb96f1Jj0DxEsninWGf1lpu0YJsHO/XtuAUXrDwLpBaOBVWew== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(39860400002)(376002)(346002)(396003)(230922051799003)(186009)(64100799003)(1800799012)(451199024)(82310400011)(46966006)(40470700004)(36840700001)(40460700003)(40480700001)(41300700001)(83380400001)(86362001)(36756003)(82740400003)(356005)(81166007)(36860700001)(1076003)(47076005)(16526019)(2616005)(336012)(426003)(26005)(2906002)(478600001)(70206006)(70586007)(54906003)(316002)(110136005)(44832011)(6666004)(5660300002)(8936002)(8676002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2024 19:59:28.5347 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84bd7920-05e1-49c1-bcb6-08dc242976e2 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5780 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789820510051133329 X-GMAIL-MSGID: 1789820510051133329 Running xmastree.py against the driver found some RCT issues, so fix them. Also, if allocating pdsc->intr_info in pdsc_dev_init() fails the driver still tries to free pdsc->intr_info. Fix this by just returning -ENOMEM since there's nothing to free at this point of failure. Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/debugfs.c | 5 ++--- drivers/net/ethernet/amd/pds_core/dev.c | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/debugfs.c b/drivers/net/ethernet/amd/pds_core/debugfs.c index ba592dbeef14..6bdd02b7aa6d 100644 --- a/drivers/net/ethernet/amd/pds_core/debugfs.c +++ b/drivers/net/ethernet/amd/pds_core/debugfs.c @@ -32,8 +32,8 @@ void pdsc_debugfs_del_dev(struct pdsc *pdsc) static int identity_show(struct seq_file *seq, void *v) { - struct pdsc *pdsc = seq->private; struct pds_core_dev_identity *ident; + struct pdsc *pdsc = seq->private; int vt; ident = &pdsc->dev_ident; @@ -106,8 +106,7 @@ static const struct debugfs_reg32 intr_ctrl_regs[] = { void pdsc_debugfs_add_qcq(struct pdsc *pdsc, struct pdsc_qcq *qcq) { - struct dentry *qcq_dentry, *q_dentry, *cq_dentry; - struct dentry *intr_dentry; + struct dentry *qcq_dentry, *q_dentry, *cq_dentry, *intr_dentry; struct debugfs_regset32 *intr_ctrl_regset; struct pdsc_queue *q = &qcq->q; struct pdsc_cq *cq = &qcq->cq; diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c index e65a1632df50..7dc102a31185 100644 --- a/drivers/net/ethernet/amd/pds_core/dev.c +++ b/drivers/net/ethernet/amd/pds_core/dev.c @@ -341,10 +341,8 @@ int pdsc_dev_init(struct pdsc *pdsc) /* Get intr_info struct array for tracking */ pdsc->intr_info = kcalloc(nintrs, sizeof(*pdsc->intr_info), GFP_KERNEL); - if (!pdsc->intr_info) { - err = -ENOMEM; - goto err_out; - } + if (!pdsc->intr_info) + return -ENOMEM; err = pci_alloc_irq_vectors(pdsc->pdev, nintrs, nintrs, PCI_IRQ_MSIX); if (err != nintrs) { From patchwork Fri Feb 2 19:59:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brett Creeley X-Patchwork-Id: 196020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp670030dyc; Fri, 2 Feb 2024 12:03:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+oz3CbhwJT9v8pSMr1o3zLvpK4186JA5F2NtfVGDjvZWhgUatbhQQ98KSk/Y8xhBcLE/w X-Received: by 2002:a05:620a:4610:b0:783:1e5b:8e57 with SMTP id br16-20020a05620a461000b007831e5b8e57mr231856qkb.34.1706904213894; Fri, 02 Feb 2024 12:03:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUGclanRfoHJwXGlrNx/O1n/pC4NJxHMhhQXOIA1LrAsHzVg6SZONoWs04JdPv0ckA4SJVRicICnxLiHrSy2Tk/rdv4lQ== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id r13-20020a0cf80d000000b0068c7a5e268bsi2809375qvn.178.2024.02.02.12.03.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 12:03:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50522-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=UoxdQggr; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-50522-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50522-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 90B901C22FEA for ; Fri, 2 Feb 2024 20:03:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D286E130AD0; Fri, 2 Feb 2024 19:59:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="UoxdQggr" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2073.outbound.protection.outlook.com [40.107.237.73]) (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 0BE3512D753; Fri, 2 Feb 2024 19:59:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903976; cv=fail; b=jvKROnEejnqXS+PHs1hGUBWK7mEQ75qPVcs/p6f0CkIsw+7sx8ys1IOBZhoLv8TG5q+LjlKnxyoTf0Mfz1q/Vjv0mVkdqmaltmm1j4UXQWKJeTs3BLMwiofcJlmC2BEbT9gNLVCCWNaMCNap9xIrJQ9mAF1O3WPdql5vAA2jAAg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706903976; c=relaxed/simple; bh=5/XxhSKJ5dyBZqh96AqTlrkzcwfIdMcmwQoh51Qwxuk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eRR1JCxZ2LtWwTEb+wBigAhJYHUuYmQePriTNZFORTlffDceuxJH26zG3ukW1BGWVtsyBOXvprFQrU0xPNymJKahO36PynlTCsCHUvUZCDuoX8usNzq3oUkGRwgomAM6P4Ux4+XnBEwm7Po61TOwIUsIRDwpAk7FQVup8/1YR1M= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=UoxdQggr; arc=fail smtp.client-ip=40.107.237.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AhfKPOe8AP1fUBIxVL4+t0iaxc2HcuK4y7rpPz1EjTeNwESLGTh+Sux3Rk57dOt46ddaH9ay4BZtYLHk6uuzpjPEeHGo5ZIBtPCgfGTEf4NB45yD1aHL0W1Lu375LXxliD5QcIfWdvxaJd0la0rcN1JjthZh+LIzt8GDKAZ5K3X4lPPY0pgTQMTMo2SNUReJrsZIRqCeBXD04XEydQHhdFEdZe+RIr9O5ET3/H9HsTm190e1htG3G650qOVxRf7tu479bX5nP7v4Pg9Z6Wp0XX65KL4aBbXCuUEC70tY22Z8ciaP6t/kDYHS2HW9NAT/aUcJf7VeagfR07fHeHZsHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QJmn4DLpo0vKobqZwL6OFsEod8Q1UUZ0FYjc6MqS7ds=; b=OBvl3PzFzHlvbb4BeUX/rGIOH70fUk1jgw7OgNSFBa5U15+cygqbNaWjRacpJxz01q4H4OTk/IWDO1s36iktvIO0oN6awAaGOtgRQGGmDbXYl2yq3dfduvrfl5R0tNZQNb/IrODJmO2/Flk6rA0kRqOKWZPrm/kq/a5gG0XFwAPOW/XtodUPLGnB2U0HxOnZPAfFV2UMf2OBnGmkVr5mBhitmpOBzbg96k4g2QFpEHYbhE3CdvbN61aNFwl+iRx3eLNsk+VgrUVzX6CQIMo4R+Hzo1bXDUY0HxCHImQ/S0AfwxOaeZVtFkgyNLbnoAgndyBht0UY2JbYY/9vnGsuuQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=davemloft.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QJmn4DLpo0vKobqZwL6OFsEod8Q1UUZ0FYjc6MqS7ds=; b=UoxdQggrZ3UeK/aXeLgQdoQbhuAAqWyGgEi/phoPTriRWI54s+nlb4OqkUCyFWyNImZZL6UJNvK8hvXI9fPQH3wvynCA127hUyYerUNSiu2sB+zeM8RpxrnL/3RXIppb9YFcfxjzBeiGBUvQQ4QZCCxo1+9QiaIfooBuAPAVceU= Received: from SJ0PR03CA0209.namprd03.prod.outlook.com (2603:10b6:a03:2ef::34) by IA1PR12MB6258.namprd12.prod.outlook.com (2603:10b6:208:3e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.23; Fri, 2 Feb 2024 19:59:31 +0000 Received: from SJ5PEPF000001D7.namprd05.prod.outlook.com (2603:10b6:a03:2ef:cafe::57) by SJ0PR03CA0209.outlook.office365.com (2603:10b6:a03:2ef::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.31 via Frontend Transport; Fri, 2 Feb 2024 19:59:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D7.mail.protection.outlook.com (10.167.242.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7228.16 via Frontend Transport; Fri, 2 Feb 2024 19:59:29 +0000 Received: from driver-dev1.pensando.io (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Fri, 2 Feb 2024 13:59:27 -0600 From: Brett Creeley To: , , , , , CC: , Subject: [PATCH net-next 4/4] pds_core: Clean up init/uninit flows to be more readable Date: Fri, 2 Feb 2024 11:59:11 -0800 Message-ID: <20240202195911.65338-5-brett.creeley@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240202195911.65338-1-brett.creeley@amd.com> References: <20240202195911.65338-1-brett.creeley@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D7:EE_|IA1PR12MB6258:EE_ X-MS-Office365-Filtering-Correlation-Id: 83fe8cda-e59b-4b3e-5266-08dc2429779a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f5bH6a1SpNYiJtX77RBFk3CVUSeheD8RnYGYZlgkMtZkhY842JXokj8d2hlu084DYTr+l9gOYFRw2g3P/W9rjHWRVZ/YpTsSEwY41AjGi2XNLHGMZd6S/IwyN8AitH5u7HKQ539y2r4EnJ1upNykR+mv+u3TtwQPJC26un4x+Qz1NLB8c67N/H0p9f6nqwSfuBMQ4kSQzvvlLG7o45FhmrrBIgzI2ClYSwiLWf68ZYSYcbSG9NIrVcbujLsy4VT1RJR1GZYQfv0TWzsm/L3i+B0TskfxSfuVbX2t3REo6ZajhKKGAu4NCYjhhpd18+hkeNLDZ/hbBmyEwKu9Up1a2T5MYwpeYgr4n2tEfiH22D7EO5OIgxoeusHVYnJaETfG6kvB/ES7LgJoPnU2riTYzpXzy93PfggPTzH97bzHUXh5zogSXtKwOeRmixrfwEJIGvknHKjV13lst7/AViUPZzNbUaJV+Pb8qP6udmD/yGzgni9APUQZSpCpSW/DvsMrcYOnhE7w5OahYpUEHu3BK2+PrxQb08qfP+QB4iCQuFa7vXM/Bq6vWB3mlEsgXB9c4EVXgt7dHP5sS5J9C6GdcW4rixpTXU7oNr9Hl9Ky4z7QBKhekKy/llLVi86w+MslV+TxoMa1E1pxb7DaTuis87zXrirHfwvheTaoA4ssmAC1RxC58SZWNmCSWdMkaW41Tw/CYtKEEw7TVC+eRKV54El5KpcgfstYrtMLeQEyxuRPf9wILSDfTVUk1Q1L1l2e7ej0KdgfDT+nDclmE2pRiA== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(376002)(346002)(136003)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799012)(40470700004)(36840700001)(46966006)(44832011)(82740400003)(54906003)(70586007)(8676002)(86362001)(2906002)(8936002)(5660300002)(70206006)(110136005)(4326008)(478600001)(36860700001)(36756003)(316002)(81166007)(47076005)(6666004)(356005)(83380400001)(336012)(26005)(41300700001)(40480700001)(40460700003)(1076003)(2616005)(426003)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Feb 2024 19:59:29.7379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 83fe8cda-e59b-4b3e-5266-08dc2429779a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D7.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6258 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789818792673354413 X-GMAIL-MSGID: 1789818792673354413 The setup and teardown flows are somewhat hard to follow regarding pdsc_core_init()/pdsc_dev_init() and their corresponding teardown flows being in pdsc_teardown(). Improve the readability by adding new pdsc_core_uninit()/pdsc_dev_unint() functions that mirror their init counterparts. Also, move the notify and admin qcq allocations into pdsc_core_init(), so they can be freed in pdsc_core_uninit(). Signed-off-by: Brett Creeley Reviewed-by: Shannon Nelson --- drivers/net/ethernet/amd/pds_core/core.c | 87 ++++++++++++------------ drivers/net/ethernet/amd/pds_core/core.h | 1 + drivers/net/ethernet/amd/pds_core/dev.c | 16 +++++ 3 files changed, 61 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/amd/pds_core/core.c b/drivers/net/ethernet/amd/pds_core/core.c index 41507ade3570..1234a4a8a4ae 100644 --- a/drivers/net/ethernet/amd/pds_core/core.c +++ b/drivers/net/ethernet/amd/pds_core/core.c @@ -300,6 +300,17 @@ int pdsc_qcq_alloc(struct pdsc *pdsc, unsigned int type, unsigned int index, return err; } +static void pdsc_core_uninit(struct pdsc *pdsc) +{ + pdsc_qcq_free(pdsc, &pdsc->notifyqcq); + pdsc_qcq_free(pdsc, &pdsc->adminqcq); + + if (pdsc->kern_dbpage) { + iounmap(pdsc->kern_dbpage); + pdsc->kern_dbpage = NULL; + } +} + static int pdsc_core_init(struct pdsc *pdsc) { union pds_core_dev_comp comp = {}; @@ -310,9 +321,32 @@ static int pdsc_core_init(struct pdsc *pdsc) struct pds_core_dev_init_data_in cidi; u32 dbid_count; u32 dbpage_num; + int numdescs; size_t sz; int err; + /* Scale the descriptor ring length based on number of CPUs and VFs */ + numdescs = max_t(int, PDSC_ADMINQ_MIN_LENGTH, num_online_cpus()); + numdescs += 2 * pci_sriov_get_totalvfs(pdsc->pdev); + numdescs = roundup_pow_of_two(numdescs); + err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_ADMINQ, 0, "adminq", + PDS_CORE_QCQ_F_CORE | PDS_CORE_QCQ_F_INTR, + numdescs, + sizeof(union pds_core_adminq_cmd), + sizeof(union pds_core_adminq_comp), + 0, &pdsc->adminqcq); + if (err) + return err; + + err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_NOTIFYQ, 0, "notifyq", + PDS_CORE_QCQ_F_NOTIFYQ, + PDSC_NOTIFYQ_LENGTH, + sizeof(struct pds_core_notifyq_cmd), + sizeof(union pds_core_notifyq_comp), + 0, &pdsc->notifyqcq); + if (err) + goto err_out_uninit; + cidi.adminq_q_base = cpu_to_le64(pdsc->adminqcq.q_base_pa); cidi.adminq_cq_base = cpu_to_le64(pdsc->adminqcq.cq_base_pa); cidi.notifyq_cq_base = cpu_to_le64(pdsc->notifyqcq.cq.base_pa); @@ -336,7 +370,7 @@ static int pdsc_core_init(struct pdsc *pdsc) if (err) { dev_err(pdsc->dev, "Device init command failed: %pe\n", ERR_PTR(err)); - return err; + goto err_out_uninit; } pdsc->hw_index = le32_to_cpu(cido.core_hw_index); @@ -346,7 +380,8 @@ static int pdsc_core_init(struct pdsc *pdsc) pdsc->kern_dbpage = pdsc_map_dbpage(pdsc, dbpage_num); if (!pdsc->kern_dbpage) { dev_err(pdsc->dev, "Cannot map dbpage, aborting\n"); - return -ENOMEM; + err = -ENOMEM; + goto err_out_uninit; } pdsc->adminqcq.q.hw_type = cido.adminq_hw_type; @@ -359,6 +394,10 @@ static int pdsc_core_init(struct pdsc *pdsc) pdsc->last_eid = 0; + return 0; + +err_out_uninit: + pdsc_core_uninit(pdsc); return err; } @@ -401,35 +440,12 @@ static int pdsc_viftypes_init(struct pdsc *pdsc) int pdsc_setup(struct pdsc *pdsc, bool init) { - int numdescs; int err; err = pdsc_dev_init(pdsc); if (err) return err; - /* Scale the descriptor ring length based on number of CPUs and VFs */ - numdescs = max_t(int, PDSC_ADMINQ_MIN_LENGTH, num_online_cpus()); - numdescs += 2 * pci_sriov_get_totalvfs(pdsc->pdev); - numdescs = roundup_pow_of_two(numdescs); - err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_ADMINQ, 0, "adminq", - PDS_CORE_QCQ_F_CORE | PDS_CORE_QCQ_F_INTR, - numdescs, - sizeof(union pds_core_adminq_cmd), - sizeof(union pds_core_adminq_comp), - 0, &pdsc->adminqcq); - if (err) - goto err_out_teardown; - - err = pdsc_qcq_alloc(pdsc, PDS_CORE_QTYPE_NOTIFYQ, 0, "notifyq", - PDS_CORE_QCQ_F_NOTIFYQ, - PDSC_NOTIFYQ_LENGTH, - sizeof(struct pds_core_notifyq_cmd), - sizeof(union pds_core_notifyq_comp), - 0, &pdsc->notifyqcq); - if (err) - goto err_out_teardown; - /* Set up the Core with the AdminQ and NotifyQ info */ err = pdsc_core_init(pdsc); if (err) @@ -455,35 +471,20 @@ int pdsc_setup(struct pdsc *pdsc, bool init) void pdsc_teardown(struct pdsc *pdsc, bool removing) { - int i; - if (!pdsc->pdev->is_virtfn) pdsc_devcmd_reset(pdsc); if (pdsc->adminqcq.work.func) cancel_work_sync(&pdsc->adminqcq.work); - pdsc_qcq_free(pdsc, &pdsc->notifyqcq); - pdsc_qcq_free(pdsc, &pdsc->adminqcq); + + pdsc_core_uninit(pdsc); if (removing) { kfree(pdsc->viftype_status); pdsc->viftype_status = NULL; } - if (pdsc->intr_info) { - for (i = 0; i < pdsc->nintrs; i++) - pdsc_intr_free(pdsc, i); - - kfree(pdsc->intr_info); - pdsc->intr_info = NULL; - pdsc->nintrs = 0; - } - - if (pdsc->kern_dbpage) { - iounmap(pdsc->kern_dbpage); - pdsc->kern_dbpage = NULL; - } + pdsc_dev_uninit(pdsc); - pci_free_irq_vectors(pdsc->pdev); set_bit(PDSC_S_FW_DEAD, &pdsc->state); } diff --git a/drivers/net/ethernet/amd/pds_core/core.h b/drivers/net/ethernet/amd/pds_core/core.h index 110c4b826b22..3468a63f5ae9 100644 --- a/drivers/net/ethernet/amd/pds_core/core.h +++ b/drivers/net/ethernet/amd/pds_core/core.h @@ -282,6 +282,7 @@ int pdsc_devcmd_locked(struct pdsc *pdsc, union pds_core_dev_cmd *cmd, int pdsc_devcmd_init(struct pdsc *pdsc); int pdsc_devcmd_reset(struct pdsc *pdsc); int pdsc_dev_init(struct pdsc *pdsc); +void pdsc_dev_uninit(struct pdsc *pdsc); void pdsc_reset_prepare(struct pci_dev *pdev); void pdsc_reset_done(struct pci_dev *pdev); diff --git a/drivers/net/ethernet/amd/pds_core/dev.c b/drivers/net/ethernet/amd/pds_core/dev.c index 7dc102a31185..e494e1298dc9 100644 --- a/drivers/net/ethernet/amd/pds_core/dev.c +++ b/drivers/net/ethernet/amd/pds_core/dev.c @@ -316,6 +316,22 @@ static int pdsc_identify(struct pdsc *pdsc) return 0; } +void pdsc_dev_uninit(struct pdsc *pdsc) +{ + if (pdsc->intr_info) { + int i; + + for (i = 0; i < pdsc->nintrs; i++) + pdsc_intr_free(pdsc, i); + + kfree(pdsc->intr_info); + pdsc->intr_info = NULL; + pdsc->nintrs = 0; + } + + pci_free_irq_vectors(pdsc->pdev); +} + int pdsc_dev_init(struct pdsc *pdsc) { unsigned int nintrs;