Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp816133imm; Wed, 20 Jun 2018 07:06:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLksa4JYsRPZHk9cItFgZdkZagRREkQcGQghzjl+cpebfnC5XgZbOn5GwAxscZmNry8e+O2 X-Received: by 2002:a65:6604:: with SMTP id w4-v6mr18900801pgv.346.1529503576872; Wed, 20 Jun 2018 07:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529503576; cv=none; d=google.com; s=arc-20160816; b=hezrN0v5F9BTeBsxxWg8fWT0kyAFUNDfEOk7iGVfdd+iVHCz7UWdugu89pwlzy56NA daCbUQbV9ViWJynWhxWztjmrQw5GgjldGFzZzVGgdYGt08N+EdiqWnKCtN/ykBxKr7TX vODmmFedhSRs8ODZdUIERkZNRGjE2dQaabPxMbzUXPQPQ7gobepXhHoGNaxU0UWjzP2p S53F1QwcxDbXHRSarfJgJlVXHfLB7L2dVOs19CBD723yEJ8w8sW8Qj99tRdE9qE7U0ee ID/4HZY4G/r25IeUC6qCnWYAq/IKoHyUbmq7a5A8/KDrVJJTbTRKnewr2kuw7oxptcFo +V9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject :arc-authentication-results; bh=0qAzVgbl5sl7j5j8s518g0ANFqgFboOqfQ38kc8mKHU=; b=Q/rWisChlUUN4d0vVxttCji/7/7ekMbCtpGF64g38FFzzN3BUF23riVBM7cg3IoXpc YNNCcZ9xHpn4yqF8WkQRwYFprpcVBEA9D/NnpygnRDi3/PBdyAsdcGN64WekONNOJ41N AsUwaWUJBxQgKIndSxGllXwqYDh6DpWsqanitEAXJIFqXx2e6TZHUQMmbgQzFgz/osWS JEbi3kLalZ5noRHcES79JCfzux7cp4ocNRyrviODkk4B2rtm0XQKeLaD6RxUQwJ+qyRb PmDayqjOI5/FxRbj7WnmoUuOsn5r8JU7AsUPMNuqXllYVYByX+NM7wmP7I26nNJ+nyP1 qqTA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8-v6si2435899pfj.300.2018.06.20.07.06.02; Wed, 20 Jun 2018 07:06:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754201AbeFTOEn (ORCPT + 99 others); Wed, 20 Jun 2018 10:04:43 -0400 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:24354 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754136AbeFTOEi (ORCPT ); Wed, 20 Jun 2018 10:04:38 -0400 X-IronPort-AV: E=Sophos;i="5.51,247,1526367600"; d="scan'208";a="13247852" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 20 Jun 2018 07:04:22 -0700 Received: from [10.159.245.112] (10.10.76.4) by chn-sv-exch07.mchp-main.com (10.10.76.108) with Microsoft SMTP Server id 14.3.352.0; Wed, 20 Jun 2018 07:04:20 -0700 Subject: Re: [PATCH] net: macb: Fix ptp time adjustment for large negative delta To: Harini Katakam , CC: , , , , Claudiu Beznea - M18063 References: <1529494460-4689-1-git-send-email-harini.katakam@xilinx.com> From: Nicolas Ferre Organization: microchip Message-ID: Date: Wed, 20 Jun 2018 16:04:17 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <1529494460-4689-1-git-send-email-harini.katakam@xilinx.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/06/2018 at 13:34, Harini Katakam wrote: > When delta passed to gem_ptp_adjtime is negative, the sign is > maintained in the ns_to_timespec64 conversion. Hence timespec_add > should be used directly. timespec_sub will just subtract the negative > value thus increasing the time difference. > > Signed-off-by: Harini Katakam Makes sense: Acked-by: Nicolas Ferre > --- > drivers/net/ethernet/cadence/macb_ptp.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c > index 2220c77..6788351 100644 > --- a/drivers/net/ethernet/cadence/macb_ptp.c > +++ b/drivers/net/ethernet/cadence/macb_ptp.c > @@ -170,10 +170,7 @@ static int gem_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) > > if (delta > TSU_NSEC_MAX_VAL) { > gem_tsu_get_time(&bp->ptp_clock_info, &now); > - if (sign) > - now = timespec64_sub(now, then); > - else > - now = timespec64_add(now, then); > + now = timespec64_add(now, then); > > gem_tsu_set_time(&bp->ptp_clock_info, > (const struct timespec64 *)&now); > -- Nicolas Ferre