Thread (8 messages) flat view 8 messages, 2 authors, 2021-02-16

Re: [PATCH net-next RFC v3] net: hdlc_x25: Queue outgoing LAPB frames

From: Leon Romanovsky <leon@kernel.org>
Date: 2021-02-16 06:05:21
Also in: lkml

On Mon, Feb 15, 2021 at 11:08:02AM -0800, Xie He wrote:
On Mon, Feb 15, 2021 at 10:54 AM Leon Romanovsky [off-list ref] wrote:
quoted
On Mon, Feb 15, 2021 at 09:23:32AM -0800, Xie He wrote:
quoted
On Mon, Feb 15, 2021 at 1:25 AM Leon Romanovsky [off-list ref] wrote:
quoted
quoted
+     /* 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.

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help