From patchwork Tue Mar 21 12:38:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harini Katakam X-Patchwork-Id: 72851 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1753549wrt; Tue, 21 Mar 2023 05:46:17 -0700 (PDT) X-Google-Smtp-Source: AK7set8eZf3mMLKxz55b5D9xfv2BtEjmwG/xmyqibrccm9gUZXfRIac2YgvzTEjdc+LjbqMR2heh X-Received: by 2002:a05:6a20:2e0a:b0:d4:a361:fd3 with SMTP id be10-20020a056a202e0a00b000d4a3610fd3mr1745276pzb.58.1679402777502; Tue, 21 Mar 2023 05:46:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1679402777; cv=pass; d=google.com; s=arc-20160816; b=bcu4ty2xpLFaGDr41VXwO6H82rqvte6MgyoAh+SFwTJX87cpOqHbcyWuGbfSjlKEgX hZNmsr7v8+SBwqM8xk7ncAQG7c3amiZWDh+hSUWPurVgx/X0Ww/r9+ZXfbXMlmRZ6rjh GxepQ+MmwwzFesMmCPdm/MSEkXe+iRUUXIrQnwHJfuii9BykyoBAYYFb8yLR+v0Z9C/N pLpLaQCBHIylq5Q2qsIPXxvDqGy5NK6UeyJSYhWFBT02iZziHYLhjxZAzmzENSJCJCrr pq3MnPeROn+zHcr9P6DDV2odTq+ZizdYJcF0j9bCdaw/QRo5g+mGRj1fsDr+xU2szFSp uwzw== 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=ACw/+ATHQZ/0tp4suPo1PQx5sREFBidaSdw0vZZeMA+RGDJQLN6uUrlf8huKrC7Tae Pz12J9lzm+fPpxODthDp5NmkCo+sh2dr6dXnLRFUSlW9kCrhvOsN1iRj4IlU6nXD17GR hsdusoTq7xM09TyBY/UJ8KbPCtPhpfHRBGLpYWk/Edeyau1APhwaljaZDOYHkUMCeVfm qLz81mmXDiy1h6j0tOOEPUzyvv/yqfrQf7aSBSymcL/PzRtdWju4ECGM67mTgVYlGyzJ lNg/6ALyYyI3vtGwVGcj2jzLl7l8BSMUt7iYhYwtvo9wvictT6z1n1noecYsApxeCyl6 iyYg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=E7VpHyKj; arc=pass (i=1); 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 z35-20020a634c23000000b0050bc14fc7absi12818063pga.106.2023.03.21.05.46.04; Tue, 21 Mar 2023 05:46:17 -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=E7VpHyKj; arc=pass (i=1); 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 S231177AbjCUMjK (ORCPT + 99 others); Tue, 21 Mar 2023 08:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbjCUMjC (ORCPT ); Tue, 21 Mar 2023 08:39:02 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2052.outbound.protection.outlook.com [40.107.93.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D4765FE5; Tue, 21 Mar 2023 05:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KEnKPOGcw6FNUD3t7rff2tCWtc8oDQEUG7+1vTZKstTmDRGb/rZFsx9BvmVBwb5WUQgzSSBuBvlz6hWHvZJFNw+vAjI0rjX4/ncqQj5fMfaxz3GwijATdP5c43t3HBooMBmjgzK85I0uIwgXsSO8UPjgj/Rd7Solyfuu9JggHSc+4A5tNGf04xRQn47aic7+3pNYdlZGwY5e7d+Q2jQ0MTn5lxYdzVO8Ocu+xBKsjpns+tiP7hHHV7oReaccP+50j1VAC4ntCNlVXjyU93xpqB21U7InDbCckiLeQOecchmcVl/ItB0B10IzTOOujK65E1Kr4A6eHtHV2vSzNkDXvw== 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=Lh7PI18Vj7yJjeQz9gYbBr9nS0AJkJiXXToLxz/V0K/LMq1RrRgyeBmOWPcpCTSLhOThDHV5/aTWjBRQZmNDIFcrfrvFl1HtPu36zzDrqhjdkdoVkAPiYZ34StO13tkaTZkx0fHO5Sosymrz9Cy0+N81tDL9AAnALbHS2uf2lerGe8+J/sZ/8Q9N0rgEAW+whBy8dcLyRdDllaotoG0k+DD/vAct7xUnmKPFbyerJismBEvZKTWY9iqmSa8fveJpsnP5AfjLoq4LAzo438FeNJjb2QIFn6t8rYunl5URxcD9onfqnBq/5OrDXJZloCBXN9KNDKMfiNzRM0Q9wV/vPA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=xilinx.com; dmarc=fail (p=quarantine sp=quarantine pct=100) action=quarantine 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=6WEEhg49v3+3iROgDmHgjFTD2ZPMS3r+TroKLngfkCs=; b=E7VpHyKjdcGpbn0rwl2Cdkh0gAk8oSkE1KTxSo29Sw/hhaRd2uGfXw/iULNbVjNmGzN0YDS7Rk4s/XMyTjMPRwJPSohICYZ8WO8oCfIcMBI/jsuX/EQtgD76Fk/XGe2yGMKfkTlSUv1AMmLrXw4V0Ez2AGLXH6E2t8duL6H+PyM= Received: from CY5PR15CA0256.namprd15.prod.outlook.com (2603:10b6:930:66::27) by CH3PR12MB8403.namprd12.prod.outlook.com (2603:10b6:610:133::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37; Tue, 21 Mar 2023 12:38:51 +0000 Received: from CY4PEPF0000C97D.namprd02.prod.outlook.com (2603:10b6:930:66:cafe::85) by CY5PR15CA0256.outlook.office365.com (2603:10b6:930:66::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.37 via Frontend Transport; Tue, 21 Mar 2023 12:38:51 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 165.204.84.17) smtp.mailfrom=xilinx.com; dkim=none (message not signed) header.d=none;dmarc=fail action=quarantine header.from=amd.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000C97D.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6178.30 via Frontend Transport; Tue, 21 Mar 2023 12:38:51 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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, 21 Mar 2023 07:38:50 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 21 Mar 2023 05:38:50 -0700 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, 21 Mar 2023 07:38:46 -0500 From: Harini Katakam To: , , , , , , , , , , CC: , , , , , Subject: [PATCH net-next v2 2/2] net: macb: Optimize reading HW timestamp Date: Tue, 21 Mar 2023 18:08:36 +0530 Message-ID: <20230321123836.6906-3-harini.katakam@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230321123836.6906-1-harini.katakam@amd.com> References: <20230321123836.6906-1-harini.katakam@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000C97D:EE_|CH3PR12MB8403:EE_ X-MS-Office365-Filtering-Correlation-Id: 0aa76614-85d6-4507-6f8f-08db2a0939c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6vtQ0LfyHWAGEn7l91Pt+pnuIbIV3IMtRX1dgGC9trcjHuOV7q3QgX3zKznmydnSvzyqNvzylfU7/wSqXRt12YbuJa701G3ie9pLKIGnSx97Gugq9FpY50dAkGZN4/BEb51T7MdP3z6MoSa/NuYXbDOpD50Ym2dkUJY3JSASwdsaZxz6sVN+5I1tcgY6RQ7/2QbQvbfWm6l5E9TegHfj+jsTR7KjiCVsrm3whwms5taE9oN+1Ns1l3O5zk7eZriJV3pbz8tq44I57fOQu/P4pe3KAbwrhGhmbSl6MGGJEXKUnGPrTefD5cBaZ4Gfk5swnvu/j+dRTpcQPJJVbJR0jWxfybWubK83dNCSXKzmgDrwsK93yTMdtpk02egTRXmzFssTtFqm9QrzeZhHxg6/Ltp8IcQJJn465u/2QxDRpZzGgAdfyL9C1/bB1yAUHnQOiBYKVhRjHwy6E1JzWr4fV7t4tOuZm2WTUqnu7udBl6G7AHCSIba9U9ekJUgV/PfqlcrE6qeixh1dAGRM6dCjNlhpfltA7PL0wapFtATc2ZlU/RFL3Gg4CokpD4sRn5BP+Wsk9QrRH/Jvk2t4Dug/HSBqMkdw1+8JNuachGDlPvSft3vMQXwNbnv3zI1INRA/5LjOGs+pACJMm/ru/aEAjrjcmscL1QN8onFuORRfeecSqTwaQ5V5wBd1V8wwArWHc9uo5VvMG9AVDqC4Ykp3bRsaadsuF0pKtJ6OuXeMpUI= 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:(13230025)(4636009)(396003)(136003)(346002)(376002)(39860400002)(451199018)(40470700004)(46966006)(82310400005)(47076005)(35950700001)(83380400001)(426003)(2616005)(42882007)(336012)(81166007)(82740400003)(921005)(83170400001)(110136005)(40460700003)(356005)(36756003)(8676002)(8936002)(4326008)(2906002)(44832011)(70206006)(70586007)(41300700001)(40480700001)(26005)(5660300002)(54906003)(1076003)(7416002)(6666004)(498600001)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Mar 2023 12:38:51.4104 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0aa76614-85d6-4507-6f8f-08db2a0939c0 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: CY4PEPF0000C97D.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8403 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, URIBL_BLOCKED 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?1760981446757317883?= X-GMAIL-MSGID: =?utf-8?q?1760981446757317883?= 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 --- 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 e6cb20aaa76a..f9db4501b995 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; }