Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5162715pxb; Mon, 15 Feb 2021 11:11:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwqQtx1es0aaTEhFegnNbGvQOdhu9FSixL2ipp0oJedXVmSIG1SFbjJdqAzhM7j3LZ4+IA9 X-Received: by 2002:a17:906:d19b:: with SMTP id c27mr17439970ejz.234.1613416266107; Mon, 15 Feb 2021 11:11:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613416266; cv=none; d=google.com; s=arc-20160816; b=g3VlR3HJLejwFnDzdWDaaW5Ppg5+R8xlGnBwoDLkO4MSX83BZ4HnNzO0R4LVrzi6Py k2YW65UXgOwBo71qJADcubpWGqQ+LidhvQJsuINrHmlog9zi1ESsg7JgHStaD8GAyg5b Mk6e1hDirlCXnPrStUNbO465XR+VUzyG7h2oGx2MeNRupRgydW2A67pCG5LG28r3ZzF0 cFMf0GjRNUIK/DvBQsRmy9dxWDtbOB+pw+c2BQqMn+CiyjWp86k3PZ2mnlID4oOemFfP 1+iTvphZHzr6ZQZ18WJngyfbTY3l7inbLvYJm1DF8K2vz6xIaAj0p3AFvudurVEHty4L c7rQ== 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=4wSIIQAoU/qUrHpFtDE4/r1lSSmKppFfAx3tPckyTMg=; b=dNKDenu1UEONBL8lLZw2n3pom8xW5Fr7xnIr6Al3q/4WwMn+5Rfu1YJD2rIIK5bet+ ymDRb+6IaBwzxVTv5T+4GQXSgfEHs8eZEJV93Jd6k7MwEH35h2Vu9Wty9glX3V9P2d23 LumvUXz6SNyOo7DwPxr9i9fWq+WSMnaLj9ORnVHtjZsmco28bn8OTX4bhMqdqLmPyA8z MwS0tusSjqEYF2+xD4d+4lX9HQcvKu8wzHTtzamPE68itMUdkXXDJm8KPs7WOVxY/yqx BlGvK5j9w6c01OCrqnIE+tpu8esTjPLRPowzuZdw+HuuBWNXl0h+f23LQLMAdvta/UTr tN1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WbZcgfON; 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 rp11si12913464ejb.724.2021.02.15.11.10.41; Mon, 15 Feb 2021 11:11:06 -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=WbZcgfON; 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 S230232AbhBOTIz (ORCPT + 99 others); Mon, 15 Feb 2021 14:08:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229764AbhBOTIy (ORCPT ); Mon, 15 Feb 2021 14:08:54 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E2CC061574; Mon, 15 Feb 2021 11:08:13 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id z9so4442112pjl.5; Mon, 15 Feb 2021 11:08:13 -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=4wSIIQAoU/qUrHpFtDE4/r1lSSmKppFfAx3tPckyTMg=; b=WbZcgfONHMSwsib7jyirAckorAOZ9aIz8BGaGHSxzE9IBK0w2zS4RqERyv2kXqLehJ 3t8lWW9K6eT2uy0zdiiz5yw0F973t4nNTNikpF/3wmhOu4W+uyQhaNPTzHPv6VQ/2hUY KnTwYi3LIV47D4qZMGp4KzyAZ5M5bA3FNgErZoYU6Jgld4bPjW3+WRUSdght+GGuXTZp daPGMuEim6QxghMcWiixp9ekOdJZUBSvPyCR3vEmPtVYD0uvuYoCgON6wsyhzteVgbij yi8/6n0rOG9nERGp9qWfRIavxLSavRIlWxuocVYOSKY7Xp42kWhkmvRtGstyQJR3MyiF /Ncg== 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=4wSIIQAoU/qUrHpFtDE4/r1lSSmKppFfAx3tPckyTMg=; b=A5IsLRspe+UuP//qIrGmUFgiAN9k2BPqYZocqxEJeFTXpukzu7ek+mIQS0M4zJd1Gx XzZSvzVFpcKr1w67iBinFhXoV5qCf1ze70KqHsgzOoYMhiR6JEq5wHJ6FHWELHH8CocY sBya1M4/C1H/sUTfG3i3dfnXQAhGEtSmyVoxoxh20b7pmPLWnwWBS+S12kOT9MGA9v7I 9eEBLQ0DnH4GW3ZFyNZnSTxn6z8WG5x6f8vNRMxRuSGKFNoWxhqHOsc5iBvgb9xpRbGn zBW+v9GyATqcoW2IQmTYRGoJPkYgp8fnViSIhROaLQh/a7vaFq6l9MQ0uNZWSfSjz69V AHWw== X-Gm-Message-State: AOAM530MtjHReV0iQ90QWYzojAWkmwEwAn4fWXtiIDHtxtIT7YeP3dYm Hk8HocUN9YgqYNv83+czL7exOPNRu4WxebvIYXkYDo7O X-Received: by 2002:a17:903:310f:b029:e3:53e8:bfe6 with SMTP id w15-20020a170903310fb02900e353e8bfe6mr6541429plc.78.1613416093556; Mon, 15 Feb 2021 11:08:13 -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 11:08:02 -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: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.