Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2982371pxb; Tue, 19 Jan 2021 10:32:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJzVvw3l3caHG7hZs8TGtJ8mfyWGh6dxpg5WO89BWmj7l0BSE6y5BtACMQ5trkPpDe/1A4vL X-Received: by 2002:a50:9ee9:: with SMTP id a96mr4431570edf.343.1611081164593; Tue, 19 Jan 2021 10:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611081164; cv=none; d=google.com; s=arc-20160816; b=MLx02aTGmUJuS4v90FFFwO90E4jjmtEyf40Moc9bQDuQQ6DssyjgWjG+/VVWn5v98A Dxuseaimuaa1sVOJ2oy78fhlFOM/wkpqhkcNGHWiJTqtQl52W9r9tug0uslQrfFu5kbs dcOl3/5ppI7U0NQIq+kyaavHVL5B9MeCz4GhFI0uHxZDhVQMJM7G1nyuzcgD6mFHe1+T Pbs8/TwabKt7oNzo1Ca5xX14vlxoQaod0AEbEXpvMFpXVtFP6Eox3JBVG1Ymb/6LP4Pf pmNTvOsoG5ySOyLnBbYRI6afnsYlj7H6XnTOIwBbUG+la8Zf4QEMKQCuLOJhMQzDYOGX BVsw== 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=3xh2tEE6OIu/dk4vFGf7sCA9BTlLAr+YrKqGHzZFYLI=; b=z43IBNyiL/EJ1HpPSjyC0nlKIggCwPEn/US6j8CjEycS9sZNH40tX/AMXNXmdZlEc7 hOPTTXJkSNzx3Uh78danqnkkFwvnwpknm0I190CDMc720oaCa1uD+rQ9BLADM294irf2 5Y/kQrDK3gQDT4y+qy3BGe5uZ5Lt/zAOHrvftqUFV16YZjzflYWiW6PH0vDC9CoGg/bD II7PeSUz63nxszrQXepR9X+D3y99eVud1/a+XjXZxmg2i7/A82DCkoiOULUd5Ix2VFzP XIKBTzIV70jz2UxcFukOZsOWh3mytMyOaTTJfkWy1SUuIssafR6aO2W+HBjMGloeCjK9 c+fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sTOv4wJ4; 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 hb19si620686ejc.14.2021.01.19.10.32.15; Tue, 19 Jan 2021 10:32:44 -0800 (PST) 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=k20201202 header.b=sTOv4wJ4; 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 S1727996AbhASSae (ORCPT + 99 others); Tue, 19 Jan 2021 13:30:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:48616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388721AbhASS1e (ORCPT ); Tue, 19 Jan 2021 13:27:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 16610238E2; Tue, 19 Jan 2021 17:45:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1611078321; bh=9UBi/msyPHQZCmsjTo0fEYHjoK6YoBp5WsNfbH0M4qg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=sTOv4wJ4KHa+QO6F3+qYhfEERh1cWXzWX0LvLM6yshvS6D3cHeX/YX7IAfkJ4z7Rp DP/UaR7SNTdY4QC6NQOFgRm2Dv0rx9PjFRcKrf/s7LFvA6d9VK7THxn8d8bxxNh+kb ZtGgoTD89xt/S8TYhBPYj+oVRA/ZTyIYoVBxgGIbL8nAzHfGWaKqvVQjBzM/C8nRq2 U+83D7vVY5armV7lDgIOUukotdx3MyikZ07uQTQYjKY9JQt2DGGAareiAyHlnFgJKX 8hfJUlrHgjFdueBp4bQozoUEDVceeX1wHEnUpvpUqlEmxLj+8Z35WMwawowIaKJhK1 WweoHa54QgUVg== Date: Tue, 19 Jan 2021 09:45:16 -0800 From: Jakub Kicinski To: Rasmus Villemoes Cc: netdev@vger.kernel.org, Horatiu Vultur , linux-kernel@vger.kernel.org, "David S. Miller" Subject: Re: [PATCH net 1/2] net: mrp: fix definitions of MRP test packets Message-ID: <20210119094516.723bce6c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <50d2a1b0-c7b5-cd12-e288-977fbfdea104@prevas.dk> References: <20201223144533.4145-1-rasmus.villemoes@prevas.dk> <20201223144533.4145-2-rasmus.villemoes@prevas.dk> <20201228142411.1c752b2e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> <50d2a1b0-c7b5-cd12-e288-977fbfdea104@prevas.dk> 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 Tue, 19 Jan 2021 16:42:14 +0100 Rasmus Villemoes wrote: > On 28/12/2020 23.24, Jakub Kicinski wrote: > > On Wed, 23 Dec 2020 15:45:32 +0100 Rasmus Villemoes wrote: > >> Wireshark says that the MRP test packets cannot be decoded - and the > >> reason for that is that there's a two-byte hole filled with garbage > >> between the "transitions" and "timestamp" members. > >> > >> So Wireshark decodes the two garbage bytes and the top two bytes of > >> the timestamp written by the kernel as the timestamp value (which thus > >> fluctuates wildly), and interprets the lower two bytes of the > >> timestamp as a new (type, length) pair, which is of course broken. > >> > >> While my copy of the MRP standard is still under way [*], I cannot > >> imagine the standard specifying a two-byte hole here, and whoever > >> wrote the Wireshark decoding code seems to agree with that. > >> > >> The struct definitions live under include/uapi/, but they are not > >> really part of any kernel<->userspace API/ABI, so fixing the > >> definitions by adding the packed attribute should not cause any > >> compatibility issues. > >> > >> The remaining on-the-wire packet formats likely also don't contain > >> holes, but pahole and manual inspection says the current definitions > >> suffice. So adding the packed attribute to those is not strictly > >> needed, but might be done for good measure. > >> > >> [*] I will never understand how something hidden behind a +1000$ > >> paywall can be called a standard. > >> > >> Signed-off-by: Rasmus Villemoes > >> --- > >> include/uapi/linux/mrp_bridge.h | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h > >> index 6aeb13ef0b1e..d1d0cf65916d 100644 > >> --- a/include/uapi/linux/mrp_bridge.h > >> +++ b/include/uapi/linux/mrp_bridge.h > >> @@ -96,7 +96,7 @@ struct br_mrp_ring_test_hdr { > >> __be16 state; > >> __be16 transitions; > >> __be32 timestamp; > >> -}; > >> +} __attribute__((__packed__)); > >> > >> struct br_mrp_ring_topo_hdr { > >> __be16 prio; > >> @@ -141,7 +141,7 @@ struct br_mrp_in_test_hdr { > >> __be16 state; > >> __be16 transitions; > >> __be32 timestamp; > >> -}; > >> +} __attribute__((__packed__)); > >> > >> struct br_mrp_in_topo_hdr { > >> __u8 sa[ETH_ALEN]; > > > > Can we use this opportunity to move the definitions of these structures > > out of the uAPI to a normal kernel header? > > Jakub, can we apply this patch to net, then later move the definitions > out of uapi (and deleting the unused ones in the process)? This has been lost in the patchwork archives already, we'll need a fresh posting anyway. Why not do the move as a part of the same series? Doesn't seems like much work, unless I'm missing something..