Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5505328pxb; Mon, 15 Feb 2021 23:32:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8tHJVbbAKFKAMc+YlaMrIworAn4Hq/XLvEFoHN4O2SOBaGCOJaY/IKBJmsMBQLuBUZiMu X-Received: by 2002:a17:906:d0cd:: with SMTP id bq13mr18974679ejb.75.1613460764707; Mon, 15 Feb 2021 23:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613460764; cv=none; d=google.com; s=arc-20160816; b=rYFN4qcqYEjGOCrZOFX8uMQwtLhI1VDRtSQ2ucwtijvxfO4C+qSPKpmYlFWlmmV6TC hgsq8ry2w7m7tMkeGnxAofj8ZT8Xk7jTvi70ktwUVJFKILCt487FDelFovSMFpKn0enY 0kw3F7SYBOr1rowkNtQsecoPCjroIPKSEDzy5B79X2jUuWtb7DWSauVY7Bw8esZ8gRf9 5tRdbXaL4Flfmv0FQqvY62lM3EW9/PnJYebdATymf3R54LK0Qg+NmMnJBwr9e7nkTfow f9jF21sff4OWM+DQ0MJFwDLL2P+e0wR9LYciO4UYigFPkhTxfZrQx+Gs9h8WWJXZ8rcu g19Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=I88mIFMB9J2IjxEmhlo7Ogv3+ByccYZjbXSfnh+qCAo=; b=o492SuCcGCUgDQ00TQFwl79WkpjIUDi8aRB55vGfeFn4xZdDqVxgS7KbsuvcKm99U9 iSfBd/5JIXjUYM1GRzDzxzhMx1CXvVRwexeWyas2OSTg16u9rZ+PIc1Irtfkd77CC2Tg +qw0h4OIZTg4AKKh3kUOfy/ZkQAkXqPk9H/bFbx7CqM8ge7I/KWhwcO4QOpKiDajUgEg 9J5d3i7tDHN43IpwW49ML7pidtpefpIxwf/d0LTwsvmkDCfWmiuqI7xhnVqusmaElu1h UclAsFu+OV6TcuFxLmMki07xDcccCtlpKy0Z2bnHLUcX/dCj52qQs6UAGU+qKOfiS/NE 6WNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=inCIuvps; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f16si14495543edx.512.2021.02.15.23.32.21; Mon, 15 Feb 2021 23: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=@gmail.com header.s=20161025 header.b=inCIuvps; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229721AbhBPHbT (ORCPT + 99 others); Tue, 16 Feb 2021 02:31:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229676AbhBPHbR (ORCPT ); Tue, 16 Feb 2021 02:31:17 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1576C061574; Mon, 15 Feb 2021 23:30:36 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id q20so5612766pfu.8; Mon, 15 Feb 2021 23:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=I88mIFMB9J2IjxEmhlo7Ogv3+ByccYZjbXSfnh+qCAo=; b=inCIuvpsW79NR8No86bgtL4mLS7lagd8bQP6x3nnSkpxtUisZdPgrT68h8fWS7bPLX 8ezbegLMDwjPhj6+wcKUSGn5AQXOwj+MTumkPed1GriSqofM7Pt2ubNa3ZbVlgZeoNxQ QGv0uRA2IFaTZY0xGCiWc822HH8LOpSZ1Og73iBFxaP3CBm2Giq1q9AnsTkhQrhZJBR1 amVo/UZ8cUrh+iwX8zFts+8v9XhxQdBynQ24Hr68ztRIh0XqtLLPu8YH2CnqCQMXPjqz H+Aap0G08Jr8TI0+1ifGYG8zQchXV2mYzre9paiFBcxDEya6WZ5QTpnxxr5Ot5ckRy6o /Ttw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=I88mIFMB9J2IjxEmhlo7Ogv3+ByccYZjbXSfnh+qCAo=; b=lUqsGWA4ycMxusi6L6ANYwK701DPZQtGOayWBLB9gx3u/D/Tbnbica6jjft0o/afn7 XUmhOumTzT1/8xarjox82ro+QQlfYInbeJNFJxmIfKKfzmlAGpFO+224QPOD8Dyz7RMY anwjZNmSTziwjVRFx4/UTn45XfyftGeQ8gxCjbUD85ys2R2ri9b9ykIKiSaaREqo7SZ1 4/sxu9ENShCv47qKRems94BkrC4FNTvIxnOEQce4e6oImPeFBZ6T8WHzJZ/mcDEVR84B vVv2AkcWQ2bTLze0QU6yjMKzS1ujNyXBXQRzgO2sy5xWMNMz+bEUpjd6lqg+hDFCu588 f9HA== X-Gm-Message-State: AOAM531ep+0bWuOHJNHJ1hqG6hNbxgDap41kRvd376jFhrminkV1YNTy 0dd1Ng2NNF2EbVwWiDZc32oY7cJm8hcAdzCe/84= X-Received: by 2002:a63:7f09:: with SMTP id a9mr17973656pgd.63.1613460636184; Mon, 15 Feb 2021 23:30:36 -0800 (PST) MIME-Version: 1.0 References: <20210215072703.43952-1-xie.he.0141@gmail.com> In-Reply-To: From: Xie He Date: Mon, 15 Feb 2021 23:30:25 -0800 Message-ID: Subject: Re: [PATCH net-next RFC v3] net: hdlc_x25: Queue outgoing LAPB frames To: Leon Romanovsky Cc: "David S. Miller" , Jakub Kicinski , Linux X25 , Linux Kernel Network Developers , LKML , Martin Schiller , Krzysztof Halasa Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.