From patchwork Tue Apr 11 12:37:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 81938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2544696vqo; Tue, 11 Apr 2023 05:52:06 -0700 (PDT) X-Google-Smtp-Source: AKy350Zu3zWoivE6TCj0VQb2WPrXhquKtx49yVyM4H8NcssM1d3RLI7zv46nib1m8CuygXAlM8Z6 X-Received: by 2002:a17:906:1b07:b0:947:40e6:fde4 with SMTP id o7-20020a1709061b0700b0094740e6fde4mr2474243ejg.2.1681217526415; Tue, 11 Apr 2023 05:52:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681217526; cv=pass; d=google.com; s=arc-20160816; b=TMx7lMFyvxbVvAGcfWReZ5E8f16RXybe0fJ0OMuFUwgu3m3mQkHSXph8YUANHVDTxG xnyK1fDpaeuLyp/5+xe4c8mn6Lc6gI44bU1T4AJqtmMoJmhnJTsZOYH6/U5yzv1mpzkm wznpvnsY2SGxF9lPqBXcqCG+/LhdhCvu0f5TKZFsNIJgj4eHK2mbXF/VcRnx9FcfLReb nj8JTUHbbtM/xbVYsNowDWF+wrDLOalSe7IyWjJWskkUWfZo0p+56HXZNTG2f9WYeV3j 0AGZ2+hEIx+f+b41aKb7fvYT7MikUTiLM8pNgiBgai41/nYNGowCJ4ljcUmUpU5no6O6 NNpA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=XR5H+zetU8Qj5jKRJfHbo6rDiAB+edNxl0vk75tLFvE=; b=wd749tmG8JYavBvpQTjPNQ3wNAOGzQcVpo7PzjW7brgH+/KUAT7pcwxWOlFQ2mkqE4 EM3bA1OoPtf/cP+mW/fUhkl321wDMM4F0iIg5Crbn+LHFaQUWTxZvlZkb8i5lDAe0gvv /iQJu1IbAI3czpCuecR+Pa12n41bPNSFekmMdVgM5v79keKsvHdDr9crEY0nU4VRDj4f FUoTXjXF0xLw8dSV3afAuMS9eC1RxzCOFcLdVvjI0jChQwp7WSVHA0jnTQ951EY6PB/R WXjfV6i0GQ3bWM1xNGVrTnplUNW4YAF3jMu2CNpweZ58iXXBYi35lCsJD4xlZM+VAcaY TpaA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GieAJakE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a50ec8c000000b005048be8a371si650681edr.441.2023.04.11.05.50.47; Tue, 11 Apr 2023 05:52:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=GieAJakE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230012AbjDKMhe (ORCPT + 99 others); Tue, 11 Apr 2023 08:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbjDKMhb (ORCPT ); Tue, 11 Apr 2023 08:37:31 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2043.outbound.protection.outlook.com [40.107.94.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FCAD49C9; Tue, 11 Apr 2023 05:37:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XEhwIYKkixFFzrRXyvLxgiFbuqjDPA1Oi2AFkaT6lmTv3wESqtSb5O322iAOtyglG9JrmvTpk6FXp9uD+aRLXmP2/4DF4VTJyFi/D7inkIBs8j9RfAaJhBYMunh91unJ1quHYnELstWVds4FUAOyOpkkh3J7E5XB7DWw1xo1VNQF9HCw9KE83CA2LbDtVz/3CiHJhIOoKbnFkadEIDxdd6u3kXoTpB7V+LjL4k0oNVNK15DWkfwiAD2sPpVoJSEu27FfWWsdu3otNUJ0LkVv0J4K00apXpS3h7uT0lxFqlnni5pc8uu9ZnfAO23/Fod0YZ6M1v5yfeTz3GGTN3PjOA== 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=XR5H+zetU8Qj5jKRJfHbo6rDiAB+edNxl0vk75tLFvE=; b=D43pwKe9vzGFm4V0iQ2rpzmw7lvih/xZcPQaGu3SBdRfU5Yg0zQ4r15/uQeHeniEBqKJj5d0V0cJmCAZgw7CDRriQQpfMREeSwYS55KZ1/BzVqpKijcKAi0s1FCiDWJqMUEX1tq7vxOcbFf0yKUjZgFBuw3UG2eGll/r2WDuHD9vlDqhQCbykUOqpMjhvUap5yVBovbnY4n5Fw+W8+g/aveahSHA4uaAdoYncUv46yTX2yv/FJy5hLp4/z68AaMgHnTA56V2ZcrM/INllMDN3HaF7oUepF4quHTwHmE1QreMvDZfsMAfZXOd1OYU9/cwG5Ju9TNDIlueqYNlcB0Fmw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com 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 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=XR5H+zetU8Qj5jKRJfHbo6rDiAB+edNxl0vk75tLFvE=; b=GieAJakEtJid9VdZIzU7nUNSHJWTvcPAUd82eMlrHWyO7VG7OoAaY7vGYjggQrXqt7R4LLEjs160VXV7+BqhVtX7KcTxIMR2e/d3uGLpPR2f6LG6ovYldVBtuuMZV+Jyo5GYA6HpvEklkkQw7EHtCDSPE0gzYyWammAU/8aNUmE= Received: from DS7PR03CA0285.namprd03.prod.outlook.com (2603:10b6:5:3ad::20) by DS7PR12MB8081.namprd12.prod.outlook.com (2603:10b6:8:e6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.35; Tue, 11 Apr 2023 12:37:26 +0000 Received: from DM6NAM11FT059.eop-nam11.prod.protection.outlook.com (2603:10b6:5:3ad:cafe::d0) by DS7PR03CA0285.outlook.office365.com (2603:10b6:5:3ad::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.28 via Frontend Transport; Tue, 11 Apr 2023 12:37:26 +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 DM6NAM11FT059.mail.protection.outlook.com (10.13.172.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.28 via Frontend Transport; Tue, 11 Apr 2023 12:37:26 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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.2375.34; Tue, 11 Apr 2023 07:37:25 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 11 Apr 2023 07:37:22 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v5 1/3] net: macb: Update gem PTP support check Date: Tue, 11 Apr 2023 18:07:10 +0530 Message-ID: <20230411123712.11459-2-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411123712.11459-1-harini.katakam@amd.com> References: <20230411123712.11459-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT059:EE_|DS7PR12MB8081:EE_ X-MS-Office365-Filtering-Correlation-Id: 54631ce0-aead-4d2e-8879-08db3a8981e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TC3eYmdP7Gp5F9nwmG0OKq/Hc3EOwAEeW5eUcnncCR/FJVF6ycz/1ogfEGC8kbWUTNk1XAUiRoBvxFy7tCbq+ujvEX0cHxsH0Ekz5DGv4UxswzdA0y/oOpp9ndbSSufp4/4bVvW+m65Io5LsGciuPV3IxzfQxVgh8WZ9RiDfVAbBBgBEwlNNTBQPC97LuHJ4L6INj8MWOl4okePhkLblyhTSncZZv/5kO1x0xKf3yFQ1mulMALnyRca2nAcXIEBSalOsoTSdLMjB4eEOisRu5iU1kkcFxSo6bFXUvYLiTULQWA8byVSAQB6u9uxkxof1mFT/kAZIxt76MySTAakdG6A40ptSlMEhog10Q4BieU0hn26xcYRZDUhSRoLKMyyR39h9ITHKcrh/2/7Ir7Fl/1Njm5XojrCXvZbExnBJ+ov4FQTLAJg7zenXA/hxVmpe/UGXwABE51sLJfpl7YZgX2bkXQDyNaF8LOYjF1xWg0UpXKQkF6SzpV5Htf1krKnbx7OEhb1vuQcSjOAG2RnO4eBvIk0Smqj2mMB4yCTcChC+eW2JEYen68Ki+7nZiZqbjtQNLlwhuJLLRp83miXz8UUoVVy3LwJpR6EjcIRjTjcCVfJPkiPY6WTQw5c/VjVDmhs5iAW8g4TRpC0f07ZbZhi2On3smNvSV0lHWPZk8z6TG43Q5yIVTC8KnLdYmiXSLMhqWJ+la8hEnxGMyoSL+Omg0ICvP1gbSAA8T5b+awk= 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:(13230028)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199021)(40470700004)(36840700001)(46966006)(86362001)(356005)(82740400003)(81166007)(36860700001)(40480700001)(36756003)(82310400005)(2906002)(40460700003)(966005)(6666004)(1076003)(70586007)(4326008)(41300700001)(8676002)(54906003)(7416002)(70206006)(478600001)(44832011)(5660300002)(8936002)(83380400001)(47076005)(110136005)(316002)(26005)(2616005)(186003)(336012)(426003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 12:37:26.6706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 54631ce0-aead-4d2e-8879-08db3a8981e8 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: DM6NAM11FT059.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8081 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762884349038291655?= X-GMAIL-MSGID: =?utf-8?q?1762884349038291655?= There are currently two checks for PTP functionality - one on GEM capability and another on the kernel config option. Combine them into a single function as there's no use case where gem_has_ptp is TRUE and MACB_USE_HWSTAMP is false. Signed-off-by: Harini Katakam --- v5: Remove unnecessary braces and !! v4: Fixed error introduced in 1/3 in v3: Reported-by: kernel test robot Link: https://lore.kernel.org/oe-kbuild-all/202303280600.LarprmhI-lkp@intel.com/ v3: New patch drivers/net/ethernet/cadence/macb.h | 2 +- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index c1fc91c97cee..07560803aa26 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -1363,7 +1363,7 @@ static inline bool macb_is_gem(struct macb *bp) static inline bool gem_has_ptp(struct macb *bp) { - return !!(bp->caps & MACB_CAPS_GEM_HAS_PTP); + return IS_ENABLED(CONFIG_MACB_USE_HWSTAMP) && (bp->caps & MACB_CAPS_GEM_HAS_PTP); } /** diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index f77bd1223c8f..eab2d41fa571 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3889,17 +3889,17 @@ static void macb_configure_caps(struct macb *bp, dcfg = gem_readl(bp, DCFG2); if ((dcfg & (GEM_BIT(RX_PKT_BUFF) | GEM_BIT(TX_PKT_BUFF))) == 0) bp->caps |= MACB_CAPS_FIFO_MODE; -#ifdef CONFIG_MACB_USE_HWSTAMP if (gem_has_ptp(bp)) { if (!GEM_BFEXT(TSU, gem_readl(bp, DCFG5))) dev_err(&bp->pdev->dev, "GEM doesn't support hardware ptp.\n"); else { +#ifdef CONFIG_MACB_USE_HWSTAMP bp->hw_dma_cap |= HW_DMA_CAP_PTP; bp->ptp_info = &gem_ptp_info; +#endif } } -#endif } dev_dbg(&bp->pdev->dev, "Cadence caps 0x%08x\n", bp->caps); From patchwork Tue Apr 11 12:37:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 81937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2538290vqo; Tue, 11 Apr 2023 05:40:16 -0700 (PDT) X-Google-Smtp-Source: AKy350ZI48t3g1Mn4LES2x9DqqvERK5UySeW0/0qTruZQuV6CYGCNNMld6RigvhJ6CVlM43ZT+be X-Received: by 2002:a17:906:b297:b0:94a:e482:e26e with SMTP id q23-20020a170906b29700b0094ae482e26emr4287152ejz.36.1681216816234; Tue, 11 Apr 2023 05:40:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681216816; cv=pass; d=google.com; s=arc-20160816; b=kJ/TcBslIQtub0Nv19HdbN3ZyAmuvoHFr0nllaCkXcn+qq8bq4oCAYiZyrVGLuw7yN eMmIdPtyKsFrQwTwOcivhbV8CEOeJWnPoZcBxxW2E1qKA1EMur2CSpKEWC0Uf/uhpOPd /rTmIcorTQDUvFtW6T68GaSqpd4Hx+7VgOivCzwLQWUG7wlZs85kFvGU6ble3WnkisLz jJsMtJqzhlSJzOO2nEsKzyZm1XrfunZ3K1Z96eeRe6CIMHf7E7zFAW0SSHR+9h4ke10n s5XnMyhvE1heQU1170azMqOM63E57RdCQ4DGdo/GatyhQdHfvCzGXuIqKnhHrTsVYKSM N9gA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=aTPRXST47667/UIqNtvDQHH8ThBYJikWD4B7SbIuU6c=; b=OGDWkK973tJtYog74dFEyIXyd9JqBWIQZMRIHr+zd/PlxeWoAfBk8xDq6E/WL3x9Pn rq8cyxZys5oHGGf/qS4Kfy9J6gbRRBGGaz+sUOE44kYw1A2TKiufIKTWDGX/qn2553VX 9mCrMrLV5ekmZbzKVAPQl1V+tEIZTqUpLdHLnoxInp/HyOM/P4x9RuIjHtC0lcmspg+E 8vneXdtwCcxjXJNhNdLYjhzTmnUXNBmMFErlLY83BtsyLXSq5uebwFCisBHo2DovwGrb tZcGAXn7rTLUn5eD2EgfMGpkKc27gZzFHzMOQMUp8NMvXD8dYH2lrpIOG6kDOcZKq3lQ eB8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1pr6ocGa; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lf1-20020a170906ae4100b008b17e6556c3si9934467ejb.587.2023.04.11.05.39.52; Tue, 11 Apr 2023 05:40:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1pr6ocGa; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230047AbjDKMho (ORCPT + 99 others); Tue, 11 Apr 2023 08:37:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230011AbjDKMhf (ORCPT ); Tue, 11 Apr 2023 08:37:35 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2065.outbound.protection.outlook.com [40.107.94.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70C144495; Tue, 11 Apr 2023 05:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8ccdjCC7LqfLcLrlkX7iocnC73aUsr1WQarPdPSoATaTjh3Gr6+B5BDgQ07yFkP92oLQA6hUYKS/KhBEin3nuq2lz2zLNbL61GYDNjenRm4vAxQz30wkXryy1vMQJjxxhS52TJu3Mt9FhfEIaNFWGpH5YItzQDerXWy15nlnjsaphlehf0LhqJ6mVOSl3p+p9aQ5RsYF5R6I2bghwIdkb4ZMOZRWJTwJX9kFo+8nHSz4p/0uvLIemburrACpotKS2AI3H/UZli1F40aOHnQiBGFhEKE9Tw9si2+2Izv11o5ZRnLcAj69/JBPI//PVfOfOfjQnCGd4NXDY3ncUaR9A== 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=aTPRXST47667/UIqNtvDQHH8ThBYJikWD4B7SbIuU6c=; b=aNHOX8HoG855ibmKDXja5LnJxrhie8Jl776w/vK3pLkn4d010bhnjXVSfvK7kZXI42PZqHjiETiX7HLWKloVMbfvps0Cm8mceBPR0mJy1sWSDb1OvcaoPppdkN4Gt59O8szt9H8/YWSdSVX+Yhz6RWs4VVzn3ma7GWDZDDiZlBTJXwYLfklwMd0r6rXK4D1tS3/oX5eQlvc8Kt8I6TDRy6abtB8miyamL1tS31Lbkztc4LsYBJTQINz4E9UO8tSk9idepoQ7Yf/S1XBNN0ZB44aakfLIFLrSwbUWQYnQaxg26SoB0cg4D37JYG/MTO9J49McfdyxtEVFWWIe/F81SA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com 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 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=aTPRXST47667/UIqNtvDQHH8ThBYJikWD4B7SbIuU6c=; b=1pr6ocGa/s9IhpIyJkr+eC1UKtWRn0sy7Vty0j1KQVywRSxFYt1r3ZYTy9OhysUIi5LF9+1+YNQO+dlgBMI9zynNY6BCjN46EVzQXET1IRKJnv0Bx6ClO40BNZrYT9ALU9HuQukCHcWeGRbMuT1cONlSGk7Jr18NYKwmTMduJA8= Received: from MW4P222CA0017.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::22) by SA0PR12MB4350.namprd12.prod.outlook.com (2603:10b6:806:92::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.36; Tue, 11 Apr 2023 12:37:31 +0000 Received: from CO1NAM11FT046.eop-nam11.prod.protection.outlook.com (2603:10b6:303:114:cafe::9c) by MW4P222CA0017.outlook.office365.com (2603:10b6:303:114::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.40 via Frontend Transport; Tue, 11 Apr 2023 12:37:30 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT046.mail.protection.outlook.com (10.13.174.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.28 via Frontend Transport; Tue, 11 Apr 2023 12:37:30 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 11 Apr 2023 07:37:29 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 11 Apr 2023 07:37:26 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v5 2/3] net: macb: Enable PTP unicast Date: Tue, 11 Apr 2023 18:07:11 +0530 Message-ID: <20230411123712.11459-3-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411123712.11459-1-harini.katakam@amd.com> References: <20230411123712.11459-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT046:EE_|SA0PR12MB4350:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d000a53-cb96-404a-9234-08db3a898466 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f9m/0jnltXEiqkpLPsuc29lEJMihsf1VkLqtv5CbBm5UzeYIX3wfOZ5RfLlfbpcDLd5bW2IhemsESyBFaPVH1xgHXiDL7Fbzt0e8plX+cJrigKD6LFRkzctsWmoe4Un8L8zCyCmyjrwvhadoIu39JwpwadTOVY9wACvs9MbRjkWKzeNWpr9f3iRjyjElqfYdFVBCCe8RRMMieqaAUQ+sA3GUCPfCrfTzX5XpwFNQ+pFL279C5vQgIiL4AKot96uk3VU8kfqA6soECHoVL1RrLgLMIpzpvyl0mypmbxxP8KvwdV+bAS4B+RF3a3ZzrAaaj88hHrwwbRyLrxNHiW92Zzi+rIRHPuliApjJch7tK5qjPQaqYBRiBrmW2lgpJ1qwTNMrDdy4KjLK7VujyZudkH0l5oKx97T5dEP7BHDdu12beD5XEIYNU5IgBUXh1GWirgtX+4ENgJqv32c53j/nWQng5PtW8BSgh/OBUpW3PQmbqYbWqW+W73tqp+pkhj3EvgEKXRhvfyCYW+jsXOkMGfvtgqE72nom9krobM3NktUUUfWfZXYtsv9ZdB3AUwRNmMOLG3GySk1BIS9dgK+YG/RitImnV5YCkx8VNHiHuu+As5zfeDboXw5Q498XtCbk6D3pPSwjLb3wil9YS12p/EOlBBv+LatLU9km4spG9vq7cGvI2XCaIr8G10NQdrZTbBuyzFTrGqbAqhYOkSI42CAczx1RGJu+plR4wjS0vhM= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(376002)(346002)(396003)(451199021)(40470700004)(36840700001)(46966006)(6666004)(8936002)(40460700003)(40480700001)(44832011)(7416002)(5660300002)(86362001)(4326008)(70206006)(70586007)(8676002)(478600001)(110136005)(316002)(82310400005)(82740400003)(81166007)(36860700001)(54906003)(356005)(2906002)(1076003)(26005)(83380400001)(2616005)(426003)(47076005)(336012)(41300700001)(36756003)(186003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 12:37:30.7739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d000a53-cb96-404a-9234-08db3a898466 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT046.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4350 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762883604647608482?= X-GMAIL-MSGID: =?utf-8?q?1762883604647608482?= From: Harini Katakam Enable transmission and reception of PTP unicast packets by updating PTP unicast config bit and setting current HW mac address as allowed address in PTP unicast filter registers. Signed-off-by: Harini Katakam Signed-off-by: Michal Simek Signed-off-by: Radhey Shyam Pandey --- v5 and v4: No change v3: Remove config check as it is handled in gem_has_ptp v2: Handle operation using a single write as suggested by Cladiu drivers/net/ethernet/cadence/macb.h | 4 ++++ drivers/net/ethernet/cadence/macb_main.c | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index 07560803aa26..cfbdd0022764 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -95,6 +95,8 @@ #define GEM_SA4B 0x00A0 /* Specific4 Bottom */ #define GEM_SA4T 0x00A4 /* Specific4 Top */ #define GEM_WOL 0x00b8 /* Wake on LAN */ +#define GEM_RXPTPUNI 0x00D4 /* PTP RX Unicast address */ +#define GEM_TXPTPUNI 0x00D8 /* PTP TX Unicast address */ #define GEM_EFTSH 0x00e8 /* PTP Event Frame Transmitted Seconds Register 47:32 */ #define GEM_EFRSH 0x00ec /* PTP Event Frame Received Seconds Register 47:32 */ #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted Seconds Register 47:32 */ @@ -245,6 +247,8 @@ #define MACB_TZQ_OFFSET 12 /* Transmit zero quantum pause frame */ #define MACB_TZQ_SIZE 1 #define MACB_SRTSM_OFFSET 15 /* Store Receive Timestamp to Memory */ +#define MACB_PTPUNI_OFFSET 20 /* PTP Unicast packet enable */ +#define MACB_PTPUNI_SIZE 1 #define MACB_OSSMODE_OFFSET 24 /* Enable One Step Synchro Mode */ #define MACB_OSSMODE_SIZE 1 #define MACB_MIIONRGMII_OFFSET 28 /* MII Usage on RGMII Interface */ diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index eab2d41fa571..e941ea365db1 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -287,6 +287,11 @@ static void macb_set_hwaddr(struct macb *bp) top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4))); macb_or_gem_writel(bp, SA1T, top); + if (gem_has_ptp(bp)) { + gem_writel(bp, RXPTPUNI, bottom); + gem_writel(bp, TXPTPUNI, bottom); + } + /* Clear unused address register sets */ macb_or_gem_writel(bp, SA2B, 0); macb_or_gem_writel(bp, SA2T, 0); @@ -773,8 +778,12 @@ static void macb_mac_link_up(struct phylink_config *config, spin_unlock_irqrestore(&bp->lock, flags); - /* Enable Rx and Tx */ - macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE)); + /* Enable Rx and Tx; Enable PTP unicast */ + ctrl = macb_readl(bp, NCR); + if (gem_has_ptp(bp)) + ctrl |= MACB_BIT(PTPUNI); + + macb_writel(bp, NCR, ctrl | MACB_BIT(RE) | MACB_BIT(TE)); netif_tx_wake_all_queues(ndev); } From patchwork Tue Apr 11 12:37:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 81939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2545358vqo; Tue, 11 Apr 2023 05:53:24 -0700 (PDT) X-Google-Smtp-Source: AKy350YJa7NSKh3qTyfl5oEa4OnMkYVU3HAPELPd4B7tsdiAe1h1k+oGp9/nRRNjSvN7A4lKZmqf X-Received: by 2002:a17:907:3e9b:b0:94a:9651:51f0 with SMTP id hs27-20020a1709073e9b00b0094a965151f0mr7264291ejc.58.1681217604116; Tue, 11 Apr 2023 05:53:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681217604; cv=pass; d=google.com; s=arc-20160816; b=ur5mnnNeVefGraaP81DPrD6STj7PS30uUnQ5C91VLIddMiRH86OG8KXFpnBbSfWhmy 3grVcfsVs9egz5zCT38cUiZnHVklF0CtjaWrjX+/CuZZSt3felNighfXUpV76+N55W3c ZVItzyXo2RvR9jllp8UfxnDnbIzAAuq64xT00kaP4a/2lbSY7URWhOxepx6R5TGL6BaL LCeqa9hoH3xiomPNHueBwqsG7d3rNDw1sUnqb09KAWNa9oF0fjW+HSvKokBXhVqu4+g/ 8NWuBZQKLED/WTuXFeqrcoIZ4LB4Du8LgqbcyaH65FhHR/WvDizj+ITQiJyRtBk5mbHa hGfA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=8i90a2xWVVDrtB/5v5OBXa8ysFre5aYy9+409ypsDdw=; b=O5nN9lojdMijVqZZBs6wI0HHJNqDjvcRoMMHC/Z+nUDBcQbntIW0VEwc4JwuByLhB5 mvQCSQiXiBGu51Hvd1zdUVC+RJZOXwnjmclvmeHtaA1lwRzxEGgra+lQxv0OA9LYneTa 1hBb0bngv3sgE73ntLHv4GDkkL+8I+AvZclcggKpa8PxJl/U2hp7b2KTLcjxGNcy/PpD uzPq+bI4lHGkbEiusyVxDU3xdjq9d354MenKDG7MyF+UgfIaC1OL5Ep5SgMc6gcNNkcg BwQXkCWf5oyovQwDBdlZJ8rwfVi/Yu22kyBe3P7cE6e2nkh9+iadL58RVp6Fi/14DIiB IqdQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="41/+s+u5"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020aa7d3c1000000b004bde63cd3adsi1726624edr.115.2023.04.11.05.52.59; Tue, 11 Apr 2023 05:53:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="41/+s+u5"; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbjDKMhz (ORCPT + 99 others); Tue, 11 Apr 2023 08:37:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbjDKMhn (ORCPT ); Tue, 11 Apr 2023 08:37:43 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2047.outbound.protection.outlook.com [40.107.92.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD01C4C2E; Tue, 11 Apr 2023 05:37:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zgj+h9Mn3VUHBXr6PPOnVcKXGWvO1qA/ZP5wRm3i/xuYtQcwzDmX/SOJuQSSjQLWlaW5JILfvSCC26y2Q2cIBGVwDSTsLZAmV+M4qGXRG3eY7f4S2/uKFkPWCLCtXcU6gUXyLgBTaEt2psNfPmr4Pyp4+rCsJ2tFZCChSg3uXf8nFvHWhJcbPZpYAx1NEL66h4d6G1vNvPuytX4lJoKk48Cuq2Pw9sbKJgmfbwijJZxdV72hyDanL+5qH2WknYSQld7YdnS02MSdfTnDe0GSkvy1y/z69u7vasP2jL1YPFB4ZhuFrI0aeM7cXDH10WzuOkZft3vRT9PFAADKHuMKVQ== 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=8i90a2xWVVDrtB/5v5OBXa8ysFre5aYy9+409ypsDdw=; b=cRRNd2UHTvnmNCAEPlczTaNj9DCmI5GN1lW+uhX+5hHu4KN+HQjnWHR4ESssXpFlOqxCyKtg7hWHLqlECFZszqWCsIz5olVd+cIsZS/q4iZkQ3Sg0EMM/RQPcmgUTR2fCl3+qIhVR3A0N89PNbZTtcLOyUX8TBNNhDGVKpuYkoSkL3j8CG3lPbie6QZkGthtkR/zlySsi1YYCZAqnFocFTqmauxtySJhGnHSGCjco3xyfwBc9zp/Og/4C/TgswerkYyhNWhVGLIJ0F8v9H4iGuSrSEwqCJnu/CXmvPK7F0ToVuo7qo6WXNKYYVSyNazRjW5Wyl1e8xMvk0F3V0VWmQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=microchip.com 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 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=8i90a2xWVVDrtB/5v5OBXa8ysFre5aYy9+409ypsDdw=; b=41/+s+u5kwxRU196kmWy6gfafx1vN0JJwT4jnfAkpDR7VD+f/XdiHVomfIZDw4wZ66K5WUesIBfjqAgA+zvyGcbb0P718wYcBOPdZkpvlP41TKTO0Q9/zxg7jZ3bi4Qo74Yz2ml7lkxGOpEkotE18xCOW3gETBW5ud49b//tF9U= Received: from MW4PR04CA0263.namprd04.prod.outlook.com (2603:10b6:303:88::28) by DM4PR12MB7670.namprd12.prod.outlook.com (2603:10b6:8:105::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38; Tue, 11 Apr 2023 12:37:34 +0000 Received: from CO1NAM11FT070.eop-nam11.prod.protection.outlook.com (2603:10b6:303:88:cafe::2b) by MW4PR04CA0263.outlook.office365.com (2603:10b6:303:88::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.38 via Frontend Transport; Tue, 11 Apr 2023 12:37:34 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CO1NAM11FT070.mail.protection.outlook.com (10.13.175.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6298.28 via Frontend Transport; Tue, 11 Apr 2023 12:37:34 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 11 Apr 2023 07:37:33 -0500 Received: from xhdharinik40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Tue, 11 Apr 2023 07:37:30 -0500 From: Harini Katakam To: , , , , , , , CC: , , , , Subject: [PATCH net-next v5 3/3] net: macb: Optimize reading HW timestamp Date: Tue, 11 Apr 2023 18:07:12 +0530 Message-ID: <20230411123712.11459-4-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230411123712.11459-1-harini.katakam@amd.com> References: <20230411123712.11459-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT070:EE_|DM4PR12MB7670:EE_ X-MS-Office365-Filtering-Correlation-Id: cb8e8b03-9a01-4f5c-2f0d-08db3a8986b4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TyDJ4znphyRf/JPHC7sveZIbqCxKjIWP+q3gssf1Z/uO2g5c4aZvMyFpH+V6cAWNd2zGK/6DV1seYSmWYYZ97HIoaLKtIrLz2VwWPDHdyE2qEAIdLpXNRlQbfbklWRpV0sKVjkjAsBQtIm4SFXvEufJjs2A13sIRgL1tjhxBTliVRFK9epCvLGUKXGwpDcPoAkbBm+UlzJ/G+PBSwMwekoS+ta6dv7cavW8LCd5aWOwJ3oaHNYB9229PmkTytWVXpBmFJOUbsK97QsOFzCsa6XpErnHTldj+dVILosS9THrFnwjOJCrNz6MZB2ARkUuRME9VUEGMHkvpsSFlrBBGf00ihvRCvVk/7ult1yLFzZnjSwESyyPx0ZVmg0il1c4cMySHnPlYLtGjbqCShHf+MAeaxScuA91+io6LprP/MFqFJotM6sO04rIrFIYW+BHv+qcWHPruG+2MK5KNLiUn/0TQI0ebda0QB9a+wOYei9E/Ol0nb3Lk3TmSgUUdcfmzca/G+JXJ8zr+oaX0CmEN+NcJPZ0qobayJaT2gr0sGLtKcYlA7UzhU63LhlTMx+J69mEoPL7l7qiqK+Yiq/fTtnrLDbYolMxB7Gl0b84Teb8vuhKjvf0YgkP3NbNzW7C1RijtfSrw2PaebetpazRGKtnh9fTcpzouJti/zPnBdqM1tJ5tHOR+3HPpkldVglEK9++qw3tK6cGIz1bRcj/07HDKW+wcSZGC4mAAwEb/oz8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(346002)(376002)(396003)(451199021)(40470700004)(46966006)(36840700001)(36756003)(110136005)(44832011)(40460700003)(82310400005)(2906002)(5660300002)(7416002)(8936002)(40480700001)(86362001)(8676002)(26005)(6666004)(1076003)(54906003)(36860700001)(478600001)(47076005)(2616005)(336012)(83380400001)(426003)(186003)(70206006)(70586007)(82740400003)(81166007)(41300700001)(356005)(4326008)(316002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Apr 2023 12:37:34.6380 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cb8e8b03-9a01-4f5c-2f0d-08db3a8986b4 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT070.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7670 X-Spam-Status: No, score=0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762884430027905608?= X-GMAIL-MSGID: =?utf-8?q?1762884430027905608?= From: Harini Katakam The seconds input from BD (6 bits) just needs to be ORed with the upper bits from timer in this function. Avoid addition operation every single time. Seconds rollover handling is left untouched. Signed-off-by: Harini Katakam Signed-off-by: Michal Simek Signed-off-by: Radhey Shyam Pandey --- v5 and v4: No change v3: No change v2: - Update HW timestamp logic to remove sec_rollover variable as per Cladiu's comment - Remove Richard Cochran's ACK on original patch as the patch changed drivers/net/ethernet/cadence/macb_ptp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c index f962a95068a0..51d26fa190d7 100644 --- a/drivers/net/ethernet/cadence/macb_ptp.c +++ b/drivers/net/ethernet/cadence/macb_ptp.c @@ -258,6 +258,8 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1, */ gem_tsu_get_time(&bp->ptp_clock_info, &tsu, NULL); + ts->tv_sec |= ((~GEM_DMA_SEC_MASK) & tsu.tv_sec); + /* If the top bit is set in the timestamp, * but not in 1588 timer, it has rolled over, * so subtract max size @@ -266,8 +268,6 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1, !(tsu.tv_sec & (GEM_DMA_SEC_TOP >> 1))) ts->tv_sec -= GEM_DMA_SEC_TOP; - ts->tv_sec += ((~GEM_DMA_SEC_MASK) & tsu.tv_sec); - return 0; }