From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=193.142.43.55 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796142933; b=jBhmT1GhEypfUXeZ/OWJYYKkztvAr56r2kIsafL+FSIkBsKVZkAi4CyMcxpWtipMzDmw r1Lh5xQbB5Sr2IHAif5sqcrjmBetU+5Tp+MgNPh2URsKaVWccRWldDkeSTnsEcXI5LpVp GQRR59QiSW6/gkzPXbbxyOzr18rgE2M2ZJ5xHDBTawd0sqj7pHAaDIG6fADGtTaLDhO+B IoMviw5WwaC+tdtwmqW8EEnkQlmmsjYWcsvvnmgyvuVUfXBqxPyNzcvejxb5QM64K7yfT 3dxN0QqprhEgmnXuV1qzT9D0kjj339rEJeRR5DIZpxsY3FcJy3LCxkHF12x5zyvbRdA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796142933; h=DMARC-Filter:Date:DKIM-Signature:DKIM-Signature:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=6yaIYA2qgS7y9GUdX0oVz+HjByMhid4aRgyinE/kPdE=; b=uyZX4ol+AqHxiTK8oELnoWiz/a0LVrNoCf0mFw3TZFNr2kZmqbcRjYxduw67sEJW60Ji M0vFkxVHs+bc79GN/SukFUpZRNptmuRjJbUb1ZOLq7UJV/SWKnyA3GizDDFnbl7boOX4O a+YiuD1+Lu9M4LYjvzxZEOQ/PeBHPpdFt32TSHaPOWtPaHfgAszl3tO6FpSy/0NnVEg2J ALF9sDhQJL08KQcvAPuruYA0qZKLZ+WdaDwc87YDqSqRtqLlA3fewkUhS00lA7KMicU/o RmwyzJU3rhc4vsS0cgQ6gmXQMDUcylFKi91mMc1jJBZUttW1/REmzw/4tXt5pfgluXA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=L76lsOMF; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=R1LDukuW; arc=none smtp.remote-ip=193.142.43.55 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A4DD606A31A for ; Tue, 1 Dec 2026 16:35:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8A4DD606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=L76lsOMF; dkim=pass header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=R1LDukuW Date: Tue, 1 Dec 2026 17:35:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1796142930; 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; bh=6yaIYA2qgS7y9GUdX0oVz+HjByMhid4aRgyinE/kPdE=; b=L76lsOMFrbltnkblJFDRejWXCVj/+BKjelrMlX+AlwdR2SPG+0JCIHaDT5xSVW8IKR+yRW UxweWt/loczUgx8vJ5D37rNqnuw4Lk71w5T1YMIMJJsdXMz6noEEO0lftnyNr1j4Lplylk BjH0NtRm2uyTwFGFmithAFPrH8eS4uQ/q4rJbs0LiFquxgkTs8iWsKDh9Wj9x/nx9Xsrex ug/5iWqctJzY47HJ3YfmT1Ph0/nmLaW8EyNvNeLy5lqzh8JZ2oK4uMNDLCWahjlDoTQN7a +NEyRJie0FwMCDznrDQIzTiBYexO3d0bynT3eCXwl2dNItoX23hPxb/ibD2MqQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1796142930; 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; bh=6yaIYA2qgS7y9GUdX0oVz+HjByMhid4aRgyinE/kPdE=; b=R1LDukuWNHOpCRqO3tKBPKAjRIOos8qf8K8QHmuXO2svhz+DhcmzlWFxy40RS15yYzLKb7 HpEG0J7TaBTcKPBw== From: Sebastian Andrzej Siewior To: netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, j-rameshbabu@ti.com, andrew+netdev@lunn.ch, danishanwar@ti.com, d-qiu@ti.com, davem@davemloft.net, fmaurer@redhat.com, kuba@kernel.org, neelima@ti.com, pabeni@redhat.com, praneeth@ti.com, pratheesh@ti.com, richardcochran@gmail.com, horms@kernel.org, vigneshr@ti.com, willemdebruijn.kernel@gmail.com, daniel.machon@microchip.com, edumazet@kernel.org Subject: Re: [PATCH net-next v13 3/8] hsr: Add a magic header for sending PTP packets Message-ID: <20261201163528.clIypeY6@linutronix.de> References: <20261130-hsr_ptp-v13-3-598326208fc5@linutronix.de> <179611532644.3146.17870747976027282649@kernel.org> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: <179611532644.3146.17870747976027282649@kernel.org> On 2026-12-01 08:55:26 [+0000], netdev-bot+sashiko@kernel.org wrote: > Critical: 0 =C2=B7 High: 0 =C2=B7 Medium: 1 =C2=B7 Low: 2 >=20 =E2=80=A6 > - [Medium] The new UAPI `struct hsr_inline_header` > (include/uapi/linux/hsr_ptp.h) is undocumented and only partly=E2=80=A6 > - [Low] `hsr_dev_xmit()` in net/hsr/hsr_device.c now drops every skb with > `skb->protocol =3D=3D ETH_P_1588` unless `hsr_ptp_parse_header()` finds= a=E2=80=A6 > - [Low] The changelog says the inline header is "mandatory if the ether > type is ETH_P_1588" and that "PTP packets missing this information=E2= =80=A6 >=20 > -- =E2=80=A6 > > + > > + /* need to access the magic header */ > > + if (!pskb_may_pull(skb, sizeof(struct hsr_inline_header))) > > + return -EINVAL; > > + > > + hsr_inline_hdr =3D (struct hsr_inline_header *)skb_mac_header(skb); > > + if (hsr_inline_hdr->magic !=3D htonl(HSR_INLINE_HDR)) > > + return -EINVAL; > > + > > + *has_hsr_header =3D hsr_inline_hdr->has_hsr_header; > > + *req_tx_port =3D hsr_inline_hdr->req_tx_port; > > + if (*req_tx_port !=3D HSR_PT_SLAVE_A && *req_tx_port !=3D HSR_PT_SLAV= E_B) > > + return -EINVAL; > > + > > + if (hsr_inline_hdr->__pad0 !=3D 0 || hsr_inline_hdr->__pad1 !=3D 0) > > + return -EINVAL; > > + > > + hdr_len =3D ETH_HLEN; > > + if (*has_hsr_header) > > + hdr_len +=3D HSR_HLEN; >=20 > [Severity: Medium] > struct hsr_inline_header becomes permanent ABI once merged. Is it validat= ed > and specified tightly enough? I think so. > has_hsr_header is copied straight into a bool, so any value from 1 to 255 > counts as true. The pad fields must be zero, but this byte is not limited > to 0 or 1. If userspace ships with arbitrary non-zero values, can this by= te > ever be used for flags later? It is intended to be false/ true. > eth_type is never checked. It sits at offset 12, which is where > eth_header_parse_protocol() reads. For ETH_P_ALL raw sockets it therefore > has to be 0x88F7. Otherwise the ETH_P_1588 check in hsr_dev_xmit() never > fires, and the 14-byte inline header goes onto the wire as an Ethernet > header. Should the UAPI header or the changelog document this? It pretends to be a PTP packet so ETH_P_1588 is expected. > req_tx_port is compared against HSR_PT_SLAVE_A and HSR_PT_SLAVE_B, which > come from the internal enum hsr_port_type. The exported > HSR_INLINE_HDR_PORT_A and HSR_INLINE_HDR_PORT_B are never used, and no > BUILD_BUG_ON ties the two sets of values together. Reordering the internal > enum would silently change the ABI. Would it be better to validate against > the UAPI constants and map them to the internal values? Hmm. The ABI is fix/ exported via uapi. The reorder would break the parsing here. I would prefer the HSR_PT_SLAVE_A+B constants and the BUILD_BUG_ON() to link it. Is this something I should resend the whole series and send a follow-up later? > What does has_hsr_header mean on a PRP device? PRP has no HSR tag, but > HSR_HLEN is added here regardless of hsr->prot_version. That pulls 6 extra > bytes and puts the network header at offset 20. >=20 > Later in the series, prp_fill_frame_info() ignores the flag and the frame > is sent without an RCT. The "hsr: Assign a socket for cloned skbs" commit > also says PRP is not considered. It should not be used for PRP. > Two smaller points: hsr_device.c includes instead = of > , and there is no Documentation/ text for the new ABI. I am not aware that uapi/ header must not be included in kernel code. Yes, no other documentation. Sebastian