From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 68CE242C10 for ; Fri, 2 Jun 2023 11:00:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60B3040ED8; Fri, 2 Jun 2023 11:00:34 +0200 (CEST) Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by mails.dpdk.org (Postfix) with ESMTP id 01C11406B8; Fri, 2 Jun 2023 11:00:33 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NKXa8O1b5nc7T64LSSQz5q64UgBejASz6/ygCc1MvwU/2+qcZq68kOgtPCTyK9YaCvebwUC74oWftKhDU0BYHxLNt6Is9s2PvcG91dlYA7K14CRHLPEe/vxvUOruNmmQcFLNNJyBrTLf9apKGKViL6ShmoG7j9WuJtn4G5SSg8F8KWjCD9C/NeN7pQbW9mqyGSSlZwN+jcmzhLbHwUmqmx14SxY14yyQPm6uLBGYgZOp/VkasXjJWEqIqq30vyFVs+T//6dL+MLvkdksmzUWEfJm6++k/45aq+XidLf1QCYJYfhHWPSKBwiltbM0mZixFeiv4bMKJkbdd4jkp5h9Jg== 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=e+Vvkm5ao/btl0zPOFCosUlxlig/r+q9P1SMp812SAQ=; b=TYjv+uYUobJMeeRNnIZ1s/ja8BQROG3OMTA8pb1EWfy+YQOe7pJyanAUmennfPgxYTLmiZWBKttmDv0I09D3Wku+2/7Nb7LpoikPTzyWkZq8wEBCjzS38CIavPA/UTf4OaFIZnV56s+YE16fS7Q2xPzHl+vKj0zepgZOZPs2esTxZdh/SHPsW/5YG7TT1bfkI/QB+pLUE3e3wsXiiXRH5z0Sxs+LPwMO80SpbX81BVG2AY921HZ2kNP7ZyIA1GQv6I17veim5TddXwXH+p5v6vbJn8ODQhUL0qcWzHtdeSNqnOHfHSkbftFNlgYvjXbOMuioRfEYOyFPRaTMjHj4kQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; 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=e+Vvkm5ao/btl0zPOFCosUlxlig/r+q9P1SMp812SAQ=; b=lIlzuLGSfB82irxA7Ks8lpDa1CdicBUFbMU3kWknz0P5zQpiNFHKbNIuVtF4pG1L/9O/oc9FJaAlC+bQGdS664p+GfFmn7c00l4WX6V68/OF10u3WcMIy/QZR1A73S6EI8DTc2UHggL15XFviccczF7lHaWyfHk77isbZYNfqFs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by BN9PR12MB5382.namprd12.prod.outlook.com (2603:10b6:408:103::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Fri, 2 Jun 2023 09:00:30 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::7957:641d:6aba:3f9a%4]) with mapi id 15.20.6433.022; Fri, 2 Jun 2023 09:00:30 +0000 Message-ID: Date: Fri, 2 Jun 2023 10:00:23 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Content-Language: en-US To: Dongdong Liu , dev@dpdk.org, thomas@monjalon.net, andrew.rybchenko@oktetlabs.ru, fengchengwen@huawei.com Cc: stable@dpdk.org, lihuisong@huawei.com, yisen.zhuang@huawei.com, huangdengdui@huawei.com References: <20230529130940.1501-1-liudongdong3@huawei.com> <20230529130940.1501-2-liudongdong3@huawei.com> From: Ferruh Yigit Subject: Re: [PATCH 01/11] net/hns3: fix uninitialized RTC time In-Reply-To: <20230529130940.1501-2-liudongdong3@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO0P265CA0005.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:355::10) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|BN9PR12MB5382:EE_ X-MS-Office365-Filtering-Correlation-Id: fb040483-bcb0-4b27-bb6c-08db6347d086 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GUrJyRg2N32q+fhAD1fP52wejLVZeiSm2bIU7GvOtDZQSTlgbKuLz6XkNxt+QcdJP7U3CI5aioKgqygf8EWBwtHsqptbsuZ30zVtnBpRnVoZgZPMHpSn230W4v6mSWXhwC5BwR299vtDcg6/EGMoGRgGOKFvbkyb4dAaM2KsOhuTbbct0SuDEJs+9Z1Y3/5C9j6scENX/0qge+IJOiY3AReX8GqHznZqOMVjLeORnIhsf4aMdzEO7TRtTJVAocBcoUihzSoiATzKSwO/Isy4mhAy+9vCcmwfWYvGTTmmICYXzVL1wDyEByL64WwjCJCnifWyqHdQ6KQ5mcSZmEIruLX9ANRANcLnzKtnjBWKoCvcwxiI4rHDFfIH4X/dEvqXG/LWc88cEfvT0ybj8EuCSDeoVivbME6Q3FwD4oSKBdCrvmIVxCy9u3Og0UkFt0lB/S1II8vBF0ujxxnjVLBIisoe8h4E03HJb4/AZsE0J/oRmpHXgChDQ2Ar8CHlSL4OGOl0pFVHOaXjO07l4jc50NydIHrSVcoop6+IJDvtKbv/I2MIEDfKbZKA0tJ09zSEfWZRGSuLUbGBzEYOSVfm9OtmIKXkal9JbF/vt1ZVZGjsg12ztypXos5PhfAWoZh8GjEFxs84CwGrOmAigU7/Gw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(376002)(346002)(396003)(366004)(39860400002)(451199021)(2616005)(83380400001)(186003)(4326008)(66946007)(66556008)(6666004)(6486002)(316002)(478600001)(66476007)(5660300002)(6512007)(6506007)(26005)(44832011)(53546011)(8676002)(8936002)(41300700001)(2906002)(38100700002)(36756003)(31696002)(86362001)(31686004)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aWpIS3VwQnErV096dWExaHpyZ0JNdkRQYWM1RU1xYXFqY21zRlp4V1dUMEJB?= =?utf-8?B?c1k2M0NnSktGU1NDZTFwaUpmemNsd2VWM1c3MzJHT0h5c2RpN0UxSjdYSmt4?= =?utf-8?B?TUFUNEZUams4UUhRQ1F3LytFRDdmSXlGOHZVODBSVnVrTGhRdnZLZVhab0Zp?= =?utf-8?B?ZWF3Qm1lb0ZRd2VBZVZkNlQwaDlwMW9HVGRpdVNDbUsvMS9GQUVQNXg2L3U1?= =?utf-8?B?Mno4S1pGRlh0d0dxa2VIUlo3Tm13dmxhb2ZCOXYva2t0YVNaV1YvcTVROU52?= =?utf-8?B?TjdWMW1YNkh6eU5KcDgxRmU3QkkyajV6TEpDb1hBSkxRMXJjdFZJVDhOYlRp?= =?utf-8?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X-MS-Exchange-CrossTenant-Network-Message-Id: fb040483-bcb0-4b27-bb6c-08db6347d086 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jun 2023 09:00:29.8322 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7cDfgaZkYvQBYFm9Ru4swWNA9HnMe40FhHQ+TCgkGXFMydNVDUf/KBiDuBYKnqYr X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5382 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 5/29/2023 2:09 PM, Dongdong Liu wrote: > From: Huisong Li > > Driver doesn't initialize RTC time during probe phase, which > lead to an inaccurate time. > > Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") > Cc: stable@dpdk.org > > Signed-off-by: Huisong Li > Signed-off-by: Dongdong Liu > --- > drivers/net/hns3/hns3_ptp.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c > index db3c007b12..fb834bb180 100644 > --- a/drivers/net/hns3/hns3_ptp.c > +++ b/drivers/net/hns3/hns3_ptp.c > @@ -59,6 +59,8 @@ hns3_ptp_int_en(struct hns3_hw *hw, bool en) > int > hns3_ptp_init(struct hns3_hw *hw) > { > + struct timespec sys_time; > + struct rte_eth_dev *dev; > int ret; > > if (!hns3_dev_get_support(hw, PTP)) > @@ -71,6 +73,11 @@ hns3_ptp_init(struct hns3_hw *hw) > /* Start PTP timer */ > hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1); > > + /* Initializing the RTC. */ > + dev = &rte_eth_devices[hw->data->port_id]; Better to not access 'rte_eth_devices[]' global array directly from the driver, driver should keep reference to the eth_dev internally. 'hns3_timesync_write_time()' already gets 'hw' from 'eth_dev' and uses it. Perhaps 'hns3_timesync_write_time()' should get 'hw' as paramter. Since 'hns3_timesync_write_time()' used for dev_ops, it is possible to get internal version of it, like: ``` hns3_timesync_write_time_(struct hns3_hw *hw, timespec *ts) { } hns3_timesync_write_time(struct rte_eth_dev *dev, timespec *ts) { struct hns3_hw *hw = ; hns3_timesync_write_time_(hw, ts); } ``` And this function can directly use internal version. > + clock_gettime(CLOCK_REALTIME, &sys_time); > + (void)hns3_timesync_write_time(dev, &sys_time); > + > return 0; > } >