Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp5978509pxu; Wed, 23 Dec 2020 10:03:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZIXGt3Qm/NN7Yyp9Zw+39M7uaw++2bRbtiseKetuheJVhcuP9hR4DB8iAI9uAHKvoc4gm X-Received: by 2002:a17:906:c408:: with SMTP id u8mr24823933ejz.364.1608746608886; Wed, 23 Dec 2020 10:03:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608746608; cv=none; d=google.com; s=arc-20160816; b=YuT+zkC1LFZxw3G7Egxd1ZIS7GQh9gIX7pxOdVdfAbvh84+onYunYtA0LXfzzDjU3y g5YCO9tFPaGyEVqgYULUi3GYueabthVLwyvBwmVI9j67Hl+MH+JMJXHoDa66zYbuVKZ0 tWSTdK3I+RjKJ3jyNc0b0ELJ4paCZVVWWSwoLRbc3rtj1F7HoqR3mMkqVg7z6WcgWMhP 0bJz1gfe1AFuBEq6zw8D+ajkPORKy+RCR0TTEOL758CwJUS6738q9BBQFL0m2pSbIh57 pIm7UsHc/5dcjd9wErMAUVBpABQjwZGLVc5ZNgQMaUdJkXNF9ZxZCi9VnH5kNeKwC6bx pGIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :dkim-signature; bh=B58BxuvCou/KUveUnoQmGgQrVqrTh/vgP3Zlx74frs0=; b=nIp/aZ9LrO6O0UB8uM3QGXi0iPhgzv33MU+8A6LG5IzPSLGhFJrxookgNw7toKFkt5 PYYPUcajHaMYla/HvyYvOHca+ddi7B6Hp/SXY9YOxhvXqMgO8twmN03QCXDhuc2maStx IXpaH1eRx6a9Vfd6y+8/u49MvtaAys0LgFAYwrBd7nlfBQxMDmURrTm6HzLFmMLJ01RV zoPRFymFr6hPklWMe1rWRzFsADAu9oae8U5ultauqPn2KoAh0Lry36Wq9GtBwaM+dJ1d IGDrvpmoPgmTllR/xazAX3b21tktDnAvHOmK+fua/UwMKeJlRjcCIEK6VdP6J07GdxHy NI0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@microchip.com header.s=mchp header.b=K78l9kP6; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dt4si12412360ejc.439.2020.12.23.10.03.06; Wed, 23 Dec 2020 10:03:28 -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=fail header.i=@microchip.com header.s=mchp header.b=K78l9kP6; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728227AbgLWSA2 (ORCPT + 99 others); Wed, 23 Dec 2020 13:00:28 -0500 Received: from esa.microchip.iphmx.com ([68.232.154.123]:53779 "EHLO esa.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbgLWSA1 (ORCPT ); Wed, 23 Dec 2020 13:00:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1608746427; x=1640282427; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=47r11GPRFhq3kFKg3DEtYYb9IpOCEZgBgEMABlO6tnQ=; b=K78l9kP6cv7pXXDye8hsQ9+Zztb/ba48efmGMdQvOd+mKfn2lhWaqNxn WsGu1cZg8UoUKsIBckzSIHhQahgsexyel3wdGD1gIjpFfaiiDCt0bNm2w XhPMagy79gSCD2HQ4yLKh/eds/rvJvfTEvGVJTtF+HP6ojaLAfevwuVhT qD2Ys+0TYYna3zwAne1rYxk/MoJ6B1ZazMgyeJ0Ys6+9uM3xnpnvlPGqc x09wsHSowg/TWBDMXPU6zCmDB3Nw5xxF95y6B+Pph/9tLTzkPWGVdCibc kYmgHljgTR9dhuJMxc91CO+3kP1iYIGgO0cw+CIgSQ1NhbouyE6DbHkph Q==; IronPort-SDR: VbMItp7eqgc6S1n0XuY9L3oN/3JOHEV5urxycxQ78oZy7UX33+VepDUFlH4w2nNTzNNRFWgdyk Yd7wq3OaODn/Ope0K1IvCTA3PQDGm4IjzLQKLXTZ1uq5l3T0v8dXmTG80X/oxghIfLYwA+b81B C4E9nSs39d2SOa8N2qLCZok9JIB+U0ygEcLecAbHwl6AemmB5y0H2Ygt1Zs9NEhCXSd3H4b2BI 6Q98u6W8VixUYIqON/esoAPdNIYS7mfM30loudA1xKTXDITWjTnCAdM3Bfhd7/RxejA7cCWiku YU8= X-IronPort-AV: E=Sophos;i="5.78,441,1599548400"; d="scan'208";a="98105173" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 23 Dec 2020 10:59:11 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1979.3; Wed, 23 Dec 2020 10:59:11 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Wed, 23 Dec 2020 10:59:10 -0700 Date: Wed, 23 Dec 2020 18:59:10 +0100 From: Horatiu Vultur To: Rasmus Villemoes CC: , , Jakub Kicinski , "David S. Miller" Subject: Re: [PATCH net 1/2] net: mrp: fix definitions of MRP test packets Message-ID: <20201223175910.2ipmowhcn63mqtqt@soft-dev3.localdomain> References: <20201223144533.4145-1-rasmus.villemoes@prevas.dk> <20201223144533.4145-2-rasmus.villemoes@prevas.dk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20201223144533.4145-2-rasmus.villemoes@prevas.dk> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 12/23/2020 15:45, Rasmus Villemoes wrote: Hi Rasmus, > > 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__)); Yes, I agree that this should be packed but it also needs to be 32 bit alligned, so extra 2 bytes are needed. The same will apply also for 'br_mrp_ring_topo_hdr' > > 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]; > -- > 2.23.0 > -- /Horatiu