From patchwork Mon Jul 19 06:25:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruud Bos X-Patchwork-Id: 480341 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCE58C12002 for ; Mon, 19 Jul 2021 06:25:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AA35961073 for ; Mon, 19 Jul 2021 06:25:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbhGSG2p (ORCPT ); Mon, 19 Jul 2021 02:28:45 -0400 Received: from mail-eopbgr80119.outbound.protection.outlook.com ([40.107.8.119]:14596 "EHLO EUR04-VI1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233580AbhGSG2o (ORCPT ); Mon, 19 Jul 2021 02:28:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jiL8X71DXzWScDBhM4cwBFIGZKwyBTcTbU3w/kErGli7/9QnTeocjxQxxNuaytgmx9F/K+TmS+e/7UCgfOq6inqwGTN9pTfXIPXz2D8iRJ0k+yJXneDNQcYdW7p6Vd83/9W3e+Sl3PPasY+FzpU4KTH6di3dv1MDZKbLwFZMEFC/nEp54o/4v1GxcjKBYz0zsdxsL2+4i8EGu7E3hhwC84kjrRtXPRDFDvnjoUy6VcTq4OMyxcm631fh0yyKH4TbVEsQeCBU+6zs8Y9V0Jv1GBAcIoAij0wl8xa4kCCj7Z2mWMDl9z5sxY/59IYmqTOdOS/fB722lDr8s234UZ3jSw== 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-SenderADCheck; bh=dS5a4c2ZKFzE8zL4AeAbXR18mkQsM5YX1LneI7g1I6o=; b=mGXvcc/PjPQ0leF2WawZuz7HBVNKKMt8mTlxHHjSxKW/zg2lnjmDuEAvjqfbeMhF7slkpG+8UWHbQMvWao7nj++wxqb1yf9Y6HSuIVa2Az+2Er9Ij6yNIdaIeAcr5fnwhe+/Z+SUfyI/VsHvjOlos6lfNtM4omWVhDprCmrcqZuvv3ayLf4hmFfWd2Fbz6k7kia/9PvYZ9db+hxlUbYtPS6hfy0YPI5vwWVSNnWfRN5zEB9QL4Y4NRnQyMBerzzM0/Nil0DJB+Rz9myS7rfhoWeG3WzY3JJ9Xv0PqUeQB66x1mY6YODIws7W73r1EJQwObZ4sYme/b3woqfo5mdTgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hbkworld.com; dmarc=pass action=none header.from=hbkworld.com; dkim=pass header.d=hbkworld.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hbkworld.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dS5a4c2ZKFzE8zL4AeAbXR18mkQsM5YX1LneI7g1I6o=; b=SQ4Xdbh1307GFsebQq2MjvC8X/Wg/MkM+hIzoPKjpBBM72JKo7yi25N4yeus93gJdr5mPBxZxF2ai9BhxK35/nhywsYQyqMKHlEfPoIHjWBh1mYkERDcI/CtoqNMeEbn0jKaZOf306JoholGUM/knRLVHTOW3rW3Ir+KeHXlgjaZfeC2O2d0ueskOhHF3CrXo54fWeTe9HeydGOcp/NgoDJXCYy0OonSOsn+6onf2FAuooDx+hVTNuxEfDDbnohkTyFw/IdTlAMA/snN1+TDRoWoRjIL3QqlRhAxRJArmkAydiPNF0hew7glE6qRYBus9Z2K9xQWeqTxvvdnVPug2w== Received: from AM0PR09MB4276.eurprd09.prod.outlook.com (2603:10a6:20b:166::10) by AM0PR09MB2628.eurprd09.prod.outlook.com (2603:10a6:208:d7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.26; Mon, 19 Jul 2021 06:25:41 +0000 Received: from AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92]) by AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92%7]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 06:25:41 +0000 From: Ruud Bos To: "netdev@vger.kernel.org" Subject: [PATCH net-next 1/4] igb: move SDP config initialization to separate function Thread-Topic: [PATCH net-next 1/4] igb: move SDP config initialization to separate function Thread-Index: Add8ZdnZwW0JgSK1QxiyoIhbvUIypg== Date: Mon, 19 Jul 2021 06:25:41 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Enabled=true; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SetDate=2021-07-19T06:25:40Z; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Method=Privileged; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Name=Unrestricted; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SiteId=6cce74a3-3975-45e0-9893-b072988b30b6; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ActionId=78a564ba-32c2-48ba-bd85-c09c86e4c53b; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ContentBits=2 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=hbkworld.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: a306f40d-c23c-422a-5fa1-08d94a7e082d x-ms-traffictypediagnostic: AM0PR09MB2628: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2958; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: p0tc9mi7uzxPgA9L6gZXwR0Sm9FaoAK9A8iK4r1fHCl05YgJUt/5/M5S8yL9X5wEGTbUo19gS4zGhG/AdaD9TP8U9PhKvn8fkiy9q44x8T/ya1VakZWdCt80XbyyzpXwV/mWFXnkhOa/k+Mo5cIcpeOakwBZ5Y65S1XBy60PRuGUZNBL6G6CsMq2d5EwWBmizj9iN1Jnq2KEiZjLL1ENFeqLHir9uizW/eroEpH/4obDA69KI+Svb45naOCyr2WQLxmMW8YNQhv8nGyB6yfhIJ2lIE/3U3dC/XcA8yMf0ONwtSDDm6TQp79FbnuXm8Shr95YKBbDANPvNt6AacP3nPqAHRtWdrPi2vajHuQelBvxtIJh9JJkbK3FYg05pSanBm8FE1Bqf2VilgpfMo2e0Of6CbjkLsWDkJkHI+3iOH3ZvVjX0Noxwe37Dy/58kic78qk2E6kWnsPXU+024nh+4o0vqeBe+qaj5E2DL2sGC5t9emmOlQemm5e8yIrmR33UsI8Ofx4VR6fMuyQd/qGXbiryR5anwCccbVyU8wfucQ2CKyhWX5TZATnEiUPZ/xK5St8aRWq3nc89s5GfYf+foiRWUs0F2TyDJSrwe6snaQvR/bzqqg4flB681e9aDjzl80sgCGHqIRw0vJkI7cJQM9gNRkxBhBsVE6RXDr+Q917tiErDEtBk6J7w6j4zHIOtnKQsT9o1Qev2iQnkNIEmQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR09MB4276.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(9686003)(26005)(55016002)(186003)(33656002)(71200400001)(86362001)(64756008)(66446008)(5660300002)(66476007)(83380400001)(15974865002)(52536014)(66556008)(8936002)(38100700002)(122000001)(66946007)(2906002)(8676002)(44832011)(6506007)(7696005)(316002)(76116006)(508600001)(6916009)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?jaDZhBIEo+tIurUQH+D5vvk/A?= =?utf-8?q?63jl+kAh8V9PKXSkUVO9WV6pavud9xYZ3UM+onmn7eNldJLxKYpGxlxH?= =?utf-8?q?FeB5im9WfwhjEJsKLeXH4awEUe1pZ9lJ6iEywnU88m4toi/CKC92a5We?= =?utf-8?q?DJ6ykJ/MBih3L8Kpngp0qjZL5NOW/WPV9ZKLvGNxj/foEMFlt/8LUUgo?= =?utf-8?q?0T+dwu4sFUhOtW3kCucLZ16w54pLFJ3uuXKTxquDypaO6q3q7NfFbrXm?= =?utf-8?q?QCLa4vC54ZojVVIbQm3QkAyEaDKcPZrlFoG6PSIrqt8NBvplFOTbOykG?= =?utf-8?q?opfHxkMF/kVTUn9EuY8U1DmKoGk9EY2u5LumRsQohi1hq+VKuyoD+CRB?= =?utf-8?q?b9zpdw/cX4ZEtAjrIwPvoG7j8PBhHiy8FSdSRNM4Bqg0YaJpoIm9xcNq?= =?utf-8?q?Bm5wQo9IhAsbtyk6O1uPNtI47q1ScQz7gE+KvBaB4WekjepBhL5+0v0K?= =?utf-8?q?k3HYMU2/Nff/PwqLwU4E3zNDSfNqQM9YZhFYZPfRMBpxsvVvwjorFz68?= =?utf-8?q?XheY/nABfSMhhY6m1sEQsKFulbfOMrAPp3jcwCxsTny6Tj4UEUL6CpiV?= =?utf-8?q?SkIl4nSlwM8Y8CJ2iZWe4DGWfU23zXOM62CqoVX+huFEAgVLoCO32WXT?= =?utf-8?q?vatzlES0TWNvPe3O3euYNbHai4an971QUoGEBAbwBqxoYg0rWT7kqKwZ?= =?utf-8?q?87TGqVz5A4fLxrThRcljj1t8YRvEndedUKThPmwcnaERfABW7jeN3/qa?= =?utf-8?q?GyCAt80BDmEfLc8LJGSlDAvebCe18I+iInjIffCm1cJ/7ffl3tpNztZH?= =?utf-8?q?QjbinKHoSEtf+GPD5RjjYw1FVqkjDz3yD7YKPYXOAJ5E6lQhNwv7jGQv?= =?utf-8?q?6nvGUfkR9fim2/bBkWBCUxfXmg6YJT2OgJTOGGMDqaQY7ah9ZDRljDeU?= =?utf-8?q?2K9FoN0XdbU/hBlfMHAwjnAfID9bqKcjZh7nzInMwik8qS9qY8yu5LFQ?= =?utf-8?q?1F7lgPWP4Yq69G4o87M+DWMNBvx2fK0EnTtt4N127bIUoM5k8uqpuBW8?= =?utf-8?q?yje8UZNpvgEFgWmHSKEhZ5enTtaGrZBe1XSXH0dvrBldr6QYmbLgCJmQ?= =?utf-8?q?QO3weblwsks52lH5OYVXawrc+OIRIGYq8cVUmf2oEWGbE4zgCkPXfsiC?= =?utf-8?q?iI44bzkYCuYBpHXPdgW48oiBO1axMhYjFqIYBakQ+Ji8JZGK8RL227kn?= =?utf-8?q?CGCk+GAuhNrPQ33RqIHoH5kIQfbq00qrJWQck0vTfwfdBkL9qgQtxz0K?= =?utf-8?q?37+CFg4ShEqmIY2A4Wj5fE+nM4QT8rjsTyOCTXVyLf/D8hJ3zs9VJHR5?= =?utf-8?q?AoBITqv2go=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: hbkworld.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR09MB4276.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a306f40d-c23c-422a-5fa1-08d94a7e082d X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2021 06:25:41.2564 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6cce74a3-3975-45e0-9893-b072988b30b6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: SgoW/KgyTv0YMoOw0vo2RhMkbCnDhlfVIluiHl3C0wz12H0DhH1WfD26hB4c5FLs X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2628 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Allow reuse of SDP config struct initialization by moving it to a separate function. Signed-off-by: Ruud Bos --- drivers/net/ethernet/intel/igb/igb_ptp.c | 27 +++++++++++++++++------- 1 file changed, 19 insertions(+), 8 deletions(-) -- 2.30.2 UNRESTRICTED HBK Benelux B.V., Schutweg 15a, NL-5145 NP Waalwijk, The Netherlands www.hbkworld.com Registered as B.V. (Dutch limited liability company) in the Dutch commercial register 08183075 0000 Company domiciled in Waalwijk Managing Directors : Alexandra Hellemans, Jens Wiegand, Jorn Bagijn The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 0011b15e678c..c78d0c2a5341 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -69,6 +69,7 @@ #define IGB_NBITS_82580 40 static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter); +static void igb_ptp_sdp_init(struct igb_adapter *adapter); /* SYSTIM read access for the 82576 */ static u64 igb_ptp_read_82576(const struct cyclecounter *cc) @@ -1192,7 +1193,6 @@ void igb_ptp_init(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; struct net_device *netdev = adapter->netdev; - int i; switch (hw->mac.type) { case e1000_82576: @@ -1233,13 +1233,7 @@ void igb_ptp_init(struct igb_adapter *adapter) break; case e1000_i210: case e1000_i211: - for (i = 0; i < IGB_N_SDP; i++) { - struct ptp_pin_desc *ppd = &adapter->sdp_config[i]; - - snprintf(ppd->name, sizeof(ppd->name), "SDP%d", i); - ppd->index = i; - ppd->func = PTP_PF_NONE; - } + igb_ptp_sdp_init(adapter); snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); adapter->ptp_caps.owner = THIS_MODULE; adapter->ptp_caps.max_adj = 62499999; @@ -1284,6 +1278,23 @@ void igb_ptp_init(struct igb_adapter *adapter) } } +/** + * igb_ptp_sdp_init - utility function which inits the SDP config structs + * @adapter: Board private structure. + **/ +void igb_ptp_sdp_init(struct igb_adapter *adapter) +{ + int i; + + for (i = 0; i < IGB_N_SDP; i++) { + struct ptp_pin_desc *ppd = &adapter->sdp_config[i]; + + snprintf(ppd->name, sizeof(ppd->name), "SDP%d", i); + ppd->index = i; + ppd->func = PTP_PF_NONE; + } +} + /** * igb_ptp_suspend - Disable PTP work items and prepare for suspend * @adapter: Board private structure From patchwork Mon Jul 19 06:25:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruud Bos X-Patchwork-Id: 482111 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 837FAC636C9 for ; Mon, 19 Jul 2021 06:25:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DA3C61182 for ; Mon, 19 Jul 2021 06:25:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234253AbhGSG2x (ORCPT ); Mon, 19 Jul 2021 02:28:53 -0400 Received: from mail-am6eur05on2092.outbound.protection.outlook.com ([40.107.22.92]:52480 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233580AbhGSG2u (ORCPT ); Mon, 19 Jul 2021 02:28:50 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VJFeoe4r1KcGJVxS5/fCb8XtDb/UxDvB1MxVr83LRNnzsiyGU0S93uTqCyrGsp+Kk/kD+PWuiiGX4m2wzNb/di618UpVWLhI1JucrHcSIA8lGZ+05fkzt9weNicjUS+uSCNc6IZVCyZYi58Dhjjt/fmnXJAHflUneOKWL1259yFW34COH9Ep0NASTFZrRqGaXZbXSx9qOnf7eUhj6fi0CBKO+dVKmUSnq1+7+39Krb+gA7TPSmSE9p2h9hqSdcdebX228qKsZh71pF57OeLH9CnUjr1gAv83rm2yiZpP0ruW3aeNz2tpBjJs3ikj1ueqSN+tMTnqT9BTCZ2Cr9IbfA== 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-SenderADCheck; bh=xVx49oXx8ozh5Ie97HOTLJgsHOOGeX/cdF9taFRmLrQ=; b=cPXyCimblDXgZv2ShJTrt4BPsasL0G5QeQl+PwGwVjngdYLYvC+k5Hmx/L2DIlip4KUwYEq646nYcUjee9hn/c/d5b4eQHdgeirD2kYmy1PoxnTAtSkYMhKxk/3ryADtrObX9rf7jElPADv/BTghfJpi5rSNKdMxdzP0yD6O1sGHDi0GaN2re806c2zNSEUl8dXKqSqvM9FZbVtwA9lQNknhFJlxIjR3qmUDF8BaZv/x0Hbo1YESSkEDwmqVS34S4sSxmWz3hRyA/qwtDC+rqTPLw//VE7CKtevTOJMH1Mnam2CllR5v97WQVNhG3te2Zd2MBUOcNnHTU7if8VzQhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hbkworld.com; dmarc=pass action=none header.from=hbkworld.com; dkim=pass header.d=hbkworld.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hbkworld.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xVx49oXx8ozh5Ie97HOTLJgsHOOGeX/cdF9taFRmLrQ=; b=h155L9q6CcSNV96hoGNKDj1Fy2V0/kILFija68zbBHfsFmaIKUoKWLb7W7fcE0a2MqwILingKvkbXdgS8xgAHKwwBNw0KThW4azF4ghDJNSlWCf8B/aCQj7p8p6gwpbfALTJqrGd56MPuD3seSrqqKG6u0oKqZ6+JTTiHUX6yZLRWFzLdJbPNdldXyVgzWO/4D082HnWTbslHFboDJ/zbCW161czcz1b4X72IBC++On+r7QE0S3KR8rVz7EI9FcUgrMPG5xPksWOyJA7VDvPM/ZzBUT1MORp6sdiAyFGJyh4vzU9scmrfAn/StGcDRceLTqOgbn59p81Nh3Ru5UOqA== Received: from AM0PR09MB4276.eurprd09.prod.outlook.com (2603:10a6:20b:166::10) by AM0PR09MB2611.eurprd09.prod.outlook.com (2603:10a6:208:e1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 06:25:46 +0000 Received: from AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92]) by AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92%7]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 06:25:46 +0000 From: Ruud Bos To: "netdev@vger.kernel.org" Subject: [PATCH net-next 2/4] igb: move PEROUT and EXTTS isr logic to separate functions Thread-Topic: [PATCH net-next 2/4] igb: move PEROUT and EXTTS isr logic to separate functions Thread-Index: Add8Zg2HsnagZRwHRyWVVy37Ak9WQA== Date: Mon, 19 Jul 2021 06:25:46 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Enabled=true; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SetDate=2021-07-19T06:25:45Z; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Method=Privileged; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Name=Unrestricted; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SiteId=6cce74a3-3975-45e0-9893-b072988b30b6; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ActionId=5eecda3c-6006-4c8d-9727-f6a9c7277be8; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ContentBits=2 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=hbkworld.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6422ff35-078e-4b62-2955-08d94a7e0b7e x-ms-traffictypediagnostic: AM0PR09MB2611: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6430; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Y9102dSofeyMaDTbVoJJybOXO9mJyZUVQcE6AIpiYLWNhQjTqBMiO94RhStXEQ4quw+52dJlpgeygcc/qR25HMEsq73RvAyaUVWUV6NE8RH2jAAdZSP0HXVSY1o8vgDTAGo5wR/2sU+1iZ655VeGGp/+PTNLQMxKuc+p01kRxNFX/uGzt5z3yxIWMcgmWrR1z0+B14QgWQyTLXMRUoIaSKWtqYpAbftFqP8WrSXQ9Y7cCE9meA4Wow5SJ1z595hePVevPsFc867FLsogiF1eV1bGu/QVKCo7XJZr0wlSHBJQxBFdtuRY0ckUFN8+PjJyZ97sLSFK1CR3z5xjUFFGxm8uJ5PCv7UFnvaA0v5U4z3HNbB7FRdhtqMxrb8GJJemZksxLB9f5zLyFYkTxisya9Y/eC+huxtsG35T0qsGbJcA/puTVAF/qDeqXr/3ObETDfjKPk/g5GCo07m+Gnc68WeY269bixZ9/0LOdUSJisyuAiKCuUo+UQ7oY1p2Bjq+dbWjaOs/eRD1O11AbNmMsbKN/l1DDV4PcdijjZACEikOE3/PQeGyl4qXn+buvZHQzPnx1xPJULjNxZxLFcifCbsWx5pbgIFPIkxU101xKehW8ucV4OE88scrXRuL1U4AdffRq6wwA3Uto5+mbZRK6b+9IH6Li9aV/4Cn1IzTMboAaIMQFJRXe68URloY6X/Tm0QUWzpPAGyuDX0oFzOnDg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR09MB4276.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(346002)(396003)(366004)(136003)(376002)(478600001)(83380400001)(9686003)(52536014)(44832011)(71200400001)(5660300002)(55016002)(38100700002)(6506007)(2906002)(122000001)(316002)(33656002)(15974865002)(6916009)(76116006)(7696005)(86362001)(26005)(66476007)(186003)(66556008)(66446008)(8936002)(8676002)(66946007)(64756008)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?Zf4VbOTrF2BPo9c3ZsmnDe9Di?= =?utf-8?q?HdzPNu6uw3gcvlaJoX9fkyjuUGfmYfXByG4ifzjxwtaednnGCENEIxIc?= =?utf-8?q?eYL1d4sxEqUjSQi3XuN6vrd9+k1YXvzBvBqTSFG9gAWsHLgFqftXa1hT?= =?utf-8?q?VHBJN7kjijfImZSvn2jnUbVAzq5qIWCg2Kk5XpvdWhDQbzzL7doiTWV1?= =?utf-8?q?TIk1tfxjZtA/VyjVPvcEuEJRG2MqiCpvvLeXEqpDSTEOCOFhV8AXjNNs?= =?utf-8?q?0jhUoiDksr0F3pu/shXt5xxLKJpPiGHtR+LTPr4Dmx2zdinvOxCp6G6Z?= =?utf-8?q?6qu2pU30JcQZkaGR72NhbABjuTCSL3cyLPTAcYeYLy76MLk30AZmr6Kv?= =?utf-8?q?A4soGvFKhIsQSZL7qeXclimtD/ClqbnBcO8g+bWqj4Wpn71VnZdEPBTH?= =?utf-8?q?vmHvBSrU4mrt7OQW5wxLzyFrD/jtS1/hli+D9Q2sfEEL0N3kKXP6F1fl?= =?utf-8?q?igsVTNHEEFQC5EYjRNaBMmiDT8EAhQUdABgUU8vGQ9TW5YLIKCuJEB8c?= =?utf-8?q?dd70iDUY4qR1Bb8BJbdCuggBCsBBBK9eoSWPhD9hHw11K7K64+xivKjo?= =?utf-8?q?XIKl2zCn5BdsxZdniKkXdvlM4XwcaGKHSh3beaQ3qA/zEDNInlmJAZ7A?= =?utf-8?q?yqnrfwlIVrO+MTWiz6V7+xMDujqGbeKbfd7u1YGq0OhWdcePZH52wajZ?= =?utf-8?q?uK2bokPbdEqISQYDQYaue+0XKOmINvYnTB+eb+gKtOP/Kd25EZ9BrUmy?= =?utf-8?q?xO2Xbw7vRYq69vRNzHaayIRaVWWVN+jFYMeX0S6YgR6gUGY6cghgsfvL?= =?utf-8?q?uz6nD77vwkw0m9BmWr3Wx5O+fhX/t6urbhtd4E8kpBzi+/UxSnLv42Q7?= =?utf-8?q?DMCvxZ6VStX2R32a9LZyjCpP4f/+S9NQiA8MYuhIJ2fDBviOXbOm2H92?= =?utf-8?q?qRbC+lPdaA+CBgE7WzSnNd9DOjggXpLx8YLzsJKEjEG5Q5J4ml7LB77n?= =?utf-8?q?fdyCB3FvSHjB2HmBifmGafRTXoM9lMNwH9i3g1a/cLJDMwJZy9Gr72OV?= =?utf-8?q?gjGVovSnLKfLVA1pMuY/w6kZzNbxD1u70YkRVFhZV00m3SL/Vb3LAugl?= =?utf-8?q?xRZlc4Vg+PChtt708TPLWLgFsBylYN+kcyKfvEtiSWNHJTuByM/S4hPv?= =?utf-8?q?X1FQPStgtzNpgi8SWZFjOZuSo8vfhUY0k5e1qFN05QXusz/OFxTO5PcC?= =?utf-8?q?/XUUwHZ2uePQLzAfJbkIFEuWenTzK8b4/ziozIiPAEpM9TFMvWMQbXYH?= =?utf-8?q?4aUho0x+8lrsjxc6ka7lC1kaiY6aMoUnevQOUWlGt4llkiRvCL6iampq?= =?utf-8?q?74xUV7g9E0=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: hbkworld.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR09MB4276.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6422ff35-078e-4b62-2955-08d94a7e0b7e X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2021 06:25:46.8210 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6cce74a3-3975-45e0-9893-b072988b30b6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ncHn1nlVcWQvqNuHNybx73VGbhlWzIf0mFvYarS7VrpeiXXpH6cMRIvEROx9KyDL X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2611 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Remove code duplication in the tsync interrupt handler function by moving this logic to separate functions. This keeps the interrupt handler readable and allows the new functions to be extended for adapter types other than i210. Signed-off-by: Ruud Bos --- drivers/net/ethernet/intel/igb/igb_main.c | 79 +++++++++++++---------- 1 file changed, 44 insertions(+), 35 deletions(-) -- 2.30.2 UNRESTRICTED HBK Benelux B.V., Schutweg 15a, NL-5145 NP Waalwijk, The Netherlands www.hbkworld.com Registered as B.V. (Dutch limited liability company) in the Dutch commercial register 08183075 0000 Company domiciled in Waalwijk Managing Directors : Alexandra Hellemans, Jens Wiegand, Jorn Bagijn The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 7e6435dc7e80..928ac9ba1c66 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6721,12 +6721,50 @@ void igb_update_stats(struct igb_adapter *adapter) } } +static void igb_perout(struct igb_adapter *adapter, int sdp) +{ + struct e1000_hw *hw = &adapter->hw; + struct timespec64 ts; + u32 tsauxc; + + if (sdp < 0 || sdp >= IGB_N_PEROUT) + return; + + spin_lock(&adapter->tmreg_lock); + ts = timespec64_add(adapter->perout[sdp].start, + adapter->perout[sdp].period); + /* u32 conversion of tv_sec is safe until y2106 */ + wr32((sdp == 1) ? E1000_TRGTTIML1 : E1000_TRGTTIML0, ts.tv_nsec); + wr32((sdp == 1) ? E1000_TRGTTIMH1 : E1000_TRGTTIMH0, (u32)ts.tv_sec); + tsauxc = rd32(E1000_TSAUXC); + tsauxc |= TSAUXC_EN_TT0; + wr32(E1000_TSAUXC, tsauxc); + adapter->perout[sdp].start = ts; + spin_unlock(&adapter->tmreg_lock); +} + +static void igb_extts(struct igb_adapter *adapter, int sdp) +{ + struct e1000_hw *hw = &adapter->hw; + u32 sec, nsec; + struct ptp_clock_event event; + + if (sdp < 0 || sdp >= IGB_N_EXTTS) + return; + + nsec = rd32((sdp == 1) ? E1000_AUXSTMPL1 : E1000_AUXSTMPL0); + sec = rd32((sdp == 1) ? E1000_AUXSTMPH1 : E1000_AUXSTMPH0); + event.type = PTP_CLOCK_EXTTS; + event.index = sdp; + event.timestamp = sec * 1000000000ULL + nsec; + ptp_clock_event(adapter->ptp_clock, &event); +} + static void igb_tsync_interrupt(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; struct ptp_clock_event event; - struct timespec64 ts; - u32 ack = 0, tsauxc, sec, nsec, tsicr = rd32(E1000_TSICR); + u32 ack = 0, tsicr = rd32(E1000_TSICR); if (tsicr & TSINTR_SYS_WRAP) { event.type = PTP_CLOCK_PPS; @@ -6742,51 +6780,22 @@ static void igb_tsync_interrupt(struct igb_adapter *adapter) } if (tsicr & TSINTR_TT0) { - spin_lock(&adapter->tmreg_lock); - ts = timespec64_add(adapter->perout[0].start, - adapter->perout[0].period); - /* u32 conversion of tv_sec is safe until y2106 */ - wr32(E1000_TRGTTIML0, ts.tv_nsec); - wr32(E1000_TRGTTIMH0, (u32)ts.tv_sec); - tsauxc = rd32(E1000_TSAUXC); - tsauxc |= TSAUXC_EN_TT0; - wr32(E1000_TSAUXC, tsauxc); - adapter->perout[0].start = ts; - spin_unlock(&adapter->tmreg_lock); + igb_perout(adapter, 0); ack |= TSINTR_TT0; } if (tsicr & TSINTR_TT1) { - spin_lock(&adapter->tmreg_lock); - ts = timespec64_add(adapter->perout[1].start, - adapter->perout[1].period); - wr32(E1000_TRGTTIML1, ts.tv_nsec); - wr32(E1000_TRGTTIMH1, (u32)ts.tv_sec); - tsauxc = rd32(E1000_TSAUXC); - tsauxc |= TSAUXC_EN_TT1; - wr32(E1000_TSAUXC, tsauxc); - adapter->perout[1].start = ts; - spin_unlock(&adapter->tmreg_lock); + igb_perout(adapter, 1); ack |= TSINTR_TT1; } if (tsicr & TSINTR_AUTT0) { - nsec = rd32(E1000_AUXSTMPL0); - sec = rd32(E1000_AUXSTMPH0); - event.type = PTP_CLOCK_EXTTS; - event.index = 0; - event.timestamp = sec * 1000000000ULL + nsec; - ptp_clock_event(adapter->ptp_clock, &event); + igb_extts(adapter, 0); ack |= TSINTR_AUTT0; } if (tsicr & TSINTR_AUTT1) { - nsec = rd32(E1000_AUXSTMPL1); - sec = rd32(E1000_AUXSTMPH1); - event.type = PTP_CLOCK_EXTTS; - event.index = 1; - event.timestamp = sec * 1000000000ULL + nsec; - ptp_clock_event(adapter->ptp_clock, &event); + igb_extts(adapter, 1); ack |= TSINTR_AUTT1; } From patchwork Mon Jul 19 06:25:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruud Bos X-Patchwork-Id: 480340 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D785AC636CB for ; Mon, 19 Jul 2021 06:25:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BC8A461164 for ; Mon, 19 Jul 2021 06:25:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234425AbhGSG2z (ORCPT ); Mon, 19 Jul 2021 02:28:55 -0400 Received: from mail-am6eur05on2119.outbound.protection.outlook.com ([40.107.22.119]:18080 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234097AbhGSG2w (ORCPT ); Mon, 19 Jul 2021 02:28:52 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U87F40O1ZXO61nd1MqRoMsgM/dbA8GgVvnAGWfqaUPRxfRP6LzBNPOIauIPR54kNREw4EdvFw1t//nv0a0UZ2arGd49EDxlUMBAb1uxKjLBS9qm0p8pyXMn3t656zSYbI9fuTlQkEDwTwoSPnqmHPsIOAuOuM1tcg/NsusFCRTYmzyoXpP1dD6k/cOklhLVWN5r3YrooTFUf8aEkpGdAGq/lsB9EU/RouASd8youjm6lFOCTr8Sh8NLDI/3g9Jp4qVaQ056u2UCsmp7qcK0BakqptWEAwCDDWSO9hs3EkYfBCsykNwj0Q1x9Pf1bBenTAwahDHIkEMdQqoADA+jPIw== 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-SenderADCheck; bh=nPlZDvKhE4RraMfAtX7WizVBoBE/gFSrrYogCOBS6W0=; b=VnBrJVRp1Q9mdo/lYP/EFcUHpgRh9LF31X5MKTLwP8zFk0BuOGSYaxdkgoCK1goRwXhWWHr4suQwSzHxE0St/f2WRmQ2YtvYmcH7rIwLoiRrcwgjdC8GBYgrRtBk2sDJsH9Ivyk/xqxMorv0nwG1GZAVeCg3nOU34gFYT/5VpWTUykp3MWJvoVq6iFaxPJObdBSTe+zuXz5AJr4APPuTlhV5ax20ERqCV3BLIIaAnzaznYMgGAtv3mWP2Zq5kMhN+O7fd9MEx5Czu5JYpdysXjm3NFI4TcwYJX1mPXYFXGwTO0g10Vc8tK6ixDN67m6HdgjNquyag0+gdYLCp8Kg+w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hbkworld.com; dmarc=pass action=none header.from=hbkworld.com; dkim=pass header.d=hbkworld.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hbkworld.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nPlZDvKhE4RraMfAtX7WizVBoBE/gFSrrYogCOBS6W0=; b=ZpQEMcemyGYTFJkWtketxDfBELT5cxqgtFBDZPkVl1+2mLR+O+QB8nQ2tO0jt+vfh6maeRV61RbgF415G2IUg4bSr79JvyhHLPrnrnZOqZieNVANfJ/4cSwqZhx/ZNFGoMPN4zLmxQIQ4l58DoGgZRY++eHujFVdVwZjjEIa2LTt33ZVjRlBsY5jYkjiW+ZVJ4wH6E1/nhEvPD/IXDlKmRTApohDjOahTvyH1fLrIC+3alndOsar3McqKbuKvZNuG7zd+HInyDjREBQVcy2aS/aRAoijWm2av4KTDE5twBt1b0K+Hmc44rvqlXoo/ivwHSSBX8bD5uhL11FEqNTXmg== Received: from AM0PR09MB4276.eurprd09.prod.outlook.com (2603:10a6:20b:166::10) by AM0PR09MB2611.eurprd09.prod.outlook.com (2603:10a6:208:e1::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 06:25:51 +0000 Received: from AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92]) by AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92%7]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 06:25:50 +0000 From: Ruud Bos To: "netdev@vger.kernel.org" Subject: [PATCH net-next 3/4] igb: support PEROUT on 82580/i354/i350 Thread-Topic: [PATCH net-next 3/4] igb: support PEROUT on 82580/i354/i350 Thread-Index: Add8ZiG7H0oEPUSpQmm6VGTj1rMqZQ== Date: Mon, 19 Jul 2021 06:25:50 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Enabled=true; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SetDate=2021-07-19T06:25:49Z; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Method=Privileged; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Name=Unrestricted; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SiteId=6cce74a3-3975-45e0-9893-b072988b30b6; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ActionId=beed1e61-85c4-446c-993e-928f823284ef; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ContentBits=2 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=hbkworld.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2e00382b-aa49-4ad3-623f-08d94a7e0df0 x-ms-traffictypediagnostic: AM0PR09MB2611: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:883; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: NwbfF3K0fUPWQRztraLclBjZTwhM7TRuL+GLIG/2g57FKth/gngS7Qyj/ntwhrjNaJzjcpLBNyvPLsgxI1hl8UMUWK4Z4MyRZCPeAmtWqHhxxOjA5CqMXNGoeOa7/5qFDcpQ9OHfYBhJfZjJMDBx0nqBYu8Y5CFozprcfpDtCkUagsszYSDItc8ZJCDjdTsS8E/2hPjGSs9N3nkSGN9nzay8hyOtxfpEkOkp5L1qz1iCBIJfQsEi3lk1x2jG0bgp9YCU7gmpKiM3PBjhrQreahxO7xuQtFYVgZc0ZrxL7NbvZAhg3WJdu5cfC4wMDHLjwtQb7XaaHro8yPm//JKC5SbCKuGTgQ8Iv6GfoR8oRZXQSkAyVezEGul+VoENfQKRReAXQvKsrD8yhnJ4XbSIE+rHdit5vmoxE9QWTUXwctZrR7rq3H9fZX4fBs/fOe6JtQVwvnva8+DzxuIfitw/0hm1V/r9/2ohi3gQN11LROCyuWcTYH9JXsaBog5R+1g4bRrQtrpc64rcz7i76ev6nAGJJOHL8jx4EcUXpWmYRlf5CIKpNATvrnR+vNR2GLhUB6tQlVUjQ8Kha31xklh+PEAHJsae7W3X6khDUQQyoTiV1ThLHH0INakXoBxhIseethgweu4pTMsKE+7psqIQJKMN+NVEKX28gLeZXw3hSSbcNPCqws3z+LTWboWSI2YcuTn8FFVtOHp4r453sRkZPA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR09MB4276.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39850400004)(346002)(396003)(366004)(136003)(376002)(478600001)(83380400001)(9686003)(52536014)(44832011)(71200400001)(5660300002)(55016002)(38100700002)(6506007)(2906002)(122000001)(316002)(33656002)(15974865002)(6916009)(76116006)(7696005)(86362001)(26005)(66476007)(186003)(66556008)(66446008)(8936002)(8676002)(66946007)(64756008)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?Hrb15qynTYpPw5IKMiX/XmYbU?= =?utf-8?q?cBgwx+IKBMLObE20MINBgmNkke//NNbYJjnQbE7t03DlUYo/V77pWAQg?= =?utf-8?q?SKA+pvuvkEItb1P1DfAdSv9mysuh0zLKzegUbhlNVePsidWnLRPxnGqD?= =?utf-8?q?xNagJqgXeA7hecTH0/b2Ugfhs5rTMBoiXLL3wCsMkUiOCn8HFMKmxTYb?= =?utf-8?q?W7+08M+w3g3TZXaMylUKi+OGylGBr3DsyjJRszrhfiq9qJzWu5JvCNRF?= =?utf-8?q?NZPC9/2N+lAHcaTiYc9rguiTkD9FvUtptkF2Rk3VUieYnnQOE/BooY3n?= =?utf-8?q?zzvKioMr9Q7K+hdvxTuFJW+aPxQK5bfCT/21uv3LVxr+KKQxS99fiXRq?= =?utf-8?q?vOBFkdhzuiEW4pOBIuZDkO/kaBtY88B0nH2gytThjTmBa2jvdacwtBM3?= =?utf-8?q?NJa3u9TNzP3K42NUZcKepFKJ088HFXTi1SJ336PLKKaEXms2FSIfP9sL?= =?utf-8?q?YIvszx+y0R8mNRMbHmE0jgRaEQB54GYYRWZ/KF7h8qeg07zspzNRD/9k?= =?utf-8?q?VQw8bcepBMMQTdmt6TixGbdhnc+2Bs1D5uv/hVGgPiLqfLODbkn6Z4Zh?= =?utf-8?q?J4uU0vo9ioAwKsLHfjXTCm7yRejSMdgs+DWDE0b80Mssa733L0r9JNI+?= =?utf-8?q?j/nPXYjcPXhJS3Wv1eZgsFZg80ZRTWlizTsmLAyNEWVra+4X9HKqZyh7?= =?utf-8?q?Dj6tfb750FUkEmWooFlEJeNc/BoZX7XitMQajqAgK7K9yGthkdo9FMtW?= =?utf-8?q?AggYJeftfgvZK11Bjo+KkgF5Y5SAxXMy2knAx+brsrNiO98TImQQUIJF?= =?utf-8?q?VmlmMy4+LaCcLIlwxFQxMMMfQkQL2P0u37Vp0T4QJOaTWYB1jGiXh2Me?= =?utf-8?q?nM5o9jx+qMoApOReid8VtKKB/4KD7he9hr59CpWTC6BBzcUPDox8+BSJ?= =?utf-8?q?VoKfN83bpEaC3rvcfMQmpR88E+JbCZJ7Vut862WZqfDA8Bq4wD1SbKJ6?= =?utf-8?q?ptw81Z/gKDaD6ejZvpt5tvqWpsMEq2dojT4gMUHhniAWpA4ljybdNIqM?= =?utf-8?q?avI2pEJoyTgjLcKqK8rZfSigfvsQ8RnjJ7NHWKkUBpQzYfdNKhpxT7HZ?= =?utf-8?q?nZ4+DGI8f2RXiL05EXLSGlfMadWN3QRb+0kX+VZa4Aak1ItCtPNnLWdG?= =?utf-8?q?4VoD5Tkv0gzEr9RyxDe5rUpvg5Rb06NBHVAK+twrTtVqN/PORteMtERP?= =?utf-8?q?0Fag517UI6T26nAMA23gJzHpyDOl+uTEw3u2QLBpnLCqvhhPS1YPJ3La?= =?utf-8?q?KQUzTEs8mqry/exgsQ69WGuhOgmt9TbQiCCIPSIl66hnmzQeN+sxG3Z/?= =?utf-8?q?jMXBEQ9Sb4=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: hbkworld.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR09MB4276.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e00382b-aa49-4ad3-623f-08d94a7e0df0 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2021 06:25:50.8812 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6cce74a3-3975-45e0-9893-b072988b30b6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: f6K4IbkQYgT76/ycvXTZESLPrEla72Ul8XVD7e+l4krPX/SdhYPrvt7mWv7p2t2b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR09MB2611 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support for the PEROUT PTP pin function on 82580/i354/i350 based adapters. Because the time registers of these adapters do not have the nice split in second rollovers as the i210 has, the implementation is slightly more complex compared to the i210 implementation. Signed-off-by: Ruud Bos --- drivers/net/ethernet/intel/igb/igb_main.c | 54 +++++++++- drivers/net/ethernet/intel/igb/igb_ptp.c | 122 +++++++++++++++++++++- 2 files changed, 172 insertions(+), 4 deletions(-) -- 2.30.2 UNRESTRICTED HBK Benelux B.V., Schutweg 15a, NL-5145 NP Waalwijk, The Netherlands www.hbkworld.com Registered as B.V. (Dutch limited liability company) in the Dutch commercial register 08183075 0000 Company domiciled in Waalwijk Managing Directors : Alexandra Hellemans, Jens Wiegand, Jorn Bagijn The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 928ac9ba1c66..8d87166e5ecb 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6731,8 +6731,57 @@ static void igb_perout(struct igb_adapter *adapter, int sdp) return; spin_lock(&adapter->tmreg_lock); - ts = timespec64_add(adapter->perout[sdp].start, - adapter->perout[sdp].period); + + if ((hw->mac.type == e1000_82580) || + (hw->mac.type == e1000_i354) || + (hw->mac.type == e1000_i350)) { + u32 systiml, systimh, level_mask, level, rem; + u64 systim, now; + s64 ns = timespec64_to_ns(&adapter->perout[sdp].period); + + /* read systim registers in sequence */ + rd32(E1000_SYSTIMR); + systiml = rd32(E1000_SYSTIML); + systimh = rd32(E1000_SYSTIMH); + systim = (((u64)(systimh & 0xFF)) << 32) | ((u64)systiml); + now = timecounter_cyc2time(&adapter->tc, systim); + + level_mask = (sdp == 1) ? 0x80000 : 0x40000; + level = (rd32(E1000_CTRL) & level_mask) ? 1 : 0; + + div_u64_rem(now, ns, &rem); + systim = systim + (ns - rem); + + /* synchronize pin level with rising/falling edges */ + div_u64_rem(now, ns << 1, &rem); + if (rem < ns) { + /* first half of period */ + if (level == 0) { + /* output is already low, skip this period */ + systim += ns; + pr_notice("igb: periodic output on %s missed falling edge\n", + adapter->sdp_config[sdp].name); + } + } else { + /* second half of period */ + if (level == 1) { + /* output is already high, skip this period */ + systim += ns; + pr_notice("igb: periodic output on %s missed rising edge\n", + adapter->sdp_config[sdp].name); + } + } + + /* for this chip family tv_sec is the upper part of the binary value, + * so not seconds + */ + ts.tv_nsec = (u32)systim; + ts.tv_sec = ((u32)(systim >> 32)) & 0xFF; + } else { + ts = timespec64_add(adapter->perout[sdp].start, + adapter->perout[sdp].period); + } + /* u32 conversion of tv_sec is safe until y2106 */ wr32((sdp == 1) ? E1000_TRGTTIML1 : E1000_TRGTTIML0, ts.tv_nsec); wr32((sdp == 1) ? E1000_TRGTTIMH1 : E1000_TRGTTIMH0, (u32)ts.tv_sec); @@ -6740,6 +6789,7 @@ static void igb_perout(struct igb_adapter *adapter, int sdp) tsauxc |= TSAUXC_EN_TT0; wr32(E1000_TSAUXC, tsauxc); adapter->perout[sdp].start = ts; + spin_unlock(&adapter->tmreg_lock); } diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index c78d0c2a5341..64a949bb5d8a 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -508,6 +508,119 @@ static void igb_pin_perout(struct igb_adapter *igb, int chan, int pin, int freq) wr32(E1000_CTRL_EXT, ctrl_ext); } +static int igb_ptp_feature_enable_82580(struct ptp_clock_info *ptp, + struct ptp_clock_request *rq, int on) +{ + struct igb_adapter *igb = + container_of(ptp, struct igb_adapter, ptp_caps); + struct e1000_hw *hw = &igb->hw; + u32 tsauxc, tsim, tsauxc_mask, tsim_mask, trgttiml, trgttimh, systiml, + systimh, level_mask, level, rem; + unsigned long flags; + struct timespec64 ts, start; + int pin = -1; + s64 ns; + u64 systim, now; + + switch (rq->type) { + case PTP_CLK_REQ_EXTTS: + return -EOPNOTSUPP; + + case PTP_CLK_REQ_PEROUT: + /* Reject requests with unsupported flags */ + if (rq->perout.flags) + return -EOPNOTSUPP; + + if (on) { + pin = ptp_find_pin(igb->ptp_clock, PTP_PF_PEROUT, + rq->perout.index); + if (pin < 0) + return -EBUSY; + } + ts.tv_sec = rq->perout.period.sec; + ts.tv_nsec = rq->perout.period.nsec; + ns = timespec64_to_ns(&ts); + ns = ns >> 1; + if (on && (ns < 8LL)) + return -EINVAL; + ts = ns_to_timespec64(ns); + if (rq->perout.index == 1) { + tsauxc_mask = TSAUXC_EN_TT1; + tsim_mask = TSINTR_TT1; + trgttiml = E1000_TRGTTIML1; + trgttimh = E1000_TRGTTIMH1; + } else { + tsauxc_mask = TSAUXC_EN_TT0; + tsim_mask = TSINTR_TT0; + trgttiml = E1000_TRGTTIML0; + trgttimh = E1000_TRGTTIMH0; + } + spin_lock_irqsave(&igb->tmreg_lock, flags); + tsauxc = rd32(E1000_TSAUXC); + tsim = rd32(E1000_TSIM); + if (rq->perout.index == 1) { + tsauxc &= ~(TSAUXC_EN_TT1 | TSAUXC_EN_CLK1 | TSAUXC_ST1); + tsim &= ~TSINTR_TT1; + } else { + tsauxc &= ~(TSAUXC_EN_TT0 | TSAUXC_EN_CLK0 | TSAUXC_ST0); + tsim &= ~TSINTR_TT0; + } + if (on) { + int i = rq->perout.index; + + /* read systim registers in sequence */ + rd32(E1000_SYSTIMR); + systiml = rd32(E1000_SYSTIML); + systimh = rd32(E1000_SYSTIMH); + systim = (((u64)(systimh & 0xFF)) << 32) | ((u64)systiml); + now = timecounter_cyc2time(&igb->tc, systim); + + level_mask = (pin == 1) ? 0x80000 : 0x40000; + level = (rd32(E1000_CTRL) & level_mask) ? 1 : 0; + + div_u64_rem(now, ns, &rem); + systim = systim + (ns - rem); + + /* synchronize pin level with rising/falling edges */ + div_u64_rem(now, ns << 1, &rem); + if (rem < ns) { + /* first half of period */ + if (level == 0) { + /* output is already low, skip this period */ + systim += ns; + } + } else { + /* second half of period */ + if (level == 1) { + /* output is already high, skip this period */ + systim += ns; + } + } + + start = ns_to_timespec64(systim + (ns - rem)); + igb_pin_perout(igb, i, pin, 0); + igb->perout[i].start.tv_sec = start.tv_sec; + igb->perout[i].start.tv_nsec = start.tv_nsec; + igb->perout[i].period.tv_sec = ts.tv_sec; + igb->perout[i].period.tv_nsec = ts.tv_nsec; + + wr32(trgttiml, (u32)systim); + wr32(trgttimh, ((u32)(systim >> 32)) & 0xFF); + tsauxc |= tsauxc_mask; + tsim |= tsim_mask; + } + wr32(E1000_TSAUXC, tsauxc); + wr32(E1000_TSIM, tsim); + spin_unlock_irqrestore(&igb->tmreg_lock, flags); + return 0; + + case PTP_CLK_REQ_PPS: + return -EOPNOTSUPP; + } + + return -EOPNOTSUPP; +} + static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp, struct ptp_clock_request *rq, int on) { @@ -1215,16 +1328,21 @@ void igb_ptp_init(struct igb_adapter *adapter) case e1000_82580: case e1000_i354: case e1000_i350: + igb_ptp_sdp_init(adapter); snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr); adapter->ptp_caps.owner = THIS_MODULE; adapter->ptp_caps.max_adj = 62499999; - adapter->ptp_caps.n_ext_ts = 0; + adapter->ptp_caps.n_ext_ts = IGB_N_EXTTS; + adapter->ptp_caps.n_per_out = IGB_N_PEROUT; + adapter->ptp_caps.n_pins = IGB_N_SDP; adapter->ptp_caps.pps = 0; + adapter->ptp_caps.pin_config = adapter->sdp_config; adapter->ptp_caps.adjfine = igb_ptp_adjfine_82580; adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576; adapter->ptp_caps.gettimex64 = igb_ptp_gettimex_82580; adapter->ptp_caps.settime64 = igb_ptp_settime_82576; - adapter->ptp_caps.enable = igb_ptp_feature_enable; + adapter->ptp_caps.enable = igb_ptp_feature_enable_82580; + adapter->ptp_caps.verify = igb_ptp_verify_pin; adapter->cc.read = igb_ptp_read_82580; adapter->cc.mask = CYCLECOUNTER_MASK(IGB_NBITS_82580); adapter->cc.mult = 1; From patchwork Mon Jul 19 06:25:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ruud Bos X-Patchwork-Id: 482110 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1FDDC636C9 for ; Mon, 19 Jul 2021 06:26:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8536961073 for ; Mon, 19 Jul 2021 06:26:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234097AbhGSG3A (ORCPT ); Mon, 19 Jul 2021 02:29:00 -0400 Received: from mail-eopbgr20127.outbound.protection.outlook.com ([40.107.2.127]:29104 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234489AbhGSG26 (ORCPT ); Mon, 19 Jul 2021 02:28:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Du5arjW4UPl08Cj1sOy5kyHU05X/eVC2qkzrvX9OOoFSKjU+i8uL7qGV+G1Vz+96eymY1njrs+9JcSP2+m3iazyhdKqlGVaZoKtxlbJQSaOd4/9RfvBKnplKcnmiZxL379iAUV99L6x/cmpYIVVrRhbXpXeAn94gzAfjWNRY2cQENrUq1DjqOtrXT5qSUEr0wP7G/2rVKR3cD1qz3BewCZOyTM4oUl4lLGH/VsDqYcvbYkbjy+xAldLT60lRhqibV1HK2XBogq0YYrvvgMuHVqSTTHYO8wpXdeQ8G7XxdxkflChsNgx2iuYhWtIndeh0TbT5biSov9QxkO8L4DrK5g== 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-SenderADCheck; bh=s95j8m7gT7PbaAgGJPHJ/JAr+kuGxWwLGbxaKQUKVrE=; b=PL0MUEBp13V1QIg5yyhCYmrn9O2JHfbWV21X3Z7Q/3L1t4liqc3Ej/Tr9O+GfaG4W88hNO09O9us8mNn8NeM7twIvB5KeSF68/QmAXoFr4Lb8dREog0bZ8aI9KLObDUQEpbG/yclBaHyoIJtsbtcsiB+NEJrLO43nSoVx50UNmyXrKLuGJO5AhB85j9SFcpoPUqzfGx2nQBhOUBjOPiY/duDPwgQJoqcbuDbXeW+uMnpk4Y6bz5y7gdmTJPa6/4IlBNfohiJAGjpwOQddPo7BMrlslmQLt16rWyjScvYLWIEwQe1c7cI1IXKSD8q6Fj8WZfLzKNLompFXxGB+PExLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hbkworld.com; dmarc=pass action=none header.from=hbkworld.com; dkim=pass header.d=hbkworld.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hbkworld.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s95j8m7gT7PbaAgGJPHJ/JAr+kuGxWwLGbxaKQUKVrE=; b=n0wZTeu4j9MRyq0sW4ELQCJXD5WBHpah3nMFRiq6MEUMdkFpCM06C0MlnPcFEI941oGatOgGPf+hXC6zFcve098usIpDPs0hkL+3j2xcu9uSPM5b3O90wZJ/QHIyZZdr/lh/ytJUDjW8hxoSO6nhNCQmWeBfOpPME0Lh0Pdmy7ywLxWC+gThCIM8Ufb+rJUgQc9VZrDFLSBElQnDThZHuB+T2mMoGXp864NQIcFvH92neTrEnWI3RXbrhaKWWhsYdjcphYEJPhi78Lj6vQ3fEo+OKFfg6LAu77F94qlvw/nrkPl5sckD0wQ6JB8iDL/imf0ShyN2LGUhJth7kKpUYQ== Received: from AM0PR09MB4276.eurprd09.prod.outlook.com (2603:10a6:20b:166::10) by AM4PR0902MB1700.eurprd09.prod.outlook.com (2603:10a6:200:91::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.29; Mon, 19 Jul 2021 06:25:54 +0000 Received: from AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92]) by AM0PR09MB4276.eurprd09.prod.outlook.com ([fe80::4d88:bf9c:b655:7a92%7]) with mapi id 15.20.4331.032; Mon, 19 Jul 2021 06:25:54 +0000 From: Ruud Bos To: "netdev@vger.kernel.org" Subject: [PATCH net-next 4/4] igb: support EXTTS on 82580/i354/i350 Thread-Topic: [PATCH net-next 4/4] igb: support EXTTS on 82580/i354/i350 Thread-Index: Add8Zle2A1UU0nbxSC2+juLWttqTWA== Date: Mon, 19 Jul 2021 06:25:54 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Enabled=true; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SetDate=2021-07-19T06:25:53Z; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Method=Privileged; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_Name=Unrestricted; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_SiteId=6cce74a3-3975-45e0-9893-b072988b30b6; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ActionId=5738b05a-9c4b-4bdf-894d-4df06591fc59; MSIP_Label_9208be00-d674-40fd-8399-cd3587f85bc0_ContentBits=2 authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=hbkworld.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 02fad29b-8b8e-4213-75d0-08d94a7e1037 x-ms-traffictypediagnostic: AM4PR0902MB1700: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fq8MiYJYmbYhbdBQAGaj3jHuk1Ope81LGXtuJQBM457MHZYlcJO+LoHlukeHxenYAZZOp4BEm6hlL8G3CEZc3A3D9sC6Z35/YJ8HrBRSnDQKboy7Mv0+rwwCVHcT1IrfyhGbMNNSgWex6paHWODkZI1XPN8tSPFdKzy4ms3e2U4NR0DGgA2mKjcElF5QvH63WywcPXhM6Yg6XfZDNvoqn71W9ogAr3BlUH8KweG6hEvgQbfwx/w8TMNr6DwMowc0DVsHeAYo84KiMh6fKEKnBRSKR5bZ1fGP7SqfLMYZCkTzpMjS8MG2KjmO4LJTXuZUxrhghwZdxleXEhN7g6EIqQRQkA7Fipb/B3wT6EqQ6b/jaSD9to4alAh1pff9nIOigIim7WKwcd6lO7QEqTt8JoP8sGGOix/hUYV4BbHUgxsmlPLYR0OBMfUL0S2Bg27w/1cxpgjOn60/w5cwBgclUrLCFZpTz+e3V5yjBRju/oPSYyXA518e60qirPAedsmlfS2auai3ekhs3EWmWDq5gzCz7+A5NARIiplrX0pRotlfTvUHaH/nsJgiln0MXcNfC/E7lQOYN3g3F05talHAUgGnUliFaKMYl8IMArHAmxM0kFsmjm3QA1EbpNDzSUJXUCOKy0IK8E1ll0p3NXrguR8IAHprl7J1fFjK3oJysFDwcY1x7BVoc/yZFgweD22yNVx1zph9iFeISdXRUpBsvg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR09MB4276.eurprd09.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(376002)(366004)(136003)(346002)(39850400004)(52536014)(2906002)(5660300002)(66446008)(64756008)(8936002)(83380400001)(8676002)(6916009)(186003)(66556008)(478600001)(86362001)(33656002)(76116006)(44832011)(26005)(71200400001)(7696005)(38100700002)(6506007)(122000001)(316002)(15974865002)(66946007)(66476007)(9686003)(55016002)(38070700004); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?HTiwB3qn32cPrm9D/kb5ss79J?= =?utf-8?q?8cZl6mokASkEOQL6twVeY/KlK97h3y5fvRtkYlXMpZOl/4SYG8Oy7qqZ?= =?utf-8?q?XrHqmRM8jfxl800Drj6p59IXoh+eA9fOeMyMMBGeqcr6gywGobbK+HNo?= =?utf-8?q?2Q91eboLhe1lvJ7tsNCOticVhGNix6BDdjKjqn9cmLN6n/OiUtwNt0Ck?= =?utf-8?q?yqRyPepjZzl1eohUDqJQDHkcQE5OKEsG4sHpJ5BnA7OY4T4iSDuS+gAM?= =?utf-8?q?KK2u+FNwLYyyvFiGfO1CTFNpv41LNNcporEpiqLjvmiJpzwLBROEaFZ/?= =?utf-8?q?pSSRq9lMRAI8vTrbh85vGYei0k+AKw2WV/ps6RBqQTzt/8bAhzHHQ31M?= =?utf-8?q?dLo0XKuCL/PQg0W6eoNd1TibSn++AKzKmEKXtbXQclcDCXqq1emI2Sm8?= =?utf-8?q?7Svq/ljic3/TmxFFkPcLohGvMbyAqSovK9NzUnS5p+3SdA8FFbaJqyGB?= =?utf-8?q?oN3Ir+qjw35ElwZAR/VHb6PFxpK+xcrWGQ8Le75e7Mf02tyFzbJj5xV+?= =?utf-8?q?8skYHznqucBSLwG5Hma/aBRniyGEER+fgW2UHcKdiiB6q9pskJtplELU?= =?utf-8?q?ZgYin53aL3G+dENsmAlSIJHwNH2lKwKnKaRXKHozVP9l00+94vQI7sGf?= =?utf-8?q?eYH4mnIxQy5RgyXFklhcrv1lq/Je5+1kL+S6u7md+HKASkspVJaAeFXA?= =?utf-8?q?iV7/jJUXjlDnnXQJAbwiEx8Zo8WB9tYXGe4RXEaWqwJdZNUSvKeJYzlw?= =?utf-8?q?+uoYAaTfs3XzBSj102EHHdE1u/UjRC0uIXhwUaSpG+vwwXGcnEyzNE9f?= =?utf-8?q?/mMY3wYJ3vK9yzfj1flCcB6T5czNSnCuo8mc30wgI8ipxZOBzS2MF6B/?= =?utf-8?q?XtY8QyCreUiQor/hmbOolmpmganGCS8HkfcoX+j/6aBF2vuJMG03gIVW?= =?utf-8?q?zVcUHFaWRfQNoP25L4W+I1eKyr6AkFNkKairqk2Rt0wyClbK1kcATlBa?= =?utf-8?q?pBFaPRR7S0TeCqZTtlFE4SHEb2bpC4E+LyLESWvxaLG2CfRjQmvtPhMS?= =?utf-8?q?jzry1hahTxyydj+UsIT4qpjfXN7EpaiJrAyXtCktFnmQeS6yIsQS78XE?= =?utf-8?q?L2ub6rANiXj00RFK7pkwLUaNhdQ0uldkBWDosMgngJ4qyZ7ImyTf9Abf?= =?utf-8?q?5gWDfooOTwObcPb2GtBOm5vZdwVzm+LLGk6rb66lTOmHPLl3Em7sq6mZ?= =?utf-8?q?8wSKFnJ70mYJvExl/R9Mt4VohSpH/4rBVTBCN9eskLprgNrX5ip7Q3Vs?= =?utf-8?q?ICuw1J7KuRHWdxpCCsILYBzQWVeDPsaojVvHOsKWMk4zvJTAHH+oJkO7?= =?utf-8?q?2+bnYzYUBM=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: hbkworld.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM0PR09MB4276.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02fad29b-8b8e-4213-75d0-08d94a7e1037 X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Jul 2021 06:25:54.7015 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 6cce74a3-3975-45e0-9893-b072988b30b6 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Ncpj2MAhfwkGkMa+A6MJt31B/6GAdCAc3QOdx2yJZwkAsGnkEztyOZuEpCAcbuIs X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0902MB1700 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Support for the EXTTS PTP pin function on 82580/i354/i350 based adapters. Because the time registers of these adapters do not have the nice split in second rollovers as the i210 has, the implementation is slightly more complex compared to the i210 implementation. Signed-off-by: Ruud Bos --- drivers/net/ethernet/intel/igb/igb_main.c | 20 ++++++++++--- drivers/net/ethernet/intel/igb/igb_ptp.c | 36 ++++++++++++++++++++++- 2 files changed, 51 insertions(+), 5 deletions(-) -- 2.30.2 UNRESTRICTED HBK Benelux B.V., Schutweg 15a, NL-5145 NP Waalwijk, The Netherlands www.hbkworld.com Registered as B.V. (Dutch limited liability company) in the Dutch commercial register 08183075 0000 Company domiciled in Waalwijk Managing Directors : Alexandra Hellemans, Jens Wiegand, Jorn Bagijn The information in this email is confidential. It is intended solely for the addressee. If you are not the intended recipient, please let me know and delete this email. diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 8d87166e5ecb..3f76b45d7e65 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6796,17 +6796,29 @@ static void igb_perout(struct igb_adapter *adapter, int sdp) static void igb_extts(struct igb_adapter *adapter, int sdp) { struct e1000_hw *hw = &adapter->hw; - u32 sec, nsec; + int auxstmpl = (sdp == 1) ? E1000_AUXSTMPL1 : E1000_AUXSTMPL0; + int auxstmph = (sdp == 1) ? E1000_AUXSTMPH1 : E1000_AUXSTMPH0; + struct timespec64 ts; struct ptp_clock_event event; if (sdp < 0 || sdp >= IGB_N_EXTTS) return; - nsec = rd32((sdp == 1) ? E1000_AUXSTMPL1 : E1000_AUXSTMPL0); - sec = rd32((sdp == 1) ? E1000_AUXSTMPH1 : E1000_AUXSTMPH0); + if ((hw->mac.type == e1000_82580) || + (hw->mac.type == e1000_i354) || + (hw->mac.type == e1000_i350)) { + s64 ns = rd32(auxstmpl); + + ns += ((s64)(rd32(auxstmph) & 0xFF)) << 32; + ts = ns_to_timespec64(ns); + } else { + ts.tv_nsec = rd32(auxstmpl); + ts.tv_sec = rd32(auxstmph); + } + event.type = PTP_CLOCK_EXTTS; event.index = sdp; - event.timestamp = sec * 1000000000ULL + nsec; + event.timestamp = ts.tv_sec * 1000000000ULL + ts.tv_nsec; ptp_clock_event(adapter->ptp_clock, &event); } diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index 64a949bb5d8a..bc24295b6b52 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -524,7 +524,41 @@ static int igb_ptp_feature_enable_82580(struct ptp_clock_info *ptp, switch (rq->type) { case PTP_CLK_REQ_EXTTS: - return -EOPNOTSUPP; + /* Reject requests with unsupported flags */ + if (rq->extts.flags & ~(PTP_ENABLE_FEATURE | + PTP_RISING_EDGE | + PTP_FALLING_EDGE | + PTP_STRICT_FLAGS)) + return -EOPNOTSUPP; + + if (on) { + pin = ptp_find_pin(igb->ptp_clock, PTP_PF_EXTTS, + rq->extts.index); + if (pin < 0) + return -EBUSY; + } + if (rq->extts.index == 1) { + tsauxc_mask = TSAUXC_EN_TS1; + tsim_mask = TSINTR_AUTT1; + } else { + tsauxc_mask = TSAUXC_EN_TS0; + tsim_mask = TSINTR_AUTT0; + } + spin_lock_irqsave(&igb->tmreg_lock, flags); + tsauxc = rd32(E1000_TSAUXC); + tsim = rd32(E1000_TSIM); + if (on) { + igb_pin_extts(igb, rq->extts.index, pin); + tsauxc |= tsauxc_mask; + tsim |= tsim_mask; + } else { + tsauxc &= ~tsauxc_mask; + tsim &= ~tsim_mask; + } + wr32(E1000_TSAUXC, tsauxc); + wr32(E1000_TSIM, tsim); + spin_unlock_irqrestore(&igb->tmreg_lock, flags); + return 0; case PTP_CLK_REQ_PEROUT: /* Reject requests with unsupported flags */