Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2209467pxx; Sat, 31 Oct 2020 11:42:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywGIuS0WwOuR8w3foyjJZYXwB9/d1h3ksGDgiD7tHEDrWVQjHm4XEcsq+VFxyevvsPG9aN X-Received: by 2002:a50:d805:: with SMTP id o5mr8897193edj.142.1604169757424; Sat, 31 Oct 2020 11:42:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604169757; cv=none; d=google.com; s=arc-20160816; b=f5TIh4U3lFczYCSbZnBDR/kmwnvhpA6tHZ7WDy7pvuLCbjOzZkcT9ErbpdEk62lJRY oXWJGfxK76bolq44H+LNLTFqL8Z4gMkIBN9u6DoqkJa4nkWlpJcm/Eiij1WV1Kf7JZgX klL0oTmW9TltM7K1L9MomFeFR8oVqo4llR7o76zvmcGunPoeVUDfcvEKU1igdHpkYZ/C OYsEpx1DfjTX1DtItHJkLRWkaHpEKrNGCpguIUpfmAb/zzi+6J6QYjuzwycJTxGFGuyF LL49bDLrsuTZVjiSThw25MQgLUZdpC7XT+bEKJiCP4xM9ohPUEPyiUjyQFa8FceJt9GQ Xa7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=TmQQSCEanislAtPIZXQM140FeUSt37iOorZ7v0ALpH8=; b=JE3aT+01ORoB/ENhzRth2hftYtVveYKiLi0tTkpySo8RfZN0xW9EicIRyQfTO4Wnjf vBQ+IfGSufD+XaJSgEM55qFQ+4IYvimRmMkKcjNW+GImGupcuLhgy4sBNvsK/AHUiDqP tvTkM0RzgoLdzQBu7TALttFCbavVBi+I8p59+0SBiZMTl+oBw1EZZNmYurdcm62gru+3 2uKEiFalNGopaSh8s0wiATWa62etw32kaYC5FyG7k0+dSyKZxUYvbZEOO89LMQDj4dpK 83Sh9BcxZQTl87zgu+CSqpTeI+Cuxx3WIvL5mXBxOqc9hc+vuk8tKr4qlr0e6YTpwi1Z 8Cxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jx3Df7BZ; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r2si5962766ejr.265.2020.10.31.11.42.14; Sat, 31 Oct 2020 11:42:37 -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=@kernel.org header.s=default header.b=jx3Df7BZ; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728399AbgJaSkr (ORCPT + 99 others); Sat, 31 Oct 2020 14:40:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:58272 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727967AbgJaSkq (ORCPT ); Sat, 31 Oct 2020 14:40:46 -0400 Received: from kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net (c-67-180-217-166.hsd1.ca.comcast.net [67.180.217.166]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AF11320702; Sat, 31 Oct 2020 18:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604169646; bh=skJUEgoqkET7svqQtfRHu/uPx8Rw/sIJQTtx5ZQkuVA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jx3Df7BZD/Y1daJQjmKryx9YdgWk3r0M5kqspBdywfNnJ8juemsw4B2kQwA0+PyaM 4z3rstZSSWaxJA1gJE0y98PvVy8JyBw1Oepo6aJJUSlu75ekOpgF0d7TyUpIbeV6RD dpZONZV/OCYoVnR3lc3Z8HOtBh0YX16PWHKiqT40= Date: Sat, 31 Oct 2020 11:40:42 -0700 From: Jakub Kicinski To: Grygorii Strashko Cc: "David S. Miller" , , Vignesh Raghavendra , Sekhar Nori , , , Richard Cochran Subject: Re: [PATCH] net: ethernet: ti: cpsw: disable PTPv1 hw timestamping advertisement Message-ID: <20201031114042.7ccdf507@kicinski-fedora-PC1C0HJN.hsd1.ca.comcast.net> In-Reply-To: <20201029190910.30789-1-grygorii.strashko@ti.com> References: <20201029190910.30789-1-grygorii.strashko@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 29 Oct 2020 21:09:10 +0200 Grygorii Strashko wrote: > The TI CPTS does not natively support PTPv1, only PTPv2. But, as it > happens, the CPTS can provide HW timestamp for PTPv1 Sync messages, because > CPTS HW parser looks for PTP messageType id in PTP message octet 0 which > value is 0 for PTPv1. As result, CPTS HW can detect Sync messages for PTPv1 > and PTPv2 (Sync messageType = 0 for both), but it fails for any other PTPv1 > messages (Delay_req/resp) and will return PTP messageType id 0 for them. > > The commit e9523a5a32a1 ("net: ethernet: ti: cpsw: enable > HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter") added PTPv1 hw timestamping > advertisement by mistake, only to make Linux Kernel "timestamping" utility > work, and this causes issues with only PTPv1 compatible HW/SW - Sync HW > timestamped, but Delay_req/resp are not. > > Hence, fix it disabling PTPv1 hw timestamping advertisement, so only PTPv1 > compatible HW/SW can properly roll back to SW timestamping. > > Fixes: e9523a5a32a1 ("net: ethernet: ti: cpsw: enable HWTSTAMP_FILTER_PTP_V1_L4_EVENT filter") > Signed-off-by: Grygorii Strashko CC: Richard > diff --git a/drivers/net/ethernet/ti/cpsw_ethtool.c b/drivers/net/ethernet/ti/cpsw_ethtool.c > index 4d02c5135611..4619c3a950b0 100644 > --- a/drivers/net/ethernet/ti/cpsw_ethtool.c > +++ b/drivers/net/ethernet/ti/cpsw_ethtool.c > @@ -728,7 +728,6 @@ int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info) > (1 << HWTSTAMP_TX_ON); > info->rx_filters = > (1 << HWTSTAMP_FILTER_NONE) | > - (1 << HWTSTAMP_FILTER_PTP_V1_L4_EVENT) | > (1 << HWTSTAMP_FILTER_PTP_V2_EVENT); > return 0; > } > diff --git a/drivers/net/ethernet/ti/cpsw_priv.c b/drivers/net/ethernet/ti/cpsw_priv.c > index 51cc29f39038..31c5e36ff706 100644 > --- a/drivers/net/ethernet/ti/cpsw_priv.c > +++ b/drivers/net/ethernet/ti/cpsw_priv.c > @@ -639,13 +639,10 @@ static int cpsw_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) > break; > case HWTSTAMP_FILTER_ALL: > case HWTSTAMP_FILTER_NTP_ALL: > - return -ERANGE; > case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: > case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: > case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: > - priv->rx_ts_enabled = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; > - cfg.rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; > - break; > + return -ERANGE; > case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: > case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: > case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: