netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	xiaosuo@gmail.com, paulus@samba.org, harvey.harrison@gmail.com,
	linux-ppp@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] net: ppp: use {get,put}_unaligned_be{16,32}
Date: Sat, 08 Jan 2011 11:33:14 +0100	[thread overview]
Message-ID: <4D283D6A.4050502@gmail.com> (raw)
In-Reply-To: <1294482005.2709.90.camel@edumazet-laptop>

Eric Dumazet wrote:
> Le samedi 08 janvier 2011 à 11:04 +0100, Jarek Poplawski a écrit :
> 
>> Just for the record: I agree with Paul that current code is more readable.
>> This code still requires thinking about specific bytes and the patch mixes
>> it only with word access.
>>
>> Jarek P.
>>
>>> @@ -395,16 +396,14 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
>>>  	 */
>>>  	obuf[0] = PPP_ADDRESS(ibuf);
>>>  	obuf[1] = PPP_CONTROL(ibuf);
>>> -	obuf[2] = PPP_COMP >> 8;	/* isize + MPPE_OVHD + 1 */
>>> -	obuf[3] = PPP_COMP;	/* isize + MPPE_OVHD + 2 */
>>> +	put_unaligned_be16(PPP_COMP, obuf + 2);
>>>  	obuf += PPP_HDRLEN;
> 
> Compilers are stupid not generating optimal code, so we should help them
> a bit.
> 
> Yes, I agree this is ugly Jarek and makes reading of this code a bit
> more complex, but this is a move we cannot stop. Number of functions,
> macros, etc... is exploding and we must follow the trend ;)
> 
> 41 c6 44 24 02 00       movb   $0x0,0x2(%r12)
> 41 c6 44 24 03 fd       movb   $0xfd,0x3(%r12)
> 
> After patch :
> 
> 66 41 c7 44 24 02 00 fd   movw   $0xfd00,0x2(%r12)

And that's why Paul wanted more justification, because readability
gain is questionable.

Jarek P.

  reply	other threads:[~2011-01-08 10:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-06 23:37 [PATCH v2] net: ppp: use {get,put}_unaligned_be{16,32} Changli Gao
2011-01-06 23:42 ` Harvey Harrison
2011-01-07  3:01 ` Paul Mackerras
2011-01-08  0:43   ` Changli Gao
2011-01-08  1:15     ` David Miller
2011-01-08  3:13       ` Paul Mackerras
2011-01-08  4:37         ` David Miller
2011-01-08 10:04       ` Jarek Poplawski
2011-01-08 10:20         ` Eric Dumazet
2011-01-08 10:33           ` Jarek Poplawski [this message]
2011-01-11  0:13 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D283D6A.4050502@gmail.com \
    --to=jarkao2@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=harvey.harrison@gmail.com \
    --cc=linux-ppp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=paulus@samba.org \
    --cc=xiaosuo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).