Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5510164pxb; Mon, 15 Feb 2021 23:43:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIkZPiLWJyFVvO7iWvyxNpbWDxtfxUWhEb8mp4ZDQP6jo7KjIWbhrPL6QAtRT6XDYDhF3d X-Received: by 2002:a05:6402:14c9:: with SMTP id f9mr19968294edx.90.1613461426266; Mon, 15 Feb 2021 23:43:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613461426; cv=none; d=google.com; s=arc-20160816; b=pp35JLfuQDyrHsVl+Uv/ey4CBka5izO6jo3nxLF4kdOxy0qXgDUm6ZukXLSu217kQ+ yowB+0e1/Pn1qO9IHxJ7Nyolih8kjvWhsFAeemmtT0zOzMceA4gqNL5uFn8b2abjzwXu H2nfdxQ7/W5veHOdB9wVRS+Kiu8qo/JXMLTytr04mfgou9KNn08xqT+6yHW0JrOCjSeb LIHPVHMptKB1F7esVj7wuvS4reE8TGao8zOlANIv8CT05ESv5LJrTF1OPsEI80qvDKF4 5G7JextyUjUb86RlL8guAm7Sfo29opW5wCP74AGGpNIYKhzabwumVPGJf1ljSEcDWRYk a/AQ== 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:dkim-signature; bh=XrnQcntU8bUV1Xwu0L9yPWQxwsIDFhuYLSL1Ol1hca4=; b=jMk+UjKVcEmxwUOiuZQ9oQF3vwbspkKVsVw0ETookPXq+p7A3mc0gYs7zl01kCbN33 6DnXpO4tjgNx/tv1ykAmJ8OvAlERqPaPjNxefQbkmfhtQz+MED3a4ekM+Rgn0BV0bGPL u08Imospo63UmW3DUKQmYaeuUbERAUAktkd+ry4QXSgWIhhYWRCwcs0iAbhU6MpmvsBE Us1epJk+cB6iWyzXeg1uuldbgI2xZQR5JYN/7GHsVbk66YcOrBShl0kbDV3ta8upvFCl qf91X+rUIN2UfT6193KU89w0TJidlhlUP67MQbH2FkE+TZRQg5Qh5udcXsg/PCUP1awy N3aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k+HchKGT; 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 q19si8835401eds.59.2021.02.15.23.43.22; Mon, 15 Feb 2021 23:43:46 -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=k+HchKGT; 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 S229780AbhBPHkp (ORCPT + 99 others); Tue, 16 Feb 2021 02:40:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:33636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbhBPHkn (ORCPT ); Tue, 16 Feb 2021 02:40:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5D79B64E04; Tue, 16 Feb 2021 07:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613461202; bh=hKiX52cLMN3cUoxtSOVIQl65AGC6ungrAGJmKsxqt30=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k+HchKGThqHy+nr2gPPllfVB+QljdDnFodST5Qgn6ouMsuf+5wWugkNzpqITArqoy SFA7vzEV9Dc0wk++mTACb2Qx9exF/KTG0TH1Qo2IP50ZD7TJmupli6IWSssnroUxhl Lifo/ffqIZEwsxqTAXG3Vy+G/TjnSXqdfqqy+uoSQybkMIeIAxSKynyCcA3HfwfkCc FREacdBk4bb7oElJP+Yf+j+Rejnq+51XKAxo+NBXDqdG6MHdvvKIe9ph7G/tLLy3es XgQdMFeuNQoW7Ve6v7aBQ/WlY6Z2OesUMXXHgi6RC/La6URVTl8kTxN6HYVQhrsMvp svAm04GR4V5/Q== Date: Tue, 16 Feb 2021 09:39:58 +0200 From: Leon Romanovsky To: Xie He Cc: "David S. Miller" , Jakub Kicinski , Linux X25 , Linux Kernel Network Developers , LKML , Martin Schiller , Krzysztof Halasa Subject: Re: [PATCH net-next RFC v3] net: hdlc_x25: Queue outgoing LAPB frames Message-ID: References: <20210215072703.43952-1-xie.he.0141@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 15, 2021 at 11:30:25PM -0800, Xie He wrote: > On Mon, Feb 15, 2021 at 10:04 PM Leon Romanovsky wrote: > > > > On Mon, Feb 15, 2021 at 11:08:02AM -0800, Xie He wrote: > > > On Mon, Feb 15, 2021 at 10:54 AM Leon Romanovsky wrote: > > > > > > > > On Mon, Feb 15, 2021 at 09:23:32AM -0800, Xie He wrote: > > > > > On Mon, Feb 15, 2021 at 1:25 AM Leon Romanovsky wrote: > > > > > > > > > > > > > + /* When transmitting data: > > > > > > > + * first we'll remove a pseudo header of 1 byte, > > > > > > > + * then the LAPB module will prepend an LAPB header of at most 3 bytes. > > > > > > > + */ > > > > > > > + dev->needed_headroom = 3 - 1; > > > > > > > > > > > > 3 - 1 = 2 > > > > > > > > > > > > Thanks > > > > > > > > > > Actually this is intentional. It makes the numbers more meaningful. > > > > > > > > > > The compiler should automatically generate the "2" so there would be > > > > > no runtime penalty. > > > > > > > > If you want it intentional, write it in the comment. > > > > > > > > /* When transmitting data, we will need extra 2 bytes headroom, > > > > * which are 3 bytes of LAPB header minus one byte of pseudo header. > > > > */ > > > > dev->needed_headroom = 2; > > > > > > I think this is unnecessary. The current comment already explains the > > > meaning of the "1" and the "3". There's no need for a reader of this > > > code to understand what a "2" is. That is the job of the compiler, not > > > the human reader. > > > > It is not related to compiler/human format. If you need to write "3 - 1" > > to make it easy for users, it means that your comment above is not > > full/correct/e.t.c. > > My point is: there is no need for human programmers / code readers to > understand what this "2" is. There is no need to explain what this "2" > means in the comment. There is no need to write this "2" in the code. > There is no need for this "2" to appear anywhere. That is just an > intermediate result generated by the compiler. It is similar to > assembly or machine code. It is generated by the compiler. Human > programmers just don't care about this intermediate result. > > My point could be more apparent if you consider a more complex > situation: "3 - 1 + 2 + 4 + 2". No human would want to see a > meaningless "10" in the code. We want to see the meaning of the > numbers, not a meaningless intermediate calculation result. Right, and we are using defines for that. Thanks