Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1488137ybh; Thu, 16 Jul 2020 13:39:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3Tz9EwP4JWHAVUy8u0V+pSv6CsBcoqwIU9ULmXSz2+SGeCjiLcI9c/p7WiR4SraPZbYZk X-Received: by 2002:a17:906:35ce:: with SMTP id p14mr3061576ejb.514.1594931945820; Thu, 16 Jul 2020 13:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594931945; cv=none; d=google.com; s=arc-20160816; b=lrFhzuYFqM1P9wWi/E/A9QlfxsElcQ+JyX4LajX9KmWvRsteiokH/JQQbAaO4Mugnd FKo7fimrNxFWQlhz5t2umyqja8Y+wF/RgOa3Q5WuJjdHCJDASzMSB1zmYMfY3xX8ypnd uBsttbM/MXDmJiEIBK3CLgwNZ3oNhRHWzHy6y2WDAk5/aOcDCzLKOwfS5vXHKh1yQSMY VXJptgwDJuMOzFFNgEb5G/u+P0LkNbNzl9rFm47qA9O+8sJLrIIMcDW94Q4VKRi6Tf7J VibG+5wtamz2/F2gUFoYM1eWPVub2tQUv1C+SCUnIRfVxFHFFsrsdEMrc2EcvyygNlAV LxPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:dkim-signature; bh=2O7bQWDLwUQDhW0OWAcbDHupVIWe6xHnIDUrKXN+BPE=; b=euZK5A9s2fxgDIC7TLXCH3SRpfnHvp+Cc4G6JqFkqTgEG0AnZXhblCffrLW8NBuecs IcEu8WNRxrqDFBUhGqI6C9W0HVUeSwwqoMCCFGFn1a5pEcw91oe/lpBx/26ShpDW1yah mYeCzXh5RcbTeeH3ThsCjoJ3/Qtsn8IxvUBBt5Trpndf1zGuIcLlkF1cHmLLelzwK5OU RWnN7tWQ62zSICnEGg+qZctPbXqKNc7OvN52H67LkIC1B+JQ+annF4nX5rwt+HY6jUK6 yCE1mhClBR68WOc5xn2zIWOi/Owlw/G+gm/604ZTkI7DE5PQ58tpJab7ORcdUDASKQMp C2pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="tayLBiK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si3632727ejx.229.2020.07.16.13.38.42; Thu, 16 Jul 2020 13:39:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="tayLBiK/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726181AbgGPUiS (ORCPT + 99 others); Thu, 16 Jul 2020 16:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725926AbgGPUiR (ORCPT ); Thu, 16 Jul 2020 16:38:17 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60C77C061755; Thu, 16 Jul 2020 13:38:17 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id d17so9859514ljl.3; Thu, 16 Jul 2020 13:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2O7bQWDLwUQDhW0OWAcbDHupVIWe6xHnIDUrKXN+BPE=; b=tayLBiK/WNaM9ea4BqBDSKhbMdqpMJ8yMhQ2ZgaKzKGSoUcoHHS4cfokqB9mxIVpxi sp+xoUxTXku7dRJg5p2wfpRHztxxiWjPfV+mEFuD258pgivHSOyEqR5QCGQWmkIJsi9H C8W6LhHnoSu4O9RU9paS/EB1PkLocmxKif1LymCGQCmBPhQQHKyFBIRls/D2rvu1P/uv gMq+6FNPlF4K2zBL0T43L9WSsLD+rcWlY/9gnn9klm29IzYFmpWTxREb1PTTNI2ss/nm 8n6+Fh1GbggE+3yiVKbaZibdtHz7xAtbrHVI1uu1NJJ8+ItK6JtDzeTi2Qkig6AnwWex +6vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2O7bQWDLwUQDhW0OWAcbDHupVIWe6xHnIDUrKXN+BPE=; b=Y13yuLDbf5psSAq1oD93Fhk22Rkd9c2RHm6BfKeiQdWDtFG/7XL0sXQqUxCwvwgdky rsDXdNrX/YqLqZ8a6bH/GAayoZ302KhZdZD7ue95vw0rIpkvzACAf3O+SIdIH8FijiFm yuPLHMIiJ6DcMiW5KenPC2r5tt8DoXOfKfLNjcwLGMjA2FHVYDTv5kfqmAj10ah9FJNV LGStiRo8vBptDrpfc6dWsjfveleE+ya0GAAB3u2H/KUp1zwpHbkoP5dFf23lRDe4/bUq Wb/lS8wQzydV2dazzfCYi7AsdtsQlvmKmA8DK6bXgvbrPSdtvebAjdKHN6y8XAJN+A4Y AbrA== X-Gm-Message-State: AOAM532bpqdP8HRp3rekd2qBtth3MLBrjBr8hkVx4L55h/a3oYB5Zil8 sB3LO/ps9Z3Y140GlHt3GrI= X-Received: by 2002:a2e:85ce:: with SMTP id h14mr2692804ljj.356.1594931895810; Thu, 16 Jul 2020 13:38:15 -0700 (PDT) Received: from osv.localdomain ([89.175.180.246]) by smtp.gmail.com with ESMTPSA id n3sm1244807ljc.114.2020.07.16.13.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jul 2020 13:38:15 -0700 (PDT) From: Sergey Organov To: Jakub Kicinski Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Fugang Duan , "David S. Miller" , Richard Cochran , Vladimir Oltean Subject: Re: [PATCH v3 net] net: fec: fix hardware time stamping by external devices References: <20200706142616.25192-1-sorganov@gmail.com> <20200714162802.11926-1-sorganov@gmail.com> <20200716112432.127b9d99@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> Date: Thu, 16 Jul 2020 23:38:13 +0300 In-Reply-To: <20200716112432.127b9d99@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (Jakub Kicinski's message of "Thu, 16 Jul 2020 11:24:32 -0700") Message-ID: <87a6zz9owa.fsf@osv.gnss.ru> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jakub Kicinski writes: > On Tue, 14 Jul 2020 19:28:02 +0300 Sergey Organov wrote: >> Fix support for external PTP-aware devices such as DSA or PTP PHY: >> >> Make sure we never time stamp tx packets when hardware time stamping >> is disabled. >> >> Check for PTP PHY being in use and then pass ioctls related to time >> stamping of Ethernet packets to the PTP PHY rather than handle them >> ourselves. In addition, disable our own hardware time stamping in this >> case. >> >> Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware >> clock") >> Signed-off-by: Sergey Organov >> Acked-by: Richard Cochran >> Acked-by: Vladimir Oltean >> --- >> >> v3: >> - Fixed SHA1 length of Fixes: tag >> - Added Acked-by: tags >> >> v2: >> - Extracted from larger patch series >> - Description/comments updated according to discussions >> - Added Fixes: tag > > FWIW in the networking subsystem we like the changelog to be part of the > commit. Thanks, Jakub, I took a notice for myself! > > Applied, and added to the stable queue, thanks! Thanks, and I've also got a no-brainer patch that lets this bug fix compile as-is with older kernels, where there were no phy_has_hwtstamp() function. Dunno how to properly handle this. Here is the patch (on top of v4.9.146), just in case: --- >8 --- commit eee1f92bbc83ad59c83935a21f635e088cf7aa02 Author: Sergey Organov Date: Tue Jun 30 17:12:16 2020 +0300 phy: add phy_has_hwtstamp() for compatibility with newer kernels Signed-off-by: Sergey Organov diff --git a/include/linux/phy.h b/include/linux/phy.h index 867110c9d707..aa01ed4e8e1f 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -595,6 +595,15 @@ struct phy_driver { #define PHY_ANY_ID "MATCH ANY PHY" #define PHY_ANY_UID 0xffffffff +/** + * phy_has_hwtstamp - Tests whether a PHY supports time stamp configuration. + * @phydev: the phy_device struct + */ +static inline bool phy_has_hwtstamp(struct phy_device *phydev) +{ + return phydev && phydev->drv && phydev->drv->hwtstamp; +} + /* A Structure for boards to register fixups with the PHY Lib */ struct phy_fixup { struct list_head list; -- Sergey