Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2831205lqt; Tue, 23 Apr 2024 03:01:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyRnmrub+K20xxOF7rGQfD0X0o92hNGy8CthMTJyMSsIqte2yGC0XRoZ9WV6Zy+XjXd7B1pDPYx9t5XReoeMJE6v5/hkufw8t6spKWzA== X-Google-Smtp-Source: AGHT+IGqCqY50jlLQsakHTr6uddj+1452AKhu0NW/fkCp+PHmU9ufz1kv2gT8akwO7LttPZ7kDdb X-Received: by 2002:a17:903:248:b0:1e5:4f00:37b9 with SMTP id j8-20020a170903024800b001e54f0037b9mr18247681plh.11.1713866476129; Tue, 23 Apr 2024 03:01:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713866476; cv=pass; d=google.com; s=arc-20160816; b=Z+D1RE0qH9iEe00WcRkYirFs4OJeFL6L7yi8uBsJvuqq+1H8k89jJWDcZkmyn0M0lj udrbD4NcGC0/9O+aDbXOaIosyqVG2KZCCiRBBnXkJTZtZsNLPNC+cUUtcHm4pyr30cx6 ERlmJns1MnoHJ2KxRVJbfqRAxbbc9WPV+UwuLfHixesRMnLjdICZwqkr7VhLHmoF3rXu LVeip2f7qVhFRksycXrC9dEJkg5GdfX0ihr7Ii3A7UKSAmPHB/Qz/qFTF5aMuUGhL+jF 0A0aNmHuQzYcv6VkPQCVSzQ+5vHMFEmmw1Xl9l5XNAoA/9bfcKgt5ojd4LMVAFsirq70 uIJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:references :in-reply-to:date:cc:to:from:subject:message-id:dkim-signature; bh=YwIkjif5BreNxnLNOWf6abaVgTHOQBKAwUvTq0Bl3Ug=; fh=jTnDNGRnwxRIYUq4gUmxzJ/+Wb/txPeIcT29tBsO8Tk=; b=FzCMlBuUwxjeZSdmXnB9UyyELclBtdInkqlOwj1m5oM1nKtCAUSIMm07GIdDghMyB2 KeIBiphl6Onewm0P7yyafDcvsdk8LF2QzJyTXu+Uw+92E77ZlHDTBTCXblrM4NHVzRnt ReZgolmIIXL3A/V8KBDX9Dww/QrSI6d2fRMMx9rbG7qK+KWkMbQFaSIP4eWilXGDEo3T NWsfxVZIsekPyeK9iWd6YhEPwviF0eYkGI4gN5Iw+Es99Icjm/ItpWicZlnjT5kBHN0a Uo83wMZ/rszPoWkp7ZG/zrGOj520PwJ8RR/8xKeyAd5O740IpfEvVEFwwEBFiETOcgRe hijw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wy7aYCT+; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-154825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j6-20020a170903024600b001e23723701fsi9561315plh.515.2024.04.23.03.01.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 03:01:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-154825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Wy7aYCT+; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-154825-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-154825-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6E6692810DF for ; Tue, 23 Apr 2024 10:01:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0223E5FDA9; Tue, 23 Apr 2024 10:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Wy7aYCT+" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFC5A5FBA0 for ; Tue, 23 Apr 2024 10:01:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713866469; cv=none; b=BHPx8O2iB8dHUyGe62PLJCX3gJNo3uXC9VJ5CStzBcep/Xu+U6bXX/VBR1OSKT4w4qMQDIhWxs1fKI57YCPp8mM2Icqu/CP4c9BZmPBeCmZcG4Z72JfmoS+7X7hmAT6mCAliQD4bcgpy3zOgBRmsN5nK5z94/E/Fq2fpp0aA3os= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713866469; c=relaxed/simple; bh=YwIkjif5BreNxnLNOWf6abaVgTHOQBKAwUvTq0Bl3Ug=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=YeGhuwZfP5zmAoMHrvByQrKoWUoMjmiah0ekh5Wgmgsq4pONWVKQNNLiSoFSjz7mO31u38o2aYZ7yhVwembmnSkBrcby/LCuudnz7s+EHQ60M327PAQfT9QGygL6XaAvuOghtPuwDXn1H4n0DuBtoMBS6N7mLZFNQTiYeCLLLv4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Wy7aYCT+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713866466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=YwIkjif5BreNxnLNOWf6abaVgTHOQBKAwUvTq0Bl3Ug=; b=Wy7aYCT+8RFva8VV/bXu8uMFTXFyUbPay1LaVJ1ci09ULOAM1vBJvGMAPyBmehC628HSyH EHJN7PI9qtLptG5OSHbcWBOplR4ZPlwDaPayoMTNHi8fCdeQviunf13JZ+mpBYeLCPa81d NYVzUrw1A/XDI/wHUIy1SdUYcHkx43Y= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-590-0O6f0zfJMT2cJKe5d_PBqQ-1; Tue, 23 Apr 2024 06:01:05 -0400 X-MC-Unique: 0O6f0zfJMT2cJKe5d_PBqQ-1 Received: by mail-oi1-f197.google.com with SMTP id 5614622812f47-3c73b20ff31so1608470b6e.2 for ; Tue, 23 Apr 2024 03:01:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713866465; x=1714471265; h=mime-version:user-agent:content-transfer-encoding:autocrypt :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YwIkjif5BreNxnLNOWf6abaVgTHOQBKAwUvTq0Bl3Ug=; b=ndOKV/OtzlOPItdJNZE/hk73tI4VFB2wDlcyEKUaJcVVCj373V4wG002+3YDWHy/oG MRpPEber5fh8XbpvSUBhhCfRWuW6+2L8v1nn4rPOeLhvJhF4mwJy92lS5LzcSGoN3oa2 OrGMM/HG6uo2L7fk+9pRejclbi22Afdj3mweT5b+PiZeFqRkGkHKDMPWEH9KedWwNzo6 5S10j37ZffMoPxDyu9hk2GMENcywN9znZ2BIXqurze+rN0588opXr0NMtP/FjUCmoX6e pBw9YKdKjX+0iicY29zqaBHs+g1Fi+A0cH+Sj0VqsQ1lxW6gFSohPnB2jldgDxhciYYc T7OA== X-Forwarded-Encrypted: i=1; AJvYcCUsTeF7J+2p/mrolrTxGdd/80Xdt2Ra26VemvCo7kXwioYlOM1RAm8rJSEZYUj7UglHE6CNW/8zn5pciLiSTc4UTqUtDwUZuKZjY2AS X-Gm-Message-State: AOJu0YzfGXuZ3yuesHByAfM2nMlnDDfp2HbZS34leRxdz0VztyNuDI1h uN1g9UGWug6OZDyBg9l0+6SEmE3/17ZAMRhzkw5ZnVIf0r1FRV8+yNofcFJds478wRcsK8enRd5 TybAmTTMUe3Qh4hUU1Untih/Q+KjgHWls1ELY0m0uyygSxDX2r6zPCuzgVozAvw== X-Received: by 2002:a05:6870:8891:b0:22e:dfbc:4aae with SMTP id m17-20020a056870889100b0022edfbc4aaemr14682574oam.2.1713866464844; Tue, 23 Apr 2024 03:01:04 -0700 (PDT) X-Received: by 2002:a05:6870:8891:b0:22e:dfbc:4aae with SMTP id m17-20020a056870889100b0022edfbc4aaemr14682536oam.2.1713866464448; Tue, 23 Apr 2024 03:01:04 -0700 (PDT) Received: from gerbillo.redhat.com ([2a0d:3344:172c:4510::f71]) by smtp.gmail.com with ESMTPSA id x4-20020ac87304000000b00434c31fa60csm5023855qto.92.2024.04.23.03.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 03:01:04 -0700 (PDT) Message-ID: <4a92f794480b12c21eaeeeb66521dbe978f08414.camel@redhat.com> Subject: Re: [PATCH net] net: ethernet: ti: am65-cpts: Fix PTPv1 message type on TX packets From: Paolo Abeni To: Ravi Gunasekaran , s-vadapalli@ti.com, rogerq@kernel.org Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, richardcochran@gmail.com, jreeder@ti.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, srk@ti.com Date: Tue, 23 Apr 2024 12:01:01 +0200 In-Reply-To: <20240419080547.10682-1-r-gunasekaran@ti.com> References: <20240419080547.10682-1-r-gunasekaran@ti.com> Autocrypt: addr=pabeni@redhat.com; prefer-encrypt=mutual; keydata=mQINBGISiDUBEAC5uMdJicjm3ZlWQJG4u2EU1EhWUSx8IZLUTmEE8zmjPJFSYDcjtfGcbzLPb63BvX7FADmTOkO7gwtDgm501XnQaZgBUnCOUT8qv5MkKsFH20h1XJyqjPeGM55YFAXc+a4WD0YyO5M0+KhDeRLoildeRna1ey944VlZ6Inf67zMYw9vfE5XozBtytFIrRyGEWkQwkjaYhr1cGM8ia24QQVQid3P7SPkR78kJmrT32sGk+TdR4YnZzBvVaojX4AroZrrAQVdOLQWR+w4w1mONfJvahNdjq73tKv51nIpu4SAC1Zmnm3x4u9r22mbMDr0uWqDqwhsvkanYmn4umDKc1ZkBnDIbbumd40x9CKgG6ogVlLYeJa9WyfVMOHDF6f0wRjFjxVoPO6p/ZDkuEa67KCpJnXNYipLJ3MYhdKWBZw0xc3LKiKc+nMfQlo76T/qHMDfRMaMhk+L8gWc3ZlRQF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EAakWsqHoKZ5WdpeOcH9iVlUQhRgemQSkhfNaP9LqR1XKujlTuUTpoyT3xwAzkmSxN1nABoutHEO/N87fpIbpbZaIdinF7b9srwUvDOKsywfs5HMiUZhLKoZzCcU/AEFjQsPTATACGsWf3JYPnWxL9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (3.50.4-1.fc39) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2024-04-19 at 13:35 +0530, Ravi Gunasekaran wrote: > From: Jason Reeder >=20 > The CPTS, by design, captures the messageType (Sync, Delay_Req, etc.) > field from the second nibble of the PTP header which is defined in the > PTPv2 (1588-2008) specification. In the PTPv1 (1588-2002) specification > the first two bytes of the PTP header are defined as the versionType > which is always 0x0001. This means that any PTPv1 packets that are > tagged for TX timestamping by the CPTS will have their messageType set > to 0x0 which corresponds to a Sync message type. This causes issues > when a PTPv1 stack is expecting a Delay_Req (messageType: 0x1) > timestamp that never appears. >=20 > Fix this by checking if the ptp_class of the timestamped TX packet is > PTP_CLASS_V1 and then matching the PTP sequence ID to the stored > sequence ID in the skb->cb data structure. If the sequence IDs match > and the packet is of type PTPv1 then there is a chance that the > messageType has been incorrectly stored by the CPTS so overwrite the > messageType stored by the CPTS with the messageType from the skb->cb > data structure. This allows the PTPv1 stack to receive TX timestamps > for Delay_Req packets which are necessary to lock onto a PTP Leader. >=20 > Signed-off-by: Jason Reeder > Signed-off-by: Ravi Gunasekaran Please provide a suitable fixes tag, thanks! Paolo