Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp5345415ybi; Tue, 30 Jul 2019 19:04:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdH1cseC0/8IeoNxmkqLdPNlLI62Qx1o5s96wH/fhfaolA/8NKYbo5M6GKyVAeWbyrJ2Gs X-Received: by 2002:a63:5945:: with SMTP id j5mr110944276pgm.452.1564538664600; Tue, 30 Jul 2019 19:04:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564538664; cv=none; d=google.com; s=arc-20160816; b=E9PawqyomL+U17mtzwYr5FMIYm8U3Bm5y8tv1Lv77oqHfBpVTRJEjhlsT/X06b+3+r VYUZ3212d6ybaqAPlLc/x2dQy5Th39I8T+5D9H+/S87LnWiO3YcGEnCtaTRb/NGd/vY5 UgPPBXrOmvhM6dFoYypv08m9EB0g8MZm1dh1bysN5xjlyGJfVazXeGGC6e8jcGmDYquf jlvQgjwy2aI+zdj377nWGuT2XOLve2JYS3EPs6FVdGmUwY4LKl3N/8NMhR1O0H36ODuh 09vkiexeoS0oNBJrhWt7K4IgmLEQ4w+8f01Aj0KeK8leapBynetB/boknVQcwS5kNX2F v56g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rnJlkh/Q87VmPKlKJL1ihGGE96lC4RRb7Zru8TgeksQ=; b=p31j82EBMPdQ005nsVlJiI6CBJ3jzsNQXQGQKB19p7cPBspECtH5dV2eDoGBdBDqq3 WYC/6YIyEME0q4oENMuFvrtAvHuked61h8AI+jYI9HJH/mY/9UyOP5vwgRIIr5d6NwkJ OeMZg2wHz0WVpjIMpRrA5b2gC48Z9dJ5V45ovEbN3ILl0De8uMGVdLjrIm8Qx5D42rKS jgCsyNuJgWVBnAuaOtFIP67iu6oDv2d174h5zpdlPDjgK+3epBvROfYlHe8tEntXUhJK H+eEuV3MCLmRl1S3sROV3KgycoM+JC8vbiqfGhZLXyuJawRWxkM+2Yoi26nU1U00BcAG og8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="f8IqJ/pA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id t6si207235pjv.14.2019.07.30.19.03.58; Tue, 30 Jul 2019 19:04:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="f8IqJ/pA"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728232AbfG3UrE (ORCPT + 99 others); Tue, 30 Jul 2019 16:47:04 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:36364 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfG3UrE (ORCPT ); Tue, 30 Jul 2019 16:47:04 -0400 Received: by mail-ed1-f65.google.com with SMTP id k21so63743017edq.3; Tue, 30 Jul 2019 13:47:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rnJlkh/Q87VmPKlKJL1ihGGE96lC4RRb7Zru8TgeksQ=; b=f8IqJ/pAch002pXspZ6OhH5kYQoo6n1EqdqJxxjFLE57pclEzoGGY2TuFeRh82x+zB SIl0/VlupxrlWOPyFbQDl8BbRrewXg4quGXAcSW6woMu+RZPN2tGTv0GQ7IXkqLF/jX0 fS9CmLsIw9tu+wJt3JHv/PzL0WYLt7U+fCXlxpEXVDlz58ZzE00bnUQh1vWI5zcePL8h kn9zsjk9w062Z2ommrJu9r7pi4k6oqnOKUPwM4Ked5mnBGpDXregTGTwfZ9BRiRibfop yqAYPra2h7LuufqdOZT2CzkWpG9HaN+gED8jAM2oTW/hOi/EKvx5zmmp5qwDY5QXYJEr wNLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rnJlkh/Q87VmPKlKJL1ihGGE96lC4RRb7Zru8TgeksQ=; b=atImn6qFoHSJZxPjfoWbKtE6qO5xocSogIuQYxInXodrSiqb8d285nSafVHF3mGUVY BSezSCPC2J+hi6BpT5IWMmVY2AI6pyzcq4tmLJ6AiCt2Lc050/zgWjiinDWGiUcbCYQQ UZHch8T4wIgA2h6ba4IR92KxmvvIOHFGKt/MK27BH2ySuyowx4ywqCcneGEOXkkl+6Gv h7nYuKM2MjXjA3VdvKVcg/GNxHmQmJEohhscVWjwx1J7MH+0MWFl7oxqX14OVrxKhYsa Ka1kLA0pH44+5/P5YdoeDcEllXxvorMV+K09lYpR9TFfcESpB9mWl45ayaxLD4xJK7vH 7nJA== X-Gm-Message-State: APjAAAXH6CNOUVk7Um59P1tQ7OCDJ7vLdckkiuNB0CcAjMZxKh8vkeuQ TMqROf6tOkeRHHcclLXVJ2na00JIJ9gPabNIO94= X-Received: by 2002:a50:ba19:: with SMTP id g25mr103537071edc.123.1564519622422; Tue, 30 Jul 2019 13:47:02 -0700 (PDT) MIME-Version: 1.0 References: <20190730100429.32479-1-h.feurstein@gmail.com> <20190730100429.32479-5-h.feurstein@gmail.com> <20190730160032.GA1251@localhost> <20190730171246.GB1251@localhost> In-Reply-To: <20190730171246.GB1251@localhost> From: Vladimir Oltean Date: Tue, 30 Jul 2019 23:46:51 +0300 Message-ID: Subject: Re: [PATCH 4/4] net: dsa: mv88e6xxx: add PTP support for MV88E6250 family To: Richard Cochran Cc: Hubert Feurstein , netdev , lkml , Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Rasmus Villemoes Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Hubert, Richard, On Tue, 30 Jul 2019 at 19:44, Richard Cochran wrote: > > On Tue, Jul 30, 2019 at 12:04:29PM +0200, Hubert Feurstein wrote: > > diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c > > index 768d256f7c9f..51cdf4712517 100644 > > --- a/drivers/net/dsa/mv88e6xxx/ptp.c > > +++ b/drivers/net/dsa/mv88e6xxx/ptp.c > > @@ -15,11 +15,38 @@ > > #include "hwtstamp.h" > > #include "ptp.h" > > > > -/* Raw timestamps are in units of 8-ns clock periods. */ > > -#define CC_SHIFT 28 > > -#define CC_MULT (8 << CC_SHIFT) > > -#define CC_MULT_NUM (1 << 9) > > -#define CC_MULT_DEM 15625ULL > > +/* The adjfine API clamps ppb between [-32,768,000, 32,768,000], and > > That is not true. > I was referring to this: https://github.com/richardcochran/linuxptp/blob/master/phc.c#L38 /* * On 32 bit platforms, the PHC driver's maximum adjustment (type * 'int' in units of ppb) can overflow the timex.freq field (type * 'long'). So in this case we clamp the maximum to the largest * possible adjustment that fits into a 32 bit long. */ #define BITS_PER_LONG (sizeof(long)*8) #define MAX_PPB_32 32767999 /* 2^31 - 1 / 65.536 */ Technically it is not "not true". [snip] On Tue, 30 Jul 2019 at 21:09, Richard Cochran wrote: > > On Tue, Jul 30, 2019 at 06:20:00PM +0200, Hubert Feurstein wrote: > > > Please don't re-write this logic. It is written like that for a reason. > > I used the sja1105_ptp.c as a reference. So it is also wrong there. > > I'll let that driver's author worry about that. > > Thanks, > Richard > And what is the reason for the neg_adj thing? Can you give an example of when does the "normal way" of doing signed arithmetics not work? Thanks, -Vladimir